fix: resolve all basedpyright warnings
- Use collections.abc.Generator/Iterable instead of deprecated typing imports - Replace Optional with union syntax (X | None) - Add explicit type annotations to eliminate reportUnknownVariableType - Use typing.cast for untyped mistletoe attributes (content, level, line_number) - Replace mutable default arguments with None defaults (reportCallInDefaultInitializer) - Add ClassVar annotation for model_config (reportIncompatibleVariableOverride) - Add @override decorator for settings_customise_sources (reportImplicitOverride) - Annotate class attributes in Tag (reportUnannotatedClassAttribute) - Add parameter type annotations in test (reportMissingParameterType) - Assign unused call result to _ (reportUnusedCallResult)
This commit is contained in:
parent
1e203d9db3
commit
49cd9bcfa0
10 changed files with 770 additions and 16 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from streamer.localize.repository_configuration import (
|
||||
from streamd.localize.repository_configuration import (
|
||||
Dimension,
|
||||
Marker,
|
||||
MarkerPlacement,
|
||||
|
|
@ -252,8 +252,8 @@ class TestMergeRepositoryConfiguration:
|
|||
),
|
||||
},
|
||||
markers={
|
||||
"Streamer": Marker(
|
||||
display_name="Streamer",
|
||||
"Streamd": Marker(
|
||||
display_name="Streamd",
|
||||
placements=[MarkerPlacement(dimension="project")],
|
||||
)
|
||||
},
|
||||
|
|
@ -267,8 +267,8 @@ class TestMergeRepositoryConfiguration:
|
|||
),
|
||||
},
|
||||
markers={
|
||||
"Streamer": Marker(
|
||||
display_name="Streamer2",
|
||||
"Streamd": Marker(
|
||||
display_name="Streamd2",
|
||||
placements=[
|
||||
MarkerPlacement(
|
||||
if_with={"Timesheet"}, dimension="timesheet", value="coding"
|
||||
|
|
@ -291,9 +291,9 @@ class TestMergeRepositoryConfiguration:
|
|||
assert merged.dimensions["moment"].display_name == "Moment"
|
||||
assert merged.dimensions["timesheet"].display_name == "Timesheet"
|
||||
|
||||
assert set(merged.markers.keys()) == {"Streamer", "JobHunting"}
|
||||
assert merged.markers["Streamer"].display_name == "Streamer2"
|
||||
assert merged.markers["Streamer"].placements == [
|
||||
assert set(merged.markers.keys()) == {"Streamd", "JobHunting"}
|
||||
assert merged.markers["Streamd"].display_name == "Streamd2"
|
||||
assert merged.markers["Streamd"].placements == [
|
||||
MarkerPlacement(dimension="project", value=None, if_with=set()),
|
||||
MarkerPlacement(
|
||||
if_with={"Timesheet"}, dimension="timesheet", value="coding"
|
||||
|
|
@ -359,7 +359,9 @@ class TestMergeRepositoryConfiguration:
|
|||
],
|
||||
)
|
||||
def test_merge_repository_configuration_propagate_preserves_base_when_omitted(
|
||||
base, second, expected_propagate
|
||||
base: RepositoryConfiguration,
|
||||
second: RepositoryConfiguration,
|
||||
expected_propagate: bool,
|
||||
):
|
||||
merged = merge_repository_configuration(base, second)
|
||||
assert merged.dimensions["d"].propagate is expected_propagate
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ from datetime import datetime, time
|
|||
|
||||
import pytest
|
||||
|
||||
from streamer.localize.localized_shard import LocalizedShard
|
||||
from streamer.timesheet.configuration import (
|
||||
from streamd.localize.localized_shard import LocalizedShard
|
||||
from streamd.timesheet.configuration import (
|
||||
TIMESHEET_DIMENSION_NAME,
|
||||
TimesheetPointType,
|
||||
)
|
||||
from streamer.timesheet.extract import extract_timesheets
|
||||
from streamer.timesheet.timecard import SpecialDayType, Timecard, Timesheet
|
||||
from streamd.timesheet.extract import extract_timesheets
|
||||
from streamd.timesheet.timecard import SpecialDayType, Timecard, Timesheet
|
||||
|
||||
|
||||
def point(at: datetime, type: TimesheetPointType) -> LocalizedShard:
|
||||
|
|
@ -243,7 +243,7 @@ class TestExtractTimesheets:
|
|||
]
|
||||
|
||||
with pytest.raises(ValueError, match=r"Last Timecard of .* is not a break"):
|
||||
extract_timesheets(shards)
|
||||
_ = extract_timesheets(shards)
|
||||
|
||||
def test_two_special_day_types_same_day_is_invalid(self):
|
||||
"""
|
||||
|
|
@ -257,7 +257,7 @@ class TestExtractTimesheets:
|
|||
]
|
||||
|
||||
with pytest.raises(ValueError, match=r"is both .* and .*"):
|
||||
extract_timesheets(shards)
|
||||
_ = extract_timesheets(shards)
|
||||
|
||||
def test_points_with_mixed_dates_inside_one_group_raises(self):
|
||||
"""
|
||||
|
|
@ -273,7 +273,7 @@ class TestExtractTimesheets:
|
|||
]
|
||||
|
||||
with pytest.raises(ValueError, match=r"Last Timecard of .* is not a break"):
|
||||
extract_timesheets(shards)
|
||||
_ = extract_timesheets(shards)
|
||||
|
||||
def test_day_with_only_breaks_is_ignored(self):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue