Skip to content

Commit

Permalink
reformat with black
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurnikov committed Jul 29, 2018
1 parent 4866354 commit cf85607
Show file tree
Hide file tree
Showing 343 changed files with 6,053 additions and 2,157 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*.egg-info
*.egg-info
__pycache__/
out/
/test_sqlite.py
5 changes: 4 additions & 1 deletion django-stubs/apps/config.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ from typing import Any

from django.db.models.base import Model
from typing import Any, Iterator, Type

MODELS_MODULE_NAME: str

class AppConfig:
Expand All @@ -23,6 +24,8 @@ class AppConfig:
@classmethod
def create(cls, entry: str) -> AppConfig: ...
def get_model(self, model_name: str, require_ready: bool = ...) -> Type[Model]: ...
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> Iterator[Type[Model]]: ...
def get_models(
self, include_auto_created: bool = ..., include_swapped: bool = ...
) -> Iterator[Type[Model]]: ...
def import_models(self) -> None: ...
def ready(self) -> None: ...
9 changes: 7 additions & 2 deletions django-stubs/apps/registry.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ from django.apps.config import AppConfig
from django.db.migrations.state import AppConfigStub
from django.db.models.base import Model
from typing import List, Optional, Tuple, Type, Union

class Apps:
all_models: Any = ...
app_configs: Any = ...
Expand All @@ -17,7 +18,9 @@ class Apps:
_lock: Any = ...
loading: bool = ...
_pending_operations: Any = ...
def __init__(self, installed_apps: Union[Tuple, List[str], List[AppConfigStub]] = ...) -> None: ...
def __init__(
self, installed_apps: Union[Tuple, List[str], List[AppConfigStub]] = ...
) -> None: ...
models_ready: bool = ...
ready: bool = ...
def populate(self, installed_apps: Optional[Any] = ...): ...
Expand All @@ -26,7 +29,9 @@ class Apps:
def get_app_configs(self): ...
def get_app_config(self, app_label: str) -> AppConfig: ...
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...): ...
def get_model(self, app_label: str, model_name: None = ..., require_ready: bool = ...) -> Type[Model]: ...
def get_model(
self, app_label: str, model_name: None = ..., require_ready: bool = ...
) -> Type[Model]: ...
def register_model(self, app_label: Any, model: Any) -> None: ...
def is_installed(self, app_name: Any): ...
def get_containing_app_config(self, object_name: str) -> Optional[AppConfig]: ...
Expand Down
2 changes: 2 additions & 0 deletions django-stubs/conf/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ from django.utils.functional import LazyObject
from typing import Any, Optional

from typing import Any, List

ENVIRONMENT_VARIABLE: str

class LazySettings(LazyObject):
_wrapped: Any = ...
def _setup(self, name: None = ...) -> None: ...
Expand Down
5 changes: 4 additions & 1 deletion django-stubs/conf/urls/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ from typing import Any, Optional

from django.urls.resolvers import URLPattern, URLResolver
from typing import Any, Optional, Union

handler400: Any
handler403: Any
handler404: Any
handler500: Any

def url(regex: str, view: Any, kwargs: Any = ..., name: Optional[str] = ...) -> Union[URLPattern, URLResolver]: ...
def url(
regex: str, view: Any, kwargs: Any = ..., name: Optional[str] = ...
) -> Union[URLPattern, URLResolver]: ...
5 changes: 4 additions & 1 deletion django-stubs/conf/urls/i18n.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ from typing import Any

from django.urls.resolvers import URLResolver
from typing import Any, List, Tuple, Union
def i18n_patterns(*urls: Any, prefix_default_language: bool = ...) -> Union[List[URLResolver], List[List[Any]]]: ...

def i18n_patterns(
*urls: Any, prefix_default_language: bool = ...
) -> Union[List[URLResolver], List[List[Any]]]: ...
def is_language_prefix_patterns_used(urlconf: str) -> Tuple[bool, bool]: ...

urlpatterns: Any
1 change: 1 addition & 0 deletions django-stubs/conf/urls/static.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ from typing import Any

from django.urls.resolvers import URLPattern
from typing import Callable, List

def static(prefix: str, view: Callable = ..., **kwargs: Any) -> List[URLPattern]: ...
20 changes: 18 additions & 2 deletions django-stubs/contrib/admin/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,25 @@
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from django.contrib.admin.decorators import register as register
from django.contrib.admin.filters import AllValuesFieldListFilter as AllValuesFieldListFilter, BooleanFieldListFilter as BooleanFieldListFilter, ChoicesFieldListFilter as ChoicesFieldListFilter, DateFieldListFilter as DateFieldListFilter, FieldListFilter as FieldListFilter, ListFilter as ListFilter, RelatedFieldListFilter as RelatedFieldListFilter, RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter, SimpleListFilter as SimpleListFilter
from django.contrib.admin.filters import (
AllValuesFieldListFilter as AllValuesFieldListFilter,
BooleanFieldListFilter as BooleanFieldListFilter,
ChoicesFieldListFilter as ChoicesFieldListFilter,
DateFieldListFilter as DateFieldListFilter,
FieldListFilter as FieldListFilter,
ListFilter as ListFilter,
RelatedFieldListFilter as RelatedFieldListFilter,
RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter,
SimpleListFilter as SimpleListFilter,
)
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME as ACTION_CHECKBOX_NAME
from django.contrib.admin.options import HORIZONTAL as HORIZONTAL, ModelAdmin as ModelAdmin, StackedInline as StackedInline, TabularInline as TabularInline, VERTICAL as VERTICAL
from django.contrib.admin.options import (
HORIZONTAL as HORIZONTAL,
ModelAdmin as ModelAdmin,
StackedInline as StackedInline,
TabularInline as TabularInline,
VERTICAL as VERTICAL,
)
from django.contrib.admin.sites import AdminSite as AdminSite, site as site

def autodiscover() -> None: ...
5 changes: 4 additions & 1 deletion django-stubs/contrib/admin/actions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ from django.contrib.admin.options import ModelAdmin
from django.core.handlers.wsgi import WSGIRequest
from django.db.models.query import QuerySet
from django.template.response import TemplateResponse
def delete_selected(modeladmin: ModelAdmin, request: WSGIRequest, queryset: QuerySet) -> TemplateResponse: ...

def delete_selected(
modeladmin: ModelAdmin, request: WSGIRequest, queryset: QuerySet
) -> TemplateResponse: ...
130 changes: 106 additions & 24 deletions django-stubs/contrib/admin/checks.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,113 @@ from django.contrib.auth.models import Group, User
from django.core.checks.messages import Error
from django.db.models.base import Model
from typing import Any, List, Tuple, Type, Union

def check_admin_app(app_configs: Any, **kwargs: Any): ...
def check_dependencies(**kwargs: Any): ...

class BaseModelAdminChecks:
def check(self, admin_obj: Union[ModelAdmin, InlineModelAdmin], **kwargs: Any) -> List[Error]: ...
def _check_autocomplete_fields(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_autocomplete_fields_item(self, obj: Union[ModelAdmin, InlineModelAdmin], model: Type[Model], field_name: str, label: str) -> List[Any]: ...
def _check_raw_id_fields(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_raw_id_fields_item(self, obj: ModelAdmin, model: Type[Model], field_name: str, label: str) -> List[Any]: ...
def check(
self, admin_obj: Union[ModelAdmin, InlineModelAdmin], **kwargs: Any
) -> List[Error]: ...
def _check_autocomplete_fields(
self, obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_autocomplete_fields_item(
self,
obj: Union[ModelAdmin, InlineModelAdmin],
model: Type[Model],
field_name: str,
label: str,
) -> List[Any]: ...
def _check_raw_id_fields(
self, obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_raw_id_fields_item(
self, obj: ModelAdmin, model: Type[Model], field_name: str, label: str
) -> List[Any]: ...
def _check_fields(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_fieldsets(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_fieldsets_item(self, obj: Union[ModelAdmin, InlineModelAdmin], model: Type[Model], fieldset: Any, label: str, seen_fields: List[str]) -> List[Any]: ...
def _check_field_spec(self, obj: Union[ModelAdmin, InlineModelAdmin], model: Type[Model], fields: Union[str, Tuple[str, str, str, str], Tuple[str, str]], label: str) -> List[Any]: ...
def _check_field_spec_item(self, obj: Union[ModelAdmin, TabularInline], model: Type[Model], field_name: str, label: str) -> List[Any]: ...
def _check_fieldsets_item(
self,
obj: Union[ModelAdmin, InlineModelAdmin],
model: Type[Model],
fieldset: Any,
label: str,
seen_fields: List[str],
) -> List[Any]: ...
def _check_field_spec(
self,
obj: Union[ModelAdmin, InlineModelAdmin],
model: Type[Model],
fields: Union[str, Tuple[str, str, str, str], Tuple[str, str]],
label: str,
) -> List[Any]: ...
def _check_field_spec_item(
self,
obj: Union[ModelAdmin, TabularInline],
model: Type[Model],
field_name: str,
label: str,
) -> List[Any]: ...
def _check_exclude(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_form(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_filter_vertical(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_filter_horizontal(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_filter_item(self, obj: ModelAdmin, model: Type[Union[Group, User]], field_name: str, label: str) -> List[Any]: ...
def _check_radio_fields(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_radio_fields_key(self, obj: Any, model: Any, field_name: Any, label: Any): ...
def _check_filter_vertical(
self, obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_filter_horizontal(
self, obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_filter_item(
self, obj: ModelAdmin, model: Type[Union[Group, User]], field_name: str, label: str
) -> List[Any]: ...
def _check_radio_fields(
self, obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_radio_fields_key(
self, obj: Any, model: Any, field_name: Any, label: Any
): ...
def _check_radio_fields_value(self, obj: Any, val: Any, label: Any): ...
def _check_view_on_site_url(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_prepopulated_fields(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_prepopulated_fields_key(self, obj: Union[ModelAdmin, InlineModelAdmin], model: Type[Model], field_name: str, label: str) -> List[Any]: ...
def _check_prepopulated_fields_value(self, obj: Union[ModelAdmin, InlineModelAdmin], model: Type[Model], val: Union[List[str], Tuple[str]], label: str) -> List[Any]: ...
def _check_prepopulated_fields_value_item(self, obj: Union[ModelAdmin, TabularInline], model: Type[Model], field_name: str, label: str) -> List[Any]: ...
def _check_view_on_site_url(
self, obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_prepopulated_fields(
self, obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_prepopulated_fields_key(
self,
obj: Union[ModelAdmin, InlineModelAdmin],
model: Type[Model],
field_name: str,
label: str,
) -> List[Any]: ...
def _check_prepopulated_fields_value(
self,
obj: Union[ModelAdmin, InlineModelAdmin],
model: Type[Model],
val: Union[List[str], Tuple[str]],
label: str,
) -> List[Any]: ...
def _check_prepopulated_fields_value_item(
self,
obj: Union[ModelAdmin, TabularInline],
model: Type[Model],
field_name: str,
label: str,
) -> List[Any]: ...
def _check_ordering(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_ordering_item(self, obj: ModelAdmin, model: Type[Model], field_name: str, label: str) -> List[Any]: ...
def _check_readonly_fields(self, obj: Union[ModelAdmin, InlineModelAdmin]) -> List[Any]: ...
def _check_readonly_fields_item(self, obj: Union[ModelAdmin, TabularInline], model: Type[Model], field_name: str, label: str) -> List[Any]: ...
def _check_ordering_item(
self, obj: ModelAdmin, model: Type[Model], field_name: str, label: str
) -> List[Any]: ...
def _check_readonly_fields(
self, obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_readonly_fields_item(
self,
obj: Union[ModelAdmin, TabularInline],
model: Type[Model],
field_name: str,
label: str,
) -> List[Any]: ...

class ModelAdminChecks(BaseModelAdminChecks):
def check(self, admin_obj: Any, **kwargs: Any): ...
Expand All @@ -57,15 +133,21 @@ class ModelAdminChecks(BaseModelAdminChecks):
def _check_list_per_page(self, obj: Any): ...
def _check_list_max_show_all(self, obj: Any): ...
def _check_list_editable(self, obj: Any): ...
def _check_list_editable_item(self, obj: Any, model: Any, field_name: Any, label: Any): ...
def _check_list_editable_item(
self, obj: Any, model: Any, field_name: Any, label: Any
): ...
def _check_search_fields(self, obj: Any): ...
def _check_date_hierarchy(self, obj: Any): ...
def _check_action_permission_methods(self, obj: Any): ...

class InlineModelAdminChecks(BaseModelAdminChecks):
def check(self, inline_obj: Any, **kwargs: Any): ...
def _check_exclude_of_parent_model(self, obj: InlineModelAdmin, parent_model: Type[Model]) -> List[Any]: ...
def _check_relation(self, obj: InlineModelAdmin, parent_model: Type[Model]) -> List[Any]: ...
def _check_exclude_of_parent_model(
self, obj: InlineModelAdmin, parent_model: Type[Model]
) -> List[Any]: ...
def _check_relation(
self, obj: InlineModelAdmin, parent_model: Type[Model]
) -> List[Any]: ...
def _check_extra(self, obj: InlineModelAdmin) -> List[Any]: ...
def _check_max_num(self, obj: InlineModelAdmin) -> List[Any]: ...
def _check_min_num(self, obj: InlineModelAdmin) -> List[Any]: ...
Expand Down
1 change: 1 addition & 0 deletions django-stubs/contrib/admin/decorators.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
from typing import Any, Optional

from typing import Callable

def register(*models: Any, site: Optional[Any] = ...) -> Callable: ...
Loading

0 comments on commit cf85607

Please sign in to comment.