Skip to content

Commit

Permalink
Accomodate new black version
Browse files Browse the repository at this point in the history
Black v24.1 now puts ellipses on the same line as function definitions
in some cases, causing flake8 to emit E704. In formatting issues where
black and flake8 disagree, we side with black.

Black also does this for class definitions. There are two places in the
code base where we use `...` as the body of a class, and both are used
to mean "do nothing," as opposed to "fill this in later (ie, when
overriding)." The `pass` keyword is considered more idiomatic in no-op
situations, so that was chosen here instead of ignoring E701.
  • Loading branch information
chris-janidlo committed Feb 5, 2024
1 parent 6139912 commit bc400e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ exclude = .git,.tox,__pycache__,dist,venv,.venv*
# we enforce 80 char width with `black` "loosely", so flake8 should be set to
# not fail on up to 88 chars of width
max-line-length = 88
ignore = W503,W504,E203
ignore = W503, W504, E203, B008, E704

[flake8:local-plugins]
extension =
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/test_messagepack.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@ def test_unknown_envelope_fields_warn(caplog):
def test_meta_decorator():
# case 1: no defined internal Meta (inherited from Message)
@meta(foo=1, bar=2)
class MyMessage(Message): ...
class MyMessage(Message):
pass

assert MyMessage.Meta.foo == 1
assert MyMessage.Meta.bar == 2
Expand All @@ -589,7 +590,8 @@ class Meta:

# case 3: inherited internal Meta from non-Message class
@meta(message_type="foo")
class MyMessage3(MyMessage2): ...
class MyMessage3(MyMessage2):
pass

assert MyMessage3.Meta.foo == 1
assert MyMessage3.Meta.bar == 3
Expand Down

0 comments on commit bc400e0

Please sign in to comment.