-
Notifications
You must be signed in to change notification settings - Fork 6
Fix linter errors #416
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
Fix linter errors #416
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| from typing_extensions import Self | ||
|
|
||
|
|
||
| class GlobalConfig(BaseModel): | ||
| class GlobalConfig(BaseModel): # pylint: disable=too-few-public-methods | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pydantic data models intentionally have few methods. Pylint doesn't understand this pattern, so we suppress too-few-public-methods (same as RequestsRetryDecorator in internalapi.py) |
||
| """Global runtime settings for edge-endpoint behavior.""" | ||
|
|
||
| model_config = ConfigDict(extra="forbid") | ||
|
|
@@ -21,7 +21,7 @@ class GlobalConfig(BaseModel): | |
| ) | ||
|
|
||
|
|
||
| class InferenceConfig(BaseModel): | ||
| class InferenceConfig(BaseModel): # pylint: disable=too-few-public-methods | ||
| """ | ||
| Configuration for edge inference on a specific detector. | ||
| """ | ||
|
|
@@ -71,7 +71,7 @@ def validate_configuration(self) -> Self: | |
| return self | ||
|
|
||
|
|
||
| class DetectorConfig(BaseModel): | ||
| class DetectorConfig(BaseModel): # pylint: disable=too-few-public-methods | ||
| """ | ||
| Configuration for a specific detector. | ||
| """ | ||
|
|
@@ -93,15 +93,15 @@ class ConfigBase(BaseModel): | |
| @field_validator("edge_inference_configs", mode="before") | ||
| @classmethod | ||
| def hydrate_inference_config_names( | ||
| cls, value: dict[str, InferenceConfig | dict[str, Any]] | None | ||
| ) -> dict[str, InferenceConfig | dict[str, Any]]: | ||
| cls, value: Optional[dict[str, Union[InferenceConfig, dict[str, Any]]]] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This syntax is required for Python 3.9
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made a ticket for us to drop 3.9 support in the future |
||
| ) -> dict[str, Union[InferenceConfig, dict[str, Any]]]: | ||
| """Hydrate InferenceConfig.name from payload mapping keys.""" | ||
| if value is None: | ||
| return {} | ||
| if not isinstance(value, dict): | ||
| return value | ||
|
|
||
| hydrated_configs: dict[str, InferenceConfig | dict[str, Any]] = {} | ||
| hydrated_configs: dict[str, Union[InferenceConfig, dict[str, Any]]] = {} | ||
| for name, config in value.items(): | ||
| if isinstance(config, InferenceConfig): | ||
| hydrated_configs[name] = config | ||
|
|
@@ -187,7 +187,7 @@ def from_yaml( | |
| if filename is not None: | ||
| if not filename.strip(): | ||
| raise ValueError("filename must be a non-empty path when provided.") | ||
| with open(filename, "r") as f: | ||
| with open(filename, "r", encoding="utf-8") as f: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The linter wants an explicit encoding set |
||
| yaml_str = f.read() | ||
|
|
||
| yaml_text = yaml_str or "" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyYAML doesn't ship type stubs, so mypy raises [import-untyped] on import yaml. This is the same pattern as types-requests above.