-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make sure poetry.lock is up to date * add mypy and a types lib for cachetools to dev dependencies * make sure fn is_secret accounts for all cases, refactor to use try/except instead of type-checking * declare get_secret and is_secret as staticmethods, because they are * remove type hints on "params" aka "kwargs", unnecessary and results in undesired type-handling behavior * refactor site_name in handlers/base.py to correctly use parent class methods while maintaining the same functionality * change from Dict[str, str] to just dict for write_metric's tags param; the values we use are not limited to strings, and if they are not strings they are cast to strings. Can change it to a union of str | int | None if desired * fix typing for LATENCY_BUFFERS * simplify push_latency by changing LATENCY_BUFFERS to a defaultdict of LatencyBuffer * add some type hints to handlers/recommendation.py * update get_arguments override to be its own function with a different name; overriding a base/parent classes function structure is bad practice and can lead to undesired behavior * fix validate_filters type annotation for output, remove unused dict output and return None for the case where no error messages are returned * unnecessary unpacking of a dictionary argument and unnecessary use of kwargs, both in fetch_results; fixed * fix typing for propagation of `site` through a few functions; there is no case where `site` is None, and should be treated as a str not an Optional[str]. Fixed * remove code that isn't used from mappings/model.py * add a mypy.ini file for explicit mypy config * add more helpful comments to mypy.ini * add a github action to run on PRs to the main branch that runs mypy if any python file is changed * update gitignore * update gitignore * update readme with information about mypy and how to run it locally * add whitespace to end of mypy.yml * make sure poetry.lock and requirements are up to date
- Loading branch information
1 parent
9c25ec4
commit 2dbc7f5
Showing
13 changed files
with
176 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: run mypy | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- '**.py' | ||
|
||
jobs: | ||
typecheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
# change this python version if the python version is changed in pyproject.toml and the Dockerfile | ||
python-version: '3.9' | ||
- name: Set up Poetry | ||
uses: abatilo/actions-poetry@v2.0.0 | ||
with: | ||
poetry-version: 1.1.13 | ||
- name: Install dependencies | ||
run: poetry config virtualenvs.create false && poetry install --no-interaction | ||
- name: run mypy | ||
run: mypy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
.envrc | ||
.venv | ||
__pycache__ | ||
*.egg-info | ||
*.egg-info | ||
.mypy_cache | ||
.pytest_cache | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[mypy] | ||
# documentation reference: https://mypy.readthedocs.io/en/stable/config_file.html | ||
# start with this set to true, set to false and address 3rd party packages in future | ||
ignore_missing_imports = True | ||
# will also want to eventually check for missing type annotations | ||
files = app.py |
Oops, something went wrong.