question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WPS345 and custom types

See original GitHub issue

What’s wrong

WPS345 should not be raised when custom types are involved. Code such as

my_custom_obj * 0

cannot be replaced by 0, and the object may not allow assigning 0 to it directly.

How it should be

These checks should only work for builtin types, and maybe a user-defined list of custom types (e.g. Numpy arrays).

Flake8 version and plugins

Irrelevant.

pip information

Irrelevant.

OS information

All OS.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vnmabuscommented, Mar 4, 2021

Yes, I guess that it is difficult to know the types in a flake8 plugin. I think that I can take a different approach, at least for my types, or simply ignore it with noqa as this pattern is not that common.

Feel free to close this issue if you want.

0reactions
sobolevncommented, Mar 4, 2021

Thanks a lot for the report! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Types - Eno
1. Parsing a document · 1.1. Providing the source · 1.2. Localized errors · 1.3. Error formats · 1.4. Cursor lookup ; 2....
Read more >
WPS3xx Consistency - flake8 error codes
We like our code to be consistent. It is easier to bare with your code base if you follow these rules. So, we...
Read more >
wemake-python-styleguide - Issuehunt
Forbid classes with too many public instance attributes ... False positive for `WPS345 Found meaningless number operation` ... WPS345 and custom types.
Read more >
WDA : Hydraulic Wiper Seals Manufacturers ... - Max Spare
Part No. ID OD THK Material Mould No. W130026201 2.00 9.00 4/5.2 FKM WPS‑4559 W13003L401 3.00 9.00 3/4 PU WPH‑2559 W130036601 3.00 9.00 4/5.50 FKM WPS‑2150...
Read more >
Python Data Types - AskPython
There are many pre-defined Python data types. We can create our own classes to define custom data types in Python. Python data type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found