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
Sync, update and debug against DRF #94
Merged
Merged
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
35ff3a3
resolved flake8 issues
7c22d5d
Revert "resolved flake8 issues"
fdb98bf
addressed review comments
1b93396
resolved flake8 issues
48ebeeb
Added missing stubs and data
fc03caf
fixed tests
0eecdbc
applied black and isort
12ff4c0
converted Literal import from typing to typing_extensions
b56e435
updated compat
2e5343f
second pass
86fcdbc
Update relations.pyi
Goldziher b8050d6
Update utils.pyi
Goldziher b85b9c6
Update utils.pyi
Goldziher feafdc9
Update serializers.pyi
Goldziher 3349b07
refined typings
094e0c8
fixed schema typings
4319eaa
fix wrong typing of request
29c0ece
added functional testing script
1fa63ec
updated configs
0cd27bd
functioning version
3cff1cb
updated implementation
56a2414
fixed issues following drf test
612db30
updated serializer typing to use generics
b78de2a
fixed relations and permissions
01d7cdd
fixed parsers
dd01277
fixed pagination
89dc5ef
fixed serializers
890d275
update fields
6aa0fab
updated fields and added protocol to serializer
12b8a9a
fixed field typing to use generic
8477a7b
updated relations
d69e189
finished serializers
cc61bbc
finished fields
7b66e45
fixed decorators
1768f14
fixed authtoken
9c96592
fixed generic relations
affa2c2
fixed mypy detected bugs
f551193
finished schema
eb49884
finished fixing all drf related errors
1330237
cleanup
b99c47f
fix mypy.ini
51f0f31
fixed tests
0f83965
updated travis settings
dc8c30e
updated readme
74b96ba
temporarily disabled new travis config
0a5ff73
fixed python 3.6 comp. issues
cd3c16d
re-enabled full travis config
5f67e7b
address has_object_permission review comment
e113c88
fixed version comp issue
0bfe1da
address permission review comment
16ec6bd
applied black and isort
1ec1a6f
update typecheck script to use distutils
ceaf736
isorted
810454a
cleanup
dabd437
Update settings.pyi
Goldziher 8d79794
addressed review comments
efc5830
Merge branch 'sync-with-drf' of https://github.com/Goldziher/djangore…
f3b0a7e
Update decorators.pyi
Goldziher File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ | |
__pycache__/ | ||
out/ | ||
pip-wheel-metadata/ | ||
drf_source/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
HTTP_HEADER_ENCODING: str = ... | ||
ISO_8601: str = ... | ||
VERSION: str | ||
HTTP_HEADER_ENCODING: str | ||
ISO_8601: str | ||
default_app_config: str | ||
|
||
default_app_config: str = ... | ||
class RemovedInDRF313Warning(DeprecationWarning): ... | ||
class RemovedInDRF314Warning(PendingDeprecationWarning): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
12 changes: 12 additions & 0 deletions
12
rest_framework-stubs/authtoken/management/commands/drf_create_token.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from typing import Any | ||
|
||
from django.contrib.auth.base_user import AbstractBaseUser | ||
from django.core.management.base import BaseCommand | ||
|
||
UserModel: AbstractBaseUser | ||
|
||
class Command(BaseCommand): | ||
help: str = ... | ||
def create_user_token(self, username: str, reset_token: bool): ... | ||
def add_arguments(self, parser: Any) -> None: ... | ||
def handle(self, *args: Any, **options: Any) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
from django.conf import settings | ||
from typing import Any | ||
|
||
from django.db import models | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
class Token(models.Model): | ||
key = models.CharField(_("Key"), max_length=40, primary_key=True) | ||
user = models.OneToOneField( | ||
settings.AUTH_USER_MODEL, related_name="auth_token", on_delete=models.CASCADE, verbose_name=_("User") | ||
) | ||
created = models.DateTimeField(_("Created"), auto_now_add=True) | ||
def generate_key(self) -> str: ... | ||
key: models.CharField = ... | ||
user: models.OneToOneField = ... | ||
created: models.DateTimeField = ... | ||
@classmethod | ||
def generate_key(cls) -> str: ... | ||
|
||
class TokenProxy(Token): | ||
@property | ||
def pk(self) -> Any: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from django.utils.translation import ugettext_lazy as _ | ||
from rest_framework import serializers | ||
|
||
class AuthTokenSerializer(serializers.Serializer): | ||
username = serializers.CharField(label=_("Username")) | ||
password = serializers.CharField(label=_("Password"), style={"input_type": "password"}, trim_whitespace=False) | ||
username: serializers.CharField = ... | ||
password: serializers.CharField = ... | ||
token: serializers.CharField = ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
from typing import Any, Callable | ||
from typing import Any | ||
|
||
from rest_framework.authtoken.serializers import AuthTokenSerializer | ||
from rest_framework.request import Request | ||
from rest_framework.response import Response | ||
from rest_framework.views import APIView | ||
from rest_framework.views import APIView, AsView | ||
|
||
class ObtainAuthToken(APIView): | ||
serializer_class = AuthTokenSerializer | ||
def post(self, request: Request, *args: Any, **kwargs: Any) -> Response: ... | ||
|
||
obtain_auth_token: Callable = ... | ||
obtain_auth_token: AsView = ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from typing import Any, List | ||
|
||
def pagination_system_check(app_configs: Any, **kwargs: Any) -> List[Any]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from typing import Any, Optional, Tuple, Union | ||
|
||
import coreapi # noqa: F401 | ||
import requests # noqa: F401 | ||
from django.db.models import QuerySet | ||
|
||
try: | ||
from django.contrib.postgres import fields as postgres_fields | ||
except ImportError: | ||
postgres_fields = None # type: ignore | ||
try: | ||
import uritemplate | ||
except ImportError: | ||
uritemplate = None # type: ignore | ||
try: | ||
import coreschema | ||
except ImportError: | ||
coreschema = None # type: ignore | ||
try: | ||
import yaml | ||
except ImportError: | ||
yaml = None # type: ignore | ||
try: | ||
import requests | ||
except ImportError: | ||
requests = None # type: ignore | ||
try: | ||
import pygments | ||
except ImportError: | ||
pygments = None # type: ignore | ||
try: | ||
import markdown | ||
def apply_markdown(text: str): ... | ||
|
||
except ImportError: | ||
apply_markdown = None # type: ignore | ||
markdown = None # type: ignore | ||
|
||
if markdown is not None and pygments is not None: | ||
from markdown.preprocessors import Preprocessor | ||
class CodeBlockPreprocessor(Preprocessor): | ||
pattern: Any = ... | ||
formatter: Any = ... | ||
def run(self, lines: Any): ... | ||
|
||
def pygments_css(style: Any) -> Optional[str]: ... | ||
def pygments_highlight(text: str, lang: str, style: Any) -> Any: ... | ||
def md_filter_add_syntax_highlight(md: Any) -> bool: ... | ||
def unicode_http_header(value: Union[str, bytes]) -> str: ... | ||
def distinct(queryset: QuerySet, base: Optional[QuerySet]) -> QuerySet: ... | ||
|
||
SHORT_SEPARATORS: Tuple[str, str] | ||
LONG_SEPARATORS: Tuple[str, str] | ||
INDENT_SEPARATORS: Tuple[str, str] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
You undid the work that I did in #60, this MR seems reckless.
The result is that argument and return types of views are erased if they use any decorator here.