pytdml
pytdml copied to clipboard
Potential bugs withing pytdml yaml_to_pytdml
I am trying to use yaml_to_pytdml.py, but have found the following issues with the latest version that I think will also be experienced by other users. I'd be happy to push my changes, but you might have an improved set of fixes as you know the code better. So, I'm listing them and my quick but not elegant solutions. Let me know if you need further details, or I've done something incorrectly.
Best Wishes, Sam
- When I import pytdml into my code, the Python module import gets stuck.
- If I stop the code, I find
pytdml.utils.remove_emptyis trying to access a Wuhan S3 bucket, but failing to do so. My quick solution was to comment outfrom pytdml.utils import remove_emptyfrom tdml_writers.py - The next problem is I get the error "ImportError: cannot import name 'Label' from partially initialized module 'pytdml.type.basic_types' (most likely due to a circular import)" I think is because
pytdml.type.basic_typesimportspytdml.type.extended_typesandpytdml.type.extended_typesimportspytdml.type.basic_types. To solve this quickly, I commented out the import ofpytdml.type.extended_typesimport ofpytdml.type.basic_typesbut also had to undo the recent changes that used the extended types.
- If I stop the code, I find
- If optional parameters are not included, the validator complains about them not being present. I found I needed to do the following in basic_types and extended_types, e.g. change
date_time: Optional[str]todate_time: Optional[str] = ""I wasn't sure what to do when then the variable is a float/integer, e.g.tone_gradation: Optional[int], so this becomes optional. - When
yaml_to_pytdml.pycalls an extended function, I find I need to add type for the validator to be happy, but it feels like this shouldn't be needed in the call as the value is always the same, e.g. from modifiedpytdml.type.extended_types:
if dataset_type == 'EOTrainingDataset':
eo_training_dataset = EOTrainingDataset(
type="AI_EOTrainingDataset",
id=yaml_dict['id'],
name=yaml_dict['name'],
description=yaml_dict['description'],