Skip to content

Commit

Permalink
Pass mypy and link issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Sep 18, 2024
1 parent beb876c commit 7a9dbe3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
9 changes: 8 additions & 1 deletion jaraco/postgres/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@

log = logging.getLogger('jaraco.postgres')

_VERSION_PATTERN = re.compile(r'\d+(\.\d+)?')


class NotInitializedError(Exception):
"An exception raised when an uninitialized DBMS is asked to do something"
Expand Down Expand Up @@ -651,7 +653,12 @@ class PostgresFinder(paths.PathFinder):
]

def _get_version_from_path(path: str):
version_str = re.search(r'\d+(\.\d+)?', path).group(0) # type: ignore
match = re.search(_VERSION_PATTERN, path)
if not match:
raise ValueError(
f"No version matching /{_VERSION_PATTERN.pattern}/ in '{path}'"
)
version_str = match.group(0)
return packaging.version.Version(version_str)

# Prefer the highest-numbered version available.
Expand Down
8 changes: 8 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ explicit_package_bases = True
disable_error_code =
# Disable due to many false positives
overload-overlap,

# jaraco/jaraco.services#5
[mypy-jaraco.services.*]
ignore_missing_imports = True

# jaraco/portend#17
[mypy-portend.*]
ignore_missing_imports = True
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type = [
"pytest-mypy",

# local
"types-psycopg2",
]


Expand All @@ -76,7 +77,3 @@ pytest11 = {PostgreSQL = "jaraco.postgres.fixtures"}


[tool.setuptools_scm]


[tool.pytest-enabler.mypy]
# Disabled due to jaraco/skeleton#143

0 comments on commit 7a9dbe3

Please sign in to comment.