Skip to content

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
23 changes: 18 additions & 5 deletions prometheus_api_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@
__title__ = "prometheus-connect"
__version__ = "0.5.7"

from .prometheus_connect import * # noqa F403
Copy link
Collaborator

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.

from prometheus_api_client import PrometheusApiClientException

this would fails with current implementation.

Copy link
Author

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

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
def __getattr__(name):
if name == "PrometheusConnect":
from .prometheus_connect import PrometheusConnect
return PrometheusConnect
elif name == "Metric":
from .metric import Metric
return Metric
elif name == "MetricsList":
from .metrics_list import MetricsList
return MetricsList
elif name == "MetricSnapshotDataFrame":
from .metric_snapshot_df import MetricSnapshotDataFrame
return MetricSnapshotDataFrame
elif name == "MetricRangeDataFrame":
from .metric_range_df import MetricRangeDataFrame
return MetricRangeDataFrame
raise AttributeError(f"module {__name__} has no attribute {name}")
Loading