Skip to content

Commit

Permalink
Replace object type hint in __lt__ with Any
Browse files Browse the repository at this point in the history
Signed-off-by: Rodney Richardson <[email protected]>
  • Loading branch information
RodneyRichardson committed May 27, 2022
1 parent 695ee86 commit ec22f68
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 34 deletions.
30 changes: 15 additions & 15 deletions cyclonedx/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import warnings
from datetime import datetime
from enum import Enum
from typing import Iterable, Optional, Set
from typing import Any, Iterable, Optional, Set

from sortedcontainers import SortedSet

Expand Down Expand Up @@ -64,7 +64,7 @@ class ComparableTuple(tuple):
Allows comparison of tuples, allowing for None values.
"""

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
for s, o in zip(self, other):
if s == o:
continue
Expand All @@ -78,7 +78,7 @@ def __lt__(self, other: object) -> bool:
return False
return False

def __gt__(self, other: object) -> bool:
def __gt__(self, other: Any) -> bool:
for s, o in zip(self, other):
if s == o:
continue
Expand Down Expand Up @@ -356,7 +356,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, HashType):
return ComparableTuple((self.alg, self.content)) < ComparableTuple((other.alg, other.content))
return NotImplemented
Expand Down Expand Up @@ -419,7 +419,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, XsUri):
return self._uri < other._uri
return NotImplemented
Expand Down Expand Up @@ -514,7 +514,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, ExternalReference):
return ComparableTuple((self._type, self._url, self._comment)) < ComparableTuple((other._type, other._url, other._comment))
return NotImplemented
Expand Down Expand Up @@ -617,7 +617,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, License):
return ComparableTuple((self.id, self.name)) < ComparableTuple((other.id, other.name))
return NotImplemented
Expand Down Expand Up @@ -689,7 +689,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, LicenseChoice):
return ComparableTuple((self.license, self.expression)) < ComparableTuple((other.license, other.expression))
return NotImplemented
Expand Down Expand Up @@ -751,7 +751,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, Property):
return ComparableTuple((self.name, self.value)) < ComparableTuple((other.name, other.value))
return NotImplemented
Expand Down Expand Up @@ -829,7 +829,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, NoteText):
return ComparableTuple((self.content, self.content_type, self.encoding)) < ComparableTuple((other.content, other.content_type, other.encoding))
return NotImplemented
Expand Down Expand Up @@ -901,7 +901,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, Note):
return ComparableTuple((self.locale, self.text)) < ComparableTuple((other.locale, other.text))
return NotImplemented
Expand Down Expand Up @@ -978,7 +978,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, OrganizationalContact):
return ComparableTuple((self.name, self.email, self.phone)) < ComparableTuple((other.name, other.email, other.phone))
return NotImplemented
Expand Down Expand Up @@ -1158,7 +1158,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, Tool):
return ComparableTuple((self.vendor, self.name, self.version)) < ComparableTuple((other.vendor, other.name, other.version))
return NotImplemented
Expand Down Expand Up @@ -1236,7 +1236,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, IdentifiableAction):
return ComparableTuple((self.timestamp, self.name, self.email)) < ComparableTuple((other.timestamp, other.name, other.email))
return NotImplemented
Expand Down Expand Up @@ -1278,7 +1278,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, Copyright):
return self.text < other.text
return NotImplemented
Expand Down
4 changes: 2 additions & 2 deletions cyclonedx/model/bom_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.

from typing import Optional
from typing import Any, Optional
from uuid import uuid4


Expand Down Expand Up @@ -47,7 +47,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, BomRef):
return self.value < other.value
return NotImplemented
Expand Down
10 changes: 5 additions & 5 deletions cyclonedx/model/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import warnings
from enum import Enum
from os.path import exists
from typing import Iterable, Optional, Set
from typing import Any, Iterable, Optional, Set

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

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, Commit):
return ComparableTuple((self.uid, self.url, self.author, self.committer, self.message)) < ComparableTuple((other.uid, other.url, other.author, other.committer, other.message))
return NotImplemented
Expand Down Expand Up @@ -296,7 +296,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, Diff):
return ComparableTuple((self.url, self.text)) < ComparableTuple((other.url, other.text))
return NotImplemented
Expand Down Expand Up @@ -386,7 +386,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, Patch):
return ComparableTuple((self.type, self.diff, ComparableTuple(self.resolves))) < ComparableTuple((other.type, other.diff, ComparableTuple(other.resolves)))
return NotImplemented
Expand Down Expand Up @@ -1168,7 +1168,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, Component):
return ComparableTuple((self.type, self.group, self.name, self.version)) < ComparableTuple((other.type, other.group, other.name, other.version))
return NotImplemented
Expand Down
6 changes: 3 additions & 3 deletions cyclonedx/model/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Copyright (c) OWASP Foundation. All Rights Reserved.

from enum import Enum
from typing import Iterable, Optional, Set
from typing import Any, Iterable, Optional, Set

from sortedcontainers import SortedSet

Expand Down Expand Up @@ -86,7 +86,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, IssueTypeSource):
return ComparableTuple((self.name, self.url)) < ComparableTuple((other.name, other.url))
return NotImplemented
Expand Down Expand Up @@ -206,7 +206,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, IssueType):
return ComparableTuple((self.type, self.id, self.name, self.description, self.source)) < ComparableTuple((other.type, other.id, other.name, other.description, other.source))
return NotImplemented
Expand Down
4 changes: 2 additions & 2 deletions cyclonedx/model/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.

from typing import Iterable, Optional, Set
from typing import Any, Iterable, Optional, Set

from sortedcontainers import SortedSet

Expand Down Expand Up @@ -299,7 +299,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, Service):
return ComparableTuple((self.group, self.name, self.version)) < ComparableTuple((other.group, other.name, other.version))
return NotImplemented
Expand Down
14 changes: 7 additions & 7 deletions cyclonedx/model/vulnerability.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from datetime import datetime
from decimal import Decimal
from enum import Enum
from typing import Iterable, Optional, Set, Tuple, Union
from typing import Any, Iterable, Optional, Set, Tuple, Union

from sortedcontainers import SortedSet

Expand Down Expand Up @@ -116,7 +116,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, BomTargetVersionRange):
return ComparableTuple((self.version, self.range, self.status)) < ComparableTuple((other.version, other.range, other.status))
return NotImplemented
Expand Down Expand Up @@ -175,7 +175,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, BomTarget):
return self.ref < other.ref
return NotImplemented
Expand Down Expand Up @@ -320,7 +320,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, VulnerabilityAdvisory):
return ComparableTuple((self.title, self.url)) < ComparableTuple((other.title, other.url))
return NotImplemented
Expand Down Expand Up @@ -377,7 +377,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, VulnerabilitySource):
return ComparableTuple((self.name, self.url)) < ComparableTuple((other.name, other.url))
return NotImplemented
Expand Down Expand Up @@ -437,7 +437,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, VulnerabilityReference):
return ComparableTuple((self.id, self.source)) < ComparableTuple((other.id, other.source))
return NotImplemented
Expand Down Expand Up @@ -686,7 +686,7 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
def __lt__(self, other: Any) -> bool:
if isinstance(other, VulnerabilityRating):
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))
return NotImplemented
Expand Down

0 comments on commit ec22f68

Please sign in to comment.