You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Btw, I also realized that this isn't how Enums are "supposed" to be used. The "value" of an Enum should be a unique value, and the "names" are symbolic names that make the code cleaner/more robust. I think the canonical way of doing this would be to define an enum like
and then having a mapping from Enum values to regexs/patterns path_to_DataModule or something, which is then used in _find_type to match the given path and then it returns a DataModule. This way, the method module_type will not have to return module_type.name but can return module_type instead, which is a DataModule object, which is useful down the line if some other transform wants to use some Enum method/cookbook. Or in order to have more type information in the DataFrames, as the data_module_type column can be of type DataModule instead of string.
From #250 (comment):
Btw, I also realized that this isn't how Enums are "supposed" to be used. The "value" of an Enum should be a unique value, and the "names" are symbolic names that make the code cleaner/more robust. I think the canonical way of doing this would be to define an enum like
and then having a mapping from Enum values to regexs/patterns
path_to_DataModule
or something, which is then used in_find_type
to match the given path and then it returns aDataModule
. This way, the methodmodule_type
will not have to returnmodule_type.name
but can returnmodule_type
instead, which is aDataModule
object, which is useful down the line if some other transform wants to use some Enum method/cookbook. Or in order to have more type information in the DataFrames, as thedata_module_type
column can be of typeDataModule
instead of string.See also: https://docs.python.org/3/howto/enum.html#enum-cookbook
While we're refactoring, we should also:
The text was updated successfully, but these errors were encountered: