Comments (6)
Yes, this is a known issue. I haven't thought of good ways to solve it
from python-type-challenges.
Took another look. "advanced-forward" should be easy to fix, but never2 is hard, as I haven't found a way to force pyright to fail..
from python-type-challenges.
If we can insert some imports before user_code and add "reportUnusedImport": true
to pyrightconfig.json
, it is easy to solve.
advanced-forward
need to force user to annotate return_type for function
# advanced-forward-fix
## End of your code ##
+# pyright: analyzeUnannotatedFunctions=false
from typing import assert_type
inst = MyClass(x=1)
assert_type(inst.copy(), MyClass)
from python-type-challenges.
Actually, I find that pyright will ignore whatever code following raise
, since it thinks that those code is unreachable.
So it really seems to have no solution..
from python-type-challenges.
So it really seems to have no solution..
mypy
can detect the name-defined
error although code is unreachable, I think we can mix mypy
with pyright
.
If we add the below to pyproject.toml
, mypy
will show test.py:4: error: Statement is unreachable [unreachable]
[tool.mypy]
warn_unreachable = true
from python-type-challenges.
Using sourcery is a no-go, using mypy maybe could be an option but certainly would complicate things. Another option is to create a special rule just for raise
and warn users about it. I'll leave this one open and think about it.
from python-type-challenges.
Related Issues (20)
- Errors in running "Challenge - concatenate" HOT 2
- Add `from typing import *` to boilerplate HOT 2
- Add newline in `typealias` challenge HOT 1
- Consider adding a hint message with links for each question HOT 5
- Allow custom challenge order HOT 4
- Record and show passed challenges
- The ellipsis in the function parameters of challenge intermediate/literalstring causes challenge failed HOT 3
- extreme-concatenate not working? (maybe outdated pyright) HOT 3
- much simpler solution to `extreme-self-casting` HOT 4
- Too easy to pass `extreme-variance` HOT 5
- Enable UTF-8 mode for python (PEP 686) HOT 3
- [CI] Fail when pre-commit run
- [Web] 500 Internal Server Error HOT 3
- On mobile devices, click elsewhere on the screen should fold the challenge list
- [Web] Use HTMX to random page. HOT 3
- [Formatter] Replace `black` HOT 1
- [Bug] Old CodeMirrors are not remove HOT 1
- [Docs] Add random challenge entrance to README
- Return type for extreme concatenate HOT 3
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 python-type-challenges.