mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:35 +00:00
Fix typos found by codespell (#14863)
## Summary Just fix typos. ## Test Plan CI tests. --------- Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
3d9ac535e9
commit
59145098d6
34 changed files with 58 additions and 58 deletions
|
@ -50,7 +50,7 @@ reveal_type(b) # revealed: tuple[int]
|
||||||
reveal_type(c) # revealed: tuple[str, int]
|
reveal_type(c) # revealed: tuple[str, int]
|
||||||
reveal_type(d) # revealed: tuple[tuple[str, str], tuple[int, int]]
|
reveal_type(d) # revealed: tuple[tuple[str, str], tuple[int, int]]
|
||||||
|
|
||||||
# TODO: homogenous tuples, PEP-646 tuples
|
# TODO: homogeneous tuples, PEP-646 tuples
|
||||||
reveal_type(e) # revealed: @Todo(full tuple[...] support)
|
reveal_type(e) # revealed: @Todo(full tuple[...] support)
|
||||||
reveal_type(f) # revealed: @Todo(full tuple[...] support)
|
reveal_type(f) # revealed: @Todo(full tuple[...] support)
|
||||||
reveal_type(g) # revealed: @Todo(full tuple[...] support)
|
reveal_type(g) # revealed: @Todo(full tuple[...] support)
|
||||||
|
|
|
@ -22,7 +22,7 @@ reveal_type(sys.version_info[:2] == (3, 10)) # revealed: Literal[True]
|
||||||
|
|
||||||
### Grandchild
|
### Grandchild
|
||||||
|
|
||||||
The same should work for arbitrarly nested sections:
|
The same should work for arbitrarily nested sections:
|
||||||
|
|
||||||
```py
|
```py
|
||||||
reveal_type(sys.version_info[:2] == (3, 10)) # revealed: Literal[True]
|
reveal_type(sys.version_info[:2] == (3, 10)) # revealed: Literal[True]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Class defenitions in stubs
|
# Class definitions in stubs
|
||||||
|
|
||||||
## Cyclical class definition
|
## Cyclical class definition
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl SyncNotificationHandler for DidChangeTextDocumentHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dhruvmanila): Publish diagnostics if the client doesnt support pull diagnostics
|
// TODO(dhruvmanila): Publish diagnostics if the client doesn't support pull diagnostics
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -694,7 +694,7 @@ mod tests {
|
||||||
/// Folders that match the members pattern but don't have a pyproject.toml
|
/// Folders that match the members pattern but don't have a pyproject.toml
|
||||||
/// aren't valid members and discovery fails. However, don't fail
|
/// aren't valid members and discovery fails. However, don't fail
|
||||||
/// if the folder name indicates that it is a hidden folder that might
|
/// if the folder name indicates that it is a hidden folder that might
|
||||||
/// have been crated by another tool
|
/// have been created by another tool
|
||||||
#[test]
|
#[test]
|
||||||
fn member_pattern_matching_hidden_folder() -> anyhow::Result<()> {
|
fn member_pattern_matching_hidden_folder() -> anyhow::Result<()> {
|
||||||
let system = TestSystem::default();
|
let system = TestSystem::default();
|
||||||
|
|
|
@ -151,6 +151,6 @@ PRESELECT *
|
||||||
FROM {var}.table
|
FROM {var}.table
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# to be handled seperately
|
# to be handled separately
|
||||||
# query58 = f"SELECT\
|
# query58 = f"SELECT\
|
||||||
# * FROM {var}.table"
|
# * FROM {var}.table"
|
||||||
|
|
|
@ -178,7 +178,7 @@ def foo(x: int) -> int | None:
|
||||||
"""A very helpful docstring.
|
"""A very helpful docstring.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
x (int): An interger.
|
x (int): An integer.
|
||||||
"""
|
"""
|
||||||
if x < 0:
|
if x < 0:
|
||||||
return None
|
return None
|
||||||
|
@ -191,7 +191,7 @@ def foo(x):
|
||||||
"""A very helpful docstring.
|
"""A very helpful docstring.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
x (int): An interger.
|
x (int): An integer.
|
||||||
"""
|
"""
|
||||||
if x < 0:
|
if x < 0:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -154,7 +154,7 @@ def foo(x: int) -> int | None:
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
x : int
|
x : int
|
||||||
An interger.
|
An integer.
|
||||||
"""
|
"""
|
||||||
if x < 0:
|
if x < 0:
|
||||||
return None
|
return None
|
||||||
|
@ -169,7 +169,7 @@ def foo(x):
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
x : int
|
x : int
|
||||||
An interger.
|
An integer.
|
||||||
"""
|
"""
|
||||||
if x < 0:
|
if x < 0:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -12,7 +12,7 @@ t.Literal[1, t.Literal[2, t.Literal[1]]]
|
||||||
Literal[
|
Literal[
|
||||||
1, # comment 1
|
1, # comment 1
|
||||||
Literal[ # another comment
|
Literal[ # another comment
|
||||||
1 # yet annother comment
|
1 # yet another comment
|
||||||
]
|
]
|
||||||
] # once
|
] # once
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ t.Literal[1, t.Literal[2, t.Literal[1]]]
|
||||||
Literal[
|
Literal[
|
||||||
1, # comment 1
|
1, # comment 1
|
||||||
Literal[ # another comment
|
Literal[ # another comment
|
||||||
1 # yet annother comment
|
1 # yet another comment
|
||||||
]
|
]
|
||||||
] # once
|
] # once
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ fn generate_pep604_fix(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generate a [`Fix`] for two or more type expresisons, e.g. `typing.Union[int, float, complex]`.
|
/// Generate a [`Fix`] for two or more type expressions, e.g. `typing.Union[int, float, complex]`.
|
||||||
fn generate_union_fix(
|
fn generate_union_fix(
|
||||||
checker: &Checker,
|
checker: &Checker,
|
||||||
nodes: Vec<&Expr>,
|
nodes: Vec<&Expr>,
|
||||||
|
|
|
@ -259,7 +259,7 @@ fn generate_pep604_fix(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generate a [`Fix`] for two or more type expresisons, e.g. `typing.Union[int, float, complex]`.
|
/// Generate a [`Fix`] for two or more type expressions, e.g. `typing.Union[int, float, complex]`.
|
||||||
fn generate_union_fix(
|
fn generate_union_fix(
|
||||||
checker: &Checker,
|
checker: &Checker,
|
||||||
nodes: Vec<&Expr>,
|
nodes: Vec<&Expr>,
|
||||||
|
|
|
@ -150,7 +150,7 @@ pub(crate) fn unnecessary_type_union<'a>(checker: &mut Checker, union: &'a Expr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UnionKind::TypingUnion => {
|
UnionKind::TypingUnion => {
|
||||||
// When subscript is None, it uses the pervious match case.
|
// When subscript is None, it uses the previous match case.
|
||||||
let subscript = subscript.unwrap();
|
let subscript = subscript.unwrap();
|
||||||
let types = &Expr::Subscript(ast::ExprSubscript {
|
let types = &Expr::Subscript(ast::ExprSubscript {
|
||||||
value: Box::new(Expr::Name(ast::ExprName {
|
value: Box::new(Expr::Name(ast::ExprName {
|
||||||
|
|
|
@ -62,7 +62,7 @@ DOC201_google.py:178:5: DOC201 `return` is not documented in docstring
|
||||||
| _____^
|
| _____^
|
||||||
179 | |
|
179 | |
|
||||||
180 | | Args:
|
180 | | Args:
|
||||||
181 | | x (int): An interger.
|
181 | | x (int): An integer.
|
||||||
182 | | """
|
182 | | """
|
||||||
| |_______^ DOC201
|
| |_______^ DOC201
|
||||||
183 | if x < 0:
|
183 | if x < 0:
|
||||||
|
@ -78,7 +78,7 @@ DOC201_google.py:191:5: DOC201 `return` is not documented in docstring
|
||||||
| _____^
|
| _____^
|
||||||
192 | |
|
192 | |
|
||||||
193 | | Args:
|
193 | | Args:
|
||||||
194 | | x (int): An interger.
|
194 | | x (int): An integer.
|
||||||
195 | | """
|
195 | | """
|
||||||
| |_______^ DOC201
|
| |_______^ DOC201
|
||||||
196 | if x < 0:
|
196 | if x < 0:
|
||||||
|
|
|
@ -58,7 +58,7 @@ DOC201_numpy.py:152:5: DOC201 `return` is not documented in docstring
|
||||||
154 | | Parameters
|
154 | | Parameters
|
||||||
155 | | ----------
|
155 | | ----------
|
||||||
156 | | x : int
|
156 | | x : int
|
||||||
157 | | An interger.
|
157 | | An integer.
|
||||||
158 | | """
|
158 | | """
|
||||||
| |_______^ DOC201
|
| |_______^ DOC201
|
||||||
159 | if x < 0:
|
159 | if x < 0:
|
||||||
|
@ -76,7 +76,7 @@ DOC201_numpy.py:167:5: DOC201 `return` is not documented in docstring
|
||||||
169 | | Parameters
|
169 | | Parameters
|
||||||
170 | | ----------
|
170 | | ----------
|
||||||
171 | | x : int
|
171 | | x : int
|
||||||
172 | | An interger.
|
172 | | An integer.
|
||||||
173 | | """
|
173 | | """
|
||||||
| |_______^ DOC201
|
| |_______^ DOC201
|
||||||
174 | if x < 0:
|
174 | if x < 0:
|
||||||
|
|
|
@ -132,7 +132,7 @@ RUF041.py:12:1: RUF041 [*] Unnecessary nested `Literal`
|
||||||
12 | / Literal[
|
12 | / Literal[
|
||||||
13 | | 1, # comment 1
|
13 | | 1, # comment 1
|
||||||
14 | | Literal[ # another comment
|
14 | | Literal[ # another comment
|
||||||
15 | | 1 # yet annother comment
|
15 | | 1 # yet another comment
|
||||||
16 | | ]
|
16 | | ]
|
||||||
17 | | ] # once
|
17 | | ] # once
|
||||||
| |_^ RUF041
|
| |_^ RUF041
|
||||||
|
@ -148,7 +148,7 @@ RUF041.py:12:1: RUF041 [*] Unnecessary nested `Literal`
|
||||||
12 |-Literal[
|
12 |-Literal[
|
||||||
13 |- 1, # comment 1
|
13 |- 1, # comment 1
|
||||||
14 |- Literal[ # another comment
|
14 |- Literal[ # another comment
|
||||||
15 |- 1 # yet annother comment
|
15 |- 1 # yet another comment
|
||||||
16 |- ]
|
16 |- ]
|
||||||
17 |-] # once
|
17 |-] # once
|
||||||
12 |+Literal[1, 1] # once
|
12 |+Literal[1, 1] # once
|
||||||
|
|
|
@ -131,7 +131,7 @@ RUF041.pyi:12:1: RUF041 [*] Unnecessary nested `Literal`
|
||||||
12 | / Literal[
|
12 | / Literal[
|
||||||
13 | | 1, # comment 1
|
13 | | 1, # comment 1
|
||||||
14 | | Literal[ # another comment
|
14 | | Literal[ # another comment
|
||||||
15 | | 1 # yet annother comment
|
15 | | 1 # yet another comment
|
||||||
16 | | ]
|
16 | | ]
|
||||||
17 | | ] # once
|
17 | | ] # once
|
||||||
| |_^ RUF041
|
| |_^ RUF041
|
||||||
|
@ -147,7 +147,7 @@ RUF041.pyi:12:1: RUF041 [*] Unnecessary nested `Literal`
|
||||||
12 |-Literal[
|
12 |-Literal[
|
||||||
13 |- 1, # comment 1
|
13 |- 1, # comment 1
|
||||||
14 |- Literal[ # another comment
|
14 |- Literal[ # another comment
|
||||||
15 |- 1 # yet annother comment
|
15 |- 1 # yet another comment
|
||||||
16 |- ]
|
16 |- ]
|
||||||
17 |-] # once
|
17 |-] # once
|
||||||
12 |+Literal[1, 1] # once
|
12 |+Literal[1, 1] # once
|
||||||
|
|
|
@ -6,7 +6,7 @@ def foo2(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parame
|
||||||
def foo3(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
def foo3(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
||||||
def foo4(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
def foo4(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
||||||
|
|
||||||
# Adding some unformated code covering a wide range of syntaxes.
|
# Adding some unformatted code covering a wide range of syntaxes.
|
||||||
|
|
||||||
if True:
|
if True:
|
||||||
# Incorrectly indented prefix comments.
|
# Incorrectly indented prefix comments.
|
||||||
|
|
|
@ -28,7 +28,7 @@ def foo3(
|
||||||
|
|
||||||
def foo4(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
def foo4(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
||||||
|
|
||||||
# Adding some unformated code covering a wide range of syntaxes.
|
# Adding some unformatted code covering a wide range of syntaxes.
|
||||||
|
|
||||||
if True:
|
if True:
|
||||||
# Incorrectly indented prefix comments.
|
# Incorrectly indented prefix comments.
|
||||||
|
|
|
@ -19,7 +19,7 @@ z: (Short
|
||||||
z: (int) = 2.3
|
z: (int) = 2.3
|
||||||
z: ((int)) = foo()
|
z: ((int)) = foo()
|
||||||
|
|
||||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||||
x = (
|
x = (
|
||||||
z
|
z
|
||||||
== 9999999999999999999999999999999999999999
|
== 9999999999999999999999999999999999999999
|
||||||
|
|
|
@ -28,7 +28,7 @@ z: Short | Short2 | Short3 | Short4 = 8
|
||||||
z: int = 2.3
|
z: int = 2.3
|
||||||
z: int = foo()
|
z: int = foo()
|
||||||
|
|
||||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||||
x = (
|
x = (
|
||||||
z
|
z
|
||||||
== 9999999999999999999999999999999999999999
|
== 9999999999999999999999999999999999999999
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Regresssion test for https://github.com/astral-sh/ruff/issues/11724
|
# Regression test for https://github.com/astral-sh/ruff/issues/11724
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ b"aaaaaaaaa" b"bbbbbbbbbbbbbbbbbbbb" # Join
|
||||||
# F-strings
|
# F-strings
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Escape `{` and `}` when marging an f-string with a string
|
# Escape `{` and `}` when merging an f-string with a string
|
||||||
"a {not_a_variable}" f"b {10}" "c"
|
"a {not_a_variable}" f"b {10}" "c"
|
||||||
|
|
||||||
# Join, and break expressions
|
# Join, and break expressions
|
||||||
|
@ -96,7 +96,7 @@ f"{f'''test ' '''}" f'{f"""other " """}'
|
||||||
f"{10 + len('bar')=}" f"{10 + len('bar')=}"
|
f"{10 + len('bar')=}" f"{10 + len('bar')=}"
|
||||||
f"{10 + len('bar')=}" f'no debug{10}' f"{10 + len('bar')=}"
|
f"{10 + len('bar')=}" f'no debug{10}' f"{10 + len('bar')=}"
|
||||||
|
|
||||||
# We can't savely merge this pre Python 3.12 without altering the debug expression.
|
# We can't safely merge this pre Python 3.12 without altering the debug expression.
|
||||||
f"{10 + len('bar')=}" f'{10 + len("bar")=}'
|
f"{10 + len('bar')=}" f'{10 + len("bar")=}'
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ def short_docstring():
|
||||||
"Implicit" "concatenated" "docstring"
|
"Implicit" "concatenated" "docstring"
|
||||||
|
|
||||||
def long_docstring():
|
def long_docstring():
|
||||||
"Loooooooooooooooooooooong" "doooooooooooooooooooocstriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing" "exceding the line width" "but it should be concatenated anyways because it is single line"
|
"Loooooooooooooooooooooong" "doooooooooooooooooooocstriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing" "exceeding the line width" "but it should be concatenated anyways because it is single line"
|
||||||
|
|
||||||
def docstring_with_leading_whitespace():
|
def docstring_with_leading_whitespace():
|
||||||
" This is a " "implicit" "concatenated" "docstring"
|
" This is a " "implicit" "concatenated" "docstring"
|
||||||
|
|
|
@ -13,7 +13,7 @@ print("after" )
|
||||||
# The if header and the print statement together are longer than 100 characters.
|
# The if header and the print statement together are longer than 100 characters.
|
||||||
# The print statement should either be wrapped to fit at the end of the if statement, or be converted to a
|
# The print statement should either be wrapped to fit at the end of the if statement, or be converted to a
|
||||||
# suite body
|
# suite body
|
||||||
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd: <RANGE_START>print("aaaa long body, should wrap or be intented" )<RANGE_END>
|
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd: <RANGE_START>print("aaaa long body, should wrap or be indented" )<RANGE_END>
|
||||||
|
|
||||||
# This print statement is too-long even when intented. It should be wrapped
|
# This print statement is too long even when indented. It should be wrapped
|
||||||
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd: <RANGE_START>print("aaaa long body, should wrap or be intented", "more content to make it exceed the 88 chars limit")<RANGE_END>
|
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd: <RANGE_START>print("aaaa long body, should wrap or be indented", "more content to make it exceed the 88 chars limit")<RANGE_END>
|
||||||
|
|
|
@ -54,7 +54,7 @@ def test_return_union_with_elements_exceeding_length(
|
||||||
|
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
# Multiline stirngs (NeedsParentheses::Never)
|
# Multiline strings (NeedsParentheses::Never)
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub(crate) fn is_f_string_formatting_enabled(context: &PyFormatContext) -> bool
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [#13539](https://github.com/astral-sh/ruff/pull/13539)
|
/// See [#13539](https://github.com/astral-sh/ruff/pull/13539)
|
||||||
/// Remove `Quoting` when stabalizing this preview style.
|
/// Remove `Quoting` when stabilizing this preview style.
|
||||||
pub(crate) fn is_f_string_implicit_concatenated_string_literal_quotes_enabled(
|
pub(crate) fn is_f_string_implicit_concatenated_string_literal_quotes_enabled(
|
||||||
context: &PyFormatContext,
|
context: &PyFormatContext,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
|
|
@ -27,7 +27,7 @@ z: (Short
|
||||||
z: (int) = 2.3
|
z: (int) = 2.3
|
||||||
z: ((int)) = foo()
|
z: ((int)) = foo()
|
||||||
|
|
||||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||||
x = (
|
x = (
|
||||||
z
|
z
|
||||||
== 9999999999999999999999999999999999999999
|
== 9999999999999999999999999999999999999999
|
||||||
|
@ -166,7 +166,7 @@ z: Short | Short2 | Short3 | Short4 = 8
|
||||||
z: int = 2.3
|
z: int = 2.3
|
||||||
z: int = foo()
|
z: int = foo()
|
||||||
|
|
||||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||||
x = (
|
x = (
|
||||||
z
|
z
|
||||||
== 9999999999999999999999999999999999999999
|
== 9999999999999999999999999999999999999999
|
||||||
|
@ -270,7 +270,7 @@ z: Short | Short2 | Short3 | Short4 = 8
|
||||||
z: int = 2.3
|
z: int = 2.3
|
||||||
z: int = foo()
|
z: int = foo()
|
||||||
|
|
||||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||||
x = (
|
x = (
|
||||||
z
|
z
|
||||||
== 9999999999999999999999999999999999999999
|
== 9999999999999999999999999999999999999999
|
||||||
|
|
|
@ -5,7 +5,7 @@ snapshot_kind: text
|
||||||
---
|
---
|
||||||
## Input
|
## Input
|
||||||
```python
|
```python
|
||||||
# Regresssion test for https://github.com/astral-sh/ruff/issues/11724
|
# Regression test for https://github.com/astral-sh/ruff/issues/11724
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ snapshot_kind: text
|
||||||
|
|
||||||
## Output
|
## Output
|
||||||
```python
|
```python
|
||||||
# Regresssion test for https://github.com/astral-sh/ruff/issues/11724
|
# Regression test for https://github.com/astral-sh/ruff/issues/11724
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ b"aaaaaaaaa" b"bbbbbbbbbbbbbbbbbbbb" # Join
|
||||||
# F-strings
|
# F-strings
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Escape `{` and `}` when marging an f-string with a string
|
# Escape `{` and `}` when merging an f-string with a string
|
||||||
"a {not_a_variable}" f"b {10}" "c"
|
"a {not_a_variable}" f"b {10}" "c"
|
||||||
|
|
||||||
# Join, and break expressions
|
# Join, and break expressions
|
||||||
|
@ -102,7 +102,7 @@ f"{f'''test ' '''}" f'{f"""other " """}'
|
||||||
f"{10 + len('bar')=}" f"{10 + len('bar')=}"
|
f"{10 + len('bar')=}" f"{10 + len('bar')=}"
|
||||||
f"{10 + len('bar')=}" f'no debug{10}' f"{10 + len('bar')=}"
|
f"{10 + len('bar')=}" f'no debug{10}' f"{10 + len('bar')=}"
|
||||||
|
|
||||||
# We can't savely merge this pre Python 3.12 without altering the debug expression.
|
# We can't safely merge this pre Python 3.12 without altering the debug expression.
|
||||||
f"{10 + len('bar')=}" f'{10 + len("bar")=}'
|
f"{10 + len('bar')=}" f'{10 + len("bar")=}'
|
||||||
|
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ def short_docstring():
|
||||||
"Implicit" "concatenated" "docstring"
|
"Implicit" "concatenated" "docstring"
|
||||||
|
|
||||||
def long_docstring():
|
def long_docstring():
|
||||||
"Loooooooooooooooooooooong" "doooooooooooooooooooocstriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing" "exceding the line width" "but it should be concatenated anyways because it is single line"
|
"Loooooooooooooooooooooong" "doooooooooooooooooooocstriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing" "exceeding the line width" "but it should be concatenated anyways because it is single line"
|
||||||
|
|
||||||
def docstring_with_leading_whitespace():
|
def docstring_with_leading_whitespace():
|
||||||
" This is a " "implicit" "concatenated" "docstring"
|
" This is a " "implicit" "concatenated" "docstring"
|
||||||
|
@ -427,7 +427,7 @@ b"aaaaaaaaabbbbbbbbbbbbbbbbbbbb" # Join
|
||||||
# F-strings
|
# F-strings
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Escape `{` and `}` when marging an f-string with a string
|
# Escape `{` and `}` when merging an f-string with a string
|
||||||
f"a {{not_a_variable}}b {10}c"
|
f"a {{not_a_variable}}b {10}c"
|
||||||
|
|
||||||
# Join, and break expressions
|
# Join, and break expressions
|
||||||
|
@ -463,7 +463,7 @@ f"{f'''test ' '''}" f'{f"""other " """}'
|
||||||
f"{10 + len('bar')=}{10 + len('bar')=}"
|
f"{10 + len('bar')=}{10 + len('bar')=}"
|
||||||
f"{10 + len('bar')=}no debug{10}{10 + len('bar')=}"
|
f"{10 + len('bar')=}no debug{10}{10 + len('bar')=}"
|
||||||
|
|
||||||
# We can't savely merge this pre Python 3.12 without altering the debug expression.
|
# We can't safely merge this pre Python 3.12 without altering the debug expression.
|
||||||
f"{10 + len('bar')=}" f'{10 + len("bar")=}'
|
f"{10 + len('bar')=}" f'{10 + len("bar")=}'
|
||||||
|
|
||||||
|
|
||||||
|
@ -690,7 +690,7 @@ def short_docstring():
|
||||||
|
|
||||||
|
|
||||||
def long_docstring():
|
def long_docstring():
|
||||||
"Loooooooooooooooooooooongdoooooooooooooooooooocstriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiingexceding the line widthbut it should be concatenated anyways because it is single line"
|
"Loooooooooooooooooooooongdoooooooooooooooooooocstriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiingexceeding the line widthbut it should be concatenated anyways because it is single line"
|
||||||
|
|
||||||
|
|
||||||
def docstring_with_leading_whitespace():
|
def docstring_with_leading_whitespace():
|
||||||
|
|
|
@ -20,10 +20,10 @@ print("after" )
|
||||||
# The if header and the print statement together are longer than 100 characters.
|
# The if header and the print statement together are longer than 100 characters.
|
||||||
# The print statement should either be wrapped to fit at the end of the if statement, or be converted to a
|
# The print statement should either be wrapped to fit at the end of the if statement, or be converted to a
|
||||||
# suite body
|
# suite body
|
||||||
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd: <RANGE_START>print("aaaa long body, should wrap or be intented" )<RANGE_END>
|
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd: <RANGE_START>print("aaaa long body, should wrap or be indented" )<RANGE_END>
|
||||||
|
|
||||||
# This print statement is too-long even when intented. It should be wrapped
|
# This print statement is too long even when indented. It should be wrapped
|
||||||
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd: <RANGE_START>print("aaaa long body, should wrap or be intented", "more content to make it exceed the 88 chars limit")<RANGE_END>
|
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd: <RANGE_START>print("aaaa long body, should wrap or be indented", "more content to make it exceed the 88 chars limit")<RANGE_END>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Output
|
## Output
|
||||||
|
@ -48,12 +48,12 @@ print("after" )
|
||||||
# The print statement should either be wrapped to fit at the end of the if statement, or be converted to a
|
# The print statement should either be wrapped to fit at the end of the if statement, or be converted to a
|
||||||
# suite body
|
# suite body
|
||||||
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd:
|
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd:
|
||||||
print("aaaa long body, should wrap or be intented")
|
print("aaaa long body, should wrap or be indented")
|
||||||
|
|
||||||
# This print statement is too-long even when intented. It should be wrapped
|
# This print statement is too long even when indented. It should be wrapped
|
||||||
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd:
|
if aaaaaaaaaaaa + bbbbbbbbbbbbbb + cccccccccccccccccc + ddd:
|
||||||
print(
|
print(
|
||||||
"aaaa long body, should wrap or be intented",
|
"aaaa long body, should wrap or be indented",
|
||||||
"more content to make it exceed the 88 chars limit",
|
"more content to make it exceed the 88 chars limit",
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
|
@ -61,7 +61,7 @@ def test_return_union_with_elements_exceeding_length(
|
||||||
|
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
# Multiline stirngs (NeedsParentheses::Never)
|
# Multiline strings (NeedsParentheses::Never)
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ def test_return_union_with_elements_exceeding_length(
|
||||||
|
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
# Multiline stirngs (NeedsParentheses::Never)
|
# Multiline strings (NeedsParentheses::Never)
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2140,7 +2140,7 @@ impl<'src> Parser<'src> {
|
||||||
/// it's used in the context of a subscript expression or as a list expression:
|
/// it's used in the context of a subscript expression or as a list expression:
|
||||||
///
|
///
|
||||||
/// ```python
|
/// ```python
|
||||||
/// # Subcript expression; `match` is an identifier
|
/// # Subscript expression; `match` is an identifier
|
||||||
/// match[x]
|
/// match[x]
|
||||||
///
|
///
|
||||||
/// # List expression; `match` is a keyword
|
/// # List expression; `match` is a keyword
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl super::SyncNotificationHandler for DidChange {
|
||||||
.update_text_document(&key, content_changes, new_version)
|
.update_text_document(&key, content_changes, new_version)
|
||||||
.with_failure_code(ErrorCode::InternalError)?;
|
.with_failure_code(ErrorCode::InternalError)?;
|
||||||
|
|
||||||
// Publish diagnostics if the client doesnt support pull diagnostics
|
// Publish diagnostics if the client doesn't support pull diagnostics
|
||||||
if !session.resolved_client_capabilities().pull_diagnostics {
|
if !session.resolved_client_capabilities().pull_diagnostics {
|
||||||
let snapshot = session.take_snapshot(key.into_url()).unwrap();
|
let snapshot = session.take_snapshot(key.into_url()).unwrap();
|
||||||
publish_diagnostics_for_document(&snapshot, ¬ifier)?;
|
publish_diagnostics_for_document(&snapshot, ¬ifier)?;
|
||||||
|
|
|
@ -32,7 +32,7 @@ impl super::SyncNotificationHandler for DidOpen {
|
||||||
|
|
||||||
session.open_text_document(uri.clone(), document);
|
session.open_text_document(uri.clone(), document);
|
||||||
|
|
||||||
// Publish diagnostics if the client doesnt support pull diagnostics
|
// Publish diagnostics if the client doesn't support pull diagnostics
|
||||||
if !session.resolved_client_capabilities().pull_diagnostics {
|
if !session.resolved_client_capabilities().pull_diagnostics {
|
||||||
let snapshot = session
|
let snapshot = session
|
||||||
.take_snapshot(uri.clone())
|
.take_snapshot(uri.clone())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue