Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 30e6ce7

Browse files
chore(deps): update dependency ruff to v0.3.4 (#932)
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://docs.astral.sh/ruff) ([source](https://togithub.com/astral-sh/ruff), [changelog](https://togithub.com/astral-sh/ruff/blob/main/CHANGELOG.md)) | `==0.2.1` -> `==0.3.4` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.3.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.3.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.2.1/0.3.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.2.1/0.3.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.3.4`](https://togithub.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#034) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.3.3...v0.3.4) ##### Preview features - \[`flake8-simplify`] Detect implicit `else` cases in `needless-bool` (`SIM103`) ([#&#8203;10414](https://togithub.com/astral-sh/ruff/pull/10414)) - \[`pylint`] Implement `nan-comparison` (`PLW0117`) ([#&#8203;10401](https://togithub.com/astral-sh/ruff/pull/10401)) - \[`pylint`] Implement `nonlocal-and-global` (`E115`) ([#&#8203;10407](https://togithub.com/astral-sh/ruff/pull/10407)) - \[`pylint`] Implement `singledispatchmethod-function` (`PLE5120`) ([#&#8203;10428](https://togithub.com/astral-sh/ruff/pull/10428)) - \[`refurb`] Implement `list-reverse-copy` (`FURB187`) ([#&#8203;10212](https://togithub.com/astral-sh/ruff/pull/10212)) ##### Rule changes - \[`flake8-pytest-style`] Add automatic fix for `pytest-parametrize-values-wrong-type` (`PT007`) ([#&#8203;10461](https://togithub.com/astral-sh/ruff/pull/10461)) - \[`pycodestyle`] Allow SPDX license headers to exceed the line length (`E501`) ([#&#8203;10481](https://togithub.com/astral-sh/ruff/pull/10481)) ##### Formatter - Fix unstable formatting for trailing subscript end-of-line comment ([#&#8203;10492](https://togithub.com/astral-sh/ruff/pull/10492)) ##### Bug fixes - Avoid code comment detection in PEP 723 script tags ([#&#8203;10464](https://togithub.com/astral-sh/ruff/pull/10464)) - Avoid incorrect tuple transformation in single-element case (`C409`) ([#&#8203;10491](https://togithub.com/astral-sh/ruff/pull/10491)) - Bug fix: Prevent fully defined links [`name`](link) from being reformatted ([#&#8203;10442](https://togithub.com/astral-sh/ruff/pull/10442)) - Consider raw source code for `W605` ([#&#8203;10480](https://togithub.com/astral-sh/ruff/pull/10480)) - Docs: Link inline settings when not part of options section ([#&#8203;10499](https://togithub.com/astral-sh/ruff/pull/10499)) - Don't treat annotations as redefinitions in `.pyi` files ([#&#8203;10512](https://togithub.com/astral-sh/ruff/pull/10512)) - Fix `E231` bug: Inconsistent catch compared to pycodestyle, such as when dict nested in list ([#&#8203;10469](https://togithub.com/astral-sh/ruff/pull/10469)) - Fix pylint upstream categories not showing in docs ([#&#8203;10441](https://togithub.com/astral-sh/ruff/pull/10441)) - Add missing `Options` references to blank line docs ([#&#8203;10498](https://togithub.com/astral-sh/ruff/pull/10498)) - 'Revert "F821: Fix false negatives in .py files when `from __future__ import annotations` is active ([#&#8203;10362](https://togithub.com/astral-sh/ruff/issues/10362))"' ([#&#8203;10513](https://togithub.com/astral-sh/ruff/pull/10513)) - Apply NFKC normalization to unicode identifiers in the lexer ([#&#8203;10412](https://togithub.com/astral-sh/ruff/pull/10412)) - Avoid failures due to non-deterministic binding ordering ([#&#8203;10478](https://togithub.com/astral-sh/ruff/pull/10478)) - \[`flake8-bugbear`] Allow tuples of exceptions (`B030`) ([#&#8203;10437](https://togithub.com/astral-sh/ruff/pull/10437)) - \[`flake8-quotes`] Avoid syntax errors due to invalid quotes (`Q000, Q002`) ([#&#8203;10199](https://togithub.com/astral-sh/ruff/pull/10199)) ### [`v0.3.3`](https://togithub.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#033) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.3.2...v0.3.3) ##### Preview features - \[`flake8-bandit`]: Implement `S610` rule ([#&#8203;10316](https://togithub.com/astral-sh/ruff/pull/10316)) - \[`pycodestyle`] Implement `blank-line-at-end-of-file` (`W391`) ([#&#8203;10243](https://togithub.com/astral-sh/ruff/pull/10243)) - \[`pycodestyle`] Implement `redundant-backslash` (`E502`) ([#&#8203;10292](https://togithub.com/astral-sh/ruff/pull/10292)) - \[`pylint`] - implement `redeclared-assigned-name` (`W0128`) ([#&#8203;9268](https://togithub.com/astral-sh/ruff/pull/9268)) ##### Rule changes - \[`flake8_comprehensions`] Handled special case for `C400` which also matches `C416` ([#&#8203;10419](https://togithub.com/astral-sh/ruff/pull/10419)) - \[`flake8-bandit`] Implement upstream updates for `S311`, `S324` and `S605` ([#&#8203;10313](https://togithub.com/astral-sh/ruff/pull/10313)) - \[`pyflakes`] Remove `F401` fix for `__init__` imports by default and allow opt-in to unsafe fix ([#&#8203;10365](https://togithub.com/astral-sh/ruff/pull/10365)) - \[`pylint`] Implement `invalid-bool-return-type` (`E304`) ([#&#8203;10377](https://togithub.com/astral-sh/ruff/pull/10377)) - \[`pylint`] Include builtin warnings in useless-exception-statement (`PLW0133`) ([#&#8203;10394](https://togithub.com/astral-sh/ruff/pull/10394)) ##### CLI - Add message on success to `ruff check` ([#&#8203;8631](https://togithub.com/astral-sh/ruff/pull/8631)) ##### Bug fixes - \[`PIE970`] Allow trailing ellipsis in `typing.TYPE_CHECKING` ([#&#8203;10413](https://togithub.com/astral-sh/ruff/pull/10413)) - Avoid `TRIO115` if the argument is a variable ([#&#8203;10376](https://togithub.com/astral-sh/ruff/pull/10376)) - \[`F811`] Avoid removing shadowed imports that point to different symbols ([#&#8203;10387](https://togithub.com/astral-sh/ruff/pull/10387)) - Fix `F821` and `F822` false positives in `.pyi` files ([#&#8203;10341](https://togithub.com/astral-sh/ruff/pull/10341)) - Fix `F821` false negatives in `.py` files when `from __future__ import annotations` is active ([#&#8203;10362](https://togithub.com/astral-sh/ruff/pull/10362)) - Fix case where `Indexer` fails to identify continuation preceded by newline [#&#8203;10351](https://togithub.com/astral-sh/ruff/issues/10351) ([#&#8203;10354](https://togithub.com/astral-sh/ruff/pull/10354)) - Sort hash maps in `Settings` display ([#&#8203;10370](https://togithub.com/astral-sh/ruff/pull/10370)) - Track conditional deletions in the semantic model ([#&#8203;10415](https://togithub.com/astral-sh/ruff/pull/10415)) - \[`C413`] Wrap expressions in parentheses when negating ([#&#8203;10346](https://togithub.com/astral-sh/ruff/pull/10346)) - \[`pycodestyle`] Do not ignore lines before the first logical line in blank lines rules. ([#&#8203;10382](https://togithub.com/astral-sh/ruff/pull/10382)) - \[`pycodestyle`] Do not trigger `E225` and `E275` when the next token is a ')' ([#&#8203;10315](https://togithub.com/astral-sh/ruff/pull/10315)) - \[`pylint`] Avoid false-positive slot non-assignment for `__dict__` (`PLE0237`) ([#&#8203;10348](https://togithub.com/astral-sh/ruff/pull/10348)) - Gate f-string struct size test for Rustc < 1.76 ([#&#8203;10371](https://togithub.com/astral-sh/ruff/pull/10371)) ##### Documentation - Use `ruff.toml` format in README ([#&#8203;10393](https://togithub.com/astral-sh/ruff/pull/10393)) - \[`RUF008`] Make it clearer that a mutable default in a dataclass is only valid if it is typed as a ClassVar ([#&#8203;10395](https://togithub.com/astral-sh/ruff/pull/10395)) - \[`pylint`] Extend docs and test in `invalid-str-return-type` (`E307`) ([#&#8203;10400](https://togithub.com/astral-sh/ruff/pull/10400)) - Remove `.` from `check` and `format` commands ([#&#8203;10217](https://togithub.com/astral-sh/ruff/pull/10217)) ### [`v0.3.2`](https://togithub.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#032) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.3.1...v0.3.2) ##### Preview features - Improve single-`with` item formatting for Python 3.8 or older ([#&#8203;10276](https://togithub.com/astral-sh/ruff/pull/10276)) ##### Rule changes - \[`pyupgrade`] Allow fixes for f-string rule regardless of line length (`UP032`) ([#&#8203;10263](https://togithub.com/astral-sh/ruff/pull/10263)) - \[`pycodestyle`] Include actual conditions in E712 diagnostics ([#&#8203;10254](https://togithub.com/astral-sh/ruff/pull/10254)) ##### Bug fixes - Fix trailing kwargs end of line comment after slash ([#&#8203;10297](https://togithub.com/astral-sh/ruff/pull/10297)) - Fix unstable `with` items formatting ([#&#8203;10274](https://togithub.com/astral-sh/ruff/pull/10274)) - Avoid repeating function calls in f-string conversions ([#&#8203;10265](https://togithub.com/astral-sh/ruff/pull/10265)) - Fix E203 false positive for slices in format strings ([#&#8203;10280](https://togithub.com/astral-sh/ruff/pull/10280)) - Fix incorrect `Parameter` range for `*args` and `**kwargs` ([#&#8203;10283](https://togithub.com/astral-sh/ruff/pull/10283)) - Treat `typing.Annotated` subscripts as type definitions ([#&#8203;10285](https://togithub.com/astral-sh/ruff/pull/10285)) ### [`v0.3.1`](https://togithub.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#031) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.3.0...v0.3.1) ##### Preview features - \[`pycodestyle`] Fix E301 not triggering on decorated methods. ([#&#8203;10117](https://togithub.com/astral-sh/ruff/pull/10117)) - \[`pycodestyle`] Respect `isort` settings in blank line rules (`E3*`) ([#&#8203;10096](https://togithub.com/astral-sh/ruff/pull/10096)) - \[`pycodestyle`] Make blank lines in typing stub files optional (`E3*`) ([#&#8203;10098](https://togithub.com/astral-sh/ruff/pull/10098)) - \[`pylint`] Implement `singledispatch-method` (`E1519`) ([#&#8203;10140](https://togithub.com/astral-sh/ruff/pull/10140)) - \[`pylint`] Implement `useless-exception-statement` (`W0133`) ([#&#8203;10176](https://togithub.com/astral-sh/ruff/pull/10176)) ##### Rule changes - \[`flake8-debugger`] Check for use of `debugpy` and `ptvsd` debug modules ([#&#8203;10177](https://togithub.com/astral-sh/ruff/issues/10177)) ([#&#8203;10194](https://togithub.com/astral-sh/ruff/pull/10194)) - \[`pyupgrade`] Generate diagnostic for all valid f-string conversions regardless of line length (`UP032`) ([#&#8203;10238](https://togithub.com/astral-sh/ruff/pull/10238)) - \[`pep8_naming`] Add fixes for `N804` and `N805` ([#&#8203;10215](https://togithub.com/astral-sh/ruff/pull/10215)) ##### CLI - Colorize the output of `ruff format --diff` ([#&#8203;10110](https://togithub.com/astral-sh/ruff/pull/10110)) - Make `--config` and `--isolated` global flags ([#&#8203;10150](https://togithub.com/astral-sh/ruff/pull/10150)) - Correctly expand tildes and environment variables in paths passed to `--config` ([#&#8203;10219](https://togithub.com/astral-sh/ruff/pull/10219)) ##### Configuration - Accept a PEP 440 version specifier for `required-version` ([#&#8203;10216](https://togithub.com/astral-sh/ruff/pull/10216)) - Implement isort's `default-section` setting ([#&#8203;10149](https://togithub.com/astral-sh/ruff/pull/10149)) ##### Bug fixes - Remove trailing space from `CapWords` message ([#&#8203;10220](https://togithub.com/astral-sh/ruff/pull/10220)) - Respect external codes in file-level exemptions ([#&#8203;10203](https://togithub.com/astral-sh/ruff/pull/10203)) - \[`flake8-raise`] Avoid false-positives for parens-on-raise with `future.exception()` (`RSE102`) ([#&#8203;10206](https://togithub.com/astral-sh/ruff/pull/10206)) - \[`pylint`] Add fix for unary expressions in `PLC2801` ([#&#8203;9587](https://togithub.com/astral-sh/ruff/pull/9587)) - \[`ruff`] Fix RUF028 not allowing `# fmt: skip` on match cases ([#&#8203;10178](https://togithub.com/astral-sh/ruff/pull/10178)) ### [`v0.3.0`](https://togithub.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#030) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.2.2...v0.3.0) This release introduces the new Ruff formatter 2024.2 style and adds a new lint rule to detect invalid formatter suppression comments. ##### Preview features - \[`flake8-bandit`] Remove suspicious-lxml-import (`S410`) ([#&#8203;10154](https://togithub.com/astral-sh/ruff/pull/10154)) - \[`pycodestyle`] Allow `os.environ` modifications between imports (`E402`) ([#&#8203;10066](https://togithub.com/astral-sh/ruff/pull/10066)) - \[`pycodestyle`] Don't warn about a single whitespace character before a comma in a tuple (`E203`) ([#&#8203;10094](https://togithub.com/astral-sh/ruff/pull/10094)) ##### Rule changes - \[`eradicate`] Detect commented out `case` statements (`ERA001`) ([#&#8203;10055](https://togithub.com/astral-sh/ruff/pull/10055)) - \[`eradicate`] Detect single-line code for `try:`, `except:`, etc. (`ERA001`) ([#&#8203;10057](https://togithub.com/astral-sh/ruff/pull/10057)) - \[`flake8-boolean-trap`] Allow boolean positionals in `__post_init__` ([#&#8203;10027](https://togithub.com/astral-sh/ruff/pull/10027)) - \[`flake8-copyright`] Allow © in copyright notices ([#&#8203;10065](https://togithub.com/astral-sh/ruff/pull/10065)) - \[`isort`]: Use one blank line after imports in typing stub files ([#&#8203;9971](https://togithub.com/astral-sh/ruff/pull/9971)) - \[`pylint`] New Rule `dict-iter-missing-items` (`PLE1141`) ([#&#8203;9845](https://togithub.com/astral-sh/ruff/pull/9845)) - \[`pylint`] Ignore `sys.version` and `sys.platform` (`PLR1714`) ([#&#8203;10054](https://togithub.com/astral-sh/ruff/pull/10054)) - \[`pyupgrade`] Detect literals with unary operators (`UP018`) ([#&#8203;10060](https://togithub.com/astral-sh/ruff/pull/10060)) - \[`ruff`] Expand rule for `list(iterable).pop(0)` idiom (`RUF015`) ([#&#8203;10148](https://togithub.com/astral-sh/ruff/pull/10148)) ##### Formatter This release introduces the Ruff 2024.2 style, stabilizing the following changes: - Prefer splitting the assignment's value over the target or type annotation ([#&#8203;8943](https://togithub.com/astral-sh/ruff/pull/8943)) - Remove blank lines before class docstrings ([#&#8203;9154](https://togithub.com/astral-sh/ruff/pull/9154)) - Wrap multiple context managers in `with` parentheses when targeting Python 3.9 or newer ([#&#8203;9222](https://togithub.com/astral-sh/ruff/pull/9222)) - Add a blank line after nested classes with a dummy body (`...`) in typing stub files ([#&#8203;9155](https://togithub.com/astral-sh/ruff/pull/9155)) - Reduce vertical spacing for classes and functions with a dummy (`...`) body ([#&#8203;7440](https://togithub.com/astral-sh/ruff/issues/7440), [#&#8203;9240](https://togithub.com/astral-sh/ruff/pull/9240)) - Add a blank line after the module docstring ([#&#8203;8283](https://togithub.com/astral-sh/ruff/pull/8283)) - Parenthesize long type hints in assignments ([#&#8203;9210](https://togithub.com/astral-sh/ruff/pull/9210)) - Preserve indent for single multiline-string call-expressions ([#&#8203;9673](https://togithub.com/astral-sh/ruff/pull/9637)) - Normalize hex escape and unicode escape sequences ([#&#8203;9280](https://togithub.com/astral-sh/ruff/pull/9280)) - Format module docstrings ([#&#8203;9725](https://togithub.com/astral-sh/ruff/pull/9725)) ##### CLI - Explicitly disallow `extend` as part of a `--config` flag ([#&#8203;10135](https://togithub.com/astral-sh/ruff/pull/10135)) - Remove `build` from the default exclusion list ([#&#8203;10093](https://togithub.com/astral-sh/ruff/pull/10093)) - Deprecate `ruff <path>`, `ruff --explain`, `ruff --clean`, and `ruff --generate-shell-completion` in favor of `ruff check <path>`, `ruff rule`, `ruff clean`, and `ruff generate-shell-completion` ([#&#8203;10169](https://togithub.com/astral-sh/ruff/pull/10169)) - Remove the deprecated CLI option `--format` from `ruff rule` and `ruff linter` ([#&#8203;10170](https://togithub.com/astral-sh/ruff/pull/10170)) ##### Bug fixes - \[`flake8-bugbear`] Avoid adding default initializers to stubs (`B006`) ([#&#8203;10152](https://togithub.com/astral-sh/ruff/pull/10152)) - \[`flake8-type-checking`] Respect runtime-required decorators for function signatures ([#&#8203;10091](https://togithub.com/astral-sh/ruff/pull/10091)) - \[`pycodestyle`] Mark fixes overlapping with a multiline string as unsafe (`W293`) ([#&#8203;10049](https://togithub.com/astral-sh/ruff/pull/10049)) - \[`pydocstyle`] Trim whitespace when removing blank lines after section (`D413`) ([#&#8203;10162](https://togithub.com/astral-sh/ruff/pull/10162)) - \[`pylint`] Delete entire statement, including semicolons (`PLR0203`) ([#&#8203;10074](https://togithub.com/astral-sh/ruff/pull/10074)) - \[`ruff`] Avoid f-string false positives in `gettext` calls (`RUF027`) ([#&#8203;10118](https://togithub.com/astral-sh/ruff/pull/10118)) - Fix `ruff` crashing on PowerPC systems because of too small page size ([#&#8203;10080](https://togithub.com/astral-sh/ruff/pull/10080)) ##### Performance - Add cold attribute to less likely printer queue branches in the formatter ([#&#8203;10121](https://togithub.com/astral-sh/ruff/pull/10121)) - Skip unnecessary string normalization in the formatter ([#&#8203;10116](https://togithub.com/astral-sh/ruff/pull/10116)) ##### Documentation - Remove "Beta" Label from formatter documentation ([#&#8203;10144](https://togithub.com/astral-sh/ruff/pull/10144)) - `line-length` option: fix link to `pycodestyle.max-line-length` ([#&#8203;10136](https://togithub.com/astral-sh/ruff/pull/10136)) ### [`v0.2.2`](https://togithub.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#022) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.2.1...v0.2.2) Highlights include: - Initial support formatting f-strings (in `--preview`). - Support for overriding arbitrary configuration options via the CLI through an expanded `--config` argument (e.g., `--config "lint.isort.combine-as-imports=false"`). - Significant performance improvements in Ruff's lexer, parser, and lint rules. ##### Preview features - Implement minimal f-string formatting ([#&#8203;9642](https://togithub.com/astral-sh/ruff/pull/9642)) - \[`pycodestyle`] Add blank line(s) rules (`E301`, `E302`, `E303`, `E304`, `E305`, `E306`) ([#&#8203;9266](https://togithub.com/astral-sh/ruff/pull/9266)) - \[`refurb`] Implement `readlines_in_for` (`FURB129`) ([#&#8203;9880](https://togithub.com/astral-sh/ruff/pull/9880)) ##### Rule changes - \[`ruff`] Ensure closing parentheses for multiline sequences are always on their own line (`RUF022`, `RUF023`) ([#&#8203;9793](https://togithub.com/astral-sh/ruff/pull/9793)) - \[`numpy`] Add missing deprecation violations (`NPY002`) ([#&#8203;9862](https://togithub.com/astral-sh/ruff/pull/9862)) - \[`flake8-bandit`] Detect `mark_safe` usages in decorators ([#&#8203;9887](https://togithub.com/astral-sh/ruff/pull/9887)) - \[`ruff`] Expand `asyncio-dangling-task` (`RUF006`) to include `new_event_loop` ([#&#8203;9976](https://togithub.com/astral-sh/ruff/pull/9976)) - \[`flake8-pyi`] Ignore 'unused' private type dicts in class scopes ([#&#8203;9952](https://togithub.com/astral-sh/ruff/pull/9952)) ##### Formatter - Docstring formatting: Preserve tab indentation when using `indent-style=tabs` ([#&#8203;9915](https://togithub.com/astral-sh/ruff/pull/9915)) - Disable top-level docstring formatting for notebooks ([#&#8203;9957](https://togithub.com/astral-sh/ruff/pull/9957)) - Stabilize quote-style's `preserve` mode ([#&#8203;9922](https://togithub.com/astral-sh/ruff/pull/9922)) ##### CLI - Allow arbitrary configuration options to be overridden via the CLI ([#&#8203;9599](https://togithub.com/astral-sh/ruff/pull/9599)) ##### Bug fixes - Make `show-settings` filters directory-agnostic ([#&#8203;9866](https://togithub.com/astral-sh/ruff/pull/9866)) - Respect duplicates when rewriting type aliases ([#&#8203;9905](https://togithub.com/astral-sh/ruff/pull/9905)) - Respect tuple assignments in typing analyzer ([#&#8203;9969](https://togithub.com/astral-sh/ruff/pull/9969)) - Use atomic write when persisting cache ([#&#8203;9981](https://togithub.com/astral-sh/ruff/pull/9981)) - Use non-parenthesized range for `DebugText` ([#&#8203;9953](https://togithub.com/astral-sh/ruff/pull/9953)) - \[`flake8-simplify`] Avoid false positive with `async` for loops (`SIM113`) ([#&#8203;9996](https://togithub.com/astral-sh/ruff/pull/9996)) - \[`flake8-trio`] Respect `async with` in `timeout-without-await` ([#&#8203;9859](https://togithub.com/astral-sh/ruff/pull/9859)) - \[`perflint`] Catch a wider range of mutations in `PERF101` ([#&#8203;9955](https://togithub.com/astral-sh/ruff/pull/9955)) - \[`pycodestyle`] Fix `E30X` panics on blank lines with trailing white spaces ([#&#8203;9907](https://togithub.com/astral-sh/ruff/pull/9907)) - \[`pydocstyle`] Allow using `parameters` as a subsection header (`D405`) ([#&#8203;9894](https://togithub.com/astral-sh/ruff/pull/9894)) - \[`pydocstyle`] Fix blank-line docstring rules for module-level docstrings ([#&#8203;9878](https://togithub.com/astral-sh/ruff/pull/9878)) - \[`pylint`] Accept 0.0 and 1.0 as common magic values (`PLR2004`) ([#&#8203;9964](https://togithub.com/astral-sh/ruff/pull/9964)) - \[`pylint`] Avoid suggesting set rewrites for non-hashable types ([#&#8203;9956](https://togithub.com/astral-sh/ruff/pull/9956)) - \[`ruff`] Avoid false negatives with string literals inside of method calls (`RUF027`) ([#&#8203;9865](https://togithub.com/astral-sh/ruff/pull/9865)) - \[`ruff`] Fix panic on with f-string detection (`RUF027`) ([#&#8203;9990](https://togithub.com/astral-sh/ruff/pull/9990)) - \[`ruff`] Ignore builtins when detecting missing f-strings ([#&#8203;9849](https://togithub.com/astral-sh/ruff/pull/9849)) ##### Performance - Use `memchr` for string lexing ([#&#8203;9888](https://togithub.com/astral-sh/ruff/pull/9888)) - Use `memchr` for tab-indentation detection ([#&#8203;9853](https://togithub.com/astral-sh/ruff/pull/9853)) - Reduce `Result<Tok, LexicalError>` size by using `Box<str>` instead of `String` ([#&#8203;9885](https://togithub.com/astral-sh/ruff/pull/9885)) - Reduce size of `Expr` from 80 to 64 bytes ([#&#8203;9900](https://togithub.com/astral-sh/ruff/pull/9900)) - Improve trailing comma rule performance ([#&#8203;9867](https://togithub.com/astral-sh/ruff/pull/9867)) - Remove unnecessary string cloning from the parser ([#&#8203;9884](https://togithub.com/astral-sh/ruff/pull/9884)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/RobertCraigie/prisma-client-py). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Robert Craigie <robert@craigie.dev>
1 parent c755ba0 commit 30e6ce7

File tree

16 files changed

+45
-84
lines changed

16 files changed

+45
-84
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repos:
3131
- id: mixed-line-ending
3232
args: [--fix=lf]
3333
- repo: https://github.com/astral-sh/ruff-pre-commit
34-
rev: v0.1.11
34+
rev: v0.3.4
3535
hooks:
3636
# Run the formatter.
3737
- id: ruff-format

examples/fastapi-basic/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Basic FastAPI app for CRUD operations on users and posts using Prisma Client Python"""
2+
23
from typing import Optional, List
34

45
from fastapi import FastAPI

pipelines/requirements/deps/ruff.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruff==0.2.1
1+
ruff==0.3.4

src/prisma/_base_client.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ class UseClientDefault:
3333
by typing the parameter with this class rather than using None, for example:
3434
3535
```py
36-
def connect(timeout: Union[int, timedelta, UseClientDefault] = UseClientDefault()) -> None:
37-
...
36+
def connect(timeout: Union[int, timedelta, UseClientDefault] = UseClientDefault()) -> None: ...
3837
```
3938
4039
relays the intention more clearly than:
4140
4241
```py
43-
def connect(timeout: Union[int, timedelta, None] = None) -> None:
44-
...
42+
def connect(timeout: Union[int, timedelta, None] = None) -> None: ...
4543
```
4644
4745
This solution also allows us to indicate an "unset" state that is uniquely distinct
@@ -348,17 +346,15 @@ def get_metrics(
348346
format: Literal['json'] = 'json',
349347
*,
350348
global_labels: dict[str, str] | None = None,
351-
) -> Metrics:
352-
...
349+
) -> Metrics: ...
353350

354351
@overload
355352
def get_metrics(
356353
self,
357354
format: Literal['prometheus'],
358355
*,
359356
global_labels: dict[str, str] | None = None,
360-
) -> str:
361-
...
357+
) -> str: ...
362358

363359
def get_metrics(
364360
self,
@@ -469,17 +465,15 @@ async def get_metrics(
469465
format: Literal['json'] = 'json',
470466
*,
471467
global_labels: dict[str, str] | None = None,
472-
) -> Metrics:
473-
...
468+
) -> Metrics: ...
474469

475470
@overload
476471
async def get_metrics(
477472
self,
478473
format: Literal['prometheus'],
479474
*,
480475
global_labels: dict[str, str] | None = None,
481-
) -> str:
482-
...
476+
) -> str: ...
483477

484478
async def get_metrics(
485479
self,

src/prisma/_compat.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ def root_validator(
7474
pydantic.BaseConfig # pyright: ignore[reportDeprecated]
7575
)
7676

77-
class BaseConfig:
78-
...
77+
class BaseConfig: ...
7978

8079
from pydantic import (
8180
PlainSerializer as PlainSerializer,
@@ -86,8 +85,7 @@ class BaseConfig:
8685
core_schema as core_schema,
8786
)
8887

89-
class GenericModel(BaseModel):
90-
...
88+
class GenericModel(BaseModel): ...
9189

9290
else:
9391
if PYDANTIC_V2:
@@ -104,8 +102,7 @@ class GenericModel(BaseModel):
104102
else:
105103
from pydantic.generics import GenericModel as PydanticGenericModel
106104

107-
class GenericModel(PydanticGenericModel, BaseModel):
108-
...
105+
class GenericModel(PydanticGenericModel, BaseModel): ...
109106

110107
if PYDANTIC_V2:
111108
from pydantic import model_validator
@@ -358,8 +355,7 @@ def Field(*, env: str | None = None, **extra: Any) -> Any:
358355
# define good types.
359356
from enum import Enum
360357

361-
class StrEnum(str, Enum):
362-
...
358+
class StrEnum(str, Enum): ...
363359
else:
364360
if sys.version_info >= (3, 11):
365361
from enum import StrEnum as StrEnum

src/prisma/_fields.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,10 @@ def keys(cls, **data: Serializable) -> Json:
7979
# cast(Dict[str, Any], user.json_obj)
8080
# prisma.validate(ExpectedType, user.json_obj) # NOTE: not implemented yet
8181
@overload # type: ignore
82-
def __getitem__(self, i: slice) -> List[Serializable]:
83-
...
82+
def __getitem__(self, i: slice) -> List[Serializable]: ...
8483

8584
@overload
86-
def __getitem__(self, i: _JsonKeys) -> Serializable:
87-
...
85+
def __getitem__(self, i: _JsonKeys) -> Serializable: ...
8886

8987
@override
9088
def __getitem__(self, i: Union[_JsonKeys, slice]) -> Serializable: # pyright: ignore[reportIncompatibleMethodOverride]

src/prisma/_proxy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,4 @@ def __as_proxied__(self) -> T:
4646
return cast(T, self)
4747

4848
@abstractmethod
49-
def __load__(self) -> T:
50-
...
49+
def __load__(self) -> T: ...

src/prisma/_raw_query.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,14 @@
3636

3737

3838
@overload
39-
def deserialize_raw_results(raw_list: list[dict[str, Any]]) -> list[dict[str, Any]]:
40-
...
39+
def deserialize_raw_results(raw_list: list[dict[str, Any]]) -> list[dict[str, Any]]: ...
4140

4241

4342
@overload
4443
def deserialize_raw_results(
4544
raw_list: list[dict[str, object]],
4645
model: type[BaseModelT],
47-
) -> list[BaseModelT]:
48-
...
46+
) -> list[BaseModelT]: ...
4947

5048

5149
def deserialize_raw_results(
@@ -74,8 +72,7 @@ def _deserialize_prisma_object(
7472
raw_obj: dict[str, Any],
7573
*,
7674
for_model: bool,
77-
) -> dict[str, Any]:
78-
...
75+
) -> dict[str, Any]: ...
7976

8077

8178
@overload
@@ -84,8 +81,7 @@ def _deserialize_prisma_object(
8481
*,
8582
for_model: bool,
8683
model: type[BaseModelT],
87-
) -> BaseModelT:
88-
...
84+
) -> BaseModelT: ...
8985

9086

9187
def _deserialize_prisma_object(

src/prisma/cli/utils.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,15 @@ def warning(message: str) -> None:
135135

136136

137137
@overload
138-
def error(message: str) -> NoReturn:
139-
...
138+
def error(message: str) -> NoReturn: ...
140139

141140

142141
@overload
143-
def error(message: str, exit_: Literal[True]) -> NoReturn:
144-
...
142+
def error(message: str, exit_: Literal[True]) -> NoReturn: ...
145143

146144

147145
@overload
148-
def error(message: str, exit_: Literal[False]) -> None:
149-
...
146+
def error(message: str, exit_: Literal[False]) -> None: ...
150147

151148

152149
def error(message: str, exit_: bool = True) -> Union[None, NoReturn]:

src/prisma/engine/_abstract.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ def metrics(
9292
*,
9393
format: Literal['json'],
9494
global_labels: dict[str, str] | None,
95-
) -> dict[str, Any]:
96-
...
95+
) -> dict[str, Any]: ...
9796

9897
@overload
9998
@abstractmethod
@@ -102,17 +101,15 @@ def metrics(
102101
*,
103102
format: Literal['prometheus'],
104103
global_labels: dict[str, str] | None,
105-
) -> str:
106-
...
104+
) -> str: ...
107105

108106
@abstractmethod
109107
def metrics(
110108
self,
111109
*,
112110
format: MetricsFormat,
113111
global_labels: dict[str, str] | None,
114-
) -> str | dict[str, Any]:
115-
...
112+
) -> str | dict[str, Any]: ...
116113

117114

118115
class AsyncAbstractEngine(BaseAbstractEngine):
@@ -161,8 +158,7 @@ async def metrics(
161158
*,
162159
format: Literal['json'],
163160
global_labels: dict[str, str] | None,
164-
) -> dict[str, Any]:
165-
...
161+
) -> dict[str, Any]: ...
166162

167163
@overload
168164
@abstractmethod
@@ -171,14 +167,12 @@ async def metrics(
171167
*,
172168
format: Literal['prometheus'],
173169
global_labels: dict[str, str] | None,
174-
) -> str:
175-
...
170+
) -> str: ...
176171

177172
@abstractmethod
178173
async def metrics(
179174
self,
180175
*,
181176
format: MetricsFormat,
182177
global_labels: dict[str, str] | None,
183-
) -> str | dict[str, Any]:
184-
...
178+
) -> str | dict[str, Any]: ...

src/prisma/engine/_query.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,17 +269,15 @@ def metrics(
269269
*,
270270
format: Literal['json'],
271271
global_labels: dict[str, str] | None,
272-
) -> dict[str, Any]:
273-
...
272+
) -> dict[str, Any]: ...
274273

275274
@overload
276275
def metrics(
277276
self,
278277
*,
279278
format: Literal['prometheus'],
280279
global_labels: dict[str, str] | None,
281-
) -> str:
282-
...
280+
) -> str: ...
283281

284282
@override
285283
def metrics(
@@ -431,17 +429,15 @@ async def metrics(
431429
*,
432430
format: Literal['json'],
433431
global_labels: dict[str, str] | None,
434-
) -> dict[str, Any]:
435-
...
432+
) -> dict[str, Any]: ...
436433

437434
@overload
438435
async def metrics(
439436
self,
440437
*,
441438
format: Literal['prometheus'],
442439
global_labels: dict[str, str] | None,
443-
) -> str:
444-
...
440+
) -> str: ...
445441

446442
@override
447443
async def metrics(

src/prisma/generator/_dsl_parser/parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
}
88
```
99
"""
10+
1011
from __future__ import annotations
1112

1213
from typing import Union

src/prisma/generator/generator.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ def get_manifest(self) -> Manifest:
7373
...
7474

7575
@abstractmethod
76-
def generate(self, data: BaseModelT) -> None:
77-
...
76+
def generate(self, data: BaseModelT) -> None: ...
7877

7978
@classmethod
8079
def invoke(cls) -> None:

src/prisma/http_abstract.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,16 @@ def __init__(self, **kwargs: Any) -> None:
5050
}
5151

5252
@abstractmethod
53-
def download(self, url: str, dest: str) -> MaybeCoroutine[None]:
54-
...
53+
def download(self, url: str, dest: str) -> MaybeCoroutine[None]: ...
5554

5655
@abstractmethod
57-
def request(self, method: Method, url: str, **kwargs: Any) -> MaybeCoroutine['AbstractResponse[Response]']:
58-
...
56+
def request(self, method: Method, url: str, **kwargs: Any) -> MaybeCoroutine['AbstractResponse[Response]']: ...
5957

6058
@abstractmethod
61-
def open(self) -> None:
62-
...
59+
def open(self) -> None: ...
6360

6461
@abstractmethod
65-
def close(self) -> MaybeCoroutine[None]:
66-
...
62+
def close(self) -> MaybeCoroutine[None]: ...
6763

6864
@property
6965
def closed(self) -> bool:
@@ -108,21 +104,17 @@ def __init__(self, original: Response) -> None:
108104

109105
@property
110106
@abstractmethod
111-
def status(self) -> int:
112-
...
107+
def status(self) -> int: ...
113108

114109
@property
115110
@abstractmethod
116-
def headers(self) -> Headers:
117-
...
111+
def headers(self) -> Headers: ...
118112

119113
@abstractmethod
120-
def json(self) -> MaybeCoroutine[Any]:
121-
...
114+
def json(self) -> MaybeCoroutine[Any]: ...
122115

123116
@abstractmethod
124-
def text(self) -> MaybeCoroutine[str]:
125-
...
117+
def text(self) -> MaybeCoroutine[str]: ...
126118

127119
@override
128120
def __repr__(self) -> str:

src/prisma_cleanup/_cleanup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
@runtime_checkable
1010
class SourceLoader(Protocol):
11-
def get_filename(self) -> str:
12-
...
11+
def get_filename(self) -> str: ...
1312

1413

1514
def main(*args: str) -> None:

tests/test_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ def mock___init__(real__init__: Any, *args: Any, **kwargs: Any) -> None:
127127

128128
getter = patch_method(monkeypatch, httpx.AsyncClient, '__init__', mock___init__)
129129

130-
def mock_app(args: Mapping[str, object], data: object) -> object:
131-
...
130+
def mock_app(args: Mapping[str, object], data: object) -> object: ...
132131

133132
async def _test(config: HttpConfig) -> None:
134133
client = Prisma(

0 commit comments

Comments
 (0)