Skip to content

Commit

Permalink
Fix mypy to v1.0.1 - minor code base fixes
Browse files Browse the repository at this point in the history
Minor code base fixes:
- Fix documentation rendering for lists in API doc-strings.
- Update end2end_test.py according to updated dev tools guidelines.

Concerning mypy. Pydantic v1 and mypy are not being updated properly.
The latest working version of mypy with Pydantic v1 is v1.0.1, hence,
mypy should henceforth be fixed to this version. See
pydantic/pydantic#5192
for more information.
  • Loading branch information
CasperWA committed Mar 15, 2023
1 parent 6981ec7 commit 538afc6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
14 changes: 7 additions & 7 deletions .github/utils/end2end_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def _check_import(package_: str) -> str:
f"Please install {package_} by running:\n\n"
f" pip install {package_}\n\n"
)
else:
return ""

return ""


def _check_service_availability(service_url: str) -> None:
Expand All @@ -33,9 +33,9 @@ def _check_service_availability(service_url: str) -> None:
response = requests.get(f"{service_url}/docs", allow_redirects=True, timeout=30)
except (requests.ConnectionError, requests.ConnectTimeout) as exc_:
raise RuntimeError(f"Cannot connect to {service_url} !") from exc_
else:
if not response.ok:
raise RuntimeError(f"Cannot connect to {service_url} !")

if not response.ok:
raise RuntimeError(f"Cannot connect to {service_url} !")


def main(oteapi_url: str) -> None:
Expand All @@ -62,7 +62,7 @@ def main(oteapi_url: str) -> None:
}
}

source = client.create_dataresource(
source = client.create_dataresource( # pylint: disable=no-member
accessService="OPTIMADE",
accessUrl=f"http://localhost:{os.getenv('OPTIMADE_PORT', '5000')}/",
configuration=config,
Expand All @@ -85,7 +85,7 @@ def main(oteapi_url: str) -> None:
assert parsed_resource.id in ["mpf_1", "mpf_110"]

# Use a filter strategy
query = client.create_filter(
query = client.create_filter( # pylint: disable=no-member
filterType="OPTIMADE",
query='NOT( elements HAS "Ag" AND nelements>1 )',
limit=4,
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
files: ^oteapi_optimade/.*$

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
rev: v1.0.1
hooks:
- id: mypy
exclude: ^tests/.*$
Expand Down
5 changes: 3 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ plugins:
setup_commands:
- import os
- os.environ["MKDOCS_BUILD"] = "1"
watch:
- "oteapi_optimade"
- awesome-pages

nav:
Expand All @@ -94,3 +92,6 @@ nav:
- Changelog: CHANGELOG.md
- all_strategies.md
- ... | api_reference/**

watch:
- "oteapi_optimade"
1 change: 1 addition & 0 deletions oteapi_optimade/strategies/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def initialize(
OPTIMADE resource strategy through this filter strategy.
Workflow:
1. Compile received information.
2. Update session with compiled information.
Expand Down
1 change: 1 addition & 0 deletions oteapi_optimade/strategies/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def get( # pylint: disable=too-many-branches
precedence over the derived values from `downloadUrl`.
Workflow:
1. Request OPTIMADE response.
2. Parse as an OPTIMADE Python tools (OPT) pydantic response model.
Expand Down

0 comments on commit 538afc6

Please sign in to comment.