-
Notifications
You must be signed in to change notification settings - Fork 1
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
Common notation #146
Common notation #146
Conversation
format! |
Strange black complains, but the format action seems to be ok with the formatting. Also my local black seems to be OK with the files. |
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.
Looks good, please see comments.
if not operation.get("schema"): | ||
logging.error("Error Schema missing for Set schema to allow creating views") | ||
raise KeyError | ||
|
||
return operation["schema"].format(**flatten(value)) + "/" | ||
|
||
|
||
def extract_from_operation(operation, value): | ||
"""takes an operation""" | ||
def extract_from_operation(operation: dict, value) -> dict: |
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.
What type could value
be in this context?
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.
In the current design it is either are number, string or dict. This should be refactored at some point such that it is only a number or string
src/obr/create_tree.py
Outdated
@@ -142,7 +165,10 @@ def add_variations( | |||
parent_job: Job, | |||
id_path_mapping: dict, | |||
) -> list: |
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.
If possible, could you specifiy what type the list elements inherit? I assume operations would be list[str]
?
base_dict = deepcopy(to_dict(parent_job.sp)) | ||
|
||
statepoint = { | ||
"keys": keys, | ||
"keys": parse_res["keys"], |
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.
Is keys
always existing in parse_keys
? Or could this potentially throw a KeyError?
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.
This has always keys, since extract_from_operation
always adds them.
Co-authored-by: Lukas Petermann <60653355+lupeterm@users.noreply.github.com>
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.
Alright LGTM!
This PR implements the common notation to allow writing yaml files with key values more compact
Example:
can now be written as
Additionally,