Created
November 20, 2019 09:31
-
-
Save icoxfog417/7d910315059011e933f0e7674d66265d to your computer and use it in GitHub Desktop.
xbrl_part3_role_ref.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
role_ref_tags = xbrl_dir.xbrl.find_all("link:roleRef") | |
role_ref_elements = [t.element for t in role_ref_tags] | |
role_refs = {} | |
for e in role_ref_elements: | |
role_refs[e["roleURI"]] = e["xlink:href"] | |
roles = {} | |
for r in role_refs: | |
role_name = taxonomy.read(role_refs[r]).element.find("link:definition").text | |
roles[role_name] = r | |
# Show roles | |
for r in roles: | |
print(f"{r}\t{roles[r]}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment