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

More specific type annotation for BaseJobExec.parse_status() #17381

Merged
merged 1 commit into from Jan 31, 2024

Conversation

nsoranzo
Copy link
Member

@nsoranzo nsoranzo commented Jan 29, 2024

Add type annotation to BaseJobExec.parse_single_status()

Follow-up on #17367 (comment) .

Needed to add TypeAlias to model.Job.states to fix:

lib/galaxy/jobs/runners/util/cli/job/__init__.py:67: error: Variable "galaxy.jobs.runners.util.cli.job.job_states" is not valid as a type  [valid-type]
        def parse_status(self, status: str, job_ids: List[str]) -> Dict[str, job_states]:
                                                                             ^

See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases :

You should always use TypeAlias to define a type alias in a class body
or inside a function.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@nsoranzo nsoranzo added kind/bug kind/refactoring cleanup or refactoring of existing code, no functional changes labels Jan 29, 2024
@github-actions github-actions bot added area/jobs area/database Galaxy's database or data access layer labels Jan 29, 2024
@github-actions github-actions bot added this to the 24.0 milestone Jan 29, 2024
Add type annotation to ``BaseJobExec.parse_single_status()``

Follow-up on galaxyproject#17367 (comment) .

Needed to add ``TypeAlias`` to ``model.Job.states`` to fix:

```
lib/galaxy/jobs/runners/util/cli/job/__init__.py:67: error: Variable "galaxy.jobs.runners.util.cli.job.job_states" is not valid as a type  [valid-type]
        def parse_status(self, status: str, job_ids: List[str]) -> Dict[str, job_states]:
                                                                             ^
```

See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases :

> You should always use ``TypeAlias`` to define a type alias in a class body
> or inside a function.
@nsoranzo nsoranzo requested a review from mvdbeek January 30, 2024 11:05
@mvdbeek mvdbeek merged commit fa670f8 into galaxyproject:dev Jan 31, 2024
51 of 52 checks passed
@mvdbeek
Copy link
Member

mvdbeek commented Jan 31, 2024

Very nice, thank you!

@nsoranzo nsoranzo deleted the 17367_followup branch January 31, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/database Galaxy's database or data access layer area/jobs kind/bug kind/refactoring cleanup or refactoring of existing code, no functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants