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

Replace hard-coded attribute keys #110

Conversation

flange-ipb
Copy link
Collaborator

At the moment the keys of node and edge attributes are hard-coded strings. This PR replaces all of them with symbols that are defined in the new module tucan.graph_attributes.

  • Backwards compatibility is preserved: You can still use strings as attribute keys.
  • (De-)Serialization: A mapping from node/edge attribute keys in the Graph data structure to atom attribute keys in TUCAN strings and vice-versa is introduced. (_SERIALIZER_NODE_ATTRIBUTE_MAPPING in tucan/serialization.py and _DESERIALIZER_NODE_ATTRIBUTE_MAPPING in tucan/parser/parser.py)
  • Misc. changes:
    • in tests/io/test_molfile_v2000_reader.py: Add a test for the code that processes the charge field in the atom block of V2000 Molfiles. This is not yet covered by the corpus of test Molfiles.
    • correct type hints in the parser module

@flange-ipb flange-ipb requested a review from JanCBrammer January 3, 2024 11:31
Copy link
Collaborator

@JanCBrammer JanCBrammer left a comment

Choose a reason for hiding this comment

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

Looks good! Just to be sure, I've used VSCode search to find potentially unconverted attribute keys. There aren't any.

@JanCBrammer JanCBrammer merged commit 432889e into TUCAN-nest:bliss-canonicalization Jan 4, 2024
1 check passed
@flange-ipb flange-ipb deleted the replace_hardcoded_dict_keys branch January 8, 2024 17:30
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.

2 participants