Skip to content

Commit 7d2d335

Browse files
committed
ref: fmt
1 parent 8c2253d commit 7d2d335

File tree

9 files changed

+23
-34
lines changed

9 files changed

+23
-34
lines changed

src/hario_core/parse/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .har_parser import parse, validate, register_entry_model, entry_selector
1+
from .har_parser import entry_selector, parse, register_entry_model, validate
22
from .interfaces import HarParser, JsonSource
33

44
__all__ = [

src/hario_core/parse/har_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
import orjson
1313
from pydantic import ValidationError
1414

15-
from hario_core.parse.interfaces import JsonSource
1615
from hario_core.models.extensions.chrome_devtools import DevToolsEntry
1716
from hario_core.models.har_1_2 import Entry, HarLog
17+
from hario_core.parse.interfaces import JsonSource
1818

1919
# The registry for custom Entry models.
2020
# It's a list of (detector_function, model_class) tuples.

src/hario_core/parse/interfaces.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
from __future__ import annotations
22

33
from pathlib import Path
4-
from typing import (
5-
IO,
6-
Any,
7-
Protocol,
8-
Union,
9-
)
4+
from typing import IO, Any, Protocol, Union
105

116
from hario_core.models.har_1_2 import HarLog
127

138
JsonSource = Union[str, Path, bytes, bytearray, IO[Any]]
149

10+
1511
class HarParser(Protocol):
1612
"""Protocol for a function that parses HAR data from a source."""
1713

src/hario_core/transform/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
from .defaults import by_field, json_array_handler, uuid
2+
from .interfaces import Processor, ProcessorConfig, Transformer
13
from .pipeline import Pipeline, PipelineConfig
24
from .transform import flatten, normalize_sizes, normalize_timings, set_id
3-
from .interfaces import Transformer, Processor, ProcessorConfig
4-
from .defaults import by_field, uuid, json_array_handler
55

66
__all__ = [
77
"Pipeline",

src/hario_core/transform/interfaces.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
from __future__ import annotations
22

3-
from typing import (
4-
Any,
5-
Dict,
6-
List,
7-
Optional,
8-
Protocol,
9-
runtime_checkable,
10-
)
3+
from typing import Any, Dict, List, Optional, Protocol, runtime_checkable
4+
115

126
class Processor(Protocol):
137
"""

src/hario_core/transform/pipeline.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
from dataclasses import dataclass
44
from typing import Any, Optional, Sequence
55

6-
from hario_core.transform.interfaces import (
7-
Processor,
8-
ProcessorConfig,
9-
Transformer,
10-
)
6+
from hario_core.transform.interfaces import Processor, ProcessorConfig, Transformer
117
from hario_core.transform.strategies import (
128
AsyncStrategy,
139
ProcessingStrategy,
@@ -16,14 +12,15 @@
1612
ThreadPoolStrategy,
1713
)
1814

15+
1916
def _chunked(seq: list[Any], size: int) -> list[list[Any]]:
2017
return [seq[i : i + size] for i in range(0, len(seq), size)]
2118

2219

2320
@dataclass
2421
class PipelineConfig(ProcessorConfig):
25-
batch_size: int = 12
26-
processing_strategy: str = "process"
22+
batch_size: int = 20000
23+
processing_strategy: str = "sequential"
2724
max_workers: Optional[int] = None
2825

2926

src/hario_core/transform/strategies.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
from typing import Any, Dict, List, Optional
44

55
from hario_core.transform.interfaces import Transformer
6-
7-
from hario_core.transform.worker import (
8-
init_worker,
9-
process_batch,
10-
)
6+
from hario_core.transform.worker import init_worker, process_batch
117

128

139
class ProcessingStrategy(ABC):

src/hario_core/transform/transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
from typing import Any, Callable, Dict, Optional
77

8-
from hario_core.transform.interfaces import Transformer
98
from hario_core.transform.defaults import json_array_handler
9+
from hario_core.transform.interfaces import Transformer
1010

1111

1212
class NormalizeSizes:

tests/test_id.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,19 @@ def test_uuid_unique(self, cleaned_entry: Dict[str, Any]) -> None:
5555
assert isinstance(val, str)
5656
assert len(val) == 36
5757

58-
def test_by_field_not_dict_raises_value_error(self, cleaned_entry: Dict[str, Any]) -> None:
58+
def test_by_field_not_dict_raises_value_error(
59+
self, cleaned_entry: Dict[str, Any]
60+
) -> None:
5961
# Make "url" a string, so the next step can't access "something"
6062
id_fn = by_field(["request.url.something"])
61-
with pytest.raises(ValueError, match="Field 'request.url.something' is not a dictionary"):
63+
with pytest.raises(
64+
ValueError, match="Field 'request.url.something' is not a dictionary"
65+
):
6266
id_fn(cleaned_entry)
6367

64-
def test_by_field_none_raises_value_error(self, cleaned_entry: Dict[str, Any]) -> None:
68+
def test_by_field_none_raises_value_error(
69+
self, cleaned_entry: Dict[str, Any]
70+
) -> None:
6571
# Make "url" a string, so the next step can't access "something"
6672
cleaned_entry["request"]["nonexistent"] = None
6773
id_fn = by_field(["request.nonexistent"])

0 commit comments

Comments
 (0)