mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 15:01:08 +00:00
Replace flake8 with ruff (#8184)
This commit is contained in:
parent
c96241b5a5
commit
521fbca61c
|
@ -81,11 +81,11 @@ We want your work to be readable by others; therefore, we encourage you to note
|
|||
black .
|
||||
```
|
||||
|
||||
- All submissions will need to pass the test `flake8 . --ignore=E203,W503 --max-line-length=88` before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.
|
||||
- All submissions will need to pass the test `ruff .` before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.
|
||||
|
||||
```bash
|
||||
python3 -m pip install flake8 # only required the first time
|
||||
flake8 . --ignore=E203,W503 --max-line-length=88 --show-source
|
||||
python3 -m pip install ruff # only required the first time
|
||||
ruff .
|
||||
```
|
||||
|
||||
- Original code submission require docstrings or comments to describe your work.
|
||||
|
|
|
@ -20,7 +20,7 @@ class EqualLoudnessFilter:
|
|||
samplerate, use with caution.
|
||||
|
||||
Code based on matlab implementation at https://bit.ly/3eqh2HU
|
||||
(url shortened for flake8)
|
||||
(url shortened for ruff)
|
||||
|
||||
Target curve: https://i.imgur.com/3g2VfaM.png
|
||||
Yulewalk response: https://i.imgur.com/J9LnJ4C.png
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
python/black : true
|
||||
flake8 : passed
|
||||
psf/black : true
|
||||
ruff : passed
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ Changing contrast with PIL
|
|||
This algorithm is used in
|
||||
https://noivce.pythonanywhere.com/ Python web app.
|
||||
|
||||
python/black: True
|
||||
flake8 : True
|
||||
psf/black: True
|
||||
ruff : True
|
||||
"""
|
||||
|
||||
from PIL import Image
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
References: wikipedia:square free number
|
||||
python/black : True
|
||||
flake8 : True
|
||||
psf/black : True
|
||||
ruff : True
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""
|
||||
References: https://en.wikipedia.org/wiki/M%C3%B6bius_function
|
||||
References: wikipedia:square free number
|
||||
python/black : True
|
||||
flake8 : True
|
||||
psf/black : True
|
||||
ruff : True
|
||||
"""
|
||||
|
||||
from maths.is_square_free import is_square_free
|
||||
|
|
|
@ -9,10 +9,10 @@ class LinearCongruentialGenerator:
|
|||
"""
|
||||
|
||||
# The default value for **seed** is the result of a function call which is not
|
||||
# normally recommended and causes flake8-bugbear to raise a B008 error. However,
|
||||
# in this case, it is accptable because `LinearCongruentialGenerator.__init__()`
|
||||
# will only be called once per instance and it ensures that each instance will
|
||||
# generate a unique sequence of numbers.
|
||||
# normally recommended and causes ruff to raise a B008 error. However, in this case,
|
||||
# it is accptable because `LinearCongruentialGenerator.__init__()` will only be
|
||||
# called once per instance and it ensures that each instance will generate a unique
|
||||
# sequence of numbers.
|
||||
|
||||
def __init__(self, multiplier, increment, modulo, seed=int(time())): # noqa: B008
|
||||
"""
|
||||
|
|
|
@ -56,6 +56,7 @@ select = [ # https://beta.ruff.rs/docs/rules
|
|||
"W", # W: pycodestyle warnings
|
||||
"YTT", # YTT: year 2020
|
||||
]
|
||||
show-source = true
|
||||
target-version = "py311"
|
||||
|
||||
[tool.ruff.mccabe] # DO NOT INCREASE THIS VALUE
|
||||
|
|
|
@ -54,9 +54,9 @@ def full_adder(
|
|||
|
||||
|
||||
# The default value for **backend** is the result of a function call which is not
|
||||
# normally recommended and causes flake8-bugbear to raise a B008 error. However,
|
||||
# in this case, this is acceptable because `Aer.get_backend()` is called when the
|
||||
# function is defined and that same backend is then reused for all function calls.
|
||||
# normally recommended and causes ruff to raise a B008 error. However, in this case,
|
||||
# this is acceptable because `Aer.get_backend()` is called when the function is defined
|
||||
# and that same backend is then reused for all function calls.
|
||||
|
||||
|
||||
def ripple_adder(
|
||||
|
|
Loading…
Reference in New Issue
Block a user