mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:21 +00:00
Fix typos (#17988)
Fix typos --------- Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com> Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
This commit is contained in:
parent
b4a1ebdfe3
commit
882a1a702e
15 changed files with 191 additions and 191 deletions
|
@ -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
|
/// Determines the visual width of a tab character (`\t`) and the number of
|
||||||
/// spaces per indent when using [`IndentStyle::Space`].
|
/// 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.
|
/// What's the max width of a line. Defaults to 80.
|
||||||
fn line_width(&self) -> LineWidth;
|
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;
|
fn as_print_options(&self) -> PrinterOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,14 +144,14 @@ def f():
|
||||||
|
|
||||||
def f():
|
def f():
|
||||||
# make sure that `tmp` is not deleted
|
# 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):
|
for i in range(10):
|
||||||
result.append(i + 1) # PERF401
|
result.append(i + 1) # PERF401
|
||||||
|
|
||||||
|
|
||||||
def f():
|
def f():
|
||||||
# make sure that `tmp` is not deleted
|
# 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):
|
for i in range(10):
|
||||||
result.append(i + 1) # PERF401
|
result.append(i + 1) # PERF401
|
||||||
|
|
||||||
|
|
|
@ -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
|
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):
|
148 | for i in range(10):
|
||||||
149 | result.append(i + 1) # PERF401
|
149 | result.append(i + 1) # PERF401
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ 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
|
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):
|
155 | for i in range(10):
|
||||||
156 | result.append(i + 1) # PERF401
|
156 | result.append(i + 1) # PERF401
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ PERF401
|
| ^^^^^^^^^^^^^^^^^^^^ PERF401
|
||||||
|
|
|
@ -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
|
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):
|
148 | for i in range(10):
|
||||||
149 | result.append(i + 1) # PERF401
|
149 | result.append(i + 1) # PERF401
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ PERF401
|
| ^^^^^^^^^^^^^^^^^^^^ PERF401
|
||||||
|
@ -234,10 +234,10 @@ PERF401.py:149:9: PERF401 [*] Use a list comprehension to create a transformed l
|
||||||
144 144 |
|
144 144 |
|
||||||
145 145 | def f():
|
145 145 | def f():
|
||||||
146 146 | # make sure that `tmp` is not deleted
|
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):
|
148 |- for i in range(10):
|
||||||
149 |- result.append(i + 1) # PERF401
|
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
|
148 |+ result = [i + 1 for i in range(10)] # PERF401
|
||||||
150 149 |
|
150 149 |
|
||||||
151 150 |
|
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
|
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):
|
155 | for i in range(10):
|
||||||
156 | result.append(i + 1) # PERF401
|
156 | result.append(i + 1) # PERF401
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ PERF401
|
| ^^^^^^^^^^^^^^^^^^^^ PERF401
|
||||||
|
@ -256,10 +256,10 @@ PERF401.py:156:9: PERF401 [*] Use a list comprehension to create a transformed l
|
||||||
151 151 |
|
151 151 |
|
||||||
152 152 | def f():
|
152 152 | def f():
|
||||||
153 153 | # make sure that `tmp` is not deleted
|
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):
|
155 |- for i in range(10):
|
||||||
156 |- result.append(i + 1) # PERF401
|
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
|
155 |+ result = [i + 1 for i in range(10)] # PERF401
|
||||||
157 156 |
|
157 156 |
|
||||||
158 157 |
|
158 157 |
|
||||||
|
|
|
@ -2844,7 +2844,7 @@ impl Arguments {
|
||||||
self.find_argument(name, position).map(ArgOrKeyword::value)
|
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
|
/// argument exists. Used to retrieve arguments that can be provided _either_ as keyword or
|
||||||
/// positional arguments.
|
/// positional arguments.
|
||||||
pub fn find_argument(&self, name: &str, position: usize) -> Option<ArgOrKeyword> {
|
pub fn find_argument(&self, name: &str, position: usize) -> Option<ArgOrKeyword> {
|
||||||
|
|
|
@ -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) {
|
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
|
// f(*args, a=2, *args2, **kwargs)`, but we follow Python in evaluating first `args` and then
|
||||||
// `keywords`. See also [Arguments::arguments_source_order`].
|
// `keywords`. See also [Arguments::arguments_source_order`].
|
||||||
for arg in &*arguments.args {
|
for arg in &*arguments.args {
|
||||||
|
|
|
@ -576,7 +576,7 @@ pub fn walk_except_handler<V: Transformer + ?Sized>(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn walk_arguments<V: Transformer + ?Sized>(visitor: &V, arguments: &mut Arguments) {
|
pub fn walk_arguments<V: Transformer + ?Sized>(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
|
// f(*args, a=2, *args2, **kwargs)`, but we follow Python in evaluating first `args` and then
|
||||||
// `keywords`. See also [Arguments::arguments_source_order`].
|
// `keywords`. See also [Arguments::arguments_source_order`].
|
||||||
for arg in &mut *arguments.args {
|
for arg in &mut *arguments.args {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# For tuple expression, the minimum binding power of star expression is bitwise or.
|
# 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)
|
(*x in y, z, *x in y)
|
||||||
(*not x, z, *not x)
|
(*not x, z, *not x)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1389,7 +1389,7 @@ X: bool = True
|
||||||
|
|
||||||
```py
|
```py
|
||||||
def f():
|
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 *
|
from exporter import *
|
||||||
|
|
||||||
# error: [unresolved-reference]
|
# error: [unresolved-reference]
|
||||||
|
|
|
@ -163,7 +163,7 @@ other
|
||||||
|
|
||||||
## Based on type inference
|
## 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,
|
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
|
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:
|
demonstrate this, since semantic index building is inherently single-module:
|
||||||
|
|
|
@ -1824,7 +1824,7 @@ where
|
||||||
// Save the state immediately *after* visiting the `try` block
|
// Save the state immediately *after* visiting the `try` block
|
||||||
// but *before* we prepare for visiting the `except` block(s).
|
// 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
|
// as there necessarily must have been 0 `except` blocks executed
|
||||||
// if we hit the `else` block.
|
// if we hit the `else` block.
|
||||||
let post_try_block_state = self.flow_snapshot();
|
let post_try_block_state = self.flow_snapshot();
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub(crate) struct CallArguments<'a>(Vec<Argument<'a>>);
|
||||||
|
|
||||||
impl<'a> CallArguments<'a> {
|
impl<'a> CallArguments<'a> {
|
||||||
/// Prepend an optional extra synthetic argument (for a `self` or `cls` parameter) to the front
|
/// 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.)
|
/// unmodified.)
|
||||||
pub(crate) fn with_self(&self, bound_self: Option<Type<'_>>) -> Cow<Self> {
|
pub(crate) fn with_self(&self, bound_self: Option<Type<'_>>) -> Cow<Self> {
|
||||||
if bound_self.is_some() {
|
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
|
/// 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.)
|
/// unmodified.)
|
||||||
pub(crate) fn with_self(&self, bound_self: Option<Type<'db>>) -> Cow<Self> {
|
pub(crate) fn with_self(&self, bound_self: Option<Type<'db>>) -> Cow<Self> {
|
||||||
if let Some(bound_self) = bound_self {
|
if let Some(bound_self) = bound_self {
|
||||||
|
|
|
@ -492,7 +492,7 @@ impl std::ops::DerefMut for DiagnosticGuard<'_, '_> {
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # 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
|
/// annotation, or if it has one and its file doesn't match the file
|
||||||
/// being type checked.
|
/// being type checked.
|
||||||
impl Drop for DiagnosticGuard<'_, '_> {
|
impl Drop for DiagnosticGuard<'_, '_> {
|
||||||
|
|
|
@ -8277,7 +8277,7 @@ impl<'db> TypeInferenceBuilder<'db> {
|
||||||
let callable_type = Type::Callable(callable_type);
|
let callable_type = Type::Callable(callable_type);
|
||||||
|
|
||||||
// `Signature` / `Parameters` are not a `Type` variant, so we're storing
|
// `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);
|
self.store_expression_type(arguments_slice, callable_type);
|
||||||
if let Some(first_argument) = first_argument {
|
if let Some(first_argument) = first_argument {
|
||||||
self.store_expression_type(first_argument, callable_type);
|
self.store_expression_type(first_argument, callable_type);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue