forked from typeddjango/djangorestframework-stubs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
112 additions
and
108 deletions.
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
language: python | ||
# cache package wheels (1 cache per python version) | ||
cache: pip | ||
# newer python versions are available only on xenial (while some older only on trusty) Ubuntu distribution | ||
dist: xenial | ||
sudo: required | ||
|
||
jobs: | ||
include: | ||
- name: "run test suite with python 3.7" | ||
python: 3.7 | ||
script: | | ||
set -e | ||
pytest | ||
- name: "Lint with black" | ||
python: 3.7 | ||
script: | | ||
black --check --line-length=120 django-stubs/ | ||
before_install: | | ||
# Upgrade pip, setuptools, and wheel | ||
pip install -U pip setuptools wheel | ||
install: | | ||
pip install -r ./dev-requirements.txt |
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 @@ | ||
#!/usr/local/bin/xonsh | ||
|
||
black --line-length=120 rest_framework-stubs/ |
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,25 +1,17 @@ | ||
from typing import Any, Union, Dict, Optional | ||
|
||
|
||
class APIException(Exception): | ||
status_code: int | ||
|
||
|
||
class ValidationError(APIException): | ||
detail: Union[str, Dict[str, Any]] | ||
|
||
def __init__(self, | ||
detail: Optional[Union[str, Dict[str, Any]]] = ..., | ||
): ... | ||
|
||
def __init__(self, detail: Optional[Union[str, Dict[str, Any]]] = ...): ... | ||
|
||
class NotAuthenticated(APIException): | ||
pass | ||
|
||
|
||
class ParseError(APIException): | ||
pass | ||
|
||
|
||
class PermissionDenied(APIException): | ||
pass |
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,34 +1,35 @@ | ||
from typing import Dict | ||
|
||
from rest_framework.fields import (Field as Field, | ||
CharField as CharField, | ||
RegexField as RegexField, | ||
EmailField as EmailField, | ||
URLField as URLField, | ||
FileField as FileField, | ||
IntegerField as IntegerField, | ||
FloatField as FloatField, | ||
BooleanField as BooleanField, | ||
NullBooleanField as NullBooleanField, | ||
ListField as ListField, | ||
DictField as DictField, | ||
ChoiceField as ChoiceField, | ||
JSONField as JSONField, | ||
DateTimeField as DateTimeField, | ||
SerializerMethodField as SerializerMethodField) | ||
from rest_framework.exceptions import (APIException as APIException, | ||
ValidationError as ValidationError, | ||
ParseError as ParseError, | ||
NotAuthenticated as NotAuthenticated, | ||
PermissionDenied as PermissionDenied) | ||
|
||
from rest_framework.fields import ( | ||
Field as Field, | ||
CharField as CharField, | ||
RegexField as RegexField, | ||
EmailField as EmailField, | ||
URLField as URLField, | ||
FileField as FileField, | ||
IntegerField as IntegerField, | ||
FloatField as FloatField, | ||
BooleanField as BooleanField, | ||
NullBooleanField as NullBooleanField, | ||
ListField as ListField, | ||
DictField as DictField, | ||
ChoiceField as ChoiceField, | ||
JSONField as JSONField, | ||
DateTimeField as DateTimeField, | ||
SerializerMethodField as SerializerMethodField, | ||
) | ||
from rest_framework.exceptions import ( | ||
APIException as APIException, | ||
ValidationError as ValidationError, | ||
ParseError as ParseError, | ||
NotAuthenticated as NotAuthenticated, | ||
PermissionDenied as PermissionDenied, | ||
) | ||
|
||
class BaseSerializer(Field): | ||
pass | ||
|
||
|
||
class Serializer(BaseSerializer): | ||
@property | ||
def fields(self) -> Dict[str, Field]: ... | ||
|
||
def get_fields(self) -> Dict[str, Field]: ... | ||
def get_fields(self) -> Dict[str, Field]: ... |
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ class UniqueValidator(object): | |
pass | ||
|
||
class UniqueTogetherValidator(object): | ||
pass | ||
pass |
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