Skip to content

Commit

Permalink
Apply ruff autofixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Nov 28, 2023
1 parent 5a83f93 commit 4067d93
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 16 deletions.
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True


# -- autodoc customization
def strip_class_signature(app, what, name, obj, options, signature, return_annotation):
if what == "class":
Expand Down
3 changes: 2 additions & 1 deletion libcst/_nodes/tests/test_with.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,5 +331,6 @@ def test_adding_parens(self) -> None:
)
module = cst.Module([])
self.assertEqual(
module.code_for_node(node), ("with ( foo(),\n" "bar(), ): pass\n") # noqa
module.code_for_node(node),
("with ( foo(),\n" "bar(), ): pass\n"), # noqa
)
1 change: 0 additions & 1 deletion libcst/_typed_visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from libcst._removal_sentinel import RemovalSentinel
from libcst._typed_visitor_base import mark_no_op


if TYPE_CHECKING:
from libcst._nodes.expression import ( # noqa: F401
Annotation,
Expand Down
1 change: 0 additions & 1 deletion libcst/_typed_visitor_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from typing import Any, Callable, cast, TypeVar


# pyre-fixme[24]: Generic type `Callable` expects 2 type parameters.
F = TypeVar("F", bound=Callable)

Expand Down
2 changes: 1 addition & 1 deletion libcst/codegen/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

def format_file(fname: str) -> None:
subprocess.check_call(
["ufmt", "format", fname],
["ruff", "format", fname],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
Expand Down
1 change: 0 additions & 1 deletion libcst/codemod/commands/add_trailing_commas.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import libcst as cst
from libcst.codemod import CodemodContext, VisitorBasedCodemodCommand


presets_per_formatter: Dict[str, Dict[str, int]] = {
"black": {
"parameter_count": 1,
Expand Down
4 changes: 1 addition & 3 deletions libcst/codemod/visitors/_apply_type_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import libcst as cst
import libcst.matchers as m

from libcst.codemod._context import CodemodContext
from libcst.codemod._visitor import ContextAwareTransformer
from libcst.codemod.visitors._add_imports import AddImportsVisitor
Expand All @@ -19,7 +18,6 @@
from libcst.helpers import get_full_name_for_node
from libcst.metadata import PositionProvider, QualifiedNameProvider


NameOrAttribute = Union[cst.Name, cst.Attribute]
NAME_OR_ATTRIBUTE = (cst.Name, cst.Attribute)
# Union type for *args and **args
Expand Down Expand Up @@ -881,7 +879,7 @@ def _quote_future_annotations(self, annotation: cst.Annotation) -> cst.Annotatio
if (
isinstance(node, cst.Name)
and (node.value in self.global_names)
and not (node.value in self.visited_classes)
and node.value not in self.visited_classes
):
return annotation.with_changes(
annotation=cst.SimpleString(value=f'"{node.value}"')
Expand Down
1 change: 0 additions & 1 deletion libcst/matchers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import libcst as cst
from libcst.matchers._decorators import call_if_inside, call_if_not_inside, leave, visit

from libcst.matchers._matcher_base import (
AbstractBaseMatcherNodeMeta,
AllOf,
Expand Down
2 changes: 1 addition & 1 deletion libcst/matchers/_matcher_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ def _matches_zero_nodes(
MatchIfTrue[libcst.CSTNode],
_BaseMetadataMatcher,
DoNotCareSentinel,
]
],
) -> bool:
if isinstance(matcher, AtLeastN) and matcher.n == 0:
return True
Expand Down
2 changes: 0 additions & 2 deletions libcst/matchers/_return_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
Yield,
)
from libcst._nodes.module import Module

from libcst._nodes.op import (
Add,
AddAssign,
Expand Down Expand Up @@ -202,7 +201,6 @@
)
from libcst._removal_sentinel import RemovalSentinel


TYPED_FUNCTION_RETURN_MAPPING: TypingDict[Type[CSTNode], object] = {
Add: BaseBinaryOp,
AddAssign: BaseAugOp,
Expand Down
1 change: 0 additions & 1 deletion libcst/metadata/accessor_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import dataclasses

import libcst as cst

from libcst.metadata.base_provider import VisitorMetadataProvider


Expand Down
1 change: 0 additions & 1 deletion libcst/metadata/tests/test_accessor_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# LICENSE file in the root directory of this source tree.

import dataclasses

from textwrap import dedent

import libcst as cst
Expand Down
1 change: 0 additions & 1 deletion libcst/tests/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from libcst._parser.entrypoints import is_native


if __name__ == "__main__":
parser_type = "native" if is_native() else "pure"
print(f"running tests with {parser_type!r} parser")
Expand Down
1 change: 0 additions & 1 deletion libcst/tests/test_add_slots.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from typing import ClassVar

from libcst._add_slots import add_slots

from libcst.testing.utils import UnitTest


Expand Down

0 comments on commit 4067d93

Please sign in to comment.