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

Incorrect scenario of unidiomatic-typecheck #10161 #10170

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nedelcu-ioan
Copy link
Contributor

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Closes #10161

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

All modified and coverable lines are covered by tests βœ…

Project coverage is 95.83%. Comparing base (6456374) to head (226c110).
Report is 10 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #10170      +/-   ##
==========================================
- Coverage   95.83%   95.83%   -0.01%     
==========================================
  Files         174      174              
  Lines       18995    18993       -2     
==========================================
- Hits        18204    18202       -2     
  Misses        791      791              
Files with missing lines Coverage Ξ”
pylint/checkers/base/comparison_checker.py 100.00% <100.00%> (ΓΈ)

Copy link
Contributor

github-actions bot commented Jan 7, 2025

πŸ€– Effect of this PR on checked open source code: πŸ€–

Effect on pandas:
The following messages are no longer emitted:

  1. unidiomatic-typecheck:
    Use isinstance() rather than type() for a typecheck.
    https://github.com/pandas-dev/pandas/blob/315b54908bd0dc8a7bc913a38fb22f03377eb6eb/pandas/core/arrays/interval.py#L337
  2. unidiomatic-typecheck:
    Use isinstance() rather than type() for a typecheck.
    https://github.com/pandas-dev/pandas/blob/315b54908bd0dc8a7bc913a38fb22f03377eb6eb/pandas/core/arrays/interval.py#L992
  3. unidiomatic-typecheck:
    Use isinstance() rather than type() for a typecheck.
    https://github.com/pandas-dev/pandas/blob/315b54908bd0dc8a7bc913a38fb22f03377eb6eb/pandas/core/arrays/base.py#L1510
  4. unidiomatic-typecheck:
    Use isinstance() rather than type() for a typecheck.
    https://github.com/pandas-dev/pandas/blob/315b54908bd0dc8a7bc913a38fb22f03377eb6eb/pandas/core/arrays/masked.py#L1112
  5. unidiomatic-typecheck:
    Use isinstance() rather than type() for a typecheck.
    https://github.com/pandas-dev/pandas/blob/315b54908bd0dc8a7bc913a38fb22f03377eb6eb/pandas/core/arrays/arrow/extension_types.py#L43
  6. unidiomatic-typecheck:
    Use isinstance() rather than type() for a typecheck.
    https://github.com/pandas-dev/pandas/blob/315b54908bd0dc8a7bc913a38fb22f03377eb6eb/pandas/core/arrays/arrow/extension_types.py#L97
  7. unidiomatic-typecheck:
    Use isinstance() rather than type() for a typecheck.
    https://github.com/pandas-dev/pandas/blob/315b54908bd0dc8a7bc913a38fb22f03377eb6eb/pandas/core/indexes/base.py#L5538

This comment was generated for commit 226c110

type(a) is not type({})
type(a) is type("")
type(a) is not type("")
type(a) == type([])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't the issue say that we don't want to suggest this but only exclude the is and is not comparisons?

@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code backport maintenance/3.3.x labels Jan 25, 2025
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 3.3.4, 3.3.5 Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport maintenance/3.3.x False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

incorrect scenario of unidiomatic-typecheck
3 participants