Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 188767 Details for
Bug 266613
net-zope/zopeinterface-3.0.1: Python syntax error with python-2.6
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
adapter-patch-r1.patch
adapter-patch-r1.patch (text/plain), 11.06 KB, created by
Chialastri Mirko
on 2009-04-18 03:17:27 UTC
(
hide
)
Description:
adapter-patch-r1.patch
Filename:
MIME Type:
Creator:
Chialastri Mirko
Created:
2009-04-18 03:17:27 UTC
Size:
11.06 KB
patch
obsolete
>--- adapter.py 2009-04-18 04:33:06.000000000 +0200 >+++ adapter-patch.py 2009-04-18 04:42:36.000000000 +0200 >@@ -38,14 +38,14 @@ > > # The registrations are of the form: > >-# {(subscription, with, name, specification) -> factories} >+# {(subscription, waswith, name, specification) -> factories} > > # where: > > # 'subscription' is a flag indicating if this registration is for > # subscription adapters. > >-# 'with' is a tuple of specs that is non-empty only in the case >+# 'waswith' is a tuple of specs that is non-empty only in the case > # of multi-adapters. > > # 'name' is a unicode adapter name. Unnamed adapters have an empty >@@ -68,7 +68,7 @@ > > # For multiple adapters: > # >-# {(specification, order) -> {name -> {with -> object}}} >+# {(specification, order) -> {name -> {waswith -> object}}} > > # For single subscription adapters: > # >@@ -76,7 +76,7 @@ > > # For multiple-subscription adapters: > # >-# {('s', specification, order) -> {with -> tuple([object])}} >+# {('s', specification, order) -> {waswith -> tuple([object])}} > > > from __future__ import generators >@@ -191,22 +191,22 @@ > if not oldwithobs: > oldwithobs = implied[key] = {} > >- # v is {with -> tuple([object])} >- for with, objects in v.iteritems(): >- oldwithobs[with] = oldwithobs.get(with, ()) + objects >+ # v is {waswith -> tuple([object])} >+ for waswith, objects in v.iteritems(): >+ oldwithobs[waswith] = oldwithobs.get(waswith, ()) + objects > > else: > oldbyname = implied.get(key) > if not oldbyname: > implied[key] = oldbyname = {} > >- # v is {name -> {with -> ?}} >+ # v is {name -> {waswith -> ?}} > for name, withobs in v.iteritems(): > oldwithobs = oldbyname.get(name) > if not oldwithobs: > oldwithobs = oldbyname[name] = {} > >- # withobs is {with -> object} >+ # withobs is {waswith -> object} > oldwithobs.update(withobs) > > # Now flatten with mappings to tuples >@@ -219,8 +219,8 @@ > byname = v > for name, value in byname.iteritems(): > if isinstance(value, dict): >- # We have {with -> value} >- # convert it to sorted [(with, value] >+ # We have {waswith -> value} >+ # convert it to sorted [(waswith, value] > byname[name] = orderwith(value) > > self.get = implied.get >@@ -253,24 +253,24 @@ > def unsubscribe(self, dependent): > del self.dependents[dependent] > >- def _adaptTo(self, specification, object, name='', with=()): >+ def _adaptTo(self, specification, object, name='', waswith=()): > if object is None: > try: >- del self.adapters[False, tuple(with), name, specification] >+ del self.adapters[False, tuple(waswith), name, specification] > except KeyError: > pass > else: >- self.adapters[False, tuple(with), name, specification >+ self.adapters[False, tuple(waswith), name, specification > ] = object > > self.dirty() > >- def _subscriptionAdaptTo(self, specification, object, with=()): >+ def _subscriptionAdaptTo(self, specification, object, waswith=()): > if object is None: > raise TypeError, ("Unregistering subscription adapters" > " isn't implemented") > >- key = (True, tuple(with), '', specification) >+ key = (True, tuple(waswith), '', specification) > self.adapters[key] = self.adapters.get(key, ()) + (object, ) > self.dirty() > >@@ -282,18 +282,18 @@ > > def orderwith(bywith): > >- # Convert {with -> adapter} to withs, [(with, value)] >+ # Convert {waswith -> adapter} to withs, [(waswith, value)] > # such that there are no i, j, i < j, such that > # withs[j][0] extends withs[i][0]. > > withs = [] >- for with, value in bywith.iteritems(): >+ for waswith, value in bywith.iteritems(): > for i, (w, v) in enumerate(withs): >- if withextends(with, w): >- withs.insert(i, (with, value)) >+ if withextends(waswith, w): >+ withs.insert(i, (waswith, value)) > break > else: >- withs.append((with, value)) >+ withs.append((waswith, value)) > > return withs > >@@ -355,7 +355,7 @@ > > # Multi adapter > >- with = required[1:] >+ waswith = required[1:] > key = provided, order > > for surrogate in self.get(required[0]), self._default: >@@ -377,7 +377,7 @@ > for rwith, value in bywith: > # the `rank` describes how well the found adapter matches. > rank = [] >- for rspec, spec in zip(rwith, with): >+ for rspec, spec in zip(rwith, waswith): > if not spec.isOrExtends(rspec): > break # This one is no good > # Determine the rank of this particular specification. >@@ -459,7 +459,7 @@ > > # Multi > key = 's', provided, order >- with = required[1:] >+ waswith = required[1:] > result = [] > > for surrogate in self.get(required[0]), self._default: >@@ -468,7 +468,7 @@ > continue > > for rwith, values in bywith: >- for rspec, spec in zip(rwith, with): >+ for rspec, spec in zip(rwith, waswith): > if not spec.isOrExtends(rspec): > break # This one is no good > else: >@@ -537,22 +537,22 @@ > > def register(self, required, provided, name, value): > if required: >- with = [] >+ waswith = [] > for iface in required[1:]: > if iface is None: > iface = Interface >- with.append(iface) >- with = tuple(with) >+ waswith.append(iface) >+ waswith = tuple(waswith) > required = self.get(required[0]) > else: >- with = () >+ waswith = () > required = self._null > > if not isinstance(name, basestring): > raise TypeError("The name provided to provideAdapter " > "must be a string or unicode") > >- required._adaptTo(provided, value, unicode(name), with) >+ required._adaptTo(provided, value, unicode(name), waswith) > > def lookupAll(self, required, provided): > order = len(required) >@@ -585,7 +585,7 @@ > > # Multi adapter > >- with = required[1:] >+ waswith = required[1:] > key = provided, order > first = () > >@@ -599,7 +599,7 @@ > continue > > for rwith, value in bywith: >- for rspec, spec in zip(rwith, with): >+ for rspec, spec in zip(rwith, waswith): > if not spec.isOrExtends(rspec): > break # This one is no good > else: >@@ -611,19 +611,19 @@ > > def subscribe(self, required, provided, value): > if required: >- required, with = self.get(required[0]), tuple(required[1:]) >+ required, waswith = self.get(required[0]), tuple(required[1:]) > else: > required = self._null >- with = () >+ waswith = () > > if provided is None: > provided = Null > >- required._subscriptionAdaptTo(provided, value, with) >+ required._subscriptionAdaptTo(provided, value, waswith) > >-def mextends(with, rwith): >- if len(with) == len(rwith): >- for w, r in zip(with, rwith): >+def mextends(waswith, rwith): >+ if len(waswith) == len(rwith): >+ for w, r in zip(waswith, rwith): > if not w.isOrExtends(r): > break > else: >@@ -646,19 +646,19 @@ > # TODO: Backward compatability > # Don't need to handle 3-tuples some day > try: >- (subscription, with, name, target) = key >+ (subscription, waswith, name, target) = key > except ValueError: >- (with, name, target) = key >+ (waswith, name, target) = key > subscription = False > > if subscription: >- if with: >- _add_multi_sub_adapter(with, target, multi, value) >+ if waswith: >+ _add_multi_sub_adapter(waswith, target, multi, value) > else: > _add_named_sub_adapter(target, implied, value) > else: >- if with: >- _add_multi_adapter(with, name, target, target, multi, >+ if waswith: >+ _add_multi_adapter(waswith, name, target, target, multi, > registered, value) > else: > _add_named_adapter(target, target, name, implied, >@@ -688,10 +688,10 @@ > _add_named_adapter(b, provided, name, implied, > registered, value) > >-def _add_multi_adapter(with, name, target, provided, implied, >+def _add_multi_adapter(waswith, name, target, provided, implied, > registered, object): > >- ikey = target, (len(with) + 1) >+ ikey = target, (len(waswith) + 1) > byname = implied.get(ikey) > if not byname: > byname = implied[ikey] = {} >@@ -701,8 +701,8 @@ > bywith = byname[name] = {} > > >- rkey = ikey, name, with # The full key has all 4 >- if (with not in bywith >+ rkey = ikey, name, waswith # The full key has all 4 >+ if (waswith not in bywith > or > (rkey not in registered or registered[rkey].extends(provided)) > ): >@@ -710,10 +710,10 @@ > # general interface that is closer provided than what we had > # before > registered[rkey] = provided >- bywith[with] = object >+ bywith[waswith] = object > > for b in target.__bases__: >- _add_multi_adapter(with, name, b, provided, implied, >+ _add_multi_adapter(waswith, name, b, provided, implied, > registered, object) > > def _add_named_sub_adapter(target, implied, objects): >@@ -723,13 +723,13 @@ > for b in target.__bases__: > _add_named_sub_adapter(b, implied, objects) > >-def _add_multi_sub_adapter(with, target, implied, objects): >- key = 's', target, (len(with) + 1) >+def _add_multi_sub_adapter(waswith, target, implied, objects): >+ key = 's', target, (len(waswith) + 1) > bywith = implied.get(key) > if not bywith: > bywith = implied[key] = {} > >- bywith[with] = bywith.get(with, ()) + objects >+ bywith[waswith] = bywith.get(waswith, ()) + objects > > for b in target.__bases__: >- _add_multi_sub_adapter(with, b, implied, objects) >+ _add_multi_sub_adapter(waswith, b, implied, objects)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 266613
: 188767