iteration and collection simplifications
This commit is contained in:
parent
f304217d76
commit
62fc64c344
2 changed files with 12 additions and 12 deletions
|
|
@ -17,11 +17,11 @@ class AutoSlots(ABCMeta):
|
|||
for base in bases:
|
||||
parents |= set(base.mro())
|
||||
|
||||
slots = tuple(dctn.get('__slots__', tuple()))
|
||||
slots = tuple(dctn.get('__slots__', ()))
|
||||
for parent in parents:
|
||||
if not hasattr(parent, '__annotations__'):
|
||||
continue
|
||||
slots += tuple(getattr(parent, '__annotations__').keys())
|
||||
slots += tuple(parent.__annotations__.keys())
|
||||
|
||||
dctn['__slots__'] = slots
|
||||
return super().__new__(cls, name, bases, dctn)
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ def data_to_ports_flat(
|
|||
Returns:
|
||||
The updated `pattern`. Port labels are not removed.
|
||||
"""
|
||||
labels = list(chain.from_iterable((pattern.labels[layer] for layer in layers)))
|
||||
labels = list(chain.from_iterable(pattern.labels[layer] for layer in layers))
|
||||
if not labels:
|
||||
return pattern
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue