Skip to content

Commit

Permalink
style: update code style
Browse files Browse the repository at this point in the history
Signed-off-by: ktro2828 <[email protected]>
  • Loading branch information
ktro2828 committed Nov 14, 2024
1 parent 9986b4e commit 4f65cb4
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions t4_devkit/tier4.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,7 @@ def get_table(self, schema: str | SchemaName) -> list[SchemaTable]:
Returns:
List of dataclasses.
"""
if isinstance(schema, SchemaName):
schema = schema.value
return getattr(self, schema)
return getattr(self, SchemaName(schema))

def get(self, schema: str | SchemaName, token: str) -> SchemaTable:
"""Return a record identified by the associated token.
Expand All @@ -271,8 +269,7 @@ def get_idx(self, schema: str | SchemaName, token: str) -> int:
Returns:
The index of the record in table.
"""
if isinstance(schema, SchemaName):
schema = schema.value
schema = SchemaName(schema)
if self._token2idx.get(schema) is None:
raise KeyError(f"{schema} is not registered.")
if self._token2idx[schema].get(token) is None:
Expand Down Expand Up @@ -586,17 +583,13 @@ def box_velocity(
if not has_prev and not has_next:
return np.array([np.nan, np.nan, np.nan])

first: SampleAnnotation
if has_prev:
first = self.get("sample_annotation", current.prev)
else:
first = current
first: SampleAnnotation = (
self.get("sample_annotation", current.prev) if has_prev else current
)

last: SampleAnnotation
if has_next:
last = self.get("sample_annotation", current.next)
else:
last = current
last: SampleAnnotation = (
self.get("sample_annotation", current.next) if has_next else current
)

pos_last = last.translation
pos_first = first.translation
Expand Down

0 comments on commit 4f65cb4

Please sign in to comment.