mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:34:57 +00:00
[ty] Minor: 'can not' => cannot (#20260)
This commit is contained in:
parent
a24a4b55ee
commit
7509d376eb
3 changed files with 5 additions and 5 deletions
|
@ -142,7 +142,7 @@ info: rule `invalid-key` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error[invalid-assignment]: Can not assign to key "id" on TypedDict `Employee`
|
||||
error[invalid-assignment]: Cannot assign to key "id" on TypedDict `Employee`
|
||||
--> src/mdtest_snippet.py:33:5
|
||||
|
|
||||
32 | def write_to_readonly_key(employee: Employee):
|
||||
|
|
|
@ -457,7 +457,7 @@ class Person(TypedDict, total=False):
|
|||
alice: Person = {"id": 1, "name": "Alice", "age": 30}
|
||||
alice["age"] = 31 # okay
|
||||
|
||||
# error: [invalid-assignment] "Can not assign to key "id" on TypedDict `Person`: key is marked read-only"
|
||||
# error: [invalid-assignment] "Cannot assign to key "id" on TypedDict `Person`: key is marked read-only"
|
||||
alice["id"] = 2
|
||||
```
|
||||
|
||||
|
@ -471,9 +471,9 @@ class Config(TypedDict):
|
|||
|
||||
config: Config = {"host": "localhost", "port": 8080}
|
||||
|
||||
# error: [invalid-assignment] "Can not assign to key "host" on TypedDict `Config`: key is marked read-only"
|
||||
# error: [invalid-assignment] "Cannot assign to key "host" on TypedDict `Config`: key is marked read-only"
|
||||
config["host"] = "127.0.0.1"
|
||||
# error: [invalid-assignment] "Can not assign to key "port" on TypedDict `Config`: key is marked read-only"
|
||||
# error: [invalid-assignment] "Cannot assign to key "port" on TypedDict `Config`: key is marked read-only"
|
||||
config["port"] = 80
|
||||
```
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ pub(super) fn validate_typed_dict_key_assignment<'db, 'ast>(
|
|||
let typed_dict_d = typed_dict_ty.display(db);
|
||||
|
||||
let mut diagnostic = builder.into_diagnostic(format_args!(
|
||||
"Can not assign to key \"{key}\" on TypedDict `{typed_dict_d}`",
|
||||
"Cannot assign to key \"{key}\" on TypedDict `{typed_dict_d}`",
|
||||
));
|
||||
|
||||
diagnostic.set_primary_message(format_args!("key is marked read-only"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue