diff --git a/src/client/aggregation.pyi b/src/client/aggregation.pyi index a06ea9dd..2494b96e 100644 --- a/src/client/aggregation.pyi +++ b/src/client/aggregation.pyi @@ -39,16 +39,16 @@ class PoolAggregatedSolutionRequest(toloka.client.primitives.base.BaseTolokaObje fields: Output data fields to aggregate. For the best results, each of these fields should have limited number of response options. If the `DAWID_SKENE` aggregation type is selected, you can only specify one value. - Example: - >>> aggregation_operation = toloka_client.aggregate_solutions_by_pool( - >>> type=toloka.client.aggregation.AggregatedSolutionType.WEIGHTED_DYNAMIC_OVERLAP, - >>> pool_id='1080020', - >>> answer_weight_skill_id='11294', - >>> fields=[toloka.client.aggregation.PoolAggregatedSolutionRequest.Field(name='result')] - >>> ) - >>> aggregation_operation = toloka_client.wait_operation(aggregation_operation) - >>> aggregation_results = list(toloka_client.get_aggregated_solutions(aggregation_operation.id)) - ... + Example: + >>> aggregation_operation = toloka_client.aggregate_solutions_by_pool( + >>> type=toloka.client.aggregation.AggregatedSolutionType.WEIGHTED_DYNAMIC_OVERLAP, + >>> pool_id='1080020', + >>> answer_weight_skill_id='11294', + >>> fields=[toloka.client.aggregation.PoolAggregatedSolutionRequest.Field(name='result')] + >>> ) + >>> aggregation_operation = toloka_client.wait_operation(aggregation_operation) + >>> aggregation_results = list(toloka_client.get_aggregated_solutions(aggregation_operation.id)) + ... """ class Field(toloka.client.primitives.base.BaseTolokaObject): diff --git a/src/client/search_requests.py b/src/client/search_requests.py index 2ca60951..e04dc522 100644 --- a/src/client/search_requests.py +++ b/src/client/search_requests.py @@ -98,8 +98,9 @@ def _create_sort_field_enum(qualname: str, sort_fields: List[str]): return unique(Enum(qualname.split('.')[-1], namespace)) # type: ignore @classmethod - def for_fields(cls, qualname: str, sort_fields: List[str]): + def for_fields(cls, qualname: str, sort_fields: List[str], module_name: str = __name__): sort_field_enum = cls._create_sort_field_enum(f'{qualname}.SortField', sort_fields) + sort_field_enum.__module__ = module_name namespace = { 'SortField': sort_field_enum, 'order': SortOrder.ASCENDING, @@ -111,7 +112,7 @@ def for_fields(cls, qualname: str, sort_fields: List[str]): } subclass = BaseTolokaObjectMetaclass(qualname.split('.')[-1], (cls,), namespace, kw_only=False) - subclass.__module__ = __name__ + subclass.__module__ = module_name return subclass @@ -127,8 +128,8 @@ def structure(cls, items): return cls(items=items) @classmethod - def for_fields(cls, qualname: str, sort_fields: List[str], docstring: Optional[str] = None): - sort_item_class: Type = BaseSortItem.for_fields(f'{qualname}.SortItem', sort_fields) + def for_fields(cls, qualname: str, sort_fields: List[str], docstring: Optional[str] = None, module_name: str = __name__): + sort_item_class: Type = BaseSortItem.for_fields(f'{qualname}.SortItem', sort_fields, module_name=module_name) def items_converter(items): if isinstance(items, sort_items_class): @@ -144,7 +145,7 @@ def items_converter(items): '__qualname__': qualname, } sort_items_class = BaseTolokaObjectMetaclass(qualname.split('.')[-1], (BaseSortItems,), namespace, kw_only=False) - sort_items_class.__module__ = __name__ + sort_items_class.__module__ = module_name sort_items_class.__doc__ = docstring return sort_items_class @@ -164,7 +165,6 @@ def __new__(mcs, name, bases, namespace, kw_only=False, **kwargs): # Building class subclass = super().__new__(mcs, name, bases, namespace, kw_only=kw_only, **kwargs) - subclass.__module__ = __name__ return subclass diff --git a/src/client/search_requests.pyi b/src/client/search_requests.pyi index 77b6a382..89ec914d 100644 --- a/src/client/search_requests.pyi +++ b/src/client/search_requests.pyi @@ -83,7 +83,8 @@ class BaseSortItem(toloka.client.primitives.base.BaseTolokaObject): def for_fields( cls, qualname: str, - sort_fields: typing.List[str] + sort_fields: typing.List[str], + module_name: str = 'toloka.client.search_requests' ): ... def __init__(self) -> None: @@ -105,7 +106,8 @@ class BaseSortItems(toloka.client.primitives.base.BaseTolokaObject): cls, qualname: str, sort_fields: typing.List[str], - docstring: typing.Optional[str] = None + docstring: typing.Optional[str] = None, + module_name: str = 'toloka.client.search_requests' ): ... def __init__(self) -> None: