chore: NoneType alias for < PY310
This commit is contained in:
parent
870866df09
commit
25b87a9d49
3 changed files with 10 additions and 3 deletions
|
|
@ -9,7 +9,6 @@ import string
|
|||
import traceback
|
||||
from contextlib import contextmanager
|
||||
from time import time
|
||||
from types import NoneType
|
||||
from typing import Dict, List, Optional, Tuple, Union
|
||||
|
||||
from pypika.terms import Criterion, NullValue, PseudoColumn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,11 @@
|
|||
# License: MIT. See LICENSE
|
||||
|
||||
from functools import cached_property
|
||||
from types import NoneType
|
||||
|
||||
try:
|
||||
from types import NoneType
|
||||
except ImportError:
|
||||
NoneType = type(None)
|
||||
from typing import Dict, List, Tuple, Union
|
||||
|
||||
import frappe
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
try:
|
||||
from types import NoneType
|
||||
except ImportError:
|
||||
NoneType = type(None)
|
||||
from typing import TYPE_CHECKING, Dict, List, Optional
|
||||
|
||||
import frappe
|
||||
|
|
@ -46,7 +50,7 @@ def update_document_title(
|
|||
|
||||
# TODO: omit this after runtime type checking (ref: https://github.com/frappe/frappe/pull/14927)
|
||||
for obj in [docname, updated_title, updated_name]:
|
||||
if not isinstance(obj, (str, type(None))):
|
||||
if not isinstance(obj, (str, NoneType)):
|
||||
frappe.throw(f"{obj=} must be of type str or None")
|
||||
|
||||
# handle bad API usages
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue