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

Testing: Add type annotations to core/did #6732

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rdimaio
Copy link
Contributor

@rdimaio rdimaio commented Apr 25, 2024

Part of #6588

def __add_files_to_archive(parent_did, files_temp_table, files, account, ignore_duplicate=False, *, session: "Session"):
def __add_files_to_archive(
parent_did: models.DataIdentifier,
files_temp_table: Any,
Copy link
Contributor Author

@rdimaio rdimaio Apr 25, 2024

Choose a reason for hiding this comment

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

Note on the type Any for the temp tables across these functions:

These temp tables are generated via rucio.db.sqla.util._create_temp_table, which returns the class DeclarativeObj, which is defined inside _create_temp_table itself.

Refactoring this class to be defined outside of _create_temp_table does not seem to be straightforward, as the class definition itself uses variables from _create_temp_table. These could be set in a constructor, but I'm not sure if the functionality would remain the same.

A workaround would be to create a TypeVar named DeclarativeObj to annotate these tables more specifically, but then type checkers complain that TypeVar[DeclarativeObj has no members scope and name.

The solution would be to refactor DeclarativeObj out of _create_temp_table, but I would like to do this in a follow-up PR with assistance from someone that has already worked closely on these methods.

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.

None yet

1 participant