Skip to content

Commit e827aba

Browse files
Enforce ruff/flake8-pyi rules (PYI) (#292)
* Enforce ruff/flake8-pyi rule PYI032 PYI032 Prefer `object` to `Any` for the second parameter to `__eq__` * Enforce ruff/flake8-pyi rule PYI041 PYI041 Use `float` instead of `int | float`
1 parent bbffd73 commit e827aba

6 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/highdicom/content.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from collections import Counter
33
import datetime
44
from copy import deepcopy
5-
from typing import Any, cast, Dict, List, Optional, Union, Sequence, Tuple
5+
from typing import cast, Dict, List, Optional, Union, Sequence, Tuple
66

77
import numpy as np
88
from pydicom.dataset import Dataset
@@ -491,7 +491,7 @@ def __init__(
491491
)
492492
self.append(item)
493493

494-
def __eq__(self, other: Any) -> bool:
494+
def __eq__(self, other: object) -> bool:
495495
"""Determines whether two image planes have the same position.
496496
497497
Parameters
@@ -631,7 +631,7 @@ def __init__(
631631
)
632632
self.append(item)
633633

634-
def __eq__(self, other: Any) -> bool:
634+
def __eq__(self, other: object) -> bool:
635635
"""Determines whether two image planes have the same orientation.
636636
637637
Parameters

src/highdicom/pm/sop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def __init__(
6666
Sequence[RealWorldValueMapping],
6767
Sequence[Sequence[RealWorldValueMapping]],
6868
],
69-
window_center: Union[int, float],
70-
window_width: Union[int, float],
69+
window_center: float,
70+
window_width: float,
7171
transfer_syntax_uid: Union[str, UID] = ExplicitVRLittleEndian,
7272
content_description: Optional[str] = None,
7373
content_creator_name: Optional[str] = None,

src/highdicom/sr/coding.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from copy import deepcopy
22
import logging
3-
from typing import Any, Optional, Union
3+
from typing import Optional, Union
44

55
from pydicom.dataset import Dataset
66
from pydicom.sr.coding import Code
@@ -51,7 +51,7 @@ def __init__(
5151
def __hash__(self) -> int:
5252
return hash(self.scheme_designator + self.value)
5353

54-
def __eq__(self, other: Any) -> bool:
54+
def __eq__(self, other: object) -> bool:
5555
"""Compares `self` and `other` for equality.
5656
5757
Parameters
@@ -75,7 +75,7 @@ def __eq__(self, other: Any) -> bool:
7575
return Code.__eq__(this, other)
7676
return super().__eq__(other)
7777

78-
def __ne__(self, other: Any) -> bool:
78+
def __ne__(self, other: object) -> bool:
7979
"""Compares `self` and `other` for inequality.
8080
8181
Parameters

src/highdicom/sr/content.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class LongitudinalTemporalOffsetFromEvent(NumContentItem):
115115

116116
def __init__(
117117
self,
118-
value: Union[int, float],
118+
value: float,
119119
unit: Union[CodedConcept, Code],
120120
event_type: Union[CodedConcept, Code]
121121
) -> None:

src/highdicom/sr/templates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2299,7 +2299,7 @@ class Measurement(Template):
22992299
def __init__(
23002300
self,
23012301
name: Union[CodedConcept, Code],
2302-
value: Union[int, float],
2302+
value: float,
23032303
unit: Union[CodedConcept, Code],
23042304
qualifier: Optional[Union[CodedConcept, Code]] = None,
23052305
tracking_identifier: Optional[TrackingIdentifier] = None,

src/highdicom/sr/value_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ class NumContentItem(ContentItem):
11311131
def __init__(
11321132
self,
11331133
name: Union[Code, CodedConcept],
1134-
value: Union[int, float],
1134+
value: float,
11351135
unit: Union[Code, CodedConcept],
11361136
qualifier: Optional[Union[Code, CodedConcept]] = None,
11371137
relationship_type: Union[str, RelationshipTypeValues, None] = None,

0 commit comments

Comments
 (0)