mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-03 22:48:29 +08:00
Add __slots__ to third-party packages using stubdefaulter (#14619)
This commit is contained in:
@@ -245,6 +245,18 @@ def commit() -> None: ...
|
||||
def rollback() -> None: ...
|
||||
|
||||
class DBSessionContextManager:
|
||||
__slots__ = (
|
||||
"retry",
|
||||
"retry_exceptions",
|
||||
"allowed_exceptions",
|
||||
"immediate",
|
||||
"ddl",
|
||||
"serializable",
|
||||
"strict",
|
||||
"optimistic",
|
||||
"sql_debug",
|
||||
"show_values",
|
||||
)
|
||||
retry: int
|
||||
ddl: bool
|
||||
serializable: bool
|
||||
@@ -451,6 +463,51 @@ class DescWrapper:
|
||||
attr_id_counter: itertools.count[int]
|
||||
|
||||
class Attribute:
|
||||
__slots__ = (
|
||||
"nullable",
|
||||
"is_required",
|
||||
"is_discriminator",
|
||||
"is_unique",
|
||||
"is_part_of_unique_index",
|
||||
"is_pk",
|
||||
"is_collection",
|
||||
"is_relation",
|
||||
"is_basic",
|
||||
"is_string",
|
||||
"is_volatile",
|
||||
"is_implicit",
|
||||
"id",
|
||||
"pk_offset",
|
||||
"pk_columns_offset",
|
||||
"py_type",
|
||||
"sql_type",
|
||||
"entity",
|
||||
"name",
|
||||
"lazy",
|
||||
"lazy_sql_cache",
|
||||
"args",
|
||||
"auto",
|
||||
"default",
|
||||
"reverse",
|
||||
"composite_keys",
|
||||
"column",
|
||||
"columns",
|
||||
"col_paths",
|
||||
"_columns_checked",
|
||||
"converters",
|
||||
"kwargs",
|
||||
"cascade_delete",
|
||||
"index",
|
||||
"reverse_index",
|
||||
"original_default",
|
||||
"sql_default",
|
||||
"py_check",
|
||||
"hidden",
|
||||
"optimistic",
|
||||
"fk_name",
|
||||
"type_has_empty_value",
|
||||
"interleave",
|
||||
)
|
||||
nullable: bool | None
|
||||
is_required: bool
|
||||
is_discriminator: bool
|
||||
@@ -515,12 +572,15 @@ class Attribute:
|
||||
def desc(attr) -> DescWrapper: ...
|
||||
def describe(attr) -> str: ...
|
||||
|
||||
class Optional(Attribute): ...
|
||||
class Optional(Attribute):
|
||||
__slots__: list[str] = []
|
||||
|
||||
class Required(Attribute):
|
||||
__slots__: list[str] = []
|
||||
def validate(attr, val, obj=None, entity=None, from_db: bool = False): ...
|
||||
|
||||
class Discriminator(Required):
|
||||
__slots__ = ["code2cls"]
|
||||
code2cls: dict[Incomplete, Incomplete]
|
||||
def __init__(attr, py_type, *args, **kwargs) -> None: ...
|
||||
@staticmethod
|
||||
@@ -534,6 +594,7 @@ class Discriminator(Required):
|
||||
def update_reverse(attr, obj, old_val, new_val, undo_funcs) -> None: ...
|
||||
|
||||
class Index:
|
||||
__slots__ = ("entity", "attrs", "is_pk", "is_unique")
|
||||
entity: Incomplete
|
||||
attrs: list[Incomplete]
|
||||
is_pk: bool
|
||||
@@ -544,9 +605,24 @@ def composite_index(*attrs) -> None: ...
|
||||
def composite_key(*attrs) -> None: ...
|
||||
|
||||
class PrimaryKey(Required):
|
||||
__slots__: list[str] = []
|
||||
def __new__(cls, *args, **kwargs): ...
|
||||
|
||||
class Collection(Attribute):
|
||||
__slots__ = (
|
||||
"table",
|
||||
"wrapper_class",
|
||||
"symmetric",
|
||||
"reverse_column",
|
||||
"reverse_columns",
|
||||
"nplus1_threshold",
|
||||
"cached_load_sql",
|
||||
"cached_add_m2m_sql",
|
||||
"cached_remove_m2m_sql",
|
||||
"cached_count_sql",
|
||||
"cached_empty_sql",
|
||||
"reverse_fk_name",
|
||||
)
|
||||
table: str | list[str] | tuple[str, ...] | None
|
||||
wrapper_class: Incomplete
|
||||
symmetric: bool
|
||||
@@ -568,6 +644,7 @@ class Collection(Attribute):
|
||||
def set(attr, obj, val, fromdb: bool = False) -> None: ...
|
||||
|
||||
class SetData(set[Incomplete]):
|
||||
__slots__ = ("is_fully_loaded", "added", "removed", "absent", "count")
|
||||
is_fully_loaded: bool
|
||||
added: Incomplete
|
||||
removed: Incomplete
|
||||
@@ -580,6 +657,7 @@ def construct_batchload_criteria_list(
|
||||
): ...
|
||||
|
||||
class Set(Collection):
|
||||
__slots__: list[str] = []
|
||||
def validate(attr, val, obj=None, entity=None, from_db: bool = False): ...
|
||||
def prefetch_load_all(attr, objects): ...
|
||||
def load(attr, obj, items=None): ...
|
||||
@@ -606,6 +684,7 @@ class SetIterator:
|
||||
__next__ = next
|
||||
|
||||
class SetInstance:
|
||||
__slots__ = ("_obj_", "_attr_", "_attrnames_")
|
||||
def __init__(wrapper, obj, attr) -> None: ...
|
||||
def __reduce__(wrapper): ...
|
||||
def copy(wrapper): ...
|
||||
@@ -637,6 +716,7 @@ class SetInstance:
|
||||
def unpickle_multiset(obj, attrnames, items): ...
|
||||
|
||||
class Multiset:
|
||||
__slots__ = ["_obj_", "_attrnames_", "_items_"]
|
||||
def __init__(multiset, obj, attrnames, items) -> None: ...
|
||||
def __reduce__(multiset): ...
|
||||
def distinct(multiset): ...
|
||||
@@ -695,6 +775,18 @@ class EntityProxy:
|
||||
def __ne__(self, other) -> bool: ...
|
||||
|
||||
class Entity(metaclass=EntityMeta):
|
||||
__slots__ = (
|
||||
"_session_cache_",
|
||||
"_status_",
|
||||
"_pkval_",
|
||||
"_newid_",
|
||||
"_dbvals_",
|
||||
"_vals_",
|
||||
"_rbits_",
|
||||
"_wbits_",
|
||||
"_save_pos_",
|
||||
"__weakref__",
|
||||
)
|
||||
def __reduce__(obj): ...
|
||||
def __init__(obj, *args, **kwargs) -> None: ...
|
||||
def get_pk(obj): ...
|
||||
@@ -774,6 +866,7 @@ class Query:
|
||||
def to_json(query, include=(), exclude=(), converter=None, with_schema: bool = True, schema_hash=None): ...
|
||||
|
||||
class QueryResultIterator:
|
||||
__slots__ = ("_query_result", "_position")
|
||||
def __init__(self, query_result) -> None: ...
|
||||
def next(self): ...
|
||||
__next__ = next
|
||||
@@ -782,6 +875,7 @@ class QueryResultIterator:
|
||||
def make_query_result_method_error_stub(name: str, title: str | None = None) -> Callable[..., NoReturn]: ...
|
||||
|
||||
class QueryResult:
|
||||
__slots__ = ("_query", "_limit", "_offset", "_items", "_expr_type", "_col_names")
|
||||
def __init__(self, query, limit, offset, lazy) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@@ -20,7 +20,8 @@ class MySQLSchema(dbschema.DBSchema):
|
||||
class MySQLTranslator(SQLTranslator):
|
||||
dialect: ClassVar[str]
|
||||
|
||||
class MySQLValue(Value): ...
|
||||
class MySQLValue(Value):
|
||||
__slots__: list[str] = []
|
||||
|
||||
class MySQLBuilder(SQLBuilder):
|
||||
dialect: ClassVar[str]
|
||||
|
||||
@@ -30,7 +30,8 @@ class SQLiteTranslator(SQLTranslator):
|
||||
StringMixin_UPPER: Incomplete
|
||||
StringMixin_LOWER: Incomplete
|
||||
|
||||
class SQLiteValue(Value): ...
|
||||
class SQLiteValue(Value):
|
||||
__slots__: list[str] = []
|
||||
|
||||
class SQLiteBuilder(SQLBuilder):
|
||||
dialect: ClassVar[str]
|
||||
|
||||
@@ -6,6 +6,7 @@ from pony.orm.core import Database, Entity
|
||||
database: Database
|
||||
|
||||
class User(Entity):
|
||||
__slots__ = ()
|
||||
user_id: PrimaryKey
|
||||
owned_pokemons: Incomplete
|
||||
is_admin: Incomplete
|
||||
@@ -20,6 +21,7 @@ class User(Entity):
|
||||
def set_favorite_color(self, color: tuple[Incomplete, ...]): ...
|
||||
|
||||
class Pokemon(Entity):
|
||||
__slots__ = ()
|
||||
name: Incomplete
|
||||
pokemon_id: Incomplete
|
||||
sprite: Incomplete
|
||||
@@ -32,6 +34,7 @@ class Pokemon(Entity):
|
||||
def caught_by(self, user: User): ...
|
||||
|
||||
class Chat(Entity):
|
||||
__slots__ = ()
|
||||
chat_id: Incomplete
|
||||
active: Incomplete
|
||||
def activate(self) -> None: ...
|
||||
|
||||
@@ -5,6 +5,7 @@ from pony.orm.core import Database, Entity
|
||||
db: Database
|
||||
|
||||
class Group(Entity):
|
||||
__slots__ = ()
|
||||
dept: Incomplete
|
||||
year: Incomplete
|
||||
spec: Incomplete
|
||||
@@ -13,6 +14,7 @@ class Group(Entity):
|
||||
lessons: Incomplete
|
||||
|
||||
class Department(Entity):
|
||||
__slots__ = ()
|
||||
number: Incomplete
|
||||
faculty: Incomplete
|
||||
name: Incomplete
|
||||
@@ -20,23 +22,27 @@ class Department(Entity):
|
||||
teachers: Incomplete
|
||||
|
||||
class Faculty(Entity):
|
||||
__slots__ = ()
|
||||
number: Incomplete
|
||||
name: Incomplete
|
||||
depts: Incomplete
|
||||
|
||||
class Student(Entity):
|
||||
__slots__ = ()
|
||||
name: Incomplete
|
||||
group: Incomplete
|
||||
dob: Incomplete
|
||||
grades: Incomplete
|
||||
|
||||
class Grade(Entity):
|
||||
__slots__ = ()
|
||||
student: Incomplete
|
||||
task: Incomplete
|
||||
date: Incomplete
|
||||
value: Incomplete
|
||||
|
||||
class Task(Entity):
|
||||
__slots__ = ()
|
||||
course: Incomplete
|
||||
type: Incomplete
|
||||
number: Incomplete
|
||||
@@ -44,6 +50,7 @@ class Task(Entity):
|
||||
grades: Incomplete
|
||||
|
||||
class Course(Entity):
|
||||
__slots__ = ()
|
||||
subject: Incomplete
|
||||
semester: Incomplete
|
||||
groups: Incomplete
|
||||
@@ -52,23 +59,27 @@ class Course(Entity):
|
||||
teachers: Incomplete
|
||||
|
||||
class Subject(Entity):
|
||||
__slots__ = ()
|
||||
name: Incomplete
|
||||
descr: Incomplete
|
||||
courses: Incomplete
|
||||
|
||||
class Room(Entity):
|
||||
__slots__ = ()
|
||||
building: Incomplete
|
||||
number: Incomplete
|
||||
floor: Incomplete
|
||||
schedules: Incomplete
|
||||
|
||||
class Teacher(Entity):
|
||||
__slots__ = ()
|
||||
dept: Incomplete
|
||||
name: Incomplete
|
||||
courses: Incomplete
|
||||
lessons: Incomplete
|
||||
|
||||
class Lesson(Entity):
|
||||
__slots__ = ()
|
||||
groups: Incomplete
|
||||
course: Incomplete
|
||||
room: Incomplete
|
||||
|
||||
@@ -5,24 +5,28 @@ from pony.orm.core import Database, Entity
|
||||
db: Database
|
||||
|
||||
class Customer(Entity):
|
||||
__slots__ = ()
|
||||
id: Incomplete
|
||||
name: Incomplete
|
||||
email: Incomplete
|
||||
orders: Incomplete
|
||||
|
||||
class Order(Entity):
|
||||
__slots__ = ()
|
||||
id: Incomplete
|
||||
total_price: Incomplete
|
||||
customer: Incomplete
|
||||
items: Incomplete
|
||||
|
||||
class Product(Entity):
|
||||
__slots__ = ()
|
||||
id: Incomplete
|
||||
name: Incomplete
|
||||
price: Incomplete
|
||||
items: Incomplete
|
||||
|
||||
class OrderItem(Entity):
|
||||
__slots__ = ()
|
||||
quantity: Incomplete
|
||||
order: Incomplete
|
||||
product: Incomplete
|
||||
|
||||
@@ -5,6 +5,7 @@ from pony.orm.core import Database, Entity
|
||||
db: Database
|
||||
|
||||
class Customer(Entity):
|
||||
__slots__ = ()
|
||||
email: Incomplete
|
||||
password: Incomplete
|
||||
name: Incomplete
|
||||
@@ -14,6 +15,7 @@ class Customer(Entity):
|
||||
orders: Incomplete
|
||||
|
||||
class Product(Entity):
|
||||
__slots__ = ()
|
||||
id: Incomplete
|
||||
name: Incomplete
|
||||
categories: Incomplete
|
||||
@@ -25,17 +27,20 @@ class Product(Entity):
|
||||
order_items: Incomplete
|
||||
|
||||
class CartItem(Entity):
|
||||
__slots__ = ()
|
||||
quantity: Incomplete
|
||||
customer: Incomplete
|
||||
product: Incomplete
|
||||
|
||||
class OrderItem(Entity):
|
||||
__slots__ = ()
|
||||
quantity: Incomplete
|
||||
price: Incomplete
|
||||
order: Incomplete
|
||||
product: Incomplete
|
||||
|
||||
class Order(Entity):
|
||||
__slots__ = ()
|
||||
id: Incomplete
|
||||
state: Incomplete
|
||||
date_created: Incomplete
|
||||
@@ -46,6 +51,7 @@ class Order(Entity):
|
||||
items: Incomplete
|
||||
|
||||
class Category(Entity):
|
||||
__slots__ = ()
|
||||
name: Incomplete
|
||||
products: Incomplete
|
||||
|
||||
|
||||
@@ -5,31 +5,38 @@ from pony.orm.core import Database, Entity
|
||||
db: Database
|
||||
|
||||
class Person(Entity):
|
||||
__slots__ = ()
|
||||
id: Incomplete
|
||||
name: Incomplete
|
||||
dob: Incomplete
|
||||
ssn: Incomplete
|
||||
|
||||
class Student(Person):
|
||||
__slots__ = ()
|
||||
group: Incomplete
|
||||
mentor: Incomplete
|
||||
attend_courses: Incomplete
|
||||
|
||||
class Teacher(Person):
|
||||
__slots__ = ()
|
||||
teach_courses: Incomplete
|
||||
apprentices: Incomplete
|
||||
salary: Incomplete
|
||||
|
||||
class Assistant(Student, Teacher): ...
|
||||
class Assistant(Student, Teacher):
|
||||
__slots__ = ()
|
||||
|
||||
class Professor(Teacher):
|
||||
__slots__ = ()
|
||||
position: Incomplete
|
||||
|
||||
class Group(Entity):
|
||||
__slots__ = ()
|
||||
number: Incomplete
|
||||
students: Incomplete
|
||||
|
||||
class Course(Entity):
|
||||
__slots__ = ()
|
||||
name: Incomplete
|
||||
semester: Incomplete
|
||||
students: Incomplete
|
||||
|
||||
@@ -5,6 +5,7 @@ from pony.orm.core import Database, Entity
|
||||
db: Database
|
||||
|
||||
class Numbers(Entity):
|
||||
__slots__ = ()
|
||||
id: Incomplete
|
||||
int8: Incomplete
|
||||
int16: Incomplete
|
||||
|
||||
@@ -6,18 +6,21 @@ from pony.orm.core import Database, Entity
|
||||
db: Database
|
||||
|
||||
class Department(Entity):
|
||||
__slots__ = ()
|
||||
number: Incomplete
|
||||
name: Incomplete
|
||||
groups: Incomplete
|
||||
courses: Incomplete
|
||||
|
||||
class Group(Entity):
|
||||
__slots__ = ()
|
||||
number: Incomplete
|
||||
major: Incomplete
|
||||
dept: Incomplete
|
||||
students: Incomplete
|
||||
|
||||
class Course(Entity):
|
||||
__slots__ = ()
|
||||
name: Incomplete
|
||||
semester: Incomplete
|
||||
lect_hours: Incomplete
|
||||
@@ -27,6 +30,7 @@ class Course(Entity):
|
||||
students: Incomplete
|
||||
|
||||
class Student(Entity):
|
||||
__slots__ = ()
|
||||
id: Incomplete
|
||||
name: Incomplete
|
||||
dob: Incomplete
|
||||
|
||||
@@ -5,11 +5,13 @@ from pony.orm.core import Database, Entity
|
||||
db: Database
|
||||
|
||||
class Faculty(Entity):
|
||||
__slots__ = ()
|
||||
number: Incomplete
|
||||
name: Incomplete
|
||||
departments: Incomplete
|
||||
|
||||
class Department(Entity):
|
||||
__slots__ = ()
|
||||
number: Incomplete
|
||||
name: Incomplete
|
||||
faculty: Incomplete
|
||||
@@ -18,6 +20,7 @@ class Department(Entity):
|
||||
groups: Incomplete
|
||||
|
||||
class Group(Entity):
|
||||
__slots__ = ()
|
||||
number: Incomplete
|
||||
grad_year: Incomplete
|
||||
department: Incomplete
|
||||
@@ -25,22 +28,26 @@ class Group(Entity):
|
||||
students: Incomplete
|
||||
|
||||
class Student(Entity):
|
||||
__slots__ = ()
|
||||
name: Incomplete
|
||||
scholarship: Incomplete
|
||||
group: Incomplete
|
||||
grades: Incomplete
|
||||
|
||||
class Major(Entity):
|
||||
__slots__ = ()
|
||||
name: Incomplete
|
||||
department: Incomplete
|
||||
courses: Incomplete
|
||||
|
||||
class Subject(Entity):
|
||||
__slots__ = ()
|
||||
name: Incomplete
|
||||
courses: Incomplete
|
||||
teachers: Incomplete
|
||||
|
||||
class Course(Entity):
|
||||
__slots__ = ()
|
||||
major: Incomplete
|
||||
subject: Incomplete
|
||||
semester: Incomplete
|
||||
@@ -51,6 +58,7 @@ class Course(Entity):
|
||||
grades: Incomplete
|
||||
|
||||
class Lesson(Entity):
|
||||
__slots__ = ()
|
||||
day_of_week: Incomplete
|
||||
meeting_time: Incomplete
|
||||
classroom: Incomplete
|
||||
@@ -59,6 +67,7 @@ class Lesson(Entity):
|
||||
groups: Incomplete
|
||||
|
||||
class Grade(Entity):
|
||||
__slots__ = ()
|
||||
student: Incomplete
|
||||
course: Incomplete
|
||||
teacher: Incomplete
|
||||
@@ -66,6 +75,7 @@ class Grade(Entity):
|
||||
value: Incomplete
|
||||
|
||||
class Teacher(Entity):
|
||||
__slots__ = ()
|
||||
name: Incomplete
|
||||
degree: Incomplete
|
||||
department: Incomplete
|
||||
@@ -74,11 +84,13 @@ class Teacher(Entity):
|
||||
grades: Incomplete
|
||||
|
||||
class Building(Entity):
|
||||
__slots__ = ()
|
||||
number: Incomplete
|
||||
description: Incomplete
|
||||
classrooms: Incomplete
|
||||
|
||||
class Classroom(Entity):
|
||||
__slots__ = ()
|
||||
building: Incomplete
|
||||
number: Incomplete
|
||||
description: Incomplete
|
||||
|
||||
@@ -11,6 +11,7 @@ class LongStr(str):
|
||||
LongUnicode = LongStr
|
||||
|
||||
class SetType:
|
||||
__slots__ = "item_type"
|
||||
def __deepcopy__(self, memo) -> Self: ...
|
||||
item_type: Incomplete
|
||||
def __init__(self, item_type) -> None: ...
|
||||
@@ -19,6 +20,7 @@ class SetType:
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class FuncType:
|
||||
__slots__ = "func"
|
||||
def __deepcopy__(self, memo) -> Self: ...
|
||||
func: Incomplete
|
||||
def __init__(self, func) -> None: ...
|
||||
@@ -27,6 +29,7 @@ class FuncType:
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class MethodType:
|
||||
__slots__ = ("obj", "func")
|
||||
def __deepcopy__(self, memo) -> Self: ...
|
||||
obj: Incomplete
|
||||
func: Incomplete
|
||||
|
||||
@@ -7,6 +7,7 @@ from typing import ClassVar
|
||||
class AstError(Exception): ...
|
||||
|
||||
class Param:
|
||||
__slots__ = ("style", "id", "paramkey", "converter", "optimistic")
|
||||
style: Incomplete
|
||||
id: Incomplete
|
||||
paramkey: Incomplete
|
||||
@@ -16,12 +17,14 @@ class Param:
|
||||
def eval(param, values): ...
|
||||
|
||||
class CompositeParam(Param):
|
||||
__slots__ = ("items", "func")
|
||||
items: Iterable[Param | Value]
|
||||
func: Incomplete
|
||||
def __init__(param, paramstyle, paramkey, items: Iterable[Param | Value], func) -> None: ...
|
||||
def eval(param, values): ...
|
||||
|
||||
class Value:
|
||||
__slots__ = ("paramstyle", "value")
|
||||
paramstyle: Incomplete
|
||||
value: Incomplete
|
||||
def __init__(self, paramstyle, value) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user