Skip to content

Fix types so pylance's type checker doesn't complain#189

Closed
curtischong wants to merge 4 commits intomainfrom
add-types
Closed

Fix types so pylance's type checker doesn't complain#189
curtischong wants to merge 4 commits intomainfrom
add-types

Conversation

@curtischong
Copy link
Copy Markdown
Collaborator

@curtischong curtischong commented May 11, 2025

Summary

  • renamed "global" to "per_graph" since global is a python keyword. per_graph also fits more nicely with per_atom and per_batch

Checklist

Before a pull request can be merged, the following items must be checked:

  • Doc strings have been added in the Google docstring format.
    Run ruff on your code.
  • Tests have been added for any new functionality or bug fixes.

We highly recommended installing the pre-commit hooks running in CI locally to speedup the development process. Simply run pip install pre-commit && pre-commit install to install the hooks which will check your code before each commit.

@cla-bot cla-bot Bot added the cla-signed label May 11, 2025
@curtischong curtischong marked this pull request as draft May 11, 2025 23:34
Comment thread tests/test_state.py
def test_infer_sim_state_property_scope(si_sim_state: SimState) -> None:
"""Test inference of property scope."""
scope = infer_property_scope(si_sim_state)
assert set(scope["global"]) == {"pbc"}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

here it is global because things like the PBC cannot be different for things in a batched state. per_batch is the misleading one here as that it the per_graph level of abstraction. If pylance doesn't like global I would agree that changing it is a good thing to do but I would think that a different name, for example shared, might be better. I would also consider renaming per_batch as I don't think that per_batch is clear that it's per substate within a batched simstate.

Copy link
Copy Markdown
Member

@CompRhys CompRhys left a comment

Choose a reason for hiding this comment

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

per_graph is the wrong label but not opposed to changing the name here to avoid linting/language server issues.

@curtischong
Copy link
Copy Markdown
Collaborator Author

Closing since the per_graph change is more involved and I want to roll it back but still keep Rhys' comments. I'll put up a smaller initial PR here: #191

I'll prob rename per_batch -> per_graph in its own isolated PR

@curtischong curtischong deleted the add-types branch May 12, 2025 16:13
@orionarcher
Copy link
Copy Markdown
Collaborator

Agree with Rhys that if you open another PR I'd favor "shared" or "per-state" over "per-graph". Fine switching away from global if it's causing issues.

Alternate ideas: "atomwise" - "batchwise" - "shared".

Could also make an Enum so it's not just strings.

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