Skip to content

Commit

Permalink
Bump black from 23.12.1 to 24.2.0 (#430)
Browse files Browse the repository at this point in the history
* Bump black from 23.12.1 to 24.2.0

Bumps [black](https://github.com/psf/black) from 23.12.1 to 24.2.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@23.12.1...24.2.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update formatting

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Amethyst Reese <[email protected]>
  • Loading branch information
dependabot[bot] and amyreese authored Mar 5, 2024
1 parent 8f51bbc commit 98e437c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ docs = [
]
dev = [
"attribution == 1.6.2",
"black == 23.12.1",
"black == 24.2.0",
"flake8 == 7.0.0",
"flake8-bugbear == 24.2.6",
"mypy == 1.8.0",
Expand Down
18 changes: 10 additions & 8 deletions src/fixit/rules/compare_primitives_by_equal.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,16 @@ def replace_operators(self, node: cst.Comparison) -> cst.Comparison:
comparator, self.PRIMITIVES
):
target = target.with_changes(
operator=cst.Equal(
whitespace_before=op.whitespace_before,
whitespace_after=op.whitespace_after,
)
if isinstance(op, cst.Is)
else cst.NotEqual(
whitespace_before=op.whitespace_before,
whitespace_after=op.whitespace_after,
operator=(
cst.Equal(
whitespace_before=op.whitespace_before,
whitespace_after=op.whitespace_after,
)
if isinstance(op, cst.Is)
else cst.NotEqual(
whitespace_before=op.whitespace_before,
whitespace_after=op.whitespace_after,
)
)
)
comparisons.append(target)
Expand Down
4 changes: 3 additions & 1 deletion src/fixit/rules/no_namedtuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class NoNamedTuple(LintRule):
``@dataclass`` is faster at reading an object's nested properties and executing its methods. (`benchmark <https://medium.com/@jacktator/dataclass-vs-namedtuple-vs-object-for-performance-optimization-in-python-691e234253b9>`_)
"""

MESSAGE: str = "Instead of NamedTuple, consider using the @dataclass decorator from dataclasses instead for simplicity, efficiency and consistency."
MESSAGE: str = (
"Instead of NamedTuple, consider using the @dataclass decorator from dataclasses instead for simplicity, efficiency and consistency."
)
METADATA_DEPENDENCIES = (QualifiedNameProvider,)

VALID = [
Expand Down
8 changes: 5 additions & 3 deletions src/fixit/rules/rewrite_to_literal.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ def visit_Call(self, node: cst.Call) -> None:
)(
cst.ensure_type(
ele.value,
cst.Tuple # type: ignore
if isinstance(ele.value, cst.Tuple)
else cst.List,
(
cst.Tuple # type: ignore
if isinstance(ele.value, cst.Tuple)
else cst.List
),
)
)
for ele in elements
Expand Down
12 changes: 8 additions & 4 deletions src/fixit/rules/sorted_attributes_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class MyUnsortedConstants:
"""
)
]
MESSAGE: str = "It appears you are using the @sorted-attributes directive and the class variables are unsorted. See the lint autofix suggestion."
MESSAGE: str = (
"It appears you are using the @sorted-attributes directive and the class variables are unsorted. See the lint autofix suggestion."
)

def visit_ClassDef(self, node: cst.ClassDef) -> None:
doc_string = node.get_docstring()
Expand All @@ -86,9 +88,11 @@ def visit_ClassDef(self, node: cst.ClassDef) -> None:
post_assign_lines: List[LineType] = []

def _add_unmatched_line(line: LineType) -> None:
post_assign_lines.append(
line
) if found_any_assign else pre_assign_lines.append(line)
(
post_assign_lines.append(line)
if found_any_assign
else pre_assign_lines.append(line)
)

for line in node.body.body:
if m.matches(
Expand Down

0 comments on commit 98e437c

Please sign in to comment.