Skip to content

Commit

Permalink
Typing adoptation
Browse files Browse the repository at this point in the history
  • Loading branch information
northpowered committed Mar 6, 2023
1 parent 9952e81 commit e2a3ce5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions piccolo/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,10 @@ async def __join_field(self, field: str, ignore: bool=False)->list:
return list()

async def join_m2m(
self,
include_fields: set[str] | list[str] | None=None,
exclude_fields: set[str] | list[str] | None=None
):
self,
include_fields: t.Union[set[str], t.List[str], None] = None,
exclude_fields: t.Union[set[str], t.List[str], None] = None
):
"""
Runs get_m2m() method for all M2M fields of object. Can be useful for
complex PyDantic models in READ actions. Returns empty list() for an
Expand Down Expand Up @@ -672,13 +672,13 @@ class Band(Table):
exclude_fields (set[str] | list[str] | None, optional): This fields will be excluded from join.
Defaults to None.
"""
assert (include_fields==None) or (exclude_fields==None), "Only one of FIELDS arguments can exist"
assert (include_fields == None) or (exclude_fields == None), "Only one of FIELDS arguments can exist"
if not include_fields is None:
assert isinstance(include_fields,set | list), "include_fields MUST be set, list or None"
assert isinstance(include_fields, t.Union[set, list]), "include_fields MUST be set, list or None"
if not exclude_fields is None:
assert isinstance(exclude_fields,set | list), "exclude_fields MUST be set, list or None"
assert isinstance(exclude_fields, t.Union[set, list]), "exclude_fields MUST be set, list or None"
m2m_fields: set = set([field for field, object in inspect.getmembers(
self,
self,
lambda a:(
isinstance(
a,
Expand All @@ -697,7 +697,7 @@ class Band(Table):
if field in ignore_fields:
ignore = True
self.__setattr__(
field, #M2M attr name
field, # M2M attr name
await self.__join_field(
field=field,
ignore=ignore
Expand Down

0 comments on commit e2a3ce5

Please sign in to comment.