Skip to content

Commit ec22f68

Browse files
Replace object type hint in __lt__ with Any
Signed-off-by: Rodney Richardson <[email protected]>
1 parent 695ee86 commit ec22f68

File tree

6 files changed

+34
-34
lines changed

6 files changed

+34
-34
lines changed

cyclonedx/model/__init__.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import warnings
2222
from datetime import datetime
2323
from enum import Enum
24-
from typing import Iterable, Optional, Set
24+
from typing import Any, Iterable, Optional, Set
2525

2626
from sortedcontainers import SortedSet
2727

@@ -64,7 +64,7 @@ class ComparableTuple(tuple):
6464
Allows comparison of tuples, allowing for None values.
6565
"""
6666

67-
def __lt__(self, other: object) -> bool:
67+
def __lt__(self, other: Any) -> bool:
6868
for s, o in zip(self, other):
6969
if s == o:
7070
continue
@@ -78,7 +78,7 @@ def __lt__(self, other: object) -> bool:
7878
return False
7979
return False
8080

81-
def __gt__(self, other: object) -> bool:
81+
def __gt__(self, other: Any) -> bool:
8282
for s, o in zip(self, other):
8383
if s == o:
8484
continue
@@ -356,7 +356,7 @@ def __eq__(self, other: object) -> bool:
356356
return hash(other) == hash(self)
357357
return False
358358

359-
def __lt__(self, other: object) -> bool:
359+
def __lt__(self, other: Any) -> bool:
360360
if isinstance(other, HashType):
361361
return ComparableTuple((self.alg, self.content)) < ComparableTuple((other.alg, other.content))
362362
return NotImplemented
@@ -419,7 +419,7 @@ def __eq__(self, other: object) -> bool:
419419
return hash(other) == hash(self)
420420
return False
421421

422-
def __lt__(self, other: object) -> bool:
422+
def __lt__(self, other: Any) -> bool:
423423
if isinstance(other, XsUri):
424424
return self._uri < other._uri
425425
return NotImplemented
@@ -514,7 +514,7 @@ def __eq__(self, other: object) -> bool:
514514
return hash(other) == hash(self)
515515
return False
516516

517-
def __lt__(self, other: object) -> bool:
517+
def __lt__(self, other: Any) -> bool:
518518
if isinstance(other, ExternalReference):
519519
return ComparableTuple((self._type, self._url, self._comment)) < ComparableTuple((other._type, other._url, other._comment))
520520
return NotImplemented
@@ -617,7 +617,7 @@ def __eq__(self, other: object) -> bool:
617617
return hash(other) == hash(self)
618618
return False
619619

620-
def __lt__(self, other: object) -> bool:
620+
def __lt__(self, other: Any) -> bool:
621621
if isinstance(other, License):
622622
return ComparableTuple((self.id, self.name)) < ComparableTuple((other.id, other.name))
623623
return NotImplemented
@@ -689,7 +689,7 @@ def __eq__(self, other: object) -> bool:
689689
return hash(other) == hash(self)
690690
return False
691691

692-
def __lt__(self, other: object) -> bool:
692+
def __lt__(self, other: Any) -> bool:
693693
if isinstance(other, LicenseChoice):
694694
return ComparableTuple((self.license, self.expression)) < ComparableTuple((other.license, other.expression))
695695
return NotImplemented
@@ -751,7 +751,7 @@ def __eq__(self, other: object) -> bool:
751751
return hash(other) == hash(self)
752752
return False
753753

754-
def __lt__(self, other: object) -> bool:
754+
def __lt__(self, other: Any) -> bool:
755755
if isinstance(other, Property):
756756
return ComparableTuple((self.name, self.value)) < ComparableTuple((other.name, other.value))
757757
return NotImplemented
@@ -829,7 +829,7 @@ def __eq__(self, other: object) -> bool:
829829
return hash(other) == hash(self)
830830
return False
831831

832-
def __lt__(self, other: object) -> bool:
832+
def __lt__(self, other: Any) -> bool:
833833
if isinstance(other, NoteText):
834834
return ComparableTuple((self.content, self.content_type, self.encoding)) < ComparableTuple((other.content, other.content_type, other.encoding))
835835
return NotImplemented
@@ -901,7 +901,7 @@ def __eq__(self, other: object) -> bool:
901901
return hash(other) == hash(self)
902902
return False
903903

904-
def __lt__(self, other: object) -> bool:
904+
def __lt__(self, other: Any) -> bool:
905905
if isinstance(other, Note):
906906
return ComparableTuple((self.locale, self.text)) < ComparableTuple((other.locale, other.text))
907907
return NotImplemented
@@ -978,7 +978,7 @@ def __eq__(self, other: object) -> bool:
978978
return hash(other) == hash(self)
979979
return False
980980

981-
def __lt__(self, other: object) -> bool:
981+
def __lt__(self, other: Any) -> bool:
982982
if isinstance(other, OrganizationalContact):
983983
return ComparableTuple((self.name, self.email, self.phone)) < ComparableTuple((other.name, other.email, other.phone))
984984
return NotImplemented
@@ -1158,7 +1158,7 @@ def __eq__(self, other: object) -> bool:
11581158
return hash(other) == hash(self)
11591159
return False
11601160

1161-
def __lt__(self, other: object) -> bool:
1161+
def __lt__(self, other: Any) -> bool:
11621162
if isinstance(other, Tool):
11631163
return ComparableTuple((self.vendor, self.name, self.version)) < ComparableTuple((other.vendor, other.name, other.version))
11641164
return NotImplemented
@@ -1236,7 +1236,7 @@ def __eq__(self, other: object) -> bool:
12361236
return hash(other) == hash(self)
12371237
return False
12381238

1239-
def __lt__(self, other: object) -> bool:
1239+
def __lt__(self, other: Any) -> bool:
12401240
if isinstance(other, IdentifiableAction):
12411241
return ComparableTuple((self.timestamp, self.name, self.email)) < ComparableTuple((other.timestamp, other.name, other.email))
12421242
return NotImplemented
@@ -1278,7 +1278,7 @@ def __eq__(self, other: object) -> bool:
12781278
return hash(other) == hash(self)
12791279
return False
12801280

1281-
def __lt__(self, other: object) -> bool:
1281+
def __lt__(self, other: Any) -> bool:
12821282
if isinstance(other, Copyright):
12831283
return self.text < other.text
12841284
return NotImplemented

cyclonedx/model/bom_ref.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# SPDX-License-Identifier: Apache-2.0
1818
# Copyright (c) OWASP Foundation. All Rights Reserved.
1919

20-
from typing import Optional
20+
from typing import Any, Optional
2121
from uuid import uuid4
2222

2323

@@ -47,7 +47,7 @@ def __eq__(self, other: object) -> bool:
4747
return hash(other) == hash(self)
4848
return False
4949

50-
def __lt__(self, other: object) -> bool:
50+
def __lt__(self, other: Any) -> bool:
5151
if isinstance(other, BomRef):
5252
return self.value < other.value
5353
return NotImplemented

cyclonedx/model/component.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import warnings
2121
from enum import Enum
2222
from os.path import exists
23-
from typing import Iterable, Optional, Set
23+
from typing import Any, Iterable, Optional, Set
2424

2525
# See https://github.com/package-url/packageurl-python/issues/65
2626
from packageurl import PackageURL # type: ignore
@@ -145,7 +145,7 @@ def __eq__(self, other: object) -> bool:
145145
return hash(other) == hash(self)
146146
return False
147147

148-
def __lt__(self, other: object) -> bool:
148+
def __lt__(self, other: Any) -> bool:
149149
if isinstance(other, Commit):
150150
return ComparableTuple((self.uid, self.url, self.author, self.committer, self.message)) < ComparableTuple((other.uid, other.url, other.author, other.committer, other.message))
151151
return NotImplemented
@@ -296,7 +296,7 @@ def __eq__(self, other: object) -> bool:
296296
return hash(other) == hash(self)
297297
return False
298298

299-
def __lt__(self, other: object) -> bool:
299+
def __lt__(self, other: Any) -> bool:
300300
if isinstance(other, Diff):
301301
return ComparableTuple((self.url, self.text)) < ComparableTuple((other.url, other.text))
302302
return NotImplemented
@@ -386,7 +386,7 @@ def __eq__(self, other: object) -> bool:
386386
return hash(other) == hash(self)
387387
return False
388388

389-
def __lt__(self, other: object) -> bool:
389+
def __lt__(self, other: Any) -> bool:
390390
if isinstance(other, Patch):
391391
return ComparableTuple((self.type, self.diff, ComparableTuple(self.resolves))) < ComparableTuple((other.type, other.diff, ComparableTuple(other.resolves)))
392392
return NotImplemented
@@ -1168,7 +1168,7 @@ def __eq__(self, other: object) -> bool:
11681168
return hash(other) == hash(self)
11691169
return False
11701170

1171-
def __lt__(self, other: object) -> bool:
1171+
def __lt__(self, other: Any) -> bool:
11721172
if isinstance(other, Component):
11731173
return ComparableTuple((self.type, self.group, self.name, self.version)) < ComparableTuple((other.type, other.group, other.name, other.version))
11741174
return NotImplemented

cyclonedx/model/issue.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Copyright (c) OWASP Foundation. All Rights Reserved.
1717

1818
from enum import Enum
19-
from typing import Iterable, Optional, Set
19+
from typing import Any, Iterable, Optional, Set
2020

2121
from sortedcontainers import SortedSet
2222

@@ -86,7 +86,7 @@ def __eq__(self, other: object) -> bool:
8686
return hash(other) == hash(self)
8787
return False
8888

89-
def __lt__(self, other: object) -> bool:
89+
def __lt__(self, other: Any) -> bool:
9090
if isinstance(other, IssueTypeSource):
9191
return ComparableTuple((self.name, self.url)) < ComparableTuple((other.name, other.url))
9292
return NotImplemented
@@ -206,7 +206,7 @@ def __eq__(self, other: object) -> bool:
206206
return hash(other) == hash(self)
207207
return False
208208

209-
def __lt__(self, other: object) -> bool:
209+
def __lt__(self, other: Any) -> bool:
210210
if isinstance(other, IssueType):
211211
return ComparableTuple((self.type, self.id, self.name, self.description, self.source)) < ComparableTuple((other.type, other.id, other.name, other.description, other.source))
212212
return NotImplemented

cyclonedx/model/service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# SPDX-License-Identifier: Apache-2.0
1616
# Copyright (c) OWASP Foundation. All Rights Reserved.
1717

18-
from typing import Iterable, Optional, Set
18+
from typing import Any, Iterable, Optional, Set
1919

2020
from sortedcontainers import SortedSet
2121

@@ -299,7 +299,7 @@ def __eq__(self, other: object) -> bool:
299299
return hash(other) == hash(self)
300300
return False
301301

302-
def __lt__(self, other: object) -> bool:
302+
def __lt__(self, other: Any) -> bool:
303303
if isinstance(other, Service):
304304
return ComparableTuple((self.group, self.name, self.version)) < ComparableTuple((other.group, other.name, other.version))
305305
return NotImplemented

cyclonedx/model/vulnerability.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from datetime import datetime
2323
from decimal import Decimal
2424
from enum import Enum
25-
from typing import Iterable, Optional, Set, Tuple, Union
25+
from typing import Any, Iterable, Optional, Set, Tuple, Union
2626

2727
from sortedcontainers import SortedSet
2828

@@ -116,7 +116,7 @@ def __eq__(self, other: object) -> bool:
116116
return hash(other) == hash(self)
117117
return False
118118

119-
def __lt__(self, other: object) -> bool:
119+
def __lt__(self, other: Any) -> bool:
120120
if isinstance(other, BomTargetVersionRange):
121121
return ComparableTuple((self.version, self.range, self.status)) < ComparableTuple((other.version, other.range, other.status))
122122
return NotImplemented
@@ -175,7 +175,7 @@ def __eq__(self, other: object) -> bool:
175175
return hash(other) == hash(self)
176176
return False
177177

178-
def __lt__(self, other: object) -> bool:
178+
def __lt__(self, other: Any) -> bool:
179179
if isinstance(other, BomTarget):
180180
return self.ref < other.ref
181181
return NotImplemented
@@ -320,7 +320,7 @@ def __eq__(self, other: object) -> bool:
320320
return hash(other) == hash(self)
321321
return False
322322

323-
def __lt__(self, other: object) -> bool:
323+
def __lt__(self, other: Any) -> bool:
324324
if isinstance(other, VulnerabilityAdvisory):
325325
return ComparableTuple((self.title, self.url)) < ComparableTuple((other.title, other.url))
326326
return NotImplemented
@@ -377,7 +377,7 @@ def __eq__(self, other: object) -> bool:
377377
return hash(other) == hash(self)
378378
return False
379379

380-
def __lt__(self, other: object) -> bool:
380+
def __lt__(self, other: Any) -> bool:
381381
if isinstance(other, VulnerabilitySource):
382382
return ComparableTuple((self.name, self.url)) < ComparableTuple((other.name, other.url))
383383
return NotImplemented
@@ -437,7 +437,7 @@ def __eq__(self, other: object) -> bool:
437437
return hash(other) == hash(self)
438438
return False
439439

440-
def __lt__(self, other: object) -> bool:
440+
def __lt__(self, other: Any) -> bool:
441441
if isinstance(other, VulnerabilityReference):
442442
return ComparableTuple((self.id, self.source)) < ComparableTuple((other.id, other.source))
443443
return NotImplemented
@@ -686,7 +686,7 @@ def __eq__(self, other: object) -> bool:
686686
return hash(other) == hash(self)
687687
return False
688688

689-
def __lt__(self, other: object) -> bool:
689+
def __lt__(self, other: Any) -> bool:
690690
if isinstance(other, VulnerabilityRating):
691691
return ComparableTuple((self.severity, self.score, self.source, self.method, self.vector, self.justification)) < ComparableTuple((other.severity, other.score, other.source, other.method, other.vector, other.justification))
692692
return NotImplemented

0 commit comments

Comments
 (0)