Skip to content

Fix last mypy issues #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ jobs:
- name: 🧹 Lint with flake8
run: |
make check_code_quality
- name: 🧪 Test
run: "python -m unittest"
- name: Check types with mypy
run: mypy .
# TODO: Fix typing
continue-on-error: true
- name: 🧪 Test
run: "python -m unittest"
26 changes: 13 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,17 @@ exclude = [
]

[[tool.mypy.overrides]]
module = "_datetime.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "requests_toolbelt.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "ultralytics.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "ipywidgets.*"
module = [
"_datetime.*",
# IPython is an optional dependency
"IPython.display.*",
# ipywidgets is an optional dependency
"ipywidgets.*",
# matplotlib typing is not available for Python 3.8
# remove this when we stop supporting Python 3.8
"matplotlib.*",
"requests_toolbelt.*",
"torch.*",
"ultralytics.*",
]
ignore_missing_imports = true
2 changes: 1 addition & 1 deletion roboflow/models/semantic_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, api_key: str, version_id: str):
super(SemanticSegmentationModel, self).__init__(api_key, version_id)
self.api_url = f"{SEMANTIC_SEGMENTATION_URL}/{self.dataset_id}/{self.version}"

def predict(self, image_path: str, confidence: int = 50):
def predict(self, image_path: str, confidence: int = 50): # type: ignore[override]
"""
Infers detections based on image from a specified model and image path.

Expand Down
4 changes: 2 additions & 2 deletions roboflow/models/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(
""" # noqa: E501 // docs
self.__api_key = api_key

def predict(
def predict( # type: ignore[override]
self,
video_path: str,
inference_type: str,
Expand Down Expand Up @@ -124,7 +124,7 @@ def predict(
{
"model_id": self.dataset_id,
"model_version": self.version,
"inference_type": self.inference_type,
"inference_type": inference_type,
}
]

Expand Down