Skip to content

Fix edge case of __future__ import.#2458

Merged
DanielNoord merged 5 commits intoPyCQA:mainfrom
skv0zsneg:issue/1882
Feb 16, 2026
Merged

Fix edge case of __future__ import.#2458
DanielNoord merged 5 commits intoPyCQA:mainfrom
skv0zsneg:issue/1882

Conversation

@skv0zsneg
Copy link
Contributor

Fixing #1882

Every FUTURE section now have the "from first" rule by default to avoid exception below:

SyntaxError: from __future__ imports must occur at the beginning of the file

config.lines_between_types if from_modules and straight_modules else 0
)
if config.from_first:
if config.from_first or section == "FUTURE":
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deepsource checks warns me of cyclomatic complexity here but I got only one small change. Do I need to split the logic for decrease complexity?

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.24%. Comparing base (e8c127b) to head (313797b).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2458   +/-   ##
=======================================
  Coverage   99.24%   99.24%           
=======================================
  Files          39       39           
  Lines        3057     3057           
  Branches      675      675           
=======================================
  Hits         3034     3034           
  Misses         13       13           
  Partials       10       10           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just add an ignore for the warning :)

@DanielNoord DanielNoord added this pull request to the merge queue Feb 16, 2026
Merged via the queue into PyCQA:main with commit b0f2dab Feb 16, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants