summaryrefslogtreecommitdiff
path: root/alembic/operations
diff options
context:
space:
mode:
authorCaselIT <cfederico87@gmail.com>2021-08-23 20:54:00 +0200
committerCaselIT <cfederico87@gmail.com>2021-08-23 21:26:32 +0200
commit7fd48061bbf893002b2d7a624b313b09ee0a9700 (patch)
tree6620421f730280b84883ad524bbbd98aea5d99a4 /alembic/operations
parent18136dd42a0820fbecacea8cb0e7f47b002ce68a (diff)
downloadalembic-7fd48061bbf893002b2d7a624b313b09ee0a9700.tar.gz
avoid importing ForwardRef that's py3.9+ only
Change-Id: I76654f10e208d618e21ab0c884cb0abede4d6177
Diffstat (limited to 'alembic/operations')
-rw-r--r--alembic/operations/base.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/alembic/operations/base.py b/alembic/operations/base.py
index 21f7a85..59bbfc4 100644
--- a/alembic/operations/base.py
+++ b/alembic/operations/base.py
@@ -1,8 +1,8 @@
from contextlib import contextmanager
+import re
import textwrap
from typing import Any
from typing import Callable
-from typing import ForwardRef # noqa
from typing import Iterator
from typing import List # noqa
from typing import Optional
@@ -136,6 +136,12 @@ class Operations(util.ModuleClsProxy):
formatvalue=lambda x: "=" + x,
)
+ args = re.sub(
+ r'[_]?ForwardRef\(([\'"].+?[\'"])\)',
+ lambda m: m.group(1),
+ args,
+ )
+
func_text = textwrap.dedent(
"""\
def %(name)s%(args)s: