Skip to content

dont destroy type of decorated function#432

Merged
Erotemic merged 2 commits into
pyutils:mainfrom
dkuettel:typing
Jun 26, 2026
Merged

dont destroy type of decorated function#432
Erotemic merged 2 commits into
pyutils:mainfrom
dkuettel:typing

Conversation

@dkuettel

@dkuettel dkuettel commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Would you accept something in this direction? I've been using line_profiler a bunch and I noticed that the decorated functions fail linting with pyright and the like, because they lose the type.

I didn't setup the tests yet, and we probably have to write it more backwards compatible in case you want it to work with python 3.11 or older.

@Erotemic

Erotemic commented Jun 23, 2026

Copy link
Copy Markdown
Member

Yes, this makes sense. We are currently targeting 3.10+

@dkuettel

Copy link
Copy Markdown
Contributor Author

This syntax should be legal also for python 3.10. It's a simple change, so hopefully linting will go thru without me setting up the test dependencies.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.40%. Comparing base (c2a6a30) to head (4940bca).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #432      +/-   ##
==========================================
+ Coverage   82.38%   82.40%   +0.01%     
==========================================
  Files          20       20              
  Lines        2254     2256       +2     
  Branches      359      359              
==========================================
+ Hits         1857     1859       +2     
  Misses        300      300              
  Partials       97       97              
Files with missing lines Coverage Δ
line_profiler/autoprofile/profmod_extractor.py 61.00% <100.00%> (ø)
line_profiler/explicit_profiler.py 52.14% <100.00%> (+0.59%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a5ec7fd...4940bca. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dkuettel

Copy link
Copy Markdown
Contributor Author

fixed a linting error from ty but I don't think that one was related to my changes.

@Erotemic

Copy link
Copy Markdown
Member

Appreciated. You don't have to satisfy the linter if its unrelated to your changes. The ty checker is probably not the best one to use on CI given how much flux it is in, but that's something to address in a different PR.

This LGTM. I'll merge once the main dashboards come back green.

@Erotemic Erotemic merged commit f8e40f6 into pyutils:main Jun 26, 2026
44 of 45 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