Comments (5)
It seemed that my previous pipeline jobs that were succeeding started failing so I look at the versions of the typing packages being installed and noticed these were updated since (working versions are below):
types-protobuf = "4.24.0.4"
types-pyopenssl = "23.3.0.0"
types-redis = "4.6.0.11"
Locking the versions to the versions listed above fixed the error. I'm not sure what the issue is with the new typing packages, but it seems either mypy is pulling in incompatible versions or the there is a bug in latest version of one of the packages.
from mypy.
@getim thanks for looking into it! While typeshed will need to be fixed, let's remove trailing slash in exists_case
— seems less of a sharp edge and matches os.path.exists
better. Interested in opening a PR?
from mypy.
@jakecyr thanks for your comment! it helped a lot.
waiting until this is fixed now python/typeshed#11254
from mypy.
We ran into this as well and I drilled down into mypy since yesterday:
- It looks like the logic here assumes that there's more than 1 component in the import path being resolved. However, when that's not the case just (e.g. just
google
),dir_chain
is empty. From thereruntime_path
calculated here contains a trailing slash. - Later on, this path gets used as the
prefix
in exists_case. The trailing slash breaks the startswith check because something likefoo
doesn't start withfoo/
. That meansexists_case
ends up returningTrue
for something likesite-packages//google
while it doesn't exist.
I'm just laying this out here because I'm now unsure which component is wrong exactly. The runtime_path
assignment can check if dir_chain
is empty? Should exists_case
be fixed to correctly handle the trailing slash? Both seem to fix the issue from my tests.
Edit: I guess my comment is more about the fact that mypy could handle this better, even if the linked typeshed issue gets fixed.
from mypy.
@hauntsaninja Sounds good, see here
from mypy.
Related Issues (20)
- assert_never on exclusive union of tuples HOT 4
- Tracking mypy releases (mark a tag as release) HOT 7
- overloaded class-decorator is seen as not Callable when used on an overloaded method HOT 2
- 1.9.0 Release Tracking Issue HOT 10
- mypyc: `KeyError 'expr'` with NamedTuple HOT 1
- Optional[TypeVar] does not preserve type of TypeVar when given Union type HOT 1
- Overloaded function signature will never be matched
- false positive on interaction between `@property`, `@lru_cache`, and inheritance HOT 2
- False negative with property and decorator
- Crash Report: Internal Error for typechecking openai with pydantic-plugin HOT 5
- The attrs.field converter parameter does not support higher-order functions.
- Descriptors misbehave with `NoReturn`/`Never`, with `@overload`s, etc. HOT 4
- Stubgen crashes on TypeVarTuple usage
- If plugin has same name as top-level module which has been imported before mypy runs (e.g., you are using api), mypy picks up the wrong file HOT 1
- str counts as a Callable[..., str], but not as a Callable[..., TypeVar] HOT 1
- `Callable` not deduced correctly
- False positive typing.Self has incompatible type when method uses class' generic type HOT 3
- Calls to `.get` on TypeVars bound to TypedDict narrow to `object` HOT 2
- Presence of property in Protocol causes false positive in multiple inheritance scenario HOT 1
- Generate an error if using a type from the numbers module HOT 1
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 mypy.