Optional instead of | union
This commit is contained in:
parent
9cb35fc81c
commit
1a7a11eaf3
|
@ -13,7 +13,7 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
from typing import Any
|
from typing import Any, Optional
|
||||||
|
|
||||||
from mautrix.types import Serializable, JSON
|
from mautrix.types import Serializable, JSON
|
||||||
|
|
||||||
|
@ -26,5 +26,5 @@ class Long(int, Serializable):
|
||||||
def deserialize(cls, raw: JSON) -> "Long":
|
def deserialize(cls, raw: JSON) -> "Long":
|
||||||
return cls(raw)
|
return cls(raw)
|
||||||
|
|
||||||
def to_optional_long(x: Any | None) -> Long | None:
|
def to_optional_long(x: Optional[Any]) -> Optional[Long]:
|
||||||
return Long(x) if x is not None else None
|
return Long(x) if x is not None else None
|
||||||
|
|
Loading…
Reference in New Issue