]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Adding typing to Postgres dialect file.
authorJohn Clow <jclow@canopyservicing.com>
Tue, 4 Apr 2023 02:01:16 +0000 (19:01 -0700)
committerJohn Clow <jclow@canopyservicing.com>
Tue, 11 Apr 2023 18:42:00 +0000 (11:42 -0700)
lib/sqlalchemy/dialects/postgresql/types.py

index a6b82044b3055b50ed82302b6d2191818dc0c000..5341aa0eaad8a0c18a4e2a45dd699f10f6718bce 100644 (file)
@@ -6,10 +6,10 @@
 # mypy: ignore-errors
 
 import datetime as dt
+from typing import Optional
 
 from ...sql import sqltypes
 
-
 _DECIMAL_TYPES = (1231, 1700)
 _FLOAT_TYPES = (700, 701, 1021, 1022)
 _INT_TYPES = (20, 21, 23, 26, 1005, 1007, 1016)
@@ -150,7 +150,7 @@ class TIMESTAMP(sqltypes.TIMESTAMP):
 
     __visit_name__ = "TIMESTAMP"
 
-    def __init__(self, timezone=False, precision=None):
+    def __init__(self, timezone=False, precision: Optional[int] = None):
         """Construct a TIMESTAMP.
 
         :param timezone: boolean value if timezone present, default False
@@ -169,7 +169,7 @@ class TIME(sqltypes.TIME):
 
     __visit_name__ = "TIME"
 
-    def __init__(self, timezone=False, precision=None):
+    def __init__(self, timezone=False, precision: Optional[int] = None):
         """Construct a TIME.
 
         :param timezone: boolean value if timezone present, default False
@@ -189,7 +189,7 @@ class INTERVAL(sqltypes.NativeForEmulated, sqltypes._AbstractInterval):
     __visit_name__ = "INTERVAL"
     native = True
 
-    def __init__(self, precision=None, fields=None):
+    def __init__(self, precision: Optional[int] = None, fields: Optional[str] = None):
         """Construct an INTERVAL.
 
         :param precision: optional integer precision value
@@ -225,7 +225,7 @@ PGInterval = INTERVAL
 class BIT(sqltypes.TypeEngine[int]):
     __visit_name__ = "BIT"
 
-    def __init__(self, length=None, varying=False):
+    def __init__(self, length: Optional[int] = None, varying=False):
         if not varying:
             # BIT without VARYING defaults to length 1
             self.length = length or 1