Skip to content

Commit

Permalink
Fix logger type in all modules (typeddjango#1031)
Browse files Browse the repository at this point in the history
* Fix `logger` type in all modules

* Fix CI
  • Loading branch information
sobolevn authored Jun 28, 2022
1 parent fe2d228 commit 33d4dc7
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 11 deletions.
3 changes: 2 additions & 1 deletion django-stubs/contrib/gis/admin/widgets.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from logging import Logger
from typing import Any

from django.forms.widgets import Textarea as Textarea

geo_context: Any
logger: Any
logger: Logger

class OpenLayersWidget(Textarea):
def get_context(self, name: Any, value: Any, attrs: Any): ...
Expand Down
3 changes: 2 additions & 1 deletion django-stubs/contrib/gis/db/backends/mysql/schema.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from logging import Logger
from typing import Any

from django.db.backends.mysql.schema import DatabaseSchemaEditor as DatabaseSchemaEditor

logger: Any
logger: Logger

class MySQLGISSchemaEditor(DatabaseSchemaEditor):
sql_add_spatial_index: str = ...
Expand Down
3 changes: 2 additions & 1 deletion django-stubs/contrib/gis/forms/widgets.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from logging import Logger
from typing import Any, Optional

from django.forms.widgets import Widget as Widget

logger: Any
logger: Logger

class BaseGeometryWidget(Widget):
geom_type: str = ...
Expand Down
3 changes: 2 additions & 1 deletion django-stubs/contrib/gis/gdal/libgdal.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from logging import Logger
from typing import Any

logger: Any
logger: Logger
lib_path: Any
lib_names: Any
lgdal: Any
Expand Down
3 changes: 2 additions & 1 deletion django-stubs/contrib/gis/geos/libgeos.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from ctypes import Structure
from logging import Logger
from typing import Any, Optional

logger: Any
logger: Logger

def load_geos(): ...

Expand Down
3 changes: 2 additions & 1 deletion django-stubs/db/backends/base/schema.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from logging import Logger
from typing import Any, ContextManager, List, Optional, Sequence, Tuple, Type, Union

from django.db.backends.base.base import BaseDatabaseWrapper
Expand All @@ -6,7 +7,7 @@ from django.db.models.base import Model
from django.db.models.fields import Field
from django.db.models.indexes import Index

logger: Any
logger: Logger

class BaseDatabaseSchemaEditor(ContextManager[Any]):
sql_create_table: str = ...
Expand Down
3 changes: 2 additions & 1 deletion django-stubs/db/backends/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import sys
import types
from contextlib import contextmanager
from decimal import Decimal
from logging import Logger
from typing import Any, Dict, Generator, Iterator, List, Mapping, Optional, Sequence, Tuple, Type, Union, overload
from uuid import UUID

Expand All @@ -11,7 +12,7 @@ if sys.version_info < (3, 8):
else:
from typing import Literal

logger: Any
logger: Logger

# Python types that can be adapted to SQL.
_SQLType = Union[
Expand Down
3 changes: 2 additions & 1 deletion django-stubs/middleware/csrf.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from logging import Logger
from typing import Any, Callable, Dict, Optional, Tuple

from django.http.request import HttpRequest
from django.http.response import HttpResponseBase, HttpResponseForbidden
from django.utils.deprecation import MiddlewareMixin

logger: Any
logger: Logger
REASON_NO_REFERER: str
REASON_BAD_REFERER: str
REASON_NO_CSRF_COOKIE: str
Expand Down
3 changes: 2 additions & 1 deletion django-stubs/template/base.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from enum import Enum
from logging import Logger
from typing import (
Any,
Callable,
Expand Down Expand Up @@ -35,7 +36,7 @@ SINGLE_BRACE_START: str
SINGLE_BRACE_END: str
UNKNOWN_SOURCE: str
tag_re: Pattern[str]
logger: Any
logger: Logger

class TokenType(Enum):
TEXT: int = ...
Expand Down
3 changes: 2 additions & 1 deletion django-stubs/test/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import decimal
from contextlib import contextmanager
from decimal import Decimal
from io import StringIO
from logging import Logger
from typing import (
Any,
Callable,
Expand Down Expand Up @@ -115,7 +116,7 @@ class override_script_prefix(TestContextDecorator):
old_prefix: str = ...

class LoggingCaptureMixin:
logger: Any = ...
logger: Logger = ...
old_stream: Any = ...
logger_output: Any = ...
def setUp(self) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/utils/log.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from typing import Any, Callable, Dict, Optional, Union
from django.core.management.color import Style
from django.http import HttpRequest, HttpResponse

request_logger: Any
request_logger: Logger
DEFAULT_LOGGING: Any

def configure_logging(logging_config: str, logging_settings: Dict[str, Any]) -> None: ...
Expand Down

0 comments on commit 33d4dc7

Please sign in to comment.