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

Update deprecated type hints #37

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ribbanya
Copy link
Contributor

No description provided.

Copy link
Owner

@encounter encounter left a comment

Choose a reason for hiding this comment

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

What’s the minimum version of Python this supports?

@@ -225,15 +223,15 @@ def make_flags_str(flags: Optional[Union[str, List[str]]]) -> str:
# Load decomp-toolkit generated config.json
def load_build_config(
config: ProjectConfig, build_config_path: Path
) -> Optional[Dict[str, Any]]:
) -> dict[str, Any | None]:
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
) -> dict[str, Any | None]:
) -> dict[str, Any] | None:

Unless I’m misreading

objects: Dict[str, Object],
build_config: Optional[Dict[str, Any]],
objects: dict[str, Object],
build_config: dict[str, Any | None],
Copy link
Owner

Choose a reason for hiding this comment

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

Same

None # Additional re-configuration dependency files
)
self.custom_build_rules: Optional[List[Dict[str, Any]]] = (
self.custom_build_rules: list[dict[str, Any | None]] = (
Copy link
Owner

Choose a reason for hiding this comment

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

Here too

None # Custom ninja build rules
)
self.custom_build_steps: Optional[Dict[str, List[Dict[str, Any]]]] = (
self.custom_build_steps: dict[str, list[dict[str, Any | None]]] = (
Copy link
Owner

Choose a reason for hiding this comment

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

And here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah good catch, sorry. Will fix.

@ribbanya
Copy link
Contributor Author

What’s the minimum version of Python this supports?

3.9 for list/dict and 3.10 for union types.

@henriquegemignani
Copy link

If you do from __future__ import annotations in the top of the file, then type hints are interpreted as strings which lets you not have issues with python versions for the hints.

If looking to modernize all of these in a repository, check pyupgrade or ruff as they can automate these things.

@encounter
Copy link
Owner

If that lets us support older Python versions without type hints, I’m all for it. Even though 3.7 and 3.8 are out of support, it’s nice to not make people upgrade just for type hints.

@ribbanya ribbanya marked this pull request as draft September 29, 2024 16:20
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