From 882a1a702e8b1432ade2aa30d889dc5eccb7d770 Mon Sep 17 00:00:00 2001 From: omahs <73983677+omahs@users.noreply.github.com> Date: Fri, 9 May 2025 20:57:14 +0200 Subject: [PATCH] Fix typos (#17988) Fix typos --------- Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com> Co-authored-by: Brent Westbrook --- crates/ruff_formatter/src/lib.rs | 4 +- .../test/fixtures/perflint/PERF401.py | 4 +- ...__perflint__tests__PERF401_PERF401.py.snap | 4 +- ...t__tests__preview__PERF401_PERF401.py.snap | 12 +- crates/ruff_python_ast/src/nodes.rs | 2 +- crates/ruff_python_ast/src/visitor.rs | 2 +- .../src/visitor/transformer.rs | 2 +- .../parenthesized/tuple_starred_expr.py | 2 +- ..._parenthesized__tuple_starred_expr.py.snap | 336 +++++++++--------- .../resources/mdtest/import/star.md | 2 +- .../mdtest/statically_known_branches.md | 2 +- .../src/semantic_index/builder.rs | 2 +- .../src/types/call/arguments.rs | 4 +- .../ty_python_semantic/src/types/context.rs | 2 +- crates/ty_python_semantic/src/types/infer.rs | 2 +- 15 files changed, 191 insertions(+), 191 deletions(-) diff --git a/crates/ruff_formatter/src/lib.rs b/crates/ruff_formatter/src/lib.rs index b675813a57..5b25630fc0 100644 --- a/crates/ruff_formatter/src/lib.rs +++ b/crates/ruff_formatter/src/lib.rs @@ -92,7 +92,7 @@ impl std::fmt::Display for IndentStyle { } } -/// The visual width of a indentation. +/// The visual width of an indentation. /// /// Determines the visual width of a tab character (`\t`) and the number of /// spaces per indent when using [`IndentStyle::Space`]. @@ -207,7 +207,7 @@ pub trait FormatOptions { /// What's the max width of a line. Defaults to 80. fn line_width(&self) -> LineWidth; - /// Derives the print options from the these format options + /// Derives the print options from these format options fn as_print_options(&self) -> PrinterOptions; } diff --git a/crates/ruff_linter/resources/test/fixtures/perflint/PERF401.py b/crates/ruff_linter/resources/test/fixtures/perflint/PERF401.py index b0e6ff0759..263f0ff6c6 100644 --- a/crates/ruff_linter/resources/test/fixtures/perflint/PERF401.py +++ b/crates/ruff_linter/resources/test/fixtures/perflint/PERF401.py @@ -144,14 +144,14 @@ def f(): def f(): # make sure that `tmp` is not deleted - tmp = 1; result = [] # commment should be protected + tmp = 1; result = [] # comment should be protected for i in range(10): result.append(i + 1) # PERF401 def f(): # make sure that `tmp` is not deleted - result = []; tmp = 1 # commment should be protected + result = []; tmp = 1 # comment should be protected for i in range(10): result.append(i + 1) # PERF401 diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF401_PERF401.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF401_PERF401.py.snap index c2de08bb3f..92d7d6df85 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF401_PERF401.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF401_PERF401.py.snap @@ -93,7 +93,7 @@ PERF401.py:142:9: PERF401 Use a list comprehension to create a transformed list PERF401.py:149:9: PERF401 Use a list comprehension to create a transformed list | -147 | tmp = 1; result = [] # commment should be protected +147 | tmp = 1; result = [] # comment should be protected 148 | for i in range(10): 149 | result.append(i + 1) # PERF401 | ^^^^^^^^^^^^^^^^^^^^ PERF401 @@ -102,7 +102,7 @@ PERF401.py:149:9: PERF401 Use a list comprehension to create a transformed list PERF401.py:156:9: PERF401 Use a list comprehension to create a transformed list | -154 | result = []; tmp = 1 # commment should be protected +154 | result = []; tmp = 1 # comment should be protected 155 | for i in range(10): 156 | result.append(i + 1) # PERF401 | ^^^^^^^^^^^^^^^^^^^^ PERF401 diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__preview__PERF401_PERF401.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__preview__PERF401_PERF401.py.snap index 47100714a6..35f6a6bd92 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__preview__PERF401_PERF401.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__preview__PERF401_PERF401.py.snap @@ -223,7 +223,7 @@ PERF401.py:142:9: PERF401 [*] Use a list comprehension to create a transformed l PERF401.py:149:9: PERF401 [*] Use a list comprehension to create a transformed list | -147 | tmp = 1; result = [] # commment should be protected +147 | tmp = 1; result = [] # comment should be protected 148 | for i in range(10): 149 | result.append(i + 1) # PERF401 | ^^^^^^^^^^^^^^^^^^^^ PERF401 @@ -234,10 +234,10 @@ PERF401.py:149:9: PERF401 [*] Use a list comprehension to create a transformed l 144 144 | 145 145 | def f(): 146 146 | # make sure that `tmp` is not deleted -147 |- tmp = 1; result = [] # commment should be protected +147 |- tmp = 1; result = [] # comment should be protected 148 |- for i in range(10): 149 |- result.append(i + 1) # PERF401 - 147 |+ tmp = 1 # commment should be protected + 147 |+ tmp = 1 # comment should be protected 148 |+ result = [i + 1 for i in range(10)] # PERF401 150 149 | 151 150 | @@ -245,7 +245,7 @@ PERF401.py:149:9: PERF401 [*] Use a list comprehension to create a transformed l PERF401.py:156:9: PERF401 [*] Use a list comprehension to create a transformed list | -154 | result = []; tmp = 1 # commment should be protected +154 | result = []; tmp = 1 # comment should be protected 155 | for i in range(10): 156 | result.append(i + 1) # PERF401 | ^^^^^^^^^^^^^^^^^^^^ PERF401 @@ -256,10 +256,10 @@ PERF401.py:156:9: PERF401 [*] Use a list comprehension to create a transformed l 151 151 | 152 152 | def f(): 153 153 | # make sure that `tmp` is not deleted -154 |- result = []; tmp = 1 # commment should be protected +154 |- result = []; tmp = 1 # comment should be protected 155 |- for i in range(10): 156 |- result.append(i + 1) # PERF401 - 154 |+ tmp = 1 # commment should be protected + 154 |+ tmp = 1 # comment should be protected 155 |+ result = [i + 1 for i in range(10)] # PERF401 157 156 | 158 157 | diff --git a/crates/ruff_python_ast/src/nodes.rs b/crates/ruff_python_ast/src/nodes.rs index 282fa2a78f..5284736f68 100644 --- a/crates/ruff_python_ast/src/nodes.rs +++ b/crates/ruff_python_ast/src/nodes.rs @@ -2844,7 +2844,7 @@ impl Arguments { self.find_argument(name, position).map(ArgOrKeyword::value) } - /// Return the the argument with the given name or at the given position, or `None` if no such + /// Return the argument with the given name or at the given position, or `None` if no such /// argument exists. Used to retrieve arguments that can be provided _either_ as keyword or /// positional arguments. pub fn find_argument(&self, name: &str, position: usize) -> Option { diff --git a/crates/ruff_python_ast/src/visitor.rs b/crates/ruff_python_ast/src/visitor.rs index 6d9bb92cef..8bb2013efc 100644 --- a/crates/ruff_python_ast/src/visitor.rs +++ b/crates/ruff_python_ast/src/visitor.rs @@ -590,7 +590,7 @@ pub fn walk_except_handler<'a, V: Visitor<'a> + ?Sized>( } pub fn walk_arguments<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, arguments: &'a Arguments) { - // Note that the there might be keywords before the last arg, e.g. in + // Note that there might be keywords before the last arg, e.g. in // f(*args, a=2, *args2, **kwargs)`, but we follow Python in evaluating first `args` and then // `keywords`. See also [Arguments::arguments_source_order`]. for arg in &*arguments.args { diff --git a/crates/ruff_python_ast/src/visitor/transformer.rs b/crates/ruff_python_ast/src/visitor/transformer.rs index dad507c53e..68962941d6 100644 --- a/crates/ruff_python_ast/src/visitor/transformer.rs +++ b/crates/ruff_python_ast/src/visitor/transformer.rs @@ -576,7 +576,7 @@ pub fn walk_except_handler( } pub fn walk_arguments(visitor: &V, arguments: &mut Arguments) { - // Note that the there might be keywords before the last arg, e.g. in + // Note that there might be keywords before the last arg, e.g. in // f(*args, a=2, *args2, **kwargs)`, but we follow Python in evaluating first `args` and then // `keywords`. See also [Arguments::arguments_source_order`]. for arg in &mut *arguments.args { diff --git a/crates/ruff_python_parser/resources/invalid/expressions/parenthesized/tuple_starred_expr.py b/crates/ruff_python_parser/resources/invalid/expressions/parenthesized/tuple_starred_expr.py index 1a87159f0a..e3998d7cce 100644 --- a/crates/ruff_python_parser/resources/invalid/expressions/parenthesized/tuple_starred_expr.py +++ b/crates/ruff_python_parser/resources/invalid/expressions/parenthesized/tuple_starred_expr.py @@ -1,5 +1,5 @@ # For tuple expression, the minimum binding power of star expression is bitwise or. -# Test the first and any other element as the there are two separate calls. +# Test the first and any other element as there are two separate calls. (*x in y, z, *x in y) (*not x, z, *not x) diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap index 4b75ea06ed..a81a6db84b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap @@ -7,24 +7,24 @@ input_file: crates/ruff_python_parser/resources/invalid/expressions/parenthesize ``` Module( ModModule { - range: 0..536, + range: 0..532, body: [ Expr( StmtExpr { - range: 161..182, + range: 157..178, value: Tuple( ExprTuple { - range: 161..182, + range: 157..178, elts: [ Starred( ExprStarred { - range: 162..169, + range: 158..165, value: Compare( ExprCompare { - range: 163..169, + range: 159..165, left: Name( ExprName { - range: 163..164, + range: 159..160, id: Name("x"), ctx: Load, }, @@ -35,7 +35,7 @@ Module( comparators: [ Name( ExprName { - range: 168..169, + range: 164..165, id: Name("y"), ctx: Load, }, @@ -48,20 +48,20 @@ Module( ), Name( ExprName { - range: 171..172, + range: 167..168, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 174..181, + range: 170..177, value: Compare( ExprCompare { - range: 175..181, + range: 171..177, left: Name( ExprName { - range: 175..176, + range: 171..172, id: Name("x"), ctx: Load, }, @@ -72,7 +72,7 @@ Module( comparators: [ Name( ExprName { - range: 180..181, + range: 176..177, id: Name("y"), ctx: Load, }, @@ -92,21 +92,21 @@ Module( ), Expr( StmtExpr { - range: 183..202, + range: 179..198, value: Tuple( ExprTuple { - range: 183..202, + range: 179..198, elts: [ Starred( ExprStarred { - range: 184..190, + range: 180..186, value: UnaryOp( ExprUnaryOp { - range: 185..190, + range: 181..186, op: Not, operand: Name( ExprName { - range: 189..190, + range: 185..186, id: Name("x"), ctx: Load, }, @@ -118,21 +118,21 @@ Module( ), Name( ExprName { - range: 192..193, + range: 188..189, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 195..201, + range: 191..197, value: UnaryOp( ExprUnaryOp { - range: 196..201, + range: 192..197, op: Not, operand: Name( ExprName { - range: 200..201, + range: 196..197, id: Name("x"), ctx: Load, }, @@ -151,29 +151,29 @@ Module( ), Expr( StmtExpr { - range: 203..226, + range: 199..222, value: Tuple( ExprTuple { - range: 203..226, + range: 199..222, elts: [ Starred( ExprStarred { - range: 204..212, + range: 200..208, value: BoolOp( ExprBoolOp { - range: 205..212, + range: 201..208, op: And, values: [ Name( ExprName { - range: 205..206, + range: 201..202, id: Name("x"), ctx: Load, }, ), Name( ExprName { - range: 211..212, + range: 207..208, id: Name("y"), ctx: Load, }, @@ -186,29 +186,29 @@ Module( ), Name( ExprName { - range: 214..215, + range: 210..211, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 217..225, + range: 213..221, value: BoolOp( ExprBoolOp { - range: 218..225, + range: 214..221, op: And, values: [ Name( ExprName { - range: 218..219, + range: 214..215, id: Name("x"), ctx: Load, }, ), Name( ExprName { - range: 224..225, + range: 220..221, id: Name("y"), ctx: Load, }, @@ -228,29 +228,29 @@ Module( ), Expr( StmtExpr { - range: 227..248, + range: 223..244, value: Tuple( ExprTuple { - range: 227..248, + range: 223..244, elts: [ Starred( ExprStarred { - range: 228..235, + range: 224..231, value: BoolOp( ExprBoolOp { - range: 229..235, + range: 225..231, op: Or, values: [ Name( ExprName { - range: 229..230, + range: 225..226, id: Name("x"), ctx: Load, }, ), Name( ExprName { - range: 234..235, + range: 230..231, id: Name("y"), ctx: Load, }, @@ -263,29 +263,29 @@ Module( ), Name( ExprName { - range: 237..238, + range: 233..234, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 240..247, + range: 236..243, value: BoolOp( ExprBoolOp { - range: 241..247, + range: 237..243, op: Or, values: [ Name( ExprName { - range: 241..242, + range: 237..238, id: Name("x"), ctx: Load, }, ), Name( ExprName { - range: 246..247, + range: 242..243, id: Name("y"), ctx: Load, }, @@ -305,33 +305,33 @@ Module( ), Expr( StmtExpr { - range: 249..290, + range: 245..286, value: Tuple( ExprTuple { - range: 249..290, + range: 245..286, elts: [ Starred( ExprStarred { - range: 250..267, + range: 246..263, value: If( ExprIf { - range: 251..267, + range: 247..263, test: BooleanLiteral( ExprBooleanLiteral { - range: 256..260, + range: 252..256, value: true, }, ), body: Name( ExprName { - range: 251..252, + range: 247..248, id: Name("x"), ctx: Load, }, ), orelse: Name( ExprName { - range: 266..267, + range: 262..263, id: Name("y"), ctx: Load, }, @@ -343,33 +343,33 @@ Module( ), Name( ExprName { - range: 269..270, + range: 265..266, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 272..289, + range: 268..285, value: If( ExprIf { - range: 273..289, + range: 269..285, test: BooleanLiteral( ExprBooleanLiteral { - range: 278..282, + range: 274..278, value: true, }, ), body: Name( ExprName { - range: 273..274, + range: 269..270, id: Name("x"), ctx: Load, }, ), orelse: Name( ExprName { - range: 288..289, + range: 284..285, id: Name("y"), ctx: Load, }, @@ -388,29 +388,29 @@ Module( ), Expr( StmtExpr { - range: 291..322, + range: 287..318, value: Tuple( ExprTuple { - range: 291..322, + range: 287..318, elts: [ Starred( ExprStarred { - range: 292..304, + range: 288..300, value: Lambda( ExprLambda { - range: 293..304, + range: 289..300, parameters: Some( Parameters { - range: 300..301, + range: 296..297, posonlyargs: [], args: [ ParameterWithDefault { - range: 300..301, + range: 296..297, parameter: Parameter { - range: 300..301, + range: 296..297, name: Identifier { id: Name("x"), - range: 300..301, + range: 296..297, }, annotation: None, }, @@ -424,7 +424,7 @@ Module( ), body: Name( ExprName { - range: 303..304, + range: 299..300, id: Name("x"), ctx: Load, }, @@ -436,29 +436,29 @@ Module( ), Name( ExprName { - range: 306..307, + range: 302..303, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 309..321, + range: 305..317, value: Lambda( ExprLambda { - range: 310..321, + range: 306..317, parameters: Some( Parameters { - range: 317..318, + range: 313..314, posonlyargs: [], args: [ ParameterWithDefault { - range: 317..318, + range: 313..314, parameter: Parameter { - range: 317..318, + range: 313..314, name: Identifier { id: Name("x"), - range: 317..318, + range: 313..314, }, annotation: None, }, @@ -472,7 +472,7 @@ Module( ), body: Name( ExprName { - range: 320..321, + range: 316..317, id: Name("x"), ctx: Load, }, @@ -491,20 +491,20 @@ Module( ), Expr( StmtExpr { - range: 323..344, + range: 319..340, value: Tuple( ExprTuple { - range: 323..344, + range: 319..340, elts: [ Named( ExprNamed { - range: 324..331, + range: 320..327, target: Starred( ExprStarred { - range: 324..326, + range: 320..322, value: Name( ExprName { - range: 325..326, + range: 321..322, id: Name("x"), ctx: Store, }, @@ -514,7 +514,7 @@ Module( ), value: NumberLiteral( ExprNumberLiteral { - range: 330..331, + range: 326..327, value: Int( 2, ), @@ -524,20 +524,20 @@ Module( ), Name( ExprName { - range: 333..334, + range: 329..330, id: Name("z"), ctx: Load, }, ), Named( ExprNamed { - range: 336..343, + range: 332..339, target: Starred( ExprStarred { - range: 336..338, + range: 332..334, value: Name( ExprName { - range: 337..338, + range: 333..334, id: Name("x"), ctx: Store, }, @@ -547,7 +547,7 @@ Module( ), value: NumberLiteral( ExprNumberLiteral { - range: 342..343, + range: 338..339, value: Int( 2, ), @@ -564,20 +564,20 @@ Module( ), Expr( StmtExpr { - range: 367..386, + range: 363..382, value: Tuple( ExprTuple { - range: 367..386, + range: 363..382, elts: [ Starred( ExprStarred { - range: 367..374, + range: 363..370, value: Compare( ExprCompare { - range: 368..374, + range: 364..370, left: Name( ExprName { - range: 368..369, + range: 364..365, id: Name("x"), ctx: Load, }, @@ -588,7 +588,7 @@ Module( comparators: [ Name( ExprName { - range: 373..374, + range: 369..370, id: Name("y"), ctx: Load, }, @@ -601,20 +601,20 @@ Module( ), Name( ExprName { - range: 376..377, + range: 372..373, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 379..386, + range: 375..382, value: Compare( ExprCompare { - range: 380..386, + range: 376..382, left: Name( ExprName { - range: 380..381, + range: 376..377, id: Name("x"), ctx: Load, }, @@ -625,7 +625,7 @@ Module( comparators: [ Name( ExprName { - range: 385..386, + range: 381..382, id: Name("y"), ctx: Load, }, @@ -645,21 +645,21 @@ Module( ), Expr( StmtExpr { - range: 387..404, + range: 383..400, value: Tuple( ExprTuple { - range: 387..404, + range: 383..400, elts: [ Starred( ExprStarred { - range: 387..393, + range: 383..389, value: UnaryOp( ExprUnaryOp { - range: 388..393, + range: 384..389, op: Not, operand: Name( ExprName { - range: 392..393, + range: 388..389, id: Name("x"), ctx: Load, }, @@ -671,21 +671,21 @@ Module( ), Name( ExprName { - range: 395..396, + range: 391..392, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 398..404, + range: 394..400, value: UnaryOp( ExprUnaryOp { - range: 399..404, + range: 395..400, op: Not, operand: Name( ExprName { - range: 403..404, + range: 399..400, id: Name("x"), ctx: Load, }, @@ -704,29 +704,29 @@ Module( ), Expr( StmtExpr { - range: 405..426, + range: 401..422, value: Tuple( ExprTuple { - range: 405..426, + range: 401..422, elts: [ Starred( ExprStarred { - range: 405..413, + range: 401..409, value: BoolOp( ExprBoolOp { - range: 406..413, + range: 402..409, op: And, values: [ Name( ExprName { - range: 406..407, + range: 402..403, id: Name("x"), ctx: Load, }, ), Name( ExprName { - range: 412..413, + range: 408..409, id: Name("y"), ctx: Load, }, @@ -739,29 +739,29 @@ Module( ), Name( ExprName { - range: 415..416, + range: 411..412, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 418..426, + range: 414..422, value: BoolOp( ExprBoolOp { - range: 419..426, + range: 415..422, op: And, values: [ Name( ExprName { - range: 419..420, + range: 415..416, id: Name("x"), ctx: Load, }, ), Name( ExprName { - range: 425..426, + range: 421..422, id: Name("y"), ctx: Load, }, @@ -781,29 +781,29 @@ Module( ), Expr( StmtExpr { - range: 427..446, + range: 423..442, value: Tuple( ExprTuple { - range: 427..446, + range: 423..442, elts: [ Starred( ExprStarred { - range: 427..434, + range: 423..430, value: BoolOp( ExprBoolOp { - range: 428..434, + range: 424..430, op: Or, values: [ Name( ExprName { - range: 428..429, + range: 424..425, id: Name("x"), ctx: Load, }, ), Name( ExprName { - range: 433..434, + range: 429..430, id: Name("y"), ctx: Load, }, @@ -816,29 +816,29 @@ Module( ), Name( ExprName { - range: 436..437, + range: 432..433, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 439..446, + range: 435..442, value: BoolOp( ExprBoolOp { - range: 440..446, + range: 436..442, op: Or, values: [ Name( ExprName { - range: 440..441, + range: 436..437, id: Name("x"), ctx: Load, }, ), Name( ExprName { - range: 445..446, + range: 441..442, id: Name("y"), ctx: Load, }, @@ -858,33 +858,33 @@ Module( ), Expr( StmtExpr { - range: 447..486, + range: 443..482, value: Tuple( ExprTuple { - range: 447..486, + range: 443..482, elts: [ Starred( ExprStarred { - range: 447..464, + range: 443..460, value: If( ExprIf { - range: 448..464, + range: 444..460, test: BooleanLiteral( ExprBooleanLiteral { - range: 453..457, + range: 449..453, value: true, }, ), body: Name( ExprName { - range: 448..449, + range: 444..445, id: Name("x"), ctx: Load, }, ), orelse: Name( ExprName { - range: 463..464, + range: 459..460, id: Name("y"), ctx: Load, }, @@ -896,33 +896,33 @@ Module( ), Name( ExprName { - range: 466..467, + range: 462..463, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 469..486, + range: 465..482, value: If( ExprIf { - range: 470..486, + range: 466..482, test: BooleanLiteral( ExprBooleanLiteral { - range: 475..479, + range: 471..475, value: true, }, ), body: Name( ExprName { - range: 470..471, + range: 466..467, id: Name("x"), ctx: Load, }, ), orelse: Name( ExprName { - range: 485..486, + range: 481..482, id: Name("y"), ctx: Load, }, @@ -941,29 +941,29 @@ Module( ), Expr( StmtExpr { - range: 487..516, + range: 483..512, value: Tuple( ExprTuple { - range: 487..516, + range: 483..512, elts: [ Starred( ExprStarred { - range: 487..499, + range: 483..495, value: Lambda( ExprLambda { - range: 488..499, + range: 484..495, parameters: Some( Parameters { - range: 495..496, + range: 491..492, posonlyargs: [], args: [ ParameterWithDefault { - range: 495..496, + range: 491..492, parameter: Parameter { - range: 495..496, + range: 491..492, name: Identifier { id: Name("x"), - range: 495..496, + range: 491..492, }, annotation: None, }, @@ -977,7 +977,7 @@ Module( ), body: Name( ExprName { - range: 498..499, + range: 494..495, id: Name("x"), ctx: Load, }, @@ -989,29 +989,29 @@ Module( ), Name( ExprName { - range: 501..502, + range: 497..498, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 504..516, + range: 500..512, value: Lambda( ExprLambda { - range: 505..516, + range: 501..512, parameters: Some( Parameters { - range: 512..513, + range: 508..509, posonlyargs: [], args: [ ParameterWithDefault { - range: 512..513, + range: 508..509, parameter: Parameter { - range: 512..513, + range: 508..509, name: Identifier { id: Name("x"), - range: 512..513, + range: 508..509, }, annotation: None, }, @@ -1025,7 +1025,7 @@ Module( ), body: Name( ExprName { - range: 515..516, + range: 511..512, id: Name("x"), ctx: Load, }, @@ -1044,13 +1044,13 @@ Module( ), Expr( StmtExpr { - range: 517..519, + range: 513..515, value: Starred( ExprStarred { - range: 517..519, + range: 513..515, value: Name( ExprName { - range: 518..519, + range: 514..515, id: Name("x"), ctx: Load, }, @@ -1062,14 +1062,14 @@ Module( ), Expr( StmtExpr { - range: 523..536, + range: 519..532, value: Tuple( ExprTuple { - range: 523..536, + range: 519..532, elts: [ NumberLiteral( ExprNumberLiteral { - range: 523..524, + range: 519..520, value: Int( 2, ), @@ -1077,17 +1077,17 @@ Module( ), Name( ExprName { - range: 526..527, + range: 522..523, id: Name("z"), ctx: Load, }, ), Starred( ExprStarred { - range: 529..531, + range: 525..527, value: Name( ExprName { - range: 530..531, + range: 526..527, id: Name("x"), ctx: Load, }, @@ -1097,7 +1097,7 @@ Module( ), NumberLiteral( ExprNumberLiteral { - range: 535..536, + range: 531..532, value: Int( 2, ), @@ -1117,7 +1117,7 @@ Module( ## Errors | -2 | # Test the first and any other element as the there are two separate calls. +2 | # Test the first and any other element as there are two separate calls. 3 | 4 | (*x in y, z, *x in y) | ^^^^^^ Syntax Error: Comparison expression cannot be used here @@ -1127,7 +1127,7 @@ Module( | -2 | # Test the first and any other element as the there are two separate calls. +2 | # Test the first and any other element as there are two separate calls. 3 | 4 | (*x in y, z, *x in y) | ^^^^^^ Syntax Error: Comparison expression cannot be used here diff --git a/crates/ty_python_semantic/resources/mdtest/import/star.md b/crates/ty_python_semantic/resources/mdtest/import/star.md index 4894074f2d..a20f7259ef 100644 --- a/crates/ty_python_semantic/resources/mdtest/import/star.md +++ b/crates/ty_python_semantic/resources/mdtest/import/star.md @@ -1389,7 +1389,7 @@ X: bool = True ```py def f(): - # TODO: we should emit a syntax errror here (tracked by https://github.com/astral-sh/ruff/issues/11934) + # TODO: we should emit a syntax error here (tracked by https://github.com/astral-sh/ruff/issues/17412) from exporter import * # error: [unresolved-reference] diff --git a/crates/ty_python_semantic/resources/mdtest/statically_known_branches.md b/crates/ty_python_semantic/resources/mdtest/statically_known_branches.md index c1d979d955..63db73d206 100644 --- a/crates/ty_python_semantic/resources/mdtest/statically_known_branches.md +++ b/crates/ty_python_semantic/resources/mdtest/statically_known_branches.md @@ -163,7 +163,7 @@ other ## Based on type inference -For the the rest of this test suite, we will mostly use `True` and `False` literals to indicate +For the rest of this test suite, we will mostly use `True` and `False` literals to indicate statically known conditions, but here, we show that the results are truly based on type inference, not some special handling of specific conditions in semantic index building. We use two modules to demonstrate this, since semantic index building is inherently single-module: diff --git a/crates/ty_python_semantic/src/semantic_index/builder.rs b/crates/ty_python_semantic/src/semantic_index/builder.rs index 40fd38b566..45b9fa01b6 100644 --- a/crates/ty_python_semantic/src/semantic_index/builder.rs +++ b/crates/ty_python_semantic/src/semantic_index/builder.rs @@ -1824,7 +1824,7 @@ where // Save the state immediately *after* visiting the `try` block // but *before* we prepare for visiting the `except` block(s). // - // We will revert to this state prior to visiting the the `else` block, + // We will revert to this state prior to visiting the `else` block, // as there necessarily must have been 0 `except` blocks executed // if we hit the `else` block. let post_try_block_state = self.flow_snapshot(); diff --git a/crates/ty_python_semantic/src/types/call/arguments.rs b/crates/ty_python_semantic/src/types/call/arguments.rs index 23b8052824..392c4ee514 100644 --- a/crates/ty_python_semantic/src/types/call/arguments.rs +++ b/crates/ty_python_semantic/src/types/call/arguments.rs @@ -9,7 +9,7 @@ pub(crate) struct CallArguments<'a>(Vec>); impl<'a> CallArguments<'a> { /// Prepend an optional extra synthetic argument (for a `self` or `cls` parameter) to the front - /// of this argument list. (If `bound_self` is none, we return the the argument list + /// of this argument list. (If `bound_self` is none, we return the argument list /// unmodified.) pub(crate) fn with_self(&self, bound_self: Option>) -> Cow { if bound_self.is_some() { @@ -87,7 +87,7 @@ impl<'a, 'db> CallArgumentTypes<'a, 'db> { } /// Prepend an optional extra synthetic argument (for a `self` or `cls` parameter) to the front - /// of this argument list. (If `bound_self` is none, we return the the argument list + /// of this argument list. (If `bound_self` is none, we return the argument list /// unmodified.) pub(crate) fn with_self(&self, bound_self: Option>) -> Cow { if let Some(bound_self) = bound_self { diff --git a/crates/ty_python_semantic/src/types/context.rs b/crates/ty_python_semantic/src/types/context.rs index 454f8ce7d7..dd287fa8ea 100644 --- a/crates/ty_python_semantic/src/types/context.rs +++ b/crates/ty_python_semantic/src/types/context.rs @@ -492,7 +492,7 @@ impl std::ops::DerefMut for DiagnosticGuard<'_, '_> { /// /// # Panics /// -/// This panics when the the underlying diagnostic lacks a primary +/// This panics when the underlying diagnostic lacks a primary /// annotation, or if it has one and its file doesn't match the file /// being type checked. impl Drop for DiagnosticGuard<'_, '_> { diff --git a/crates/ty_python_semantic/src/types/infer.rs b/crates/ty_python_semantic/src/types/infer.rs index e071c60306..2e3fa5b721 100644 --- a/crates/ty_python_semantic/src/types/infer.rs +++ b/crates/ty_python_semantic/src/types/infer.rs @@ -8277,7 +8277,7 @@ impl<'db> TypeInferenceBuilder<'db> { let callable_type = Type::Callable(callable_type); // `Signature` / `Parameters` are not a `Type` variant, so we're storing - // the outer callable type on the these expressions instead. + // the outer callable type on these expressions instead. self.store_expression_type(arguments_slice, callable_type); if let Some(first_argument) = first_argument { self.store_expression_type(first_argument, callable_type);