]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Update annotation to allow PathLike
authorSam Bull <aa6bs0@sambull.org>
Mon, 13 Feb 2023 20:57:29 +0000 (15:57 -0500)
committersqla-tester <sqla-tester@sqlalchemy.org>
Mon, 13 Feb 2023 20:57:29 +0000 (15:57 -0500)
The value is only used in os.path.abspath(), so it works fine with Path.

Closes: #1173
Pull-request: https://github.com/sqlalchemy/alembic/pull/1173
Pull-request-sha: 7cf9606602bb5692ddeb3551500be0dd956bd5d9

Change-Id: Ic629a7290464291377d066e856a8ae8a3f6505bc

alembic/config.py

index ac27d585bed2731833a43a1fe67a159581f785ed..338769b29fa576c121362f25892a755be8668d0a 100644 (file)
@@ -10,6 +10,7 @@ from typing import Dict
 from typing import Optional
 from typing import overload
 from typing import TextIO
+from typing import Union
 
 from . import __version__
 from . import command
@@ -93,7 +94,7 @@ class Config:
 
     def __init__(
         self,
-        file_: Optional[str] = None,
+        file_: Union[str, os.PathLike[str], None] = None,
         ini_section: str = "alembic",
         output_buffer: Optional[TextIO] = None,
         stdout: TextIO = sys.stdout,
@@ -123,7 +124,7 @@ class Config:
 
     """
 
-    config_file_name: Optional[str] = None
+    config_file_name: Union[str, os.PathLike[str], None] = None
     """Filesystem path to the .ini file in use."""
 
     config_ini_section: str = None  # type:ignore[assignment]