8000 [PATCH] Setting hierarchy parameter in recursive function to None to a… by dherincx92 · Pull Request #19 · dherincx92/fpds · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[PATCH] Setting hierarchy parameter in recursive function to None to a… #19

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

Merged
merged 4 commits into from
Jun 6, 2024

Conversation

dherincx92
Copy link
Owner

@vdavez The issue in a nutshell (a good gotcha) -- mutable default arguments; perfect explanation is here (https://docs.python-guide.org/writing/gotchas/). In summary, setting the hierarchy parameter to None in content_tag_hierarchy prevents the function from storing state from previous processed records, which was the issue -- the reason this happened is that the first record in your example was an AWARD and the second record an IDV, which meant new keys existed and with the attribute update call, those new keys were getting created.

Also to stay consistent with the XML structure, removed some logic that was truncating certain XML keys. For debugging purposes, this should allow users to quickly determine where certain values came from when referencing the XML.

@dherincx92 dherincx92 merged commit e1961b1 into master Jun 6, 2024
1 check passed
@dherincx92 dherincx92 deleted the patch/mutable-default-arg-in-recursion branch June 6, 2024 04:15
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.

1 participant
0