Comments (6)
With "works with mypy" I mostly meant that it's no longer having syntax problems. I suppose there's more things on the actual types that might need to be changed.
I specifically want to get the typing of the @cache.memoize()
decorator working (with mypy), I'll make a PR, if I get it to work :).
from diskcache-stubs.
First of all, I only use pyright (pylance to be exact), so I don't check for mypy (I don't know how to use it, let me know and I'll adapt).
When I checked where the error occurred, I got the following code.
class Constant[T: str](tuple[T]): # noqa: SLOT001
def __new__(cls, name: T) -> Self: ...
It's definitely a syntax that's supported since 3.12, and I thought that if it was a stub file, it would work regardless of version.
This is not what I intended.
I'll fix it soon.
However, as I said before, it's hard to verify using mypy, so it may not work with mypy.
from diskcache-stubs.
@BubuOT
Removed the part where PEP 695 was applied.
For now, it seems to work fine in my environment (3.8.16, pylance), but I'd like to check it on mypy.
Can you confirm this for me, or share how to set it up?
from diskcache-stubs.
@phi-friday Thanks, installing this from main
now works with mypy for me :).
As for how to set it up, it should just be installing mypy via pip and then running mypy --strict .
on a codebase using diskcache (and with the stubs installed).
from diskcache-stubs.
First, I added mypy to development dependencies.
After checking a bit more, it seems to be a problem with mypy only.
This seems to be causing a number of issues, so I disabled the following error codes
valid-type,type-arg,overload-overlap,misc,operator
If I were to set the covariances myself, this might work, but I don't think it's necessary right now.
I don't use mypy much, so there's a lot I don't know about it, so please forgive me.
I'll close this issue with the new release 5.6.3.4
from diskcache-stubs.
@BubuOT
I removed the parameter type of __cache_key__
and changed the definition of Memoized
.
(The parameter type of __cache_key__
is important, but I decided that it was more important to have it work in mypy.)
Can you confirm that it works?
from diskcache-stubs.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diskcache-stubs.