mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-11 10:22:29 +08:00
Enable Ruff SIM (#13309)
This commit is contained in:
+29
-5
@@ -55,11 +55,6 @@ select = [
|
||||
"W", # pycodestyle Warning
|
||||
# Only include flake8-annotations rules that are autofixable. Otherwise leave this to mypy+pyright
|
||||
"ANN2",
|
||||
# Don't include TC rules that create a TYPE_CHECKING block or stringifies annotations
|
||||
"TC004", # Move import `{qualified_name}` out of type-checking block. Import is used for more than type hinting.
|
||||
"TC005", # Found empty type-checking block
|
||||
# "TC008", # TODO: Enable when out of preview
|
||||
"TC010", # Invalid string member in `X | Y`-style union type
|
||||
# Most refurb rules are in preview and can be opinionated,
|
||||
# consider them individually as they come out of preview (last check: 0.8.4)
|
||||
"FURB105", # Unnecessary empty string passed to `print`
|
||||
@@ -94,6 +89,35 @@ select = [
|
||||
# "PYI061", # TODO: Enable when out of preview
|
||||
"PYI062", # Duplicate literal member `{}`
|
||||
"PYI064", # `Final[Literal[{literal}]]` can be replaced with a bare Final
|
||||
# flake8-simplify, excluding rules that can reduce performance or readability due to long line formatting
|
||||
"SIM101", # Multiple `isinstance` calls for `{name}`, merge into a single call
|
||||
"SIM103", # Return the condition `{condition}` directly
|
||||
"SIM107", # Don't use return in `try-except` and `finally`
|
||||
"SIM109", # Use `{replacement}` instead of multiple equality comparisons
|
||||
"SIM112", # Use capitalized environment variable `{expected}` instead of `{actual}`
|
||||
"SIM113", # Use `enumerate()` for index variable `{index}` in `for` loop
|
||||
"SIM114", # Combine `if` branches using logical `or` operator
|
||||
"SIM115", # Use a context manager for opening files
|
||||
"SIM118", # Use key `{operator}` dict instead of key `{operator} dict.keys()`
|
||||
"SIM201", # Use `{left} != {right}` instead of not `{left} == {right}`
|
||||
"SIM202", # Use `{left} == {right}` instead of not `{left} != {right}`
|
||||
"SIM208", # Use `{expr}` instead of `not (not {expr})`
|
||||
"SIM210", # Remove unnecessary `True if ... else False`
|
||||
"SIM211", # Use `not ...` instead of `False if ... else True`
|
||||
"SIM212", # Use `{expr_else} if {expr_else} else {expr_body}` instead of `{expr_body} if not {expr_else} else {expr_else}`
|
||||
"SIM220", # Use `False` instead of `{name} and not {name}`
|
||||
"SIM221", # Use `True` instead of `{name} or not {name}`
|
||||
"SIM222", # Use `{expr}` instead of `{replaced}`
|
||||
"SIM223", # Use `{expr}` instead of `{replaced}`
|
||||
"SIM300", # Yoda condition detected
|
||||
"SIM401", # Use `{contents}` instead of an if block
|
||||
"SIM910", # Use `{expected}` instead of `{actual}` (dict-get-with-none-default)
|
||||
"SIM911", # Use `{expected}` instead of `{actual}` (zip-dict-keys-and-values)
|
||||
# Don't include TC rules that create a TYPE_CHECKING block or stringifies annotations
|
||||
"TC004", # Move import `{qualified_name}` out of type-checking block. Import is used for more than type hinting.
|
||||
"TC005", # Found empty type-checking block
|
||||
# "TC008", # TODO: Enable when out of preview
|
||||
"TC010", # Invalid string member in `X | Y`-style union type
|
||||
]
|
||||
extend-safe-fixes = [
|
||||
"UP036", # Remove unnecessary `sys.version_info` blocks
|
||||
|
||||
@@ -410,93 +410,6 @@ if sys.platform == "win32":
|
||||
"WindowsSelectorEventLoopPolicy", # from windows_events
|
||||
"WindowsProactorEventLoopPolicy", # from windows_events
|
||||
)
|
||||
elif sys.version_info >= (3, 10):
|
||||
__all__ = (
|
||||
"BaseEventLoop", # from base_events
|
||||
"Server", # from base_events
|
||||
"coroutine", # from coroutines
|
||||
"iscoroutinefunction", # from coroutines
|
||||
"iscoroutine", # from coroutines
|
||||
"AbstractEventLoopPolicy", # from events
|
||||
"AbstractEventLoop", # from events
|
||||
"AbstractServer", # from events
|
||||
"Handle", # from events
|
||||
"TimerHandle", # from events
|
||||
"get_event_loop_policy", # from events
|
||||
"set_event_loop_policy", # from events
|
||||
"get_event_loop", # from events
|
||||
"set_event_loop", # from events
|
||||
"new_event_loop", # from events
|
||||
"get_child_watcher", # from events
|
||||
"set_child_watcher", # from events
|
||||
"_set_running_loop", # from events
|
||||
"get_running_loop", # from events
|
||||
"_get_running_loop", # from events
|
||||
"CancelledError", # from exceptions
|
||||
"InvalidStateError", # from exceptions
|
||||
"TimeoutError", # from exceptions
|
||||
"IncompleteReadError", # from exceptions
|
||||
"LimitOverrunError", # from exceptions
|
||||
"SendfileNotAvailableError", # from exceptions
|
||||
"Future", # from futures
|
||||
"wrap_future", # from futures
|
||||
"isfuture", # from futures
|
||||
"Lock", # from locks
|
||||
"Event", # from locks
|
||||
"Condition", # from locks
|
||||
"Semaphore", # from locks
|
||||
"BoundedSemaphore", # from locks
|
||||
"BaseProtocol", # from protocols
|
||||
"Protocol", # from protocols
|
||||
"DatagramProtocol", # from protocols
|
||||
"SubprocessProtocol", # from protocols
|
||||
"BufferedProtocol", # from protocols
|
||||
"run", # from runners
|
||||
"Queue", # from queues
|
||||
"PriorityQueue", # from queues
|
||||
"LifoQueue", # from queues
|
||||
"QueueFull", # from queues
|
||||
"QueueEmpty", # from queues
|
||||
"StreamReader", # from streams
|
||||
"StreamWriter", # from streams
|
||||
"StreamReaderProtocol", # from streams
|
||||
"open_connection", # from streams
|
||||
"start_server", # from streams
|
||||
"create_subprocess_exec", # from subprocess
|
||||
"create_subprocess_shell", # from subprocess
|
||||
"Task", # from tasks
|
||||
"create_task", # from tasks
|
||||
"FIRST_COMPLETED", # from tasks
|
||||
"FIRST_EXCEPTION", # from tasks
|
||||
"ALL_COMPLETED", # from tasks
|
||||
"wait", # from tasks
|
||||
"wait_for", # from tasks
|
||||
"as_completed", # from tasks
|
||||
"sleep", # from tasks
|
||||
"gather", # from tasks
|
||||
"shield", # from tasks
|
||||
"ensure_future", # from tasks
|
||||
"run_coroutine_threadsafe", # from tasks
|
||||
"current_task", # from tasks
|
||||
"all_tasks", # from tasks
|
||||
"_register_task", # from tasks
|
||||
"_unregister_task", # from tasks
|
||||
"_enter_task", # from tasks
|
||||
"_leave_task", # from tasks
|
||||
"to_thread", # from threads
|
||||
"BaseTransport", # from transports
|
||||
"ReadTransport", # from transports
|
||||
"WriteTransport", # from transports
|
||||
"Transport", # from transports
|
||||
"DatagramTransport", # from transports
|
||||
"SubprocessTransport", # from transports
|
||||
"SelectorEventLoop", # from windows_events
|
||||
"ProactorEventLoop", # from windows_events
|
||||
"IocpProactor", # from windows_events
|
||||
"DefaultEventLoopPolicy", # from windows_events
|
||||
"WindowsSelectorEventLoopPolicy", # from windows_events
|
||||
"WindowsProactorEventLoopPolicy", # from windows_events
|
||||
)
|
||||
elif sys.version_info >= (3, 9):
|
||||
__all__ = (
|
||||
"BaseEventLoop", # from base_events
|
||||
@@ -1059,97 +972,6 @@ else:
|
||||
"ThreadedChildWatcher", # from unix_events
|
||||
"DefaultEventLoopPolicy", # from unix_events
|
||||
)
|
||||
elif sys.version_info >= (3, 10):
|
||||
__all__ = (
|
||||
"BaseEventLoop", # from base_events
|
||||
"Server", # from base_events
|
||||
"coroutine", # from coroutines
|
||||
"iscoroutinefunction", # from coroutines
|
||||
"iscoroutine", # from coroutines
|
||||
"AbstractEventLoopPolicy", # from events
|
||||
"AbstractEventLoop", # from events
|
||||
"AbstractServer", # from events
|
||||
"Handle", # from events
|
||||
"TimerHandle", # from events
|
||||
"get_event_loop_policy", # from events
|
||||
"set_event_loop_policy", # from events
|
||||
"get_event_loop", # from events
|
||||
"set_event_loop", # from events
|
||||
"new_event_loop", # from events
|
||||
"get_child_watcher", # from events
|
||||
"set_child_watcher", # from events
|
||||
"_set_running_loop", # from events
|
||||
"get_running_loop", # from events
|
||||
"_get_running_loop", # from events
|
||||
"CancelledError", # from exceptions
|
||||
"InvalidStateError", # from exceptions
|
||||
"TimeoutError", # from exceptions
|
||||
"IncompleteReadError", # from exceptions
|
||||
"LimitOverrunError", # from exceptions
|
||||
"SendfileNotAvailableError", # from exceptions
|
||||
"Future", # from futures
|
||||
"wrap_future", # from futures
|
||||
"isfuture", # from futures
|
||||
"Lock", # from locks
|
||||
"Event", # from locks
|
||||
"Condition", # from locks
|
||||
"Semaphore", # from locks
|
||||
"BoundedSemaphore", # from locks
|
||||
"BaseProtocol", # from protocols
|
||||
"Protocol", # from protocols
|
||||
"DatagramProtocol", # from protocols
|
||||
"SubprocessProtocol", # from protocols
|
||||
"BufferedProtocol", # from protocols
|
||||
"run", # from runners
|
||||
"Queue", # from queues
|
||||
"PriorityQueue", # from queues
|
||||
"LifoQueue", # from queues
|
||||
"QueueFull", # from queues
|
||||
"QueueEmpty", # from queues
|
||||
"StreamReader", # from streams
|
||||
"StreamWriter", # from streams
|
||||
"StreamReaderProtocol", # from streams
|
||||
"open_connection", # from streams
|
||||
"start_server", # from streams
|
||||
"open_unix_connection", # from streams
|
||||
"start_unix_server", # from streams
|
||||
"create_subprocess_exec", # from subprocess
|
||||
"create_subprocess_shell", # from subprocess
|
||||
"Task", # from tasks
|
||||
"create_task", # from tasks
|
||||
"FIRST_COMPLETED", # from tasks
|
||||
"FIRST_EXCEPTION", # from tasks
|
||||
"ALL_COMPLETED", # from tasks
|
||||
"wait", # from tasks
|
||||
"wait_for", # from tasks
|
||||
"as_completed", # from tasks
|
||||
"sleep", # from tasks
|
||||
"gather", # from tasks
|
||||
"shield", # from tasks
|
||||
"ensure_future", # from tasks
|
||||
"run_coroutine_threadsafe", # from tasks
|
||||
"current_task", # from tasks
|
||||
"all_tasks", # from tasks
|
||||
"_register_task", # from tasks
|
||||
"_unregister_task", # from tasks
|
||||
"_enter_task", # from tasks
|
||||
"_leave_task", # from tasks
|
||||
"to_thread", # from threads
|
||||
"BaseTransport", # from transports
|
||||
"ReadTransport", # from transports
|
||||
"WriteTransport", # from transports
|
||||
"Transport", # from transports
|
||||
"DatagramTransport", # from transports
|
||||
"SubprocessTransport", # from transports
|
||||
"SelectorEventLoop", # from unix_events
|
||||
"AbstractChildWatcher", # from unix_events
|
||||
"SafeChildWatcher", # from unix_events
|
||||
"FastChildWatcher", # from unix_events
|
||||
"PidfdChildWatcher", # from unix_events
|
||||
"MultiLoopChildWatcher", # from unix_events
|
||||
"ThreadedChildWatcher", # from unix_events
|
||||
"DefaultEventLoopPolicy", # from unix_events
|
||||
)
|
||||
elif sys.version_info >= (3, 9):
|
||||
__all__ = (
|
||||
"BaseEventLoop", # from base_events
|
||||
|
||||
Reference in New Issue
Block a user