flake8-assert-finder
A simple flake8 Plugin that checks if assert is used
The assert Keyword is very useful in Python, but has one big problem: Python has a optimized mode. When using this, The assert Keyword will no longer work, so if you use assert in a Library, this can lead to Problems.
You should replace assert with this little function:
def assert_func(expression: bool) -> None:
"""
The assert keyword is not available when running Python in optimized mode.
This function is a drop-in replacement.
See https://docs.python.org/3/using/cmdline.html?highlight=pythonoptimize#cmdoption-O
"""
if not expression:
raise AssertionError()
This makes sure, your will be working.
If you just write your own Program, which you don't use with the optimized mode or if you use something like pytest, you can use assert of course.
This Plugin just checks for the use of the assert Keyword. Nothing more.
List of warnings:
| ID | Description |
|---|---|
| AF100 | Found assert |
Metadata
Release files for flake8-assert-finder 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| flake8-assert-finder-1.0.tar.gz | 3.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_assert_finder-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / flake8-assert-finder-1.0.tar.gz
| Download URL | flake8-assert-finder-1.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c135794b770a0fcf0d6a90d733cd8c6695d1f9a9e2553d71f40cda5935b2cc0a
|
|
BLAKE2b-256 checksum How to use checksums |
c1982e16ff90f4904b35ef1c3937610ff1059a94f07a19cc252e1b7194240c59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / flake8_assert_finder-1.0-py3-none-any.whl
| Download URL | flake8_assert_finder-1.0-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e454410b10ed587187656f42bde43118b9ce318ff22c9623736be1bc8520350d
|
|
BLAKE2b-256 checksum How to use checksums |
cf977420ad427911029cb1b5dc5c6da162ebb7b7e864f4018f650bbc6aa98b1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for flake8-assert-finder 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.