Skip to content

Commit

Permalink
better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Feb 4, 2020
1 parent 8ab0194 commit 1a7e4dc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/zope/interface/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,17 +662,17 @@ def _lookup(components, specs, provided, name, i, l):
# The components.get in loops is executed 100 of 1000s times.
# by loading get into a local variable the bytecode
# "LOAD_FAST 0 (components)" in the loop can be eliminated.
cget = components.get
components_get = components.get
if i < l:
for spec in specs[i].__sro__:
comps = cget(spec)
comps = components_get(spec)
if comps:
r = _lookup(comps, specs, provided, name, i+1, l)
if r is not None:
return r
else:
for iface in provided:
comps = cget(iface)
comps = components_get(iface)
if comps:
r = comps.get(name)
if r is not None:
Expand All @@ -681,28 +681,28 @@ def _lookup(components, specs, provided, name, i, l):
return None

def _lookupAll(components, specs, provided, result, i, l):
cget = components.get # see _lookup above
components_get = components.get # see _lookup above
if i < l:
for spec in reversed(specs[i].__sro__):
comps = cget(spec)
comps = components_get(spec)
if comps:
_lookupAll(comps, specs, provided, result, i+1, l)
else:
for iface in reversed(provided):
comps = cget(iface)
comps = components_get(iface)
if comps:
result.update(comps)

def _subscriptions(components, specs, provided, name, result, i, l):
cget = components.get # see _lookup above
components_get = components.get # see _lookup above
if i < l:
for spec in reversed(specs[i].__sro__):
comps = cget(spec)
comps = components_get(spec)
if comps:
_subscriptions(comps, specs, provided, name, result, i+1, l)
else:
for iface in reversed(provided):
comps = cget(iface)
comps = components_get(iface)
if comps:
comps = comps.get(name)
if comps:
Expand Down

0 comments on commit 1a7e4dc

Please sign in to comment.