Skip to content

chore: add safe type hints for constants and returns (3 files)#510

Open
mangodxd wants to merge 1 commit intogoogle:mainfrom
mangodxd:cleanup/type_hints-1e4f0373
Open

chore: add safe type hints for constants and returns (3 files)#510
mangodxd wants to merge 1 commit intogoogle:mainfrom
mangodxd:cleanup/type_hints-1e4f0373

Conversation

@mangodxd
Copy link
Copy Markdown

@mangodxd mangodxd commented Apr 7, 2026

Hello,

I noticed a few areas where the code could be slightly improved. This PR focuses on minor housekeeping tasks and does not change any of the existing runtime logic:

Type hint additions

  • conftest.py: added type hints to 3 function(s)
  • papers/2024/GPAM/gpam_ecc_cm1.py: added type hints to 2 function(s)
  • scaaml_intro/train.py: added type hints to 1 function(s)

I have added strictly conservative type annotations based only on explicit primitive default values and singular return statements. Complex objects and dynamic references were purposefully ignored to avoid false positives.

Examples of changes

Example change in conftest.py:

-def pytest_addoption(parser):
+def pytest_addoption(parser) -> None:
-def pytest_configure(config):
+def pytest_configure(config) -> None:
-def pytest_collection_modifyitems(config, items):
+def pytest_collection_modifyitems(config, items) -> None:

Example change in papers/2024/GPAM/gpam_ecc_cm1.py:

-    def call(self, x, training=False):
+    def call(self, x, training: bool=False):
-def main():
+def main() -> None:

Verification

  • I verified these changes using ast.parse() to ensure no syntax errors were introduced.
  • I did not modify any __init__.py files.

If anything looks incorrect, please feel free to adjust it or close the PR entirely. Thank you for maintaining this project!

@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 7, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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