-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add zip_lists filter to yacfg | Improve and cleanup the github actions #316
base: main
Are you sure you want to change the base?
Conversation
Do not merge yet. |
@@ -136,6 +136,11 @@ def override_value_map_keys(value: Dict[str, Any]) -> Dict[str, Any]: | |||
""" | |||
return {override_value(key, key): val for key, val in value.items()} | |||
|
|||
def zip_lists(value: List[Any], pairing: List[Any]) -> List[(Any, Any)]: |
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.
Isn't this the invalid syntax for tuple types we discussed last week?
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.
I don't think so. It currently runs for me. Will check to make sure and resolve this.
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.
>>> from typing import List, Any
>>> List[(Any, Any)]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.12/typing.py", line 384, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/typing.py", line 1436, in __getitem__
_check_generic(self, params, self._nparams)
File "/usr/lib64/python3.12/typing.py", line 304, in _check_generic
raise TypeError(f"Too {'many' if alen > elen else 'few'} arguments for {cls};"
TypeError: Too many arguments for typing.List; actual 2, expected 1
What about 1. Merging the gha changes in separate pr? And 2. Make PR and commit Workflows be single file triggered in both cases, and put conditional for the publish job thing only? That way less duplication. |
def zip_lists(value: List[Any], pairing: List[Any]) -> List[(Any, Any)]: | ||
if not isinstance(value, List) or not isinstance(pairing, List): | ||
return [] | ||
return zip(value, pairing) |
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.
Would be nice to have a test/usage example for this. Having the actual template this will operate on only in a separate repo sucks.
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.
I agree and will try to add the test into profile_test.sh.
Make sense to do so. I am not familiar with the github actions enough to do the conditionals properly. Will look into it. |
Apparently, you can add if to jobs, https://stackoverflow.com/questions/58139406/only-run-job-on-specific-branch-with-github-actions |
Fixes/Improves:
In theory it should unify and fix the github actions steps. Should make sure that changes to the yacfg don't break anything.
Proposed Changes (What, How, and Why):
Adds zip_lists function because it can be useful in templates and I need that for one of the templates I've created.
Should create tuples/pairs of objects from two lists. It is useful when you don't want to explicitly declare relationship between or duplicate data of objects, that need to be paired. Uses underlying python zip function with minor input check.