fix: mypy 0.991 issues (#7988)

* fix: mypy 0.991 issues

* fix: invalid condition for base case
This commit is contained in:
Dhruv Manilawala 2022-11-15 22:59:14 +05:30 committed by GitHub
parent 4ce8ad9ce6
commit 8bfd1c844b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 370 additions and 369 deletions

View File

@ -76,8 +76,9 @@ def decimal_to_any(num: int, base: int) -> str:
div, mod = divmod(num, base) div, mod = divmod(num, base)
if base >= 11 and 9 < mod < 36: if base >= 11 and 9 < mod < 36:
actual_value = ALPHABET_VALUES[str(mod)] actual_value = ALPHABET_VALUES[str(mod)]
mod = actual_value else:
new_value += str(mod) actual_value = str(mod)
new_value += actual_value
div = num // base div = num // base
num = div num = div
if div == 0: if div == 0:

View File

@ -49,7 +49,7 @@ class LinkedList:
>>> print(linked_list) >>> print(linked_list)
9 --> 14 --> 23 9 --> 14 --> 23
""" """
if not self.is_empty: if self.is_empty():
return "" return ""
else: else:
iterate = self.head iterate = self.head

View File

@ -345,7 +345,7 @@ class Matrix:
if other == 0: if other == 0:
return self.identity() return self.identity()
if other < 0: if other < 0:
if self.is_invertable: if self.is_invertable():
return self.inverse() ** (-other) return self.inverse() ** (-other)
raise ValueError( raise ValueError(
"Only invertable matrices can be raised to a negative power" "Only invertable matrices can be raised to a negative power"