Skip to content

Commit

Permalink
Merge extend-ignore and ignore values for flake8 (#6660)
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikmakait authored Jul 1, 2022
1 parent 0f77c0d commit 18a4642
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 27 deletions.
3 changes: 2 additions & 1 deletion distributed/comm/ucx.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def init_once():
try:
import rmm

device_array = lambda n: rmm.DeviceBuffer(size=n)
def device_array(n):
return rmm.DeviceBuffer(size=n)

if pool_size_str is not None:
pool_size = parse_bytes(pool_size_str)
Expand Down
3 changes: 1 addition & 2 deletions distributed/dashboard/components/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
from bokeh.plotting import figure
from bokeh.themes import Theme
from bokeh.transform import cumsum, factor_cmap, linear_cmap, stack
from jinja2 import Environment, FileSystemLoader
from tlz import curry, pipe, valmap
from tlz.curried import concat, groupby, map
from tornado import escape
Expand Down Expand Up @@ -89,8 +90,6 @@

logger = logging.getLogger(__name__)

from jinja2 import Environment, FileSystemLoader

env = Environment(
loader=FileSystemLoader(
os.path.join(os.path.dirname(__file__), "..", "..", "http", "templates")
Expand Down
4 changes: 1 addition & 3 deletions distributed/dashboard/components/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from bokeh.palettes import RdBu
from bokeh.plotting import figure
from bokeh.themes import Theme
from jinja2 import Environment, FileSystemLoader
from tlz import merge, partition_all

from dask.utils import format_bytes, format_time
Expand All @@ -35,9 +36,6 @@
from distributed.utils import log_errors

logger = logging.getLogger(__name__)

from jinja2 import Environment, FileSystemLoader

env = Environment(
loader=FileSystemLoader(
os.path.join(os.path.dirname(__file__), "..", "..", "http", "templates")
Expand Down
5 changes: 4 additions & 1 deletion distributed/protocol/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ def serialize_numpy_ndarray(x, context=None):
if x.dtype.hasobject or (x.dtype.flags & np.core.multiarray.LIST_PICKLE):
header = {"pickle": True}
frames = [None]
buffer_callback = lambda f: frames.append(memoryview(f))

def buffer_callback(f):
frames.append(memoryview(f))

frames[0] = pickle.dumps(
x,
buffer_callback=buffer_callback,
Expand Down
4 changes: 3 additions & 1 deletion distributed/tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,9 @@ def test_dumps_task():
d = dumps_task((inc, 1))
assert set(d) == {"function", "args"}

f = lambda x, y=2: x + y
def f(x, y=2):
return x + y

d = dumps_task((apply, f, (1,), {"y": 10}))
assert cloudpickle.loads(d["function"])(1, 2) == 3
assert cloudpickle.loads(d["args"]) == (1,)
Expand Down
20 changes: 10 additions & 10 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
from __future__ import annotations

from docutils.parsers.rst import directives

# -- Configuration to keep autosummary in sync with autoclass::members ----------------------------------------------
# Fixes issues/3693
# See https://stackoverflow.com/questions/20569011/python-sphinx-autosummary-automated-listing-of-member-functions
from sphinx.ext.autosummary import Autosummary, get_documenter
from sphinx.util.inspect import safe_getattr

import distributed

#
# Dask.distributed documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 6 14:42:44 2015.
Expand Down Expand Up @@ -65,7 +75,6 @@
# built documents.
#
# The short X.Y version.
import distributed

version = distributed.__version__
# The full version, including alpha/beta/rc tags.
Expand Down Expand Up @@ -428,15 +437,6 @@ def copy_legacy_redirects(app, docname):
f.write(page)


from docutils.parsers.rst import directives

# -- Configuration to keep autosummary in sync with autoclass::members ----------------------------------------------
# Fixes issues/3693
# See https://stackoverflow.com/questions/20569011/python-sphinx-autosummary-automated-listing-of-member-functions
from sphinx.ext.autosummary import Autosummary, get_documenter
from sphinx.util.inspect import safe_getattr


class AutoAutoSummary(Autosummary):
"""Create a summary for methods and attributes (autosummary).
Expand Down
20 changes: 11 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
# https://flake8.readthedocs.io/en/latest/user/configuration.html
# https://flake8.readthedocs.io/en/latest/user/error-codes.html

# Aligned with black https://github.com/psf/black/blob/main/.flake8
extend-ignore = E203, E266, E501
# Note: there cannot be spaces after commas here
exclude = __init__.py,versioneer.py,distributed/_concurrent_futures_thread.py
ignore =
E4, # Import formatting
E731, # Assigning lambda expression
W503, # line break before binary operator

# Ignores below are aligned with black https://github.com/psf/black/blob/main/.flake8
E203, # Whitespace before ':'
E266, # Too many leading '#' for block comment
E501, # Line too long
W503, # Line break occurred before a binary operator
per-file-ignores =
**/tests/*:
# local variable is assigned to but never used
F841,
# Ambiguous variable name
# Module level import not at top of file (to silence on pytest.importorskip)
# See https://github.com/PyCQA/pycodestyle/issues/472
E402,
# Do not use variables named 'I', 'O', or 'l'
E741,
# Local variable name is assigned to but never used
F841,

max-line-length = 88

Expand Down

0 comments on commit 18a4642

Please sign in to comment.