Skip to content
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

Introduce EmbeddedXlTable.defaults to store composite tag info #216

Merged
merged 9 commits into from
Mar 15, 2024

Conversation

olejandro
Copy link
Member

@olejandro olejandro commented Mar 13, 2024

This PR introduces EmbeddedXlTable.defaults to store the additional info from a composite tag. Separating this info early on allows removing repeated decomposition of the composite tag.

@olejandro olejandro marked this pull request as ready for review March 13, 2024 21:44
Copy link
Collaborator

@SamRWest SamRWest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't comment on the logic (which I don't really understand), but other than my one nitpick, looks good :)

@@ -57,7 +57,7 @@ def remove_comment_rows(
result = []

for table in tables:
tag = datatypes.Tag(table.tag.split(":")[0])
tag = datatypes.Tag(table.tag)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random nitpickey suggestion : this file would be more readable if we did from .datatypes import Tag and changed all these to just Tag(table.tag).
Unless there's a good reason not to (like if there was another Tag class somewhere that needed distinguishing from)

Same with datatype.Config, EmbeddedXlTable and TimesModel references.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would make a lot of sense. If @siddharth-krishna agrees we could change all them in a separate PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea, thanks, I opened an issue to track it: #220

@olejandro
Copy link
Member Author

Can't comment on the logic (which I don't really understand), but other than my one nitpick, looks good :)

Thanks! Basically, this just extracts the extra info that may be included with a tag (e.g. ~FI_T: ACT_BND) earlier. It will also make it easier to handle some other ways in which this extra info may be included.

(newtag, varname) = table.tag.split(":")
varname = varname.strip()
if table.defaults:
varname = table.defaults
df = table.dataframe.copy()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the copy here btw

@olejandro olejandro merged commit 7ca7e40 into main Mar 15, 2024
1 check passed
@olejandro olejandro deleted the olex/composite-tags branch March 15, 2024 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants