-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #358 from OpenTrafficCam/bug/5669-replace-types-al…
…l-in-mypy-in-pre-commit-configyaml Bug/5669 replace types all in mypy in pre commit configyaml
- Loading branch information
Showing
25 changed files
with
206 additions
and
35 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 |
---|---|---|
@@ -1,45 +1,66 @@ | ||
--- | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: check-json | ||
- id: end-of-file-fixer | ||
exclude_types: [json] | ||
exclude_types: | ||
- json | ||
- id: trailing-whitespace | ||
- id: no-commit-to-branch | ||
- id: debug-statements | ||
- id: requirements-txt-fixer | ||
- id: check-executables-have-shebangs | ||
- id: detect-private-key | ||
- repo: local | ||
hooks: | ||
- id: update-type-stubs | ||
name: Check for Type Stubs and Update Config | ||
entry: ./update_precommit.py | ||
language: system | ||
files: ^requirements.*\.txt$ | ||
stages: | ||
- commit | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 6.1.0 | ||
rev: 7.1.1 | ||
hooks: | ||
- id: flake8 | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
args: ["--profile", "black"] | ||
args: | ||
- --profile | ||
- black | ||
- repo: https://github.com/psf/black | ||
rev: 23.10.0 | ||
rev: 24.8.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.6.1 | ||
rev: v1.11.1 | ||
hooks: | ||
- id: mypy | ||
entry: mypy . | ||
additional_dependencies: [types-all, pydantic] | ||
additional_dependencies: | ||
- types-PyYAML | ||
- types-flake8 | ||
- types-jsonschema | ||
- types-psutil | ||
- types-seaborn | ||
- types-setuptools | ||
- types-tqdm | ||
- types-ujson | ||
always_run: true | ||
pass_filenames: false | ||
- repo: https://github.com/adrienverge/yamllint.git | ||
rev: v1.32.0 | ||
rev: v1.35.1 | ||
hooks: | ||
- id: yamllint | ||
args: [-c=./.yamllint.yaml] | ||
args: | ||
- -c=./.yamllint.yaml | ||
- repo: https://github.com/koalaman/shellcheck-precommit | ||
rev: v0.9.0 | ||
rev: v0.10.0 | ||
hooks: | ||
- id: shellcheck |
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,6 +1,7 @@ | ||
""" | ||
OTVision init module | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision config module for setting default values | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision main module for converting videos to other formats and frame rates. | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision main module to detect objects in single or multiple images or videos. | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision helpers to change formats and retrieve information | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
@@ -93,7 +94,7 @@ def _get_time_from_frame_number( | |
fps: int, | ||
return_yyyymmdd_hhmmss: bool = True, | ||
return_milliseconds: bool = True, | ||
) -> pd.Series: | ||
) -> pd.Series | tuple[pd.Series, pd.Series]: | ||
"""Get datetime series of detections from series of frame numbers of video | ||
the objects were detected using a start datetime of the video and | ||
the video frame rate (fps). | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision helpers for logging | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision helpers to gather information about the machine and the system | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
""" | ||
OTVision module for calculating a homography from reference points | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
@@ -111,15 +112,15 @@ def get_homography( | |
|
||
|
||
def evaluate_homography( | ||
refpts_pixel: dict, | ||
refpts_pixel: np.ndarray, | ||
refpts_world_upshifted_disassembled: np.ndarray, | ||
homography_matrix: np.ndarray, | ||
) -> dict: # TODO: Type hint nested dict during refactoring | ||
"""Calculates transformation error of homography | ||
Args: | ||
refpts_pixel (dict): Reference points in both pixel and utm coordinates | ||
refpts_world_upshifted_disassembled (ndarry): Internal variable | ||
refpts_pixel (ndarray): Reference points in both pixel and utm coordinates | ||
refpts_world_upshifted_disassembled (ndarray): Internal variable | ||
homography_matrix (ndarray): Homography matrix | ||
Returns: | ||
|
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
OTVision tool to select reference points for transformation | ||
from pixel to world coordinates | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision main module for transforming tracks from pixel to world coordinates | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision main gui module | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision gui module for convert.py | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision gui module for detect.py | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision helper gui module | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
@@ -253,19 +254,19 @@ def update_tree_files(self): | |
def update_other_gui_parts(self): | ||
# Activate/deactivate buttons in FrameTransform | ||
if self.files_dict: | ||
self.master.frame_transform.frame_options.button_choose_refpts[ | ||
"state" | ||
] = tk.NORMAL | ||
self.master.frame_transform.frame_options.button_click_refpts[ | ||
"state" | ||
] = tk.NORMAL | ||
self.master.frame_transform.frame_options.button_choose_refpts["state"] = ( | ||
tk.NORMAL | ||
) | ||
self.master.frame_transform.frame_options.button_click_refpts["state"] = ( | ||
tk.NORMAL | ||
) | ||
else: | ||
self.master.frame_transform.frame_options.button_choose_refpts[ | ||
"state" | ||
] = tk.DISABLED | ||
self.master.frame_transform.frame_options.button_click_refpts[ | ||
"state" | ||
] = tk.DISABLED | ||
self.master.frame_transform.frame_options.button_choose_refpts["state"] = ( | ||
tk.DISABLED | ||
) | ||
self.master.frame_transform.frame_options.button_click_refpts["state"] = ( | ||
tk.DISABLED | ||
) | ||
|
||
def get_tree_files(self): | ||
return [ | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision gui module for track.py | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision gui module for transform.py | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision script to call the convert main with arguments parsed from command line | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision script to call the detect main with arguments parsed from command line | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,12 +1,13 @@ | ||
-r requirements.txt | ||
black==24.4.0 | ||
black==24.8.0 | ||
coremltools==7.2; sys_platform == 'darwin' | ||
flake8==7.0.0 | ||
flake8==7.1.1 | ||
interrogate==1.5.0 | ||
isort==5.12.0 | ||
isort==5.13.2 | ||
jsonschema==4.23.0 | ||
mypy==1.6.1 | ||
pre-commit==3.6.0 | ||
pytest==8.0.0 | ||
pytest-cov==4.1.0 | ||
yamllint==1.33.0 | ||
mypy==1.11.1 | ||
pandas-stubs==2.2.2.240807 | ||
pre-commit==3.8.0 | ||
pytest==8.3.2 | ||
pytest-cov==5.0.0 | ||
yamllint==1.35.1 |
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,6 +1,7 @@ | ||
""" | ||
OTVision script to call the track main with arguments parsed from command line | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
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,6 +1,7 @@ | ||
""" | ||
OTVision script to call the transform main with arguments parsed from command line | ||
""" | ||
|
||
# Copyright (C) 2022 OpenTrafficCam Contributors | ||
# <https://github.com/OpenTrafficCam | ||
# <[email protected]> | ||
|
Oops, something went wrong.