-
Notifications
You must be signed in to change notification settings - Fork 7
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
Adjust the processing order of tfm tables #251
Changes from 8 commits
dd4610e
27928ce
b0de83c
98e2958
1aba99c
99f6045
1714215
ccfed76
955c3b4
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
from xl2times.utils import max_workers | ||
|
||
from . import excel, transforms, utils | ||
from .datatypes import Config, EmbeddedXlTable, TimesModel | ||
from .datatypes import Config, DataModule, EmbeddedXlTable, TimesModel | ||
|
||
logger = utils.get_logger() | ||
|
||
|
@@ -485,6 +485,20 @@ def run(args: argparse.Namespace) -> str | None: | |
|
||
model.files.update([Path(path).stem for path in input_files]) | ||
|
||
processing_order = ["base", "subres", "trade", "demand", "scen", "syssettings"] | ||
for data_module in processing_order: | ||
model.data_modules = model.data_modules + sorted( | ||
[ | ||
item | ||
for item in { | ||
DataModule.module_name(path) | ||
for path in input_files | ||
if DataModule.module_type(path) == data_module | ||
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. Should we raise a warning/error if there are any files in 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. Good idea! |
||
} | ||
if item is not None | ||
] | ||
) | ||
|
||
if args.only_read: | ||
tables = convert_xl_to_times( | ||
input_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.
Should this be defined inside the DataModule class? Just so that if we add another enum value to it, we might be reminded to also add it to this 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.
Sounds like a good idea! Would you be up for including this in the refactoring of the class in a subsequent PR or do you think we should change it already?