mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-19 01:51:30 +00:00
Fixing more spelling errors (#16926)
## Summary Here I fix the last English spelling errors I could find in the repo. Again, I am trying not to touch variable/function names, or anything that might be misspelled in the API. The goal is to make this PR safe and easy to merge. ## Test Plan I have run all the unit tests. Though, again, all of the changes I make here are to docs and docstrings. I make no code changes, which I believe should greatly mitigate the testing concerns.
This commit is contained in:
parent
902d86e79e
commit
3899f7156f
8 changed files with 10 additions and 10 deletions
|
@ -697,10 +697,10 @@ class Base:
|
||||||
self.defined_in_init: str | None = "value in base"
|
self.defined_in_init: str | None = "value in base"
|
||||||
|
|
||||||
class Intermediate(Base):
|
class Intermediate(Base):
|
||||||
# Re-declaring base class attributes with the *same *type is fine:
|
# Redeclaring base class attributes with the *same *type is fine:
|
||||||
base_class_attribute_1: str | None = None
|
base_class_attribute_1: str | None = None
|
||||||
|
|
||||||
# Re-declaring them with a *narrower type* is unsound, because modifications
|
# Redeclaring them with a *narrower type* is unsound, because modifications
|
||||||
# through a `Base` reference could violate that constraint.
|
# through a `Base` reference could violate that constraint.
|
||||||
#
|
#
|
||||||
# Mypy does not report an error here, but pyright does: "… overrides symbol
|
# Mypy does not report an error here, but pyright does: "… overrides symbol
|
||||||
|
@ -712,7 +712,7 @@ class Intermediate(Base):
|
||||||
# TODO: This should be an error
|
# TODO: This should be an error
|
||||||
base_class_attribute_2: str
|
base_class_attribute_2: str
|
||||||
|
|
||||||
# Re-declaring attributes with a *wider type* directly violates LSP.
|
# Redeclaring attributes with a *wider type* directly violates LSP.
|
||||||
#
|
#
|
||||||
# In this case, both mypy and pyright report an error.
|
# In this case, both mypy and pyright report an error.
|
||||||
#
|
#
|
||||||
|
|
|
@ -222,7 +222,7 @@ reveal_type(X) # revealed: Unknown
|
||||||
### Only explicit re-exports are considered re-exported from `.pyi` files
|
### Only explicit re-exports are considered re-exported from `.pyi` files
|
||||||
|
|
||||||
For `.pyi` files, we should consider all imports private to the stub unless they are included in
|
For `.pyi` files, we should consider all imports private to the stub unless they are included in
|
||||||
`__all__` or use the explict `from foo import X as X` syntax.
|
`__all__` or use the explicit `from foo import X as X` syntax.
|
||||||
|
|
||||||
`a.pyi`:
|
`a.pyi`:
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Eager scopes
|
# Eager scopes
|
||||||
|
|
||||||
Some scopes are executed eagerly: references to variables defined in enclosing scopes are resolved
|
Some scopes are executed eagerly: references to variables defined in enclosing scopes are resolved
|
||||||
_immediately_. This is in constrast to (for instance) function scopes, where those references are
|
_immediately_. This is in contrast to (for instance) function scopes, where those references are
|
||||||
resolved when the function is called.
|
resolved when the function is called.
|
||||||
|
|
||||||
## Function definitions
|
## Function definitions
|
||||||
|
|
|
@ -17,7 +17,7 @@ reveal_type(Bar) # revealed: Literal[Bar]
|
||||||
reveal_type(Bar.__mro__) # revealed: tuple[Literal[Bar], Literal[Foo], Literal[object]]
|
reveal_type(Bar.__mro__) # revealed: tuple[Literal[Bar], Literal[Foo], Literal[object]]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Access to attributes declarated in stubs
|
## Access to attributes declared in stubs
|
||||||
|
|
||||||
Unlike regular Python modules, stub files often omit the right-hand side in declarations, including
|
Unlike regular Python modules, stub files often omit the right-hand side in declarations, including
|
||||||
in class scope. However, from the perspective of the type checker, we have to treat them as bindings
|
in class scope. However, from the perspective of the type checker, we have to treat them as bindings
|
||||||
|
|
|
@ -153,7 +153,7 @@ class MIMEPart(Message[_HeaderRegistryT, _HeaderRegistryParamT]):
|
||||||
def attach(self, payload: Self) -> None: ... # type: ignore[override]
|
def attach(self, payload: Self) -> None: ... # type: ignore[override]
|
||||||
# The attachments are created via type(self) in the attach method. It's theoretically
|
# The attachments are created via type(self) in the attach method. It's theoretically
|
||||||
# possible to sneak other attachment types into a MIMEPart instance, but could cause
|
# possible to sneak other attachment types into a MIMEPart instance, but could cause
|
||||||
# cause unforseen consequences.
|
# cause unforeseen consequences.
|
||||||
def iter_attachments(self) -> Iterator[Self]: ...
|
def iter_attachments(self) -> Iterator[Self]: ...
|
||||||
def iter_parts(self) -> Iterator[MIMEPart[_HeaderRegistryT]]: ...
|
def iter_parts(self) -> Iterator[MIMEPart[_HeaderRegistryT]]: ...
|
||||||
def get_content(self, *args: Any, content_manager: ContentManager | None = None, **kw: Any) -> Any: ...
|
def get_content(self, *args: Any, content_manager: ContentManager | None = None, **kw: Any) -> Any: ...
|
||||||
|
|
|
@ -197,7 +197,7 @@ def test_index_with_attribute():
|
||||||
ds["Foo"] = ds.Foo + 2.0
|
ds["Foo"] = ds.Foo + 2.0
|
||||||
assert (
|
assert (
|
||||||
ds["Foo"] is ds.Foo
|
ds["Foo"] is ds.Foo
|
||||||
) # This is now modfied, but both methods points to the same object
|
) # This is now modified, but both methods points to the same object
|
||||||
|
|
||||||
|
|
||||||
def test_getitem_time(ds3):
|
def test_getitem_time(ds3):
|
||||||
|
|
|
@ -894,7 +894,7 @@ struct PrinterState<'a> {
|
||||||
line_suffixes: LineSuffixes<'a>,
|
line_suffixes: LineSuffixes<'a>,
|
||||||
verbatim_markers: Vec<TextRange>,
|
verbatim_markers: Vec<TextRange>,
|
||||||
group_modes: GroupModes,
|
group_modes: GroupModes,
|
||||||
// Re-used queue to measure if a group fits. Optimisation to avoid re-allocating a new
|
// Reused queue to measure if a group fits. Optimisation to avoid re-allocating a new
|
||||||
// vec every time a group gets measured
|
// vec every time a group gets measured
|
||||||
fits_stack: Vec<StackFrame>,
|
fits_stack: Vec<StackFrame>,
|
||||||
fits_queue: Vec<std::slice::Iter<'a, FormatElement>>,
|
fits_queue: Vec<std::slice::Iter<'a, FormatElement>>,
|
||||||
|
|
|
@ -3124,7 +3124,7 @@ lambda: fu
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn redefined_by_gen_exp() {
|
fn redefined_by_gen_exp() {
|
||||||
// Re-using a global name as the loop variable for a generator
|
// Reusing a global name as the loop variable for a generator
|
||||||
// expression results in a redefinition warning.
|
// expression results in a redefinition warning.
|
||||||
flakes(
|
flakes(
|
||||||
"import fu; (1 for fu in range(1))",
|
"import fu; (1 for fu in range(1))",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue