mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-05-25 01:38:40 +08:00
initial commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
from datetime import (
|
||||
date,
|
||||
datetime,
|
||||
)
|
||||
from decimal import Decimal
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Cast:
|
||||
def __init__(
|
||||
self,
|
||||
expression: Union[str, date, Decimal],
|
||||
output_field: Field
|
||||
) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
**extra_context
|
||||
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[Any]]]: ...
|
||||
|
||||
|
||||
class Coalesce:
|
||||
def __init__(self, *expressions, **extra) -> None: ...
|
||||
|
||||
|
||||
class Greatest:
|
||||
def __init__(self, *expressions, **extra) -> None: ...
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
|
||||
|
||||
class Least:
|
||||
def __init__(self, *expressions, **extra) -> None: ...
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[Any]]]: ...
|
||||
@@ -0,0 +1,102 @@
|
||||
from datetime import (
|
||||
date,
|
||||
time,
|
||||
)
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.expressions import Col
|
||||
from django.db.models.fields import (
|
||||
DateTimeCheckMixin,
|
||||
IntegerField,
|
||||
)
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.db.models.sql.query import Query
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Extract:
|
||||
def __init__(
|
||||
self,
|
||||
expression: Union[str, Col, TruncDate],
|
||||
lookup_name: Optional[str] = ...,
|
||||
tzinfo: None = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: None = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> Extract: ...
|
||||
|
||||
|
||||
class TimezoneMixin:
|
||||
def get_tzname(self) -> Optional[str]: ...
|
||||
|
||||
|
||||
class Trunc:
|
||||
def __init__(
|
||||
self,
|
||||
expression: str,
|
||||
kind: str,
|
||||
output_field: Optional[Union[IntegerField, DateTimeCheckMixin]] = ...,
|
||||
tzinfo: None = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class TruncBase:
|
||||
def __init__(
|
||||
self,
|
||||
expression: Union[str, Col],
|
||||
output_field: Optional[DateTimeCheckMixin] = ...,
|
||||
tzinfo: None = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
def convert_value(
|
||||
self,
|
||||
value: Union[date, time],
|
||||
expression: django.db.models.functions.TruncBase,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[date, time]: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: None = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> TruncBase: ...
|
||||
|
||||
|
||||
class TruncDate:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
|
||||
|
||||
class TruncTime:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
@@ -0,0 +1,112 @@
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.expressions import (
|
||||
Col,
|
||||
F,
|
||||
Value,
|
||||
)
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BytesToCharFieldConversionMixin:
|
||||
def convert_value(
|
||||
self,
|
||||
value: str,
|
||||
expression: LPad,
|
||||
connection: DatabaseWrapper
|
||||
) -> str: ...
|
||||
|
||||
|
||||
class Chr:
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
**extra_context
|
||||
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
|
||||
|
||||
|
||||
class Concat:
|
||||
def __init__(self, *expressions, **extra) -> None: ...
|
||||
def _paired(
|
||||
self,
|
||||
expressions: Union[Tuple[Value, str], Tuple[str, str], Tuple[Value, str, Value]]
|
||||
) -> ConcatPair: ...
|
||||
|
||||
|
||||
class ConcatPair:
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[str]]: ...
|
||||
def coalesce(self) -> ConcatPair: ...
|
||||
|
||||
|
||||
class LPad:
|
||||
def __init__(
|
||||
self,
|
||||
expression: str,
|
||||
length: Union[int, Length],
|
||||
fill_text: Value = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class Left:
|
||||
def __init__(self, expression: str, length: int, **extra) -> None: ...
|
||||
def get_substr(self) -> Substr: ...
|
||||
def use_substr(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
**extra_context
|
||||
) -> Tuple[str, List[int]]: ...
|
||||
|
||||
|
||||
class Ord:
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
**extra_context
|
||||
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
|
||||
|
||||
|
||||
class Replace:
|
||||
def __init__(
|
||||
self,
|
||||
expression: F,
|
||||
text: Value,
|
||||
replacement: Value = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class Right:
|
||||
def get_substr(self) -> Substr: ...
|
||||
|
||||
|
||||
class Substr:
|
||||
def __init__(
|
||||
self,
|
||||
expression: Union[str, Col],
|
||||
pos: Union[int, Value],
|
||||
length: Union[int, Value] = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
def as_oracle(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[int]]: ...
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[int]], Tuple[str, List[Union[str, int]]]]: ...
|
||||
@@ -0,0 +1,5 @@
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class LagLeadFunction:
|
||||
def __init__(self, expression: Optional[str], offset: int = ..., default: None = ..., **extra): ...
|
||||
Reference in New Issue
Block a user