Skip to content

Commit c475bc0

Browse files
committed
Update typing information - switched to inline
1 parent b6f6b09 commit c475bc0

File tree

14 files changed

+31
-251
lines changed

14 files changed

+31
-251
lines changed

src/aces/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def get_and_validate_label_schema(df: pl.DataFrame) -> pa.Table:
131131

132132

133133
@hydra.main(version_base=None, config_path=str(config_yaml.parent.resolve()), config_name=config_yaml.stem)
134-
def main(cfg: DictConfig):
134+
def main(cfg: DictConfig) -> None:
135135
import os
136136
from datetime import datetime
137137
from pathlib import Path

src/aces/aggregate.pyi

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/aces/config.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from dataclasses import field
1010
from datetime import timedelta
1111
from pathlib import Path
12+
from typing import Any
1213

1314
import networkx as nx
1415
import polars as pl
@@ -28,7 +29,7 @@
2829

2930
@dataclasses.dataclass
3031
class PlainPredicateConfig:
31-
code: str | dict
32+
code: str | dict[str, Any]
3233
value_min: float | None = None
3334
value_max: float | None = None
3435
value_min_inclusive: bool | None = None
@@ -289,7 +290,7 @@ class DerivedPredicateConfig:
289290
expr: str
290291
static: bool = False
291292

292-
def __post_init__(self):
293+
def __post_init__(self) -> None:
293294
if not self.expr:
294295
raise ValueError("Derived predicates must have a non-empty expression field.")
295296

@@ -647,7 +648,7 @@ class WindowConfig:
647648
index_timestamp: str | None = None
648649

649650
@classmethod
650-
def _check_reference(cls, reference: str):
651+
def _check_reference(cls, reference: str) -> None:
651652
"""Checks to ensure referenced events are valid."""
652653
err_str = (
653654
"Window boundary reference must be either a valid alphanumeric/'_' string "
@@ -708,7 +709,7 @@ def _parse_boundary(cls, boundary: str) -> dict[str, str]:
708709
cls._check_reference(ref)
709710
return {"referenced": ref, "offset": None, "event_bound": None, "occurs_before": None}
710711

711-
def __post_init__(self):
712+
def __post_init__(self) -> None:
712713
# Parse the has constraints from the string representation to the tuple representation
713714
if self.has is not None:
714715
for each_constraint in self.has:
@@ -1127,7 +1128,11 @@ class TaskExtractorConfig:
11271128
index_timestamp_window: str | None = None
11281129

11291130
@classmethod
1130-
def load(cls, config_path: str | Path, predicates_path: str | Path = None) -> TaskExtractorConfig:
1131+
def load(
1132+
cls: TaskExtractorConfig,
1133+
config_path: str | Path,
1134+
predicates_path: str | Path = None,
1135+
) -> TaskExtractorConfig:
11311136
"""Load a configuration file from the given path and return it as a dict.
11321137
11331138
Args:
@@ -1308,7 +1313,7 @@ def load(cls, config_path: str | Path, predicates_path: str | Path = None) -> Ta
13081313

13091314
return cls(predicates=predicate_objs, trigger=trigger, windows=windows)
13101315

1311-
def _initialize_predicates(self):
1316+
def _initialize_predicates(self) -> None:
13121317
"""Initialize the predicates tree from the configuration object and check validity.
13131318
13141319
Raises:
@@ -1355,7 +1360,7 @@ def _initialize_predicates(self):
13551360
f"Graph: {nx.write_network_text(self._predicate_dag_graph)}"
13561361
)
13571362

1358-
def _initialize_windows(self):
1363+
def _initialize_windows(self) -> None:
13591364
"""Initialize the windows tree from the configuration object and check validity.
13601365
13611366
Raises:
@@ -1502,7 +1507,7 @@ def _initialize_windows(self):
15021507

15031508
self.window_nodes = window_nodes
15041509

1505-
def __post_init__(self):
1510+
def __post_init__(self) -> None:
15061511
self._initialize_predicates()
15071512
self._initialize_windows()
15081513

@@ -1515,12 +1520,12 @@ def predicates_DAG(self) -> nx.DiGraph:
15151520
return self._predicate_dag_graph
15161521

15171522
@property
1518-
def plain_predicates(self) -> dict[str:PlainPredicateConfig]:
1523+
def plain_predicates(self) -> dict[str, PlainPredicateConfig]:
15191524
"""Returns a dictionary of plain predicates in {name: code} format."""
15201525
return {p: cfg for p, cfg in self.predicates.items() if cfg.is_plain}
15211526

15221527
@property
1523-
def derived_predicates(self) -> OrderedDict[str:DerivedPredicateConfig]:
1528+
def derived_predicates(self) -> OrderedDict[str, DerivedPredicateConfig]:
15241529
"""Returns an ordered dictionary mapping derived predicates to their configs in a proper order."""
15251530
return {
15261531
p: self.predicates[p]

src/aces/config.pyi

Lines changed: 0 additions & 106 deletions
This file was deleted.

src/aces/constraints.pyi

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/aces/expand_shards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def expand_shards(*shards: str) -> str:
7171
return ",".join(result)
7272

7373

74-
def main():
74+
def main() -> None:
7575
print(expand_shards(*sys.argv[1:]))
7676

7777

src/aces/extract_subtree.pyi

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/aces/predicates.pyi

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/aces/py.typed

Whitespace-only changes.

src/aces/query.pyi

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)