Skip to content

Commit

Permalink
Fix formatting and return type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
nadove-ucsc committed Aug 1, 2023
1 parent 3d495fa commit 8475b4f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/azul/service/avro_pfb.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def entities(self) -> Iterable[JSON]:
yield entity.to_json(sorted(relations, key=attrgetter('dst_name', 'dst_id')))


def _reversible_join(joiner: str, parts: Iterable[str]):
def _reversible_join(joiner: str, parts: Iterable[str]) -> str:
parts = list(parts)
reject(any(joiner in part for part in parts), parts)
return joiner.join(parts)
Expand All @@ -175,7 +175,8 @@ def __attrs_post_init__(self):
def from_json(cls,
name: str,
object_: MutableJSON,
schema: JSON) -> 'PFBEntity':
schema: JSON
) -> 'PFBEntity':
"""
Derive ID from object in a reproducible way so that we can distinguish
entities by comparing their IDs.
Expand Down Expand Up @@ -254,7 +255,7 @@ def _replace_null_with_empty_string(cls, object_json: AnyJSON) -> AnyMutableJSON
else:
return object_json

def to_json(self, relations: Iterable['PFBRelation']):
def to_json(self, relations: Iterable['PFBRelation']) -> JSON:
return {
'id': self.id,
'name': self.name,
Expand All @@ -272,7 +273,7 @@ class PFBRelation:
dst_name: str

@classmethod
def to_entity(cls, entity: PFBEntity):
def to_entity(cls, entity: PFBEntity) -> 'PFBRelation':
return cls(dst_id=entity.id, dst_name=entity.name)


Expand Down Expand Up @@ -510,7 +511,8 @@ def _inject_reference_handover_values(entity: MutableJSON, doc: JSON):


def _entity_schema_recursive(field_types: FieldTypes,
*path: str) -> Iterable[JSON]:
*path: str
) -> Iterable[JSON]:
for field_name, field_type in field_types.items():
namespace = '.'.join(path)
plural = isinstance(field_type, list)
Expand Down

0 comments on commit 8475b4f

Please sign in to comment.