Skip to content

Commit

Permalink
sorted imports in generated __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Jan 13, 2025
1 parent 1e860ad commit aa94a32
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
16 changes: 8 additions & 8 deletions src/event_model/documents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@

DocumentType = Union[
Type[Datum], # noqa: F405,
Type[DatumPage], # noqa: F405,
Type[Event], # noqa: F405,
Type[EventDescriptor], # noqa: F405,
Type[EventPage], # noqa: F405,
Type[PartialEvent], # noqa: F405,
Type[PartialEventPage], # noqa: F405,
Type[PartialResource], # noqa: F405,
Type[Resource], # noqa: F405,
Type[RunStart], # noqa: F405,
Type[RunStop], # noqa: F405,
Type[StreamResource], # noqa: F405,
Type[DatumPage], # noqa: F405,
Type[PartialEvent], # noqa: F405,
Type[PartialResource], # noqa: F405,
Type[StreamDatum], # noqa: F405,
Type[StreamResource], # noqa: F405,
]

ALL_DOCUMENTS: Tuple[DocumentType, ...] = (
Datum, # noqa: F405
DatumPage, # noqa: F405
Event, # noqa: F405
EventDescriptor, # noqa: F405
EventPage, # noqa: F405
PartialEvent, # noqa: F405
PartialEventPage, # noqa: F405
PartialResource, # noqa: F405
Resource, # noqa: F405
RunStart, # noqa: F405
RunStop, # noqa: F405
StreamResource, # noqa: F405
DatumPage, # noqa: F405
PartialEvent, # noqa: F405
PartialResource, # noqa: F405
StreamDatum, # noqa: F405
StreamResource, # noqa: F405
)
12 changes: 7 additions & 5 deletions src/event_model/generate/create_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,13 @@ def generate_jsonschema(


def generate_init_py(output_root: Path):
document_names = [
file.stem
for file in output_root.iterdir()
if file.stem != "__init__" and file.suffix == ".py"
]
document_names = sorted(
[
file.stem
for file in output_root.iterdir()
if file.stem != "__init__" and file.suffix == ".py"
]
)

document_class_names = [
f"{document_name.title().replace('_', '')}" for document_name in document_names
Expand Down

0 comments on commit aa94a32

Please sign in to comment.