Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@CunliangGeng
Copy link
Member

@CunliangGeng CunliangGeng commented Jun 11, 2024

This PR tries to solve all type hints errors (mypy), formatting errors (ruff) and typos for refactored code. As for non-refactored code, we keep it as it is.

As for type hints, the changes follow the rules below:

  • use @overload for different data types of the same argument
  • use broader type hints Sequence and Mapping to replace list and dict, respectively, as much as possible
  • Use TYPE_CHECKING to only avoid circular imports

@CunliangGeng CunliangGeng requested a review from gcroci2 June 11, 2024 07:36
@CunliangGeng CunliangGeng marked this pull request as ready for review June 11, 2024 07:37
@CunliangGeng CunliangGeng self-assigned this Jun 11, 2024
@CunliangGeng
Copy link
Member Author

It's ready for review.

@CunliangGeng CunliangGeng force-pushed the refactor_NPLinker_methods branch from e9776df to ea42a68 Compare June 13, 2024 11:23
@CunliangGeng CunliangGeng force-pushed the fix_mypy_ruff_errors branch from b11ce5e to 7ed0c0a Compare June 13, 2024 11:23
Copy link
Contributor

@gcroci2 gcroci2 left a comment

Choose a reason for hiding this comment

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

In general, there are many lines touched by this PR where Mapping or Sequence are not used for type hints instead of dict and list. I started commenting on them, but since I realized they are quite a lot I wonder if there is a reason for this. Before I keep leaving many comments, better to know ;)

@CunliangGeng CunliangGeng force-pushed the refactor_NPLinker_methods branch from ea42a68 to e7f0420 Compare June 14, 2024 08:42
@CunliangGeng CunliangGeng force-pushed the fix_mypy_ruff_errors branch from 7ed0c0a to 36a474d Compare June 14, 2024 08:43
@CunliangGeng CunliangGeng mentioned this pull request Jun 14, 2024
src/nplinker/genomics/abc.py Outdated Show resolved Hide resolved
src/nplinker/metabolomics/abc.py Outdated Show resolved Hide resolved
src/nplinker/metabolomics/abc.py Outdated Show resolved Hide resolved
src/nplinker/metabolomics/abc.py Outdated Show resolved Hide resolved
Copy link
Member Author

CunliangGeng commented Jun 14, 2024

Merge activity

  • Jun 14, 7:27 AM EDT: @CunliangGeng started a stack merge that includes this pull request via Graphite.
  • Jun 14, 7:36 AM EDT: Graphite rebased this pull request as part of a merge.
  • Jun 14, 7:38 AM EDT: @CunliangGeng merged this pull request with Graphite.

@CunliangGeng CunliangGeng force-pushed the refactor_NPLinker_methods branch from e7f0420 to 155f7f8 Compare June 14, 2024 11:32
Base automatically changed from refactor_NPLinker_methods to dev June 14, 2024 11:34
This ensures that the type hints are available both during type checking and at runtime, improving code clarity and reducing the chance of runtime errors related to type hints.
use broader type hints Sequence and Mapping to replace list and dict, respectively
@CunliangGeng CunliangGeng force-pushed the fix_mypy_ruff_errors branch from 621635a to 4d54869 Compare June 14, 2024 11:35
@CunliangGeng CunliangGeng merged commit 6a6f170 into dev Jun 14, 2024
@CunliangGeng CunliangGeng deleted the fix_mypy_ruff_errors branch June 14, 2024 11:38
@sonarqubecloud
Copy link

This was referenced Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.