-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iron out type-checking and formatting #138
Conversation
8f8111e
to
a7d19dd
Compare
canopeum_backend/canopeum_backend/management/commands/initialize_database.py
Outdated
Show resolved
Hide resolved
@classmethod | ||
def from_string(cls, value: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC @NicolasDontigny This is how you do a classmethod in Python (ie: a method you call on the class itself, this is technically different than a static method, but this would be a static method in other languages)
# Missing "id" in "Model" or some base "User" class? | ||
if TYPE_CHECKING: | ||
id: int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if missing from upstream type stubs or if we're doing something specific to have an id on our user.
# TODO: Are we sure about getlist ? | ||
# If this is correct, consider raising an issue upstream | ||
for tree_type_json in request.data.getlist("species"): # type:ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BesOlivierBouchard Since you added this. Can you validate whether this is valid code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I saw online, this is the way to retrieve a "list" from "data". Doing it with the get() or the data[] will not work properly.
try: | ||
post = Post.objects.get(pk=postId) | ||
except Post.DoesNotExist: | ||
return Response(status="sef") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think "sef"
status was intended? I went with HTTP_404_NOT_FOUND
by combining the try-except
a7d19dd
to
dd3cf97
Compare
dd3cf97
to
f49ebdf
Compare
…eleaf-canopeum into iron-out-type-checking-and-linting
…om/BesLogic/releaf-canopeum into iron-out-type-checking-and-linting
…to iron-out-type-checking-and-linting
for more information, see https://pre-commit.ci
…om/BesLogic/releaf-canopeum into iron-out-type-checking-and-linting
Please merge #144 first
djangorestframework-stubs
Request
model to type therequest
param in our methods. This mainly allows to get ourUser
model fromdrf-spectacular
type: ignore
frompyright: ignore
commentsserializers.SitePatchSerializer
Cross-referencing upstream issues:
@extend_schema_field
type hint does not accept simple python types tfranzel/drf-spectacular#1212