iteration and collection simplifications

This commit is contained in:
Jan Petykiewicz 2024-07-28 20:12:25 -07:00
commit 62fc64c344
2 changed files with 12 additions and 12 deletions

View file

@ -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)

View file

@ -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