mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-16 08:47:49 +08:00
move django.core stubs
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
from django.core.files.base import File
|
||||
from django.core.files.base import File as File
|
||||
|
||||
__all__ = ["File"]
|
||||
|
||||
15
django-stubs/core/files/images.pyi
Normal file
15
django-stubs/core/files/images.pyi
Normal file
@@ -0,0 +1,15 @@
|
||||
from io import BufferedReader, BytesIO
|
||||
from typing import Any, Union
|
||||
|
||||
from django.core.files import File
|
||||
|
||||
class ImageFile(File):
|
||||
file: BufferedReader
|
||||
mode: str
|
||||
name: str
|
||||
@property
|
||||
def width(self) -> int: ...
|
||||
@property
|
||||
def height(self) -> int: ...
|
||||
|
||||
def get_image_dimensions(file_or_path: Union[BufferedReader, BytesIO, ImageFile, str], close: bool = ...) -> Any: ...
|
||||
17
django-stubs/core/files/locks.pyi
Normal file
17
django-stubs/core/files/locks.pyi
Normal file
@@ -0,0 +1,17 @@
|
||||
from ctypes import Structure, c_int64, c_ulong, c_void_p
|
||||
from io import BufferedRandom, TextIOWrapper
|
||||
from typing import Union
|
||||
|
||||
LOCK_SH: int
|
||||
LOCK_NB: int
|
||||
LOCK_EX: int
|
||||
ULONG_PTR = c_int64
|
||||
ULONG_PTR = c_ulong
|
||||
PVOID = c_void_p
|
||||
|
||||
class _OFFSET(Structure): ...
|
||||
class _OFFSET_UNION(Union): ...
|
||||
class OVERLAPPED(Structure): ...
|
||||
|
||||
def lock(f: Union[BufferedRandom, TextIOWrapper, int], flags: int) -> bool: ...
|
||||
def unlock(f: Union[BufferedRandom, int]) -> bool: ...
|
||||
3
django-stubs/core/files/move.pyi
Normal file
3
django-stubs/core/files/move.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
def file_move_safe(
|
||||
old_file_name: str, new_file_name: str, chunk_size: int = ..., allow_overwrite: bool = ...
|
||||
) -> None: ...
|
||||
51
django-stubs/core/files/storage.pyi
Normal file
51
django-stubs/core/files/storage.pyi
Normal file
@@ -0,0 +1,51 @@
|
||||
from datetime import datetime
|
||||
from io import StringIO, TextIOWrapper
|
||||
from typing import Any, List, Optional, Tuple, Union
|
||||
|
||||
from django.core.files.base import File
|
||||
from django.utils.functional import LazyObject
|
||||
|
||||
class Storage:
|
||||
def open(self, name: str, mode: str = ...) -> File: ...
|
||||
def save(
|
||||
self, name: Optional[str], content: Union[StringIO, TextIOWrapper, File], max_length: Optional[int] = ...
|
||||
) -> str: ...
|
||||
def get_valid_name(self, name: str) -> str: ...
|
||||
def get_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ...
|
||||
def generate_filename(self, filename: str) -> str: ...
|
||||
def path(self, name: str) -> Any: ...
|
||||
def delete(self, name: Any) -> None: ...
|
||||
def exists(self, name: Any) -> None: ...
|
||||
def listdir(self, path: Any) -> None: ...
|
||||
def size(self, name: Any) -> None: ...
|
||||
def url(self, name: Any) -> None: ...
|
||||
def get_accessed_time(self, name: Any) -> None: ...
|
||||
def get_created_time(self, name: Any) -> None: ...
|
||||
def get_modified_time(self, name: Any) -> None: ...
|
||||
|
||||
class FileSystemStorage(Storage):
|
||||
def __init__(
|
||||
self,
|
||||
location: Optional[str] = ...,
|
||||
base_url: Optional[str] = ...,
|
||||
file_permissions_mode: Optional[int] = ...,
|
||||
directory_permissions_mode: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
def base_location(self) -> str: ...
|
||||
def location(self) -> str: ...
|
||||
def base_url(self) -> str: ...
|
||||
def file_permissions_mode(self) -> Optional[int]: ...
|
||||
def directory_permissions_mode(self) -> Optional[int]: ...
|
||||
def delete(self, name: str) -> None: ...
|
||||
def exists(self, name: str) -> bool: ...
|
||||
def listdir(self, path: str) -> Tuple[List[str], List[str]]: ...
|
||||
def path(self, name: str) -> str: ...
|
||||
def size(self, name: str) -> int: ...
|
||||
def url(self, name: Optional[str]) -> str: ...
|
||||
def get_accessed_time(self, name: str) -> datetime: ...
|
||||
def get_created_time(self, name: str) -> datetime: ...
|
||||
def get_modified_time(self, name: str) -> datetime: ...
|
||||
|
||||
class DefaultStorage(LazyObject): ...
|
||||
|
||||
default_storage: Any
|
||||
Reference in New Issue
Block a user