-
Notifications
You must be signed in to change notification settings - Fork 0
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
Configure metrics with yaml #66
Conversation
for more information, see https://pre-commit.ci
…io/insight into configure_metrics_with_yaml
return {'name': self.name} | ||
|
||
@classmethod | ||
def metric_from_dict(cls, bluprnt: Dict[str, Any], check: Check = None): |
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.
def metric_from_dict(cls, bluprnt: Dict[str, Any], check: Check = None): | |
def from_dict(cls, bluprnt: Dict[str, Any], check: Check = None): |
@classmethod | ||
def metrics_to_yaml_dump(cls, metrics: List): | ||
""" | ||
Dumps the given metrics into the print stream in a YAML format. | ||
This is a prototype function and should be deleted/modified later. | ||
""" | ||
print(yaml.dump({"metrics": [m.to_dict() for m in metrics]})) | ||
|
||
@classmethod | ||
def metrics_from_yaml(cls, document: Union[IO, str], check: Check = None): | ||
""" | ||
Given a YAML document that contains a 'metrics' field, return a list of instances of the metrics within | ||
the field. | ||
""" | ||
metric_bluprnts = yaml.safe_load(document) | ||
return [_Metric.metric_from_dict(bluprnt=bluprnt, check=check) for bluprnt in metric_bluprnts['metrics']] | ||
|
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.
lets pull out these two methods
Kudos, SonarCloud Quality Gate passed! |
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.
Nicely done 👍🏼
No description provided.