Remove unnecessary Optional

The type hints `object` and `Optional[object]`
both allow the default value `None`.

Also, this commit gets rid of ruff's "FA100" error
for the two changed lines.
This commit is contained in:
Alexander Hess 2024-10-16 11:39:52 +02:00
parent 81912f1a81
commit 6ddb545491
Signed by: alexander
GPG key ID: 344EA5AB10D868E0

View file

@ -32,9 +32,7 @@ import abc
import functools import functools
import math import math
import numbers import numbers
from typing import Callable, ClassVar, Literal
# When giving up support for Python 3.9, we can get rid of `Optional`
from typing import Callable, ClassVar, Literal, Optional
try: try:
@ -502,7 +500,7 @@ class GF2Element(metaclass=GF2Meta):
""" """
return self._compute(other, lambda s, o: o % s) return self._compute(other, lambda s, o: o % s)
def __pow__(self, other: object, _modulo: Optional[object] = None) -> Self: def __pow__(self, other: object, _modulo: object = None) -> Self:
"""Exponentiation: `self ** other`. """Exponentiation: `self ** other`.
Powers of `gf2` values are like powers of `int`s. Powers of `gf2` values are like powers of `int`s.
@ -520,7 +518,7 @@ class GF2Element(metaclass=GF2Meta):
""" """
return self._compute(other, lambda s, o: s**o) return self._compute(other, lambda s, o: s**o)
def __rpow__(self, other: object, _modulo: Optional[object] = None) -> Self: def __rpow__(self, other: object, _modulo: object = None) -> Self:
"""(Reflected) Exponentiation: `other ** self`. """(Reflected) Exponentiation: `other ** self`.
See docstring for `.__pow__()`. See docstring for `.__pow__()`.