Skip to content

Commit 597c5f9

Browse files
Update dependency black to v24 (#12728)
1 parent 69e1c56 commit 597c5f9

File tree

55 files changed

+292
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+292
-302
lines changed

crates/ruff_linter/src/rules/flake8_annotations/rules/definition.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ use crate::rules::ruff::typing::type_hint_resolves_to_any;
2424
/// any provided arguments match expectation.
2525
///
2626
/// ## Example
27+
///
2728
/// ```python
28-
/// def foo(x):
29-
/// ...
29+
/// def foo(x): ...
3030
/// ```
3131
///
3232
/// Use instead:
33+
///
3334
/// ```python
34-
/// def foo(x: int):
35-
/// ...
35+
/// def foo(x: int): ...
3636
/// ```
3737
#[violation]
3838
pub struct MissingTypeFunctionArgument {
@@ -56,15 +56,15 @@ impl Violation for MissingTypeFunctionArgument {
5656
/// any provided arguments match expectation.
5757
///
5858
/// ## Example
59+
///
5960
/// ```python
60-
/// def foo(*args):
61-
/// ...
61+
/// def foo(*args): ...
6262
/// ```
6363
///
6464
/// Use instead:
65+
///
6566
/// ```python
66-
/// def foo(*args: int):
67-
/// ...
67+
/// def foo(*args: int): ...
6868
/// ```
6969
#[violation]
7070
pub struct MissingTypeArgs {
@@ -88,15 +88,15 @@ impl Violation for MissingTypeArgs {
8888
/// any provided arguments match expectation.
8989
///
9090
/// ## Example
91+
///
9192
/// ```python
92-
/// def foo(**kwargs):
93-
/// ...
93+
/// def foo(**kwargs): ...
9494
/// ```
9595
///
9696
/// Use instead:
97+
///
9798
/// ```python
98-
/// def foo(**kwargs: int):
99-
/// ...
99+
/// def foo(**kwargs: int): ...
100100
/// ```
101101
#[violation]
102102
pub struct MissingTypeKwargs {
@@ -127,17 +127,17 @@ impl Violation for MissingTypeKwargs {
127127
/// annotation is not strictly necessary.
128128
///
129129
/// ## Example
130+
///
130131
/// ```python
131132
/// class Foo:
132-
/// def bar(self):
133-
/// ...
133+
/// def bar(self): ...
134134
/// ```
135135
///
136136
/// Use instead:
137+
///
137138
/// ```python
138139
/// class Foo:
139-
/// def bar(self: "Foo"):
140-
/// ...
140+
/// def bar(self: "Foo"): ...
141141
/// ```
142142
#[violation]
143143
pub struct MissingTypeSelf {
@@ -168,19 +168,19 @@ impl Violation for MissingTypeSelf {
168168
/// annotation is not strictly necessary.
169169
///
170170
/// ## Example
171+
///
171172
/// ```python
172173
/// class Foo:
173174
/// @classmethod
174-
/// def bar(cls):
175-
/// ...
175+
/// def bar(cls): ...
176176
/// ```
177177
///
178178
/// Use instead:
179+
///
179180
/// ```python
180181
/// class Foo:
181182
/// @classmethod
182-
/// def bar(cls: Type["Foo"]):
183-
/// ...
183+
/// def bar(cls: Type["Foo"]): ...
184184
/// ```
185185
#[violation]
186186
pub struct MissingTypeCls {
@@ -449,29 +449,29 @@ impl Violation for MissingReturnTypeClassMethod {
449449
/// `Any` as an "escape hatch" only when it is really needed.
450450
///
451451
/// ## Example
452+
///
452453
/// ```python
453-
/// def foo(x: Any):
454-
/// ...
454+
/// def foo(x: Any): ...
455455
/// ```
456456
///
457457
/// Use instead:
458+
///
458459
/// ```python
459-
/// def foo(x: int):
460-
/// ...
460+
/// def foo(x: int): ...
461461
/// ```
462462
///
463463
/// ## Known problems
464464
///
465465
/// Type aliases are unsupported and can lead to false positives.
466466
/// For example, the following will trigger this rule inadvertently:
467+
///
467468
/// ```python
468469
/// from typing import Any
469470
///
470471
/// MyAny = Any
471472
///
472473
///
473-
/// def foo(x: MyAny):
474-
/// ...
474+
/// def foo(x: MyAny): ...
475475
/// ```
476476
///
477477
/// ## References

crates/ruff_linter/src/rules/flake8_async/rules/async_function_with_timeout.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ use crate::settings::types::PreviewMode;
1717
/// or `anyio.move_on_after`, among others.
1818
///
1919
/// ## Example
20+
///
2021
/// ```python
21-
/// async def long_running_task(timeout):
22-
/// ...
22+
/// async def long_running_task(timeout): ...
2323
///
2424
///
2525
/// async def main():
2626
/// await long_running_task(timeout=2)
2727
/// ```
2828
///
2929
/// Use instead:
30+
///
3031
/// ```python
31-
/// async def long_running_task():
32-
/// ...
32+
/// async def long_running_task(): ...
3333
///
3434
///
3535
/// async def main():

crates/ruff_linter/src/rules/flake8_bandit/rules/hardcoded_password_default.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ use super::super::helpers::{matches_password_name, string_literal};
2222
/// control.
2323
///
2424
/// ## Example
25+
///
2526
/// ```python
26-
/// def connect_to_server(password="hunter2"):
27-
/// ...
27+
/// def connect_to_server(password="hunter2"): ...
2828
/// ```
2929
///
3030
/// Use instead:
31+
///
3132
/// ```python
3233
/// import os
3334
///
3435
///
35-
/// def connect_to_server(password=os.environ["PASSWORD"]):
36-
/// ...
36+
/// def connect_to_server(password=os.environ["PASSWORD"]): ...
3737
/// ```
3838
///
3939
/// ## References

crates/ruff_linter/src/rules/flake8_bandit/rules/ssl_with_bad_defaults.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ use crate::checkers::ast::Checker;
1818
/// - TLS v1.1
1919
///
2020
/// ## Example
21+
///
2122
/// ```python
2223
/// import ssl
2324
///
2425
///
25-
/// def func(version=ssl.PROTOCOL_TLSv1):
26-
/// ...
26+
/// def func(version=ssl.PROTOCOL_TLSv1): ...
2727
/// ```
2828
///
2929
/// Use instead:
30+
///
3031
/// ```python
3132
/// import ssl
3233
///
3334
///
34-
/// def func(version=ssl.PROTOCOL_TLSv1_2):
35-
/// ...
35+
/// def func(version=ssl.PROTOCOL_TLSv1_2): ...
3636
/// ```
3737
#[violation]
3838
pub struct SslWithBadDefaults {

crates/ruff_linter/src/rules/flake8_boolean_trap/rules/boolean_positional_value_in_call.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ use crate::rules::flake8_boolean_trap::helpers::allow_boolean_trap;
1818
/// readers of the code.
1919
///
2020
/// ## Example
21+
///
2122
/// ```python
22-
/// def func(flag: bool) -> None:
23-
/// ...
23+
/// def func(flag: bool) -> None: ...
2424
///
2525
///
2626
/// func(True)
2727
/// ```
2828
///
2929
/// Use instead:
30+
///
3031
/// ```python
31-
/// def func(flag: bool) -> None:
32-
/// ...
32+
/// def func(flag: bool) -> None: ...
3333
///
3434
///
3535
/// func(flag=True)

crates/ruff_linter/src/rules/flake8_boolean_trap/rules/boolean_type_hint_positional_argument.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use crate::rules::flake8_boolean_trap::helpers::is_allowed_func_def;
3131
/// variants, like `bool | int`.
3232
///
3333
/// ## Example
34+
///
3435
/// ```python
3536
/// from math import ceil, floor
3637
///
@@ -44,6 +45,7 @@ use crate::rules::flake8_boolean_trap::helpers::is_allowed_func_def;
4445
/// ```
4546
///
4647
/// Instead, refactor into separate implementations:
48+
///
4749
/// ```python
4850
/// from math import ceil, floor
4951
///
@@ -61,6 +63,7 @@ use crate::rules::flake8_boolean_trap::helpers::is_allowed_func_def;
6163
/// ```
6264
///
6365
/// Or, refactor to use an `Enum`:
66+
///
6467
/// ```python
6568
/// from enum import Enum
6669
///
@@ -70,11 +73,11 @@ use crate::rules::flake8_boolean_trap::helpers::is_allowed_func_def;
7073
/// DOWN = 2
7174
///
7275
///
73-
/// def round_number(value: float, method: RoundingMethod) -> float:
74-
/// ...
76+
/// def round_number(value: float, method: RoundingMethod) -> float: ...
7577
/// ```
7678
///
7779
/// Or, make the argument a keyword-only argument:
80+
///
7881
/// ```python
7982
/// from math import ceil, floor
8083
///

crates/ruff_linter/src/rules/flake8_bugbear/rules/abstract_base_class.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,24 @@ impl Violation for AbstractBaseClassWithoutAbstractMethod {
6767
/// `@abstractmethod` decorator to the method.
6868
///
6969
/// ## Example
70+
///
7071
/// ```python
7172
/// from abc import ABC
7273
///
7374
///
7475
/// class Foo(ABC):
75-
/// def method(self):
76-
/// ...
76+
/// def method(self): ...
7777
/// ```
7878
///
7979
/// Use instead:
80+
///
8081
/// ```python
8182
/// from abc import ABC, abstractmethod
8283
///
8384
///
8485
/// class Foo(ABC):
8586
/// @abstractmethod
86-
/// def method(self):
87-
/// ...
87+
/// def method(self): ...
8888
/// ```
8989
///
9090
/// ## References

crates/ruff_linter/src/rules/flake8_bugbear/rules/function_call_in_argument_default.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use crate::checkers::ast::Checker;
3030
/// [`lint.flake8-bugbear.extend-immutable-calls`] configuration option as well.
3131
///
3232
/// ## Example
33+
///
3334
/// ```python
3435
/// def create_list() -> list[int]:
3536
/// return [1, 2, 3]
@@ -41,6 +42,7 @@ use crate::checkers::ast::Checker;
4142
/// ```
4243
///
4344
/// Use instead:
45+
///
4446
/// ```python
4547
/// def better(arg: list[int] | None = None) -> list[int]:
4648
/// if arg is None:
@@ -52,12 +54,12 @@ use crate::checkers::ast::Checker;
5254
///
5355
/// If the use of a singleton is intentional, assign the result call to a
5456
/// module-level variable, and use that variable in the default argument:
57+
///
5558
/// ```python
5659
/// ERROR = ValueError("Hosts weren't successfully added")
5760
///
5861
///
59-
/// def add_host(error: Exception = ERROR) -> None:
60-
/// ...
62+
/// def add_host(error: Exception = ERROR) -> None: ...
6163
/// ```
6264
///
6365
/// ## Options

crates/ruff_linter/src/rules/flake8_future_annotations/rules/future_required_type_annotation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ use crate::checkers::ast::Checker;
2929
/// flag such usages if your project targets Python 3.9 or below.
3030
///
3131
/// ## Example
32+
///
3233
/// ```python
33-
/// def func(obj: dict[str, int | None]) -> None:
34-
/// ...
34+
/// def func(obj: dict[str, int | None]) -> None: ...
3535
/// ```
3636
///
3737
/// Use instead:
38+
///
3839
/// ```python
3940
/// from __future__ import annotations
4041
///
4142
///
42-
/// def func(obj: dict[str, int | None]) -> None:
43-
/// ...
43+
/// def func(obj: dict[str, int | None]) -> None: ...
4444
/// ```
4545
///
4646
/// ## Fix safety

crates/ruff_linter/src/rules/flake8_future_annotations/rules/future_rewritable_type_annotation.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,32 @@ use crate::checkers::ast::Checker;
3333
/// flag such usages if your project targets Python 3.9 or below.
3434
///
3535
/// ## Example
36+
///
3637
/// ```python
3738
/// from typing import List, Dict, Optional
3839
///
3940
///
40-
/// def func(obj: Dict[str, Optional[int]]) -> None:
41-
/// ...
41+
/// def func(obj: Dict[str, Optional[int]]) -> None: ...
4242
/// ```
4343
///
4444
/// Use instead:
45+
///
4546
/// ```python
4647
/// from __future__ import annotations
4748
///
4849
/// from typing import List, Dict, Optional
4950
///
5051
///
51-
/// def func(obj: Dict[str, Optional[int]]) -> None:
52-
/// ...
52+
/// def func(obj: Dict[str, Optional[int]]) -> None: ...
5353
/// ```
5454
///
5555
/// After running the additional pyupgrade rules:
56+
///
5657
/// ```python
5758
/// from __future__ import annotations
5859
///
5960
///
60-
/// def func(obj: dict[str, int | None]) -> None:
61-
/// ...
61+
/// def func(obj: dict[str, int | None]) -> None: ...
6262
/// ```
6363
///
6464
/// ## Options

0 commit comments

Comments
 (0)