[pyflakes] Add fix safety section to docs (F601, F602) (#17440)

## Summary

add fix safety section to repeated_keys_docs, for #15584

---------

Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
This commit is contained in:
Hans 2025-04-19 02:27:40 +08:00 committed by GitHub
parent c550b4d565
commit fd3fc34a9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,6 +40,12 @@ use crate::registry::Rule;
/// foo["baz"] # 2
/// ```
///
/// ## Fix safety
///
/// This rule's fix is marked as unsafe because removing a repeated dictionary key
/// may delete comments that are attached to the removed key-value pair. This can also change
/// the program's behavior if the value expressions have side effects.
///
/// ## References
/// - [Python documentation: Dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries)
#[derive(ViolationMetadata)]
@ -106,6 +112,12 @@ impl Violation for MultiValueRepeatedKeyLiteral {
/// foo[baz] # 2
/// ```
///
/// ## Fix safety
///
/// This rule's fix is marked as unsafe because removing a repeated dictionary key
/// may delete comments that are attached to the removed key-value pair. This can also change
/// the program's behavior if the value expressions have side effects.
///
/// ## References
/// - [Python documentation: Dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries)
#[derive(ViolationMetadata)]