Optional instead of | union

This commit is contained in:
Andrew Ferrazzutti 2022-04-28 03:45:56 -04:00
parent 9cb35fc81c
commit 1a7a11eaf3
1 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@
#
# 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/>.
from typing import Any
from typing import Any, Optional
from mautrix.types import Serializable, JSON
@ -26,5 +26,5 @@ class Long(int, Serializable):
def deserialize(cls, raw: JSON) -> "Long":
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