[ty] Minor: 'can not' => cannot (#20260)

This commit is contained in:
David Peter 2025-09-05 09:19:14 +02:00 committed by GitHub
parent a24a4b55ee
commit 7509d376eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View file

@ -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):

View file

@ -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
```

View file

@ -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"));