-
Notifications
You must be signed in to change notification settings - Fork 48
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
[core][WIP] Rename type to type name #185
base: develop
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -13,7 +13,6 @@ | |
# limitations under the License. | ||
# | ||
|
||
import collections | ||
import string | ||
|
||
import glom | ||
|
@@ -46,7 +45,7 @@ def _transform_io_list(io_subsection_list): | |
"""Transform lists of dicts into a nested dict of dicts, where the keys | ||
for the top-level dict come from the `name` field in the nested dict. | ||
If `name` is not present, a name is auto-generated based on the index | ||
of the I/O and it's type. | ||
of the I/O. | ||
|
||
example: | ||
|
||
|
@@ -77,20 +76,12 @@ def _transform_io_list(io_subsection_list): | |
} | ||
""" | ||
|
||
type_counters = collections.defaultdict(int) | ||
io_dict = {} | ||
for conf in io_subsection_list: | ||
for count, conf in enumerate(io_subsection_list): | ||
if "name" in conf: | ||
name = conf["name"] | ||
# TODO: right now "name" isn't supported in IOConfig (conflicts | ||
# with existing "name" attribute), once that's fixed we | ||
# shouldn't drop name here | ||
conf.pop("name") | ||
else: | ||
type_name = conf.get("type", "unknown") | ||
type_id = type_counters[type_name] | ||
type_counters[type_name] += 1 | ||
name = "{}{}".format(type_name, type_id) | ||
name = count | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why the type is being dropped from the generated name? I'm not strongly for keeping it but I also don't see any clear reason for removing it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think i remember we discussed as a team and thought there was weirdness since there is another area https://github.com/spotify/klio/blob/develop/exec/src/klio_exec/commands/run.py#L466 where we again append an index to the type. i THINK it's used because multiple event reading requires a unique Theres also this TODO written by @econchick that touches on stuff disappearing if we convert to enforcing a dictionary for event inputs and i think the two are related. https://github.com/spotify/klio/blob/develop/exec/src/klio_exec/commands/run.py#L460 |
||
|
||
io_dict[name] = conf | ||
|
||
|
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 think we should use
TYPE_NAME
in caps to indicate this is more like a class-level constant.