-
-
Notifications
You must be signed in to change notification settings - Fork 91
Resolved issue #225 #293
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
Resolved issue #225 #293
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,8 +3,21 @@ | |||||
| __title__ = "prometheus-connect" | ||||||
| __version__ = "0.5.7" | ||||||
|
|
||||||
| from .prometheus_connect import * # noqa F403 | ||||||
| from .metric import Metric # noqa F401 | ||||||
| from .metrics_list import MetricsList # noqa F401 | ||||||
| from .metric_snapshot_df import MetricSnapshotDataFrame # noqa F401 | ||||||
| from .metric_range_df import MetricRangeDataFrame # noqa F401 | ||||||
| from .exceptions import PrometheusApiClientException, MetricValueConversionError | ||||||
|
||||||
| from .exceptions import PrometheusApiClientException, MetricValueConversionError | |
| from .exceptions import PrometheusApiClientException, MetricValueConversionError |
Copilot
AI
Dec 4, 2025
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.
Missing __all__ definition for lazy-loaded modules. When implementing lazy imports via __getattr__, it's a best practice to also define __all__ to explicitly declare the public API. This ensures tools like type checkers, IDEs, and from module import * work correctly. Add: __all__ = ["PrometheusConnect", "Metric", "MetricsList", "MetricSnapshotDataFrame", "MetricRangeDataFrame", "PrometheusApiClientException", "MetricValueConversionError"]
Copilot
AI
Dec 4, 2025
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.
The error message formatting uses an f-string but doesn't include quotes around the attribute name, making it inconsistent with Python's standard AttributeError format. The standard format is "module 'module_name' has no attribute 'attr_name'" (note the quotes around both module and attribute names). Change to: raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
| raise AttributeError(f"module {__name__} has no attribute {name}") | |
| raise AttributeError(f"module '{__name__}' has no attribute '{name}'") |
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.
The additional classes also need to be adjusted, if we are explicitly defining each class available with prometheus_api_client.
this would fails with current implementation.
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.
yes, I forgot to add 2 more imports in the init file