From 942e4ffc5b745845254f3ee311fbdddc1cd2a293 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Sat, 18 Apr 2026 14:49:57 +0800 Subject: [PATCH 1/8] Add PEP 561 type stubs and CI type-checking infrastructure - Add .pyi stubs for the full public API surface (logclient, all request/response classes, consumer sub-package) with py.typed markers for PEP 561 compliance - Wire setup.py package_data and MANIFEST.in to include stubs in sdist/wheel - Add GitHub Actions 'typing' job running mypy stubtest and a public smoke test - Add Python 2-style type comments to public SDK APIs Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/build.yaml | 30 +- .gitignore | 1 + MANIFEST.in | 2 + TYPE_STUB_MIGRATION_SUMMARY.md | 111 +++++++ aliyun/__init__.pyi | 3 + aliyun/log/__init__.pyi | 59 ++++ aliyun/log/consumer/__init__.pyi | 3 + aliyun/log/consumer/config.pyi | 40 +++ aliyun/log/consumer/py.typed | 0 aliyun/log/consumer/tasks.py | 3 +- aliyun/log/consumer/tasks.pyi | 23 ++ aliyun/log/consumer/worker.pyi | 28 ++ aliyun/log/credentials.pyi | 18 ++ aliyun/log/cursor_response.pyi | 9 + aliyun/log/cursor_time_response.pyi | 9 + aliyun/log/gethistogramsrequest.pyi | 26 ++ aliyun/log/gethistogramsresponse.pyi | 13 + aliyun/log/getlogsrequest.pyi | 42 +++ aliyun/log/getlogsresponse.pyi | 83 +++++ aliyun/log/index_config.pyi | 31 ++ aliyun/log/listlogstoresrequest.pyi | 7 + aliyun/log/listlogstoresresponse.pyi | 12 + aliyun/log/listtopicsrequest.pyi | 13 + aliyun/log/listtopicsresponse.pyi | 12 + aliyun/log/logclient.pyi | 354 ++++++++++++++++++++++ aliyun/log/logclient_operator.py | 3 +- aliyun/log/logexception.pyi | 13 + aliyun/log/logitem.pyi | 16 + aliyun/log/logresponse.pyi | 12 + aliyun/log/machine_group_detail.pyi | 14 + aliyun/log/metering_mode_response.pyi | 23 ++ aliyun/log/multimodal_config_response.pyi | 15 + aliyun/log/object_response.pyi | 19 ++ aliyun/log/pulllog_response.pyi | 34 +++ aliyun/log/putlogsrequest.pyi | 25 ++ aliyun/log/putlogsresponse.pyi | 8 + aliyun/log/py.typed | 1 + aliyun/log/queriedlog.pyi | 12 + aliyun/log/shipper_config.pyi | 15 + aliyun/log/store_view.pyi | 39 +++ aliyun/log/store_view_response.pyi | 30 ++ aliyun/log/submit_async_sql_request.pyi | 22 ++ aliyun/py.typed | 1 + setup.py | 7 + tests/ci/run_public_type_smoke.py | 73 +++++ tests/ci/run_stubtest.py | 33 ++ tests/ci/stubtest_allowlist.txt | 20 ++ tests/ci/stubtest_modules.txt | 28 ++ 48 files changed, 1390 insertions(+), 5 deletions(-) create mode 100644 MANIFEST.in create mode 100644 TYPE_STUB_MIGRATION_SUMMARY.md create mode 100644 aliyun/__init__.pyi create mode 100644 aliyun/log/__init__.pyi create mode 100644 aliyun/log/consumer/__init__.pyi create mode 100644 aliyun/log/consumer/config.pyi create mode 100644 aliyun/log/consumer/py.typed create mode 100644 aliyun/log/consumer/tasks.pyi create mode 100644 aliyun/log/consumer/worker.pyi create mode 100644 aliyun/log/credentials.pyi create mode 100644 aliyun/log/cursor_response.pyi create mode 100644 aliyun/log/cursor_time_response.pyi create mode 100644 aliyun/log/gethistogramsrequest.pyi create mode 100644 aliyun/log/gethistogramsresponse.pyi create mode 100644 aliyun/log/getlogsrequest.pyi create mode 100644 aliyun/log/getlogsresponse.pyi create mode 100644 aliyun/log/index_config.pyi create mode 100644 aliyun/log/listlogstoresrequest.pyi create mode 100644 aliyun/log/listlogstoresresponse.pyi create mode 100644 aliyun/log/listtopicsrequest.pyi create mode 100644 aliyun/log/listtopicsresponse.pyi create mode 100644 aliyun/log/logclient.pyi create mode 100644 aliyun/log/logexception.pyi create mode 100644 aliyun/log/logitem.pyi create mode 100644 aliyun/log/logresponse.pyi create mode 100644 aliyun/log/machine_group_detail.pyi create mode 100644 aliyun/log/metering_mode_response.pyi create mode 100644 aliyun/log/multimodal_config_response.pyi create mode 100644 aliyun/log/object_response.pyi create mode 100644 aliyun/log/pulllog_response.pyi create mode 100644 aliyun/log/putlogsrequest.pyi create mode 100644 aliyun/log/putlogsresponse.pyi create mode 100644 aliyun/log/py.typed create mode 100644 aliyun/log/queriedlog.pyi create mode 100644 aliyun/log/shipper_config.pyi create mode 100644 aliyun/log/store_view.pyi create mode 100644 aliyun/log/store_view_response.pyi create mode 100644 aliyun/log/submit_async_sql_request.pyi create mode 100644 aliyun/py.typed create mode 100644 tests/ci/run_public_type_smoke.py create mode 100644 tests/ci/run_stubtest.py create mode 100644 tests/ci/stubtest_allowlist.txt create mode 100644 tests/ci/stubtest_modules.txt diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f4f77ab5..3d774f6b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -37,4 +37,32 @@ jobs: - name: Run build tests run: | python -m pip install pytest - python -m pytest tests/ci/build-test/ \ No newline at end of file + python -m pytest tests/ci/build-test/ + + typing: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python 3.12 + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -V + python -m pip install --upgrade pip setuptools + python -m pip install mypy types-requests types-six + python -m pip install protobuf lz4 + python -m pip install . + + - name: Run stubtest + run: | + python tests/ci/run_stubtest.py + + - name: Run public type smoke + run: | + python tests/ci/run_public_type_smoke.py diff --git a/.gitignore b/.gitignore index f901e618..6b8bfbb5 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ cscope.in.out cscope.out cscope.po.out tags +.venv-stubtest/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..68b536b4 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +recursive-include aliyun *.pyi py.typed +recursive-include aliyun/log *.pyi py.typed diff --git a/TYPE_STUB_MIGRATION_SUMMARY.md b/TYPE_STUB_MIGRATION_SUMMARY.md new file mode 100644 index 00000000..89a69280 --- /dev/null +++ b/TYPE_STUB_MIGRATION_SUMMARY.md @@ -0,0 +1,111 @@ +# Type Stub Migration Summary + +## Background + +This change migrates the SDK typing approach from inline Python 2 style `# type:` comments in runtime `.py` files to colocated `.pyi` stub files. + +The goal is: + +- keep runtime behavior unchanged for Python 2 / Python 3 users +- avoid adding `typing` imports into runtime modules +- make type information available to static type checkers through standard PEP 561 packaging +- add CI validation with `mypy.stubtest` + +## What Changed + +### 1. Added `.pyi` stubs for public SDK modules + +New stub files were added under [aliyun/log](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log), including: + +- [aliyun/log/logclient.pyi](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/logclient.pyi) +- [aliyun/log/putlogsrequest.pyi](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/putlogsrequest.pyi) +- [aliyun/log/getlogsresponse.pyi](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/getlogsresponse.pyi) +- [aliyun/log/__init__.pyi](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/__init__.pyi) + +In total, 26 `.pyi` files were generated for the modules covered by this migration. + +These stubs now carry the type information that had previously been expressed as inline comments. + +### 2. Enabled PEP 561 packaging + +Packaging was updated so installed distributions include the stub files: + +- [setup.py](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/setup.py) +- [MANIFEST.in](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/MANIFEST.in) +- [aliyun/log/py.typed](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/py.typed) + +This ensures downstream type checkers can discover the package typing metadata after installation. + +### 3. Added CI stub validation + +GitHub Actions was updated to run `stubtest` in a dedicated typing job: + +- [build.yaml](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/.github/workflows/build.yaml) +- [tests/ci/run_stubtest.py](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/tests/ci/run_stubtest.py) +- [tests/ci/stubtest_modules.txt](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/tests/ci/stubtest_modules.txt) + +The typing job installs: + +- `mypy` +- `types-requests` +- `types-six` + +Then it installs the SDK itself and runs: + +```bash +python tests/ci/run_stubtest.py +``` + +The runner changes to a temporary directory before invoking `mypy.stubtest`, so validation targets the installed package payload instead of the source checkout. + +## Runtime Code Adjustments + +The migration target is `.pyi`, not runtime annotations. Two runtime files were adjusted only because existing historical type comments were not valid for `mypy` parsing: + +- [aliyun/log/logclient_operator.py](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/logclient_operator.py) +- [aliyun/log/consumer/tasks.py](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/consumer/tasks.py) + +These were mechanical syntax fixes to existing type-comment style so `mypy` could import the runtime package during `stubtest`. + +## Validation Performed + +Local validation was executed in a dedicated virtualenv: + +- local env: [`.venv-stubtest`](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/.venv-stubtest) +- installed package: current working tree version +- installed typing tools: `mypy`, `types-requests`, `types-six` + +Checks performed: + +1. Parsed all generated `.pyi` files successfully. +2. Confirmed installed wheel contains: + - `aliyun/log/logclient.pyi` + - `aliyun/log/putlogsrequest.pyi` + - `aliyun/log/py.typed` +3. Ran: + +```bash +.venv-stubtest/bin/python tests/ci/run_stubtest.py +``` + +Observed result: + +```text +Success: no issues found in 25 modules +``` + +## Current Scope + +The current `stubtest` scope is the explicit module list in [tests/ci/stubtest_modules.txt](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/tests/ci/stubtest_modules.txt). + +It intentionally validates the migrated modules directly, instead of validating the package root export surface in one step. That keeps CI narrower and avoids mixing this migration with unrelated package-export cleanup. + +## Notes + +- [`.venv-stubtest`](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/.venv-stubtest) is only a local verification environment and should not be committed. +- Relative to `master`, the intended deliverable is: + - new `.pyi` files + - `py.typed` + - packaging changes + - CI `stubtest` integration + - the two runtime syntax fixes needed for `mypy` importability diff --git a/aliyun/__init__.pyi b/aliyun/__init__.pyi new file mode 100644 index 00000000..0cc7ebfb --- /dev/null +++ b/aliyun/__init__.pyi @@ -0,0 +1,3 @@ +from typing import Any + +__path__: Any diff --git a/aliyun/log/__init__.pyi b/aliyun/log/__init__.pyi new file mode 100644 index 00000000..1d4bac5e --- /dev/null +++ b/aliyun/log/__init__.pyi @@ -0,0 +1,59 @@ + +from .logclient import LogClient as LogClient +from .logexception import LogException as LogException +from .gethistogramsrequest import GetHistogramsRequest as GetHistogramsRequest +from .getlogsrequest import GetLogsRequest as GetLogsRequest, GetProjectLogsRequest as GetProjectLogsRequest +from .index_config import IndexConfig as IndexConfig, IndexKeyConfig as IndexKeyConfig, IndexLineConfig as IndexLineConfig +from .listtopicsrequest import ListTopicsRequest as ListTopicsRequest +from .listlogstoresrequest import ListLogstoresRequest as ListLogstoresRequest +from .logtail_config_detail import * +from .logtail_pipeline_config_detail import * +from .logtail_pipeline_config_response import * +from .machine_group_detail import MachineGroupDetail as MachineGroupDetail +from .putlogsrequest import PutLogsRequest as PutLogsRequest +from .shipper_config import ShipperTask as ShipperTask, OssShipperConfig as OssShipperConfig, OdpsShipperConfig as OdpsShipperConfig +from .version import __version__ as __version__ +from .logitem import LogItem as LogItem +from .consumer_group_request import * +from .external_store_config import * + +# response class +from .consumer_group_response import * +from .cursor_response import GetCursorResponse as GetCursorResponse +from .cursor_time_response import GetCursorTimeResponse as GetCursorTimeResponse +from .gethistogramsresponse import GetHistogramsResponse as GetHistogramsResponse +from .getlogsresponse import GetLogsResponse as GetLogsResponse +from .histogram import Histogram as Histogram +from .queriedlog import QueriedLog as QueriedLog +from .index_config_response import * +from .listlogstoresresponse import ListLogstoresResponse as ListLogstoresResponse +from .listtopicsresponse import ListTopicsResponse as ListTopicsResponse +from .logresponse import LogResponse as LogResponse +from .logtail_config_response import * +from .machinegroup_response import * +from .project_response import * +from .pulllog_response import PullLogResponse as PullLogResponse +from .shard_response import * +from .shipper_response import * +from .common_response import * +from .external_store_config_response import * +from .proto import LogGroupRaw as LogGroup +from .rebuild_index_response import * +from .deletelogsrequest import * +from .deletelogssresponse import * +from .getdeletelogsstatusrequest import * +from .getdeletelogsstatusresponse import * +from .listdeletelogsstasksrequest import * +from .listdeletelogsstasksresponse import * +# logging handler +from .logger_hanlder import SimpleLogHandler as SimpleLogHandler, QueuedLogHandler as QueuedLogHandler, LogFields as LogFields, UwsgiQueuedLogHandler as UwsgiQueuedLogHandler +from .metering_mode_response import GetLogStoreMeteringModeResponse as GetLogStoreMeteringModeResponse, \ + GetMetricStoreMeteringModeResponse as GetMetricStoreMeteringModeResponse, \ + UpdateLogStoreMeteringModeResponse as UpdateLogStoreMeteringModeResponse, UpdateMetricStoreMeteringModeResponse as UpdateMetricStoreMeteringModeResponse +from .multimodal_config_response import GetLogStoreMultimodalConfigurationResponse as GetLogStoreMultimodalConfigurationResponse, \ + PutLogStoreMultimodalConfigurationResponse as PutLogStoreMultimodalConfigurationResponse +from .object_response import PutObjectResponse as PutObjectResponse, GetObjectResponse as GetObjectResponse + +from .store_view import StoreView as StoreView, StoreViewStore as StoreViewStore +from .store_view_response import CreateStoreViewResponse as CreateStoreViewResponse, UpdateStoreViewResponse as UpdateStoreViewResponse, DeleteStoreViewResponse as DeleteStoreViewResponse, ListStoreViewsResponse as ListStoreViewsResponse, GetStoreViewResponse as GetStoreViewResponse +from .submit_async_sql_request import SubmitAsyncSqlRequest as SubmitAsyncSqlRequest diff --git a/aliyun/log/consumer/__init__.pyi b/aliyun/log/consumer/__init__.pyi new file mode 100644 index 00000000..c9bb24a8 --- /dev/null +++ b/aliyun/log/consumer/__init__.pyi @@ -0,0 +1,3 @@ +from .config import CursorPosition as CursorPosition, LogHubConfig as LogHubConfig +from .tasks import ConsumerJsonProcessorBase as ConsumerJsonProcessorBase, ConsumerProcessorAdaptor as ConsumerProcessorAdaptor, ConsumerProcessorBase as ConsumerProcessorBase +from .worker import ConsumerWorker as ConsumerWorker diff --git a/aliyun/log/consumer/config.pyi b/aliyun/log/consumer/config.pyi new file mode 100644 index 00000000..eb206721 --- /dev/null +++ b/aliyun/log/consumer/config.pyi @@ -0,0 +1,40 @@ +from typing import Any, Callable, Optional +from enum import Enum + +class CursorPosition(Enum): + BEGIN_CURSOR = 'BEGIN_CURSOR' + END_CURSOR = 'END_CURSOR' + SPECIAL_TIMER_CURSOR = 'SPECIAL_TIMER_CURSOR' + +class ConsumerStatus(Enum): + INITIALIZING = 'INITIALIZING' + PROCESSING = 'PROCESSING' + SHUTTING_DOWN = 'SHUTTING_DOWN' + SHUTDOWN_COMPLETE = 'SHUTDOWN_COMPLETE' + +class LogHubConfig: + endpoint: str + accessKeyId: str + accessKey: str + project: str + logstore: str + consumer_group_name: str + consumer_name: str + cursor_position: CursorPosition + heartbeat_interval: int + data_fetch_interval: int + in_order: bool + cursor_start_time: Any + securityToken: Optional[str] + max_fetch_log_group_size: int + worker_pool_size: int + shared_executor: Any + consumer_group_time_out: int + cursor_end_time: Any + credentials_refresher: Optional[Callable[..., Any]] + auth_version: str + region: str + query: Optional[str] + accept_compress_type: Optional[str] + processor: Optional[str] + def __init__(self, endpoint: str, access_key_id: str, access_key: str, project: str, logstore: str, consumer_group_name: str, consumer_name: str, cursor_position: Optional[CursorPosition] = ..., heartbeat_interval: Optional[int] = ..., data_fetch_interval: Optional[int] = ..., in_order: bool = False, cursor_start_time: Any = ..., security_token: Optional[str] = ..., max_fetch_log_group_size: Optional[int] = ..., worker_pool_size: Optional[int] = ..., shared_executor: Any = ..., cursor_end_time: Any = ..., credentials_refresher: Optional[Callable[..., Any]] = ..., auth_version: str = ..., region: str = '', query: Optional[str] = ..., accept_compress_type: Optional[str] = ..., processor: Optional[str] = ...) -> None: ... diff --git a/aliyun/log/consumer/py.typed b/aliyun/log/consumer/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/aliyun/log/consumer/tasks.py b/aliyun/log/consumer/tasks.py index 57fed995..8cd04700 100755 --- a/aliyun/log/consumer/tasks.py +++ b/aliyun/log/consumer/tasks.py @@ -214,8 +214,7 @@ def consumer_fetch_task(loghub_client_adapter, preprocessor, shard_id, cursor, m for retry_times in range(3): try: - # type: PullLogResponse - response = loghub_client_adapter.pull_logs(shard_id, cursor, count=max_fetch_log_group_size, end_cursor=end_cursor, query=query, processor=consume_processor) + response = loghub_client_adapter.pull_logs(shard_id, cursor, count=max_fetch_log_group_size, end_cursor=end_cursor, query=query, processor=consume_processor) # type: PullLogResponse data = preprocessor(response) next_cursor = response.get_next_cursor() raw_size = response.get_raw_size() diff --git a/aliyun/log/consumer/tasks.pyi b/aliyun/log/consumer/tasks.pyi new file mode 100644 index 00000000..192eb280 --- /dev/null +++ b/aliyun/log/consumer/tasks.pyi @@ -0,0 +1,23 @@ +import abc +from typing import Any + +class ConsumerProcessorBase(object, metaclass=abc.ABCMeta): + shard_id: int + last_check_time: float + checkpoint_timeout: int + def __init__(self) -> None: ... + def save_checkpoint(self, tracker: Any, force: bool = False) -> None: ... + def initialize(self, shard: int) -> None: ... + @abc.abstractmethod + def process(self, log_groups: Any, check_point_tracker: Any) -> Any: ... + def shutdown(self, check_point_tracker: Any) -> None: ... + +class ConsumerJsonProcessorBase(ConsumerProcessorBase, metaclass=abc.ABCMeta): + def __init__(self) -> None: ... + @abc.abstractmethod + def process(self, flattern_json_list: Any, check_point_tracker: Any) -> Any: ... + +class ConsumerProcessorAdaptor(ConsumerProcessorBase): + func: Any + def __init__(self, func: Any) -> None: ... + def process(self, log_groups: Any, check_point_tracker: Any) -> None: ... diff --git a/aliyun/log/consumer/worker.pyi b/aliyun/log/consumer/worker.pyi new file mode 100644 index 00000000..5cb47c7f --- /dev/null +++ b/aliyun/log/consumer/worker.pyi @@ -0,0 +1,28 @@ +import logging +from typing import Any, Dict, MutableMapping, Optional, Sequence, Tuple +from threading import Thread +from .config import LogHubConfig as LogHubConfig + +class ConsumerWorkerLoggerAdapter(logging.LoggerAdapter): + def process(self, msg: Any, kwargs: MutableMapping[str, Any]) -> Tuple[Any, MutableMapping[str, Any]]: ... + +class ConsumerWorker(Thread): + make_processor: Any + process_args: Sequence[Any] + process_kwargs: Dict[str, Any] + option: LogHubConfig + consumer_client: Any + shut_down_flag: bool + logger: logging.LoggerAdapter + shard_consumers: Dict[Any, Any] + last_owned_consumer_finish_time: float + heart_beat: Any + own_executor: bool + def __init__(self, make_processor: Any, consumer_option: LogHubConfig, args: Optional[Sequence[Any]] = ..., kwargs: Optional[Dict[str, Any]] = ...) -> None: ... + @property + def executor(self) -> Any: ... + def run(self) -> None: ... + def start(self, join: bool = False) -> None: ... + def shutdown_and_wait(self) -> None: ... + def clean_shard_consumer(self, owned_shards: Sequence[Any]) -> None: ... + def shutdown(self) -> None: ... diff --git a/aliyun/log/credentials.pyi b/aliyun/log/credentials.pyi new file mode 100644 index 00000000..06c74bed --- /dev/null +++ b/aliyun/log/credentials.pyi @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from typing import Optional + +class Credentials: + access_key_id: str + access_key_secret: str + security_token: Optional[str] + def __init__(self, access_key_id: str, access_key_secret: str, security_token: Optional[str] = ...) -> None: ... + def get_access_key_id(self) -> str: ... + def get_access_key_secret(self) -> str: ... + def get_security_token(self) -> Optional[str]: ... + +class CredentialsProvider: + def get_credentials(self) -> Optional[Credentials]: ... + +class StaticCredentialsProvider(CredentialsProvider): + def __init__(self, access_key_id: str = ..., access_key_secret: str = ..., security_token: str = ...) -> None: ... + def get_credentials(self) -> Credentials: ... diff --git a/aliyun/log/cursor_response.pyi b/aliyun/log/cursor_response.pyi new file mode 100644 index 00000000..ae82830a --- /dev/null +++ b/aliyun/log/cursor_response.pyi @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +from typing import Any, Dict + +from .logresponse import LogResponse + +class GetCursorResponse(LogResponse): + def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... + def get_cursor(self) -> str: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/cursor_time_response.pyi b/aliyun/log/cursor_time_response.pyi new file mode 100644 index 00000000..9dcfbbc3 --- /dev/null +++ b/aliyun/log/cursor_time_response.pyi @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +from typing import Any, Dict + +from .logresponse import LogResponse + +class GetCursorTimeResponse(LogResponse): + def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... + def get_cursor_time(self) -> int: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/gethistogramsrequest.pyi b/aliyun/log/gethistogramsrequest.pyi new file mode 100644 index 00000000..f4872e0f --- /dev/null +++ b/aliyun/log/gethistogramsrequest.pyi @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from typing import Optional, Union + +from .logrequest import LogRequest +from .util import parse_timestamp + +class GetHistogramsRequest(LogRequest): + def __init__(self, project: Optional[str] = ..., logstore: Optional[str] = ..., fromTime: Optional[Union[int, str]] = ..., toTime: Optional[Union[int, str]] = ..., topic: Optional[str] = ..., query: Optional[str] = ..., accurate_query: bool = ..., from_time_nano_part: int = ..., to_time_nano_part: int = ..., shard_id: int = ...) -> None: ... + def get_logstore(self) -> str: ... + def set_logstore(self, logstore: str) -> None: ... + def get_topic(self) -> str: ... + def set_topic(self, topic: str) -> None: ... + def get_from(self) -> int: ... + def set_from(self, fromTime: int) -> None: ... + def get_to(self) -> int: ... + def set_to(self, toTime: int) -> None: ... + def get_query(self) -> str: ... + def set_query(self, query: str) -> None: ... + def get_accurate_query(self) -> bool: ... + def set_accurate_query(self, accurate_query: bool) -> None: ... + def get_from_time_nano_part(self) -> int: ... + def set_from_time_nano_part(self, from_time_nano_part: int) -> None: ... + def get_to_time_nano_part(self) -> int: ... + def set_to_time_nano_part(self, to_time_nano_part: int) -> None: ... + def set_shard_id(self, shard_id: int) -> None: ... + def get_shard_id(self) -> int: ... diff --git a/aliyun/log/gethistogramsresponse.pyi b/aliyun/log/gethistogramsresponse.pyi new file mode 100644 index 00000000..6a0e7efa --- /dev/null +++ b/aliyun/log/gethistogramsresponse.pyi @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +from .logresponse import LogResponse +from .histogram import Histogram +from .util import Util + +class GetHistogramsResponse(LogResponse): + def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... + def is_completed(self) -> bool: ... + def get_total_count(self) -> int: ... + def get_histograms(self) -> List[Histogram]: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/getlogsrequest.pyi b/aliyun/log/getlogsrequest.pyi new file mode 100644 index 00000000..eca2c097 --- /dev/null +++ b/aliyun/log/getlogsrequest.pyi @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +from .logrequest import LogRequest + +class GetLogsRequest(LogRequest): + def __init__(self, project: Optional[str] = ..., logstore: Optional[str] = ..., fromTime: Optional[Union[int, str]] = ..., toTime: Optional[Union[int, str]] = ..., topic: Optional[str] = ..., query: Optional[str] = ..., line: int = ..., offset: int = ..., reverse: bool = ..., power_sql: bool = ..., scan: bool = ..., forward: bool = ..., accurate_query: bool = ..., from_time_nano_part: int = ..., to_time_nano_part: int = ...) -> None: ... + def get_logstore(self) -> str: ... + def set_logstore(self, logstore: str) -> None: ... + def get_topic(self) -> str: ... + def set_topic(self, topic: str) -> None: ... + def get_from(self) -> int: ... + def set_from(self, fromTime: int) -> None: ... + def get_to(self) -> int: ... + def set_to(self, toTime: int) -> None: ... + def get_query(self) -> str: ... + def set_query(self, query: str) -> None: ... + def get_line(self) -> int: ... + def set_line(self, line: int) -> None: ... + def get_offset(self) -> int: ... + def set_offset(self, offset: int) -> None: ... + def get_reverse(self) -> bool: ... + def set_reverse(self, reverse: bool) -> None: ... + def get_power_sql(self) -> bool: ... + def set_power_sql(self, power_sql: bool) -> None: ... + def get_scan(self) -> bool: ... + def set_scan(self, scan: bool) -> None: ... + def get_forward(self) -> bool: ... + def set_forward(self, forward: bool) -> None: ... + def get_accurate_query(self) -> bool: ... + def set_accurate_query(self, accurate_query: bool) -> None: ... + def get_from_time_nano_part(self) -> int: ... + def set_from_time_nano_part(self, from_time_nano_part: int) -> None: ... + def get_to_time_nano_part(self) -> int: ... + def set_to_time_nano_part(self, to_time_nano_part: int) -> None: ... + +class GetProjectLogsRequest(LogRequest): + def __init__(self, project: Optional[str] = ..., query: Optional[str] = ..., power_sql: bool = ...) -> None: ... + def get_query(self) -> str: ... + def set_query(self, query: str) -> None: ... + def get_power_sql(self) -> bool: ... + def set_power_sql(self, power_sql: bool) -> None: ... diff --git a/aliyun/log/getlogsresponse.pyi b/aliyun/log/getlogsresponse.pyi new file mode 100644 index 00000000..ea7a31e4 --- /dev/null +++ b/aliyun/log/getlogsresponse.pyi @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +from .logresponse import LogResponse +from .queriedlog import QueriedLog +from .logexception import LogException +from .util import Util +from enum import Enum +import json + +class GetLogsResponse(LogResponse): + class QueryMode(Enum): + NORMAL = 0 + PHRASE = 1 + SCAN = 2 + SCAN_SQL = 3 + def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... + @staticmethod + def _from_v1_resp(resp, header): ... + def get_count(self) -> int: ... + def is_completed(self) -> bool: ... + def get_logs(self) -> List[QueriedLog]: ... + def get_processed_rows(self) -> int: ... + def get_elapsed_mills(self) -> int: ... + def get_has_sql(self) -> bool: ... + def get_where_query(self) -> str: ... + def get_agg_query(self) -> str: ... + def get_cpu_sec(self) -> float: ... + def get_cpu_cores(self) -> int: ... + def get_query_mode(self) -> GetLogsResponse.QueryMode: ... + def get_scan_bytes(self) -> int: ... + def get_begin_offset(self) -> int: ... + def get_end_offset(self) -> int: ... + def get_scan_all(self) -> bool: ... + def log_print(self) -> None: ... + def get_log_list(self) -> List[QueriedLog]: ... + def get_meta(self) -> GetLogsResponse.GetLogsResponseMeta: ... + def merge(self, other: GetLogsResponse) -> GetLogsResponse: ... + class GetLogsResponseMeta: + def __init__(self, meta) -> None: ... + def is_completed(self): ... + def merge(self, other): ... + def get_count(self): ... + def _to_dict(self): ... + def log_print(self): ... + def get_progress(self): ... + def get_processed_rows(self): ... + def get_elapsed_millisecond(self): ... + def get_has_sql(self): ... + def get_where_query(self): ... + def get_agg_query(self): ... + def get_cpu_sec(self): ... + def get_cpu_cores(self): ... + def get_mode(self): ... + def get_scan_bytes(self): ... + def get_phrase_query_info(self): ... + def get_limited(self): ... + def get_processed_bytes(self): ... + def get_telemetry_type(self): ... + def get_power_sql(self): ... + def get_inserted_sql(self): ... + def get_keys(self): ... + def get_marker(self): ... + def get_is_accurate(self): ... + def get_column_types(self): ... + def get_highlights(self): ... + def get_terms(self): ... + class PhraseQueryInfo: + def __init__(self, pharse_query_info) -> None: ... + def get_begin_offset(self): ... + def get_end_offset(self): ... + def get_scan_all(self): ... + def get_end_time(self): ... + def _to_dict(self): ... + def log_print(self): ... + class Term: + def __init__(self, key, term) -> None: ... + @classmethod + def _from_dict(cls, data): ... + def get_key(self): ... + def get_term(self): ... + def _to_dict(self): ... + def log_print(self): ... diff --git a/aliyun/log/index_config.pyi b/aliyun/log/index_config.pyi new file mode 100644 index 00000000..01a57eb5 --- /dev/null +++ b/aliyun/log/index_config.pyi @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +import time + +class IndexJsonKeyConfig(object): + def __init__(self, index_all: bool = ..., max_depth: int = ..., alias: Optional[str] = ...) -> None: ... + def add_key(self, key_name: Any, key_type: Any, doc_value: Any = ..., alias: Optional[str] = ...) -> None: ... + def to_json(self, json_value: Any) -> None: ... + def from_json(self, json_value: Any) -> None: ... + +class IndexKeyConfig(object): + def __init__(self, token_list: Optional[List[str]] = ..., case_sensitive: bool = ..., index_type: str = ..., doc_value: bool = ..., alias: Optional[str] = ..., json_key_config: Optional[IndexJsonKeyConfig] = ..., chinese: Optional[bool] = ..., embedding: Any = ..., vector_index: Any = ...) -> None: ... + def set_json_key_config(self, json_key_config: IndexJsonKeyConfig) -> None: ... + def get_json_key_config(self) -> Any: ... + def to_json(self) -> Any: ... + def from_json(self, json_value: Any) -> None: ... + +class IndexLineConfig(object): + def __init__(self, token_list: Optional[List[str]] = ..., case_sensitive: bool = ..., include_keys: Optional[List[str]] = ..., exclude_keys: Optional[List[str]] = ..., chinese: Optional[bool] = ..., auto_key_detect: Optional[bool] = ..., auto_key_count_limit: Optional[int] = ...) -> None: ... + def to_json(self) -> Any: ... + def from_json(self, json_value: Any) -> None: ... + +class IndexConfig(object): + def __init__(self, ttl: int = ..., line_config: Optional[IndexLineConfig] = ..., key_config_list: Optional[Dict[str, Any]] = ..., all_keys_config: Optional[IndexKeyConfig] = ..., log_reduce: Optional[bool] = ..., scan_index: Optional[bool] = ...) -> None: ... + def set_docvalue_max_text_len(self, max_len: Any) -> None: ... + def set_log_reduce_black_list(self, black_list: Any) -> None: ... + def set_log_reduce_white_list(self, white_list: Any) -> None: ... + def set_scan_index(self, scan_index: bool) -> None: ... + def to_json(self) -> Any: ... + def from_json(self, json_value: Any) -> None: ... diff --git a/aliyun/log/listlogstoresrequest.pyi b/aliyun/log/listlogstoresrequest.pyi new file mode 100644 index 00000000..bb740365 --- /dev/null +++ b/aliyun/log/listlogstoresrequest.pyi @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +from .logrequest import LogRequest + +class ListLogstoresRequest(LogRequest): + def __init__(self, project: Optional[str] = ...) -> None: ... diff --git a/aliyun/log/listlogstoresresponse.pyi b/aliyun/log/listlogstoresresponse.pyi new file mode 100644 index 00000000..4de8ca66 --- /dev/null +++ b/aliyun/log/listlogstoresresponse.pyi @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +from .logresponse import LogResponse + +class ListLogstoresResponse(LogResponse): + def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... + def get_count(self) -> int: ... + def get_total(self) -> int: ... + def get_logstores(self) -> List[str]: ... + def log_print(self) -> None: ... + def merge(self, response: ListLogstoresResponse) -> ListLogstoresResponse: ... diff --git a/aliyun/log/listtopicsrequest.pyi b/aliyun/log/listtopicsrequest.pyi new file mode 100644 index 00000000..a16726e5 --- /dev/null +++ b/aliyun/log/listtopicsrequest.pyi @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +from .logrequest import LogRequest + +class ListTopicsRequest(LogRequest): + def __init__(self, project: Optional[str] = ..., logstore: Optional[str] = ..., token: Optional[str] = ..., line: Optional[int] = ...) -> None: ... + def get_logstore(self) -> str: ... + def set_logstore(self, logstore: str) -> None: ... + def get_token(self) -> str: ... + def set_token(self, token: str) -> None: ... + def get_line(self) -> int: ... + def set_line(self, line: int) -> None: ... diff --git a/aliyun/log/listtopicsresponse.pyi b/aliyun/log/listtopicsresponse.pyi new file mode 100644 index 00000000..ffbe0628 --- /dev/null +++ b/aliyun/log/listtopicsresponse.pyi @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +from .logresponse import LogResponse +from .util import Util + +class ListTopicsResponse(LogResponse): + def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... + def get_count(self) -> int: ... + def get_topics(self) -> List[Any]: ... + def get_next_token(self) -> str: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/logclient.pyi b/aliyun/log/logclient.pyi new file mode 100644 index 00000000..37610cc0 --- /dev/null +++ b/aliyun/log/logclient.pyi @@ -0,0 +1,354 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union +from .common_response import CreateEntityResponse, DeleteEntityResponse, GetEntityResponse, ListEntityResponse, UpdateEntityResponse +from .consumer_group_response import ConsumerGroupCheckPointResponse, ConsumerGroupHeartBeatResponse, ConsumerGroupUpdateCheckPointResponse, CreateConsumerGroupResponse, DeleteConsumerGroupResponse, ListConsumerGroupResponse, UpdateConsumerGroupResponse +from .credentials import CredentialsProvider +from .delete_async_sql_request import DeleteAsyncSqlRequest +from .deletelogsrequest import DeleteLogsRequest +from .etl_config_response import CreateEtlResponse, DeleteEtlResponse, GetEtlResponse, ListEtlsResponse, StartEtlResponse, StopEtlResponse, UpdateEtlResponse +from .export_response import CreateExportResponse, DeleteExportResponse, GetExportResponse, ListExportResponse, UpdateExportResponse +from .external_store_config import ExternalStoreConfigBase +from .external_store_config_response import CreateExternalStoreResponse, DeleteExternalStoreResponse, GetExternalStoreResponse, ListExternalStoreResponse, UpdateExternalStoreResponse +from .getdeletelogsstatusrequest import GetDeleteLogsStatusRequest +from .gethistogramsrequest import GetHistogramsRequest +from .getlogsrequest import GetLogsRequest, GetProjectLogsRequest +from .index_config import IndexConfig +from .index_config_response import CreateIndexResponse, DeleteIndexResponse, GetIndexResponse, UpdateIndexResponse +from .ingestion_response import CreateIngestionResponse, DeleteIngestionResponse, GetIngestionResponse, ListIngestionResponse, RestartIngestionResponse, StartIngestionResponse, StopIngestionResponse, UpdateIngestionResponse +from .job import Export +from .listdeletelogsstasksrequest import ListDeleteLogsTasksRequest +from .listlogstoresrequest import ListLogstoresRequest +from .listtopicsrequest import ListTopicsRequest +from .logclient_operator import ResourceUsageResponse +from .logstore_config_response import CreateLogStoreResponse, DeleteLogStoreResponse, GetLogStoreResponse, ListLogStoreResponse, UpdateLogStoreResponse +from .logtail_config_detail import ApsaraFileConfigDetail, CommonRegLogConfigDetail, FullRegFileConfigDetail, JsonFileConfigDetail, LogtailConfigGenerator, SeperatorFileConfigDetail, SimpleFileConfigDetail, SyslogConfigDetail +from .logtail_config_response import CreateLogtailConfigResponse, DeleteLogtailConfigResponse, GetLogtailConfigResponse, ListLogtailConfigResponse, UpdateLogtailConfigResponse +from .logtail_pipeline_config_detail import LogtailPipelineConfigDetail +from .logtail_pipeline_config_response import CreateLogtailPipelineConfigResponse, DeleteLogtailPipelineConfigResponse, GetLogtailPipelineConfigResponse, ListLogtailPipelineConfigResponse, UpdateLogtailPipelineConfigResponse +from .machine_group_detail import MachineGroupDetail +from .machinegroup_response import ApplyConfigToMachineGroupResponse, CreateMachineGroupResponse, DeleteMachineGroupResponse, GetConfigAppliedMachineGroupsResponse, GetMachineGroupAppliedConfigResponse, GetMachineGroupResponse, ListMachineGroupResponse, ListMachinesResponse, RemoveConfigToMachineGroupResponse, UpdateMachineGroupResponse +from .project_response import CreateProjectResponse, DeleteProjectResponse, GetProjectResponse, GetProjectTagsResponse, ListProjectResponse, UpdateProjectResponse +from .putlogsrequest import PutLogsRequest +from .rebuild_index_response import CreateRebuildIndexResponse, GetRebuildIndexResponse +from .resource_params import Resource, ResourceRecord +from .resource_response import CreateRecordResponse, CreateResourceResponse, DeleteRecordResponse, DeleteResourceResponse, GetRecordResponse, GetResourceResponse, ListRecordResponse, ListResourcesResponse, UpdateRecordResponse, UpdateResourceResponse, UpsertRecordResponse +from .scheduled_sql import ScheduledSQL +from .scheduled_sql_response import CreateScheduledSQLResponse, DeleteScheduledSQLResponse, GetScheduledSQLResponse, GetScheduledSqlJobInstanceResponse, ListScheduledSQLResponse, ListScheduledSqlJobInstancesResponse, ModifyScheduledSqlJobStateResponse, UpdateScheduledSQLResponse +from .shard_response import DeleteShardResponse, ListShardResponse +from .shipper_response import GetShipperTasksResponse, RetryShipperTasksResponse +from .sql_instance_response import CreateSqlInstanceResponse, ListSqlInstanceResponse, UpdateSqlInstanceResponse +from .store_view import StoreView +from .submit_async_sql_request import SubmitAsyncSqlRequest +from .substore_config_response import CreateSubStoreResponse, CreateMetricsStoreResponse, DeleteSubStoreResponse, GetSubStoreResponse, GetSubStoreTTLResponse, ListSubStoreResponse, UpdateSubStoreResponse, UpdateSubStoreTTLResponse +from .topostore_params import Topostore, TopostoreNode, TopostoreRelation +from .topostore_response import CreateTopostoreNodeResponse, CreateTopostoreRelationResponse, CreateTopostoreResponse, DeleteTopostoreNodeResponse, DeleteTopostoreRelationResponse, DeleteTopostoreResponse, GetTopostoreNodeResponse, GetTopostoreRelationResponse, GetTopostoreResponse, ListTopostoreNodesResponse, ListTopostoreRelationsResponse, ListTopostoresResponse, UpdateTopostoreNodeResponse, UpdateTopostoreRelationResponse, UpdateTopostoreResponse, UpsertTopostoreNodeResponse, UpsertTopostoreRelationResponse + + +import json +import requests +import six +import time +from datetime import datetime +import logging +import re +from .store_view_response import ListStoreViewsResponse, CreateStoreViewResponse, UpdateStoreViewResponse, DeleteStoreViewResponse, GetStoreViewResponse +from .credentials import StaticCredentialsProvider +from .scheduled_sql import ScheduledSQLConfiguration +from .scheduled_sql_response import * +from itertools import cycle +from .consumer_group_request import * +from .consumer_group_response import * +from .getlogsrequest import * +from .cursor_response import GetCursorResponse +from .cursor_time_response import GetCursorTimeResponse +from .gethistogramsresponse import GetHistogramsResponse +from .deletelogssresponse import DeleteLogsResponse +from .getlogsresponse import GetLogsResponse +from .getdeletelogsstatusresponse import GetDeleteLogsStatusResponse +from .listdeletelogsstasksresponse import ListDeleteLogsTasksResponse +from .getcontextlogsresponse import GetContextLogsResponse +from .index_config_response import * +from .ingestion_response import * +from .sql_instance_response import * +from .listlogstoresresponse import ListLogstoresResponse +from .listtopicsresponse import ListTopicsResponse +from .logclient_operator import copy_project, list_more, query_more, pull_log_dump, copy_logstore, copy_data, \ + get_resource_usage, arrange_shard, transform_data, copy_dashboard, copy_alert +from .logexception import LogException +from .logstore_config_response import * +from .substore_config_response import * +from .logtail_config_response import * +from .logtail_pipeline_config_response import * +from .machinegroup_response import * +from .rebuild_index_response import * +from .project_response import * +from .pulllog_response import PullLogResponse +from .putlogsresponse import PutLogsResponse +from .shard_response import * +from .shipper_response import * +from .resource_response import * +from .resource_params import * +from .tag_response import GetResourceTagsResponse +from .topostore_response import * +from .topostore_params import * +from .util import base64_encodestring as b64e +from .util import base64_encodestring as e64, base64_decodestring as d64, Util +from .version import API_VERSION, USER_AGENT +if six.PY3: + from .async_sql_response import AsyncSqlResponse + from .get_async_sql_request import GetAsyncSqlRequest +from .proto import LogGroupRaw as LogGroup +from .external_store_config_response import * +import struct +from .logresponse import LogResponse +from copy import copy +from .pluralize import pluralize +from .etl_config_response import * +from .export_response import * +from .common_response import * +from .auth import * +from .compress import CompressType, Compressor +from .metering_mode_response import GetLogStoreMeteringModeResponse, \ + GetMetricStoreMeteringModeResponse, UpdateLogStoreMeteringModeResponse, \ + UpdateMetricStoreMeteringModeResponse +from .multimodal_config_response import GetLogStoreMultimodalConfigurationResponse, \ + PutLogStoreMultimodalConfigurationResponse +from .object_response import PutObjectResponse, GetObjectResponse +from .util import require_python3, object_name_encode +logger = logging.getLogger(__name__) +if six.PY3: + xrange = range +CONNECTION_TIME_OUT = 120 +MAX_LIST_PAGING_SIZE = 500 +MAX_GET_LOG_PAGING_SIZE = 100 +DEFAULT_QUERY_RETRY_COUNT = 5 +DEFAULT_QUERY_RETRY_INTERVAL = 0.5 +DEFAULT_REFRESH_RETRY_COUNT = 5 +DEFAULT_REFRESH_RETRY_DELAY = 30 +MIN_REFRESH_INTERVAL = 300 +_auth_code_set = {'Unauthorized', 'InvalidAccessKeyId.NotFound', 'SecurityToken.Expired', 'InvalidAccessKeyId', 'SecurityTokenExpired'} +_auth_partial_code_set = {'Unauthorized', 'InvalidAccessKeyId', 'SecurityToken'} + +def _is_auth_err(status, code, msg): ... + +def _apply_cn_keys_patch(): ... + +class LogClient(object): + __version__ = API_VERSION + Version = __version__ + def __init__(self, endpoint: str, accessKeyId: Optional[str] = ..., accessKey: Optional[str] = ..., securityToken: Optional[str] = ..., source: Optional[str] = ..., auth_version: str = ..., region: str = ..., credentials_provider: Optional[CredentialsProvider] = ...) -> None: ... + def set_credentials_auto_refresher(self, refresher: Callable[[], Tuple[str, str, Optional[str]]]) -> None: ... + @property + def timeout(self) -> int: ... + @timeout.setter + def timeout(self, value: int) -> None: ... + def set_user_agent(self, user_agent: str) -> None: ... + def set_source(self, source: str) -> None: ... + def put_log_raw(self, project: str, logstore: str, log_group: LogGroup, compress: Optional[bool] = ...) -> PutLogsResponse: ... + def put_logs(self, request: PutLogsRequest) -> PutLogsResponse: ... + def list_logstores(self, request: ListLogstoresRequest) -> ListLogstoresResponse: ... + def list_topics(self, request: ListTopicsRequest) -> ListTopicsResponse: ... + def get_histograms(self, request: GetHistogramsRequest) -> GetHistogramsResponse: ... + def delete_logs(self, request: DeleteLogsRequest) -> DeleteLogsResponse: ... + def get_delete_logs_status(self, request: GetDeleteLogsStatusRequest) -> GetDeleteLogsStatusResponse: ... + def list_delete_logs_tasks(self, request: ListDeleteLogsTasksRequest) -> ListDeleteLogsTasksResponse: ... + def get_log(self, project: str, logstore: str, from_time: Union[int, str], to_time: Union[int, str], topic: Optional[str] = ..., query: Optional[str] = ..., reverse: bool = ..., offset: int = ..., size: int = ..., power_sql: bool = ..., scan: bool = ..., forward: bool = ..., accurate_query: bool = ..., from_time_nano_part: int = ..., to_time_nano_part: int = ...) -> GetLogsResponse: ... + def get_logs(self, request: GetLogsRequest) -> GetLogsResponse: ... + def get_log_all(self, project: str, logstore: str, from_time: Union[int, str], to_time: Union[int, str], topic: Optional[str] = ..., query: Optional[str] = ..., reverse: bool = ..., offset: int = ..., power_sql: bool = ..., accurate_query: bool = ...) -> Iterator[GetLogsResponse]: ... + def get_log_all_v2(self, project: str, logstore: str, from_time: Union[int, str], to_time: Union[int, str], topic: Optional[str] = ..., query: Optional[str] = ..., reverse: bool = ..., offset: int = ..., power_sql: bool = ..., scan: bool = ..., forward: bool = ...) -> Iterator[GetLogsResponse]: ... + def execute_logstore_sql(self, project: str, logstore: str, from_time: Union[int, str], to_time: Union[int, str], sql: str, power_sql: bool) -> GetLogsResponse: ... + def execute_project_sql(self, project: str, sql: str, power_sql: bool) -> GetLogsResponse: ... + @require_python3 + def submit_async_sql(self, request: SubmitAsyncSqlRequest) -> AsyncSqlResponse: ... + @require_python3 + def get_async_sql(self, request: GetAsyncSqlRequest) -> AsyncSqlResponse: ... + @require_python3 + def delete_async_sql(self, request: DeleteAsyncSqlRequest) -> AsyncSqlResponse: ... + def get_context_logs(self, project: str, logstore: str, pack_id: str, pack_meta: str, back_lines: int, forward_lines: int) -> GetContextLogsResponse: ... + def get_project_logs(self, request: GetProjectLogsRequest) -> GetLogsResponse: ... + def get_cursor(self, project_name: str, logstore_name: str, shard_id: int, start_time: Union[str, int]) -> GetCursorResponse: ... + def get_cursor_time(self, project_name: str, logstore_name: str, shard_id: int, cursor: str) -> GetCursorTimeResponse: ... + def get_previous_cursor_time(self, project_name: str, logstore_name: str, shard_id: int, cursor: str, normalize: bool = ...) -> GetCursorTimeResponse: ... + def get_begin_cursor(self, project_name: str, logstore_name: str, shard_id: int) -> GetCursorResponse: ... + def get_end_cursor(self, project_name: str, logstore_name: str, shard_id: int) -> GetCursorResponse: ... + def pull_logs(self, project_name: str, logstore_name: str, shard_id: int, cursor: str, count: Optional[int] = ..., end_cursor: Optional[str] = ..., compress: Optional[bool] = ..., query: Optional[str] = ..., accept_compress_type: Optional[str] = ..., processor: Optional[str] = ...) -> PullLogResponse: ... + def pull_log(self, project_name: str, logstore_name: str, shard_id: int, from_time: Union[int, str], to_time: Union[int, str], batch_size: Optional[int] = ..., compress: Optional[bool] = ..., query: Optional[str] = ..., accept_compress_type: Optional[str] = ..., processor: Optional[str] = ...) -> Iterator[PullLogResponse]: ... + def pull_log_dump(self, project_name: str, logstore_name: str, from_time: Union[int, str], to_time: Union[int, str], file_path: str, batch_size: Optional[int] = ..., compress: Optional[bool] = ..., encodings: Optional[List[str]] = ..., shard_list: Optional[Union[str, List[str]]] = ..., no_escape: Optional[bool] = ..., query: Optional[str] = ..., processor: Optional[str] = ...) -> LogResponse: ... + def create_logstore(self, project_name: str, logstore_name: str, ttl: int = ..., shard_count: int = ..., enable_tracking: bool = ..., append_meta: bool = ..., auto_split: bool = ..., max_split_shard: int = ..., preserve_storage: bool = ..., encrypt_conf: Optional[Dict[str, Any]] = ..., telemetry_type: str = ..., hot_ttl: int = ..., mode: Optional[str] = ..., infrequent_access_ttl: int = ...) -> CreateLogStoreResponse: ... + def delete_logstore(self, project_name: str, logstore_name: str) -> DeleteLogStoreResponse: ... + def get_logstore(self, project_name: str, logstore_name: str) -> GetLogStoreResponse: ... + def update_logstore(self, project_name: str, logstore_name: str, ttl: Optional[int] = ..., enable_tracking: Optional[bool] = ..., shard_count: Optional[int] = ..., append_meta: Optional[bool] = ..., auto_split: Optional[bool] = ..., max_split_shard: Optional[int] = ..., preserve_storage: Optional[bool] = ..., encrypt_conf: Optional[Dict[str, Any]] = ..., hot_ttl: int = ..., mode: Optional[str] = ..., telemetry_type: Optional[str] = ..., infrequent_access_ttl: int = ...) -> UpdateLogStoreResponse: ... + def list_logstore(self, project_name: str, logstore_name_pattern: Optional[str] = ..., offset: int = ..., size: int = ...) -> ListLogStoreResponse: ... + def get_logstore_metering_mode(self, project_name: str, logstore_name: str) -> GetLogStoreMeteringModeResponse: ... + def update_logstore_metering_mode(self, project_name: str, logstore_name: str, metering_mode: str) -> UpdateLogStoreMeteringModeResponse: ... + def get_logstore_multimodal_configuration(self, project_name: str, logstore_name: str) -> GetLogStoreMultimodalConfigurationResponse: ... + def put_logstore_multimodal_configuration(self, project_name: str, logstore_name: str, status: str, anonymous_write: Optional[str] = ...) -> PutLogStoreMultimodalConfigurationResponse: ... + def get_metric_store_metering_mode(self, project_name: str, metric_store_name: str) -> GetMetricStoreMeteringModeResponse: ... + def update_metric_store_metering_mode(self, project_name: str, metric_store_name: str, metering_mode: str) -> UpdateMetricStoreMeteringModeResponse: ... + def create_external_store(self, project_name: str, config: ExternalStoreConfigBase) -> CreateExternalStoreResponse: ... + def delete_external_store(self, project_name: str, store_name: str) -> DeleteExternalStoreResponse: ... + def get_external_store(self, project_name: str, store_name: str) -> GetExternalStoreResponse: ... + def update_external_store(self, project_name: Any, config: ExternalStoreConfigBase) -> UpdateExternalStoreResponse: ... + def list_external_store(self, project_name: str, external_store_name_pattern: Any = ..., offset: int = ..., size: int = ...) -> ListExternalStoreResponse: ... + def list_shards(self, project_name: str, logstore_name: str) -> ListShardResponse: ... + def split_shard(self, project_name: str, logstore_name: str, shardId: int, split_hash: str) -> ListShardResponse: ... + def merge_shard(self, project_name: str, logstore_name: str, shardId: int) -> ListShardResponse: ... + def delete_shard(self, project_name: str, logstore_name: str, shardId: int) -> DeleteShardResponse: ... + def create_index(self, project_name: str, logstore_name: str, index_detail: IndexConfig) -> CreateIndexResponse: ... + def update_index(self, project_name: str, logstore_name: str, index_detail: IndexConfig) -> UpdateIndexResponse: ... + def delete_index(self, project_name: str, logstore_name: str) -> DeleteIndexResponse: ... + def get_index_config(self, project_name: str, logstore_name: str) -> GetIndexResponse: ... + def create_logtail_config(self, project_name: str, config_detail: Union[LogtailConfigGenerator, SeperatorFileConfigDetail, SimpleFileConfigDetail, FullRegFileConfigDetail, JsonFileConfigDetail, ApsaraFileConfigDetail, SyslogConfigDetail, CommonRegLogConfigDetail]) -> CreateLogtailConfigResponse: ... + def update_logtail_config(self, project_name: str, config_detail: Union[LogtailConfigGenerator, SeperatorFileConfigDetail, SimpleFileConfigDetail, FullRegFileConfigDetail, JsonFileConfigDetail, ApsaraFileConfigDetail, SyslogConfigDetail, CommonRegLogConfigDetail]) -> UpdateLogtailConfigResponse: ... + def delete_logtail_config(self, project_name: str, config_name: str) -> DeleteLogtailConfigResponse: ... + def get_logtail_config(self, project_name: str, config_name: str) -> GetLogtailConfigResponse: ... + def list_logtail_config(self, project_name: str, logstore: Optional[str] = ..., config: Optional[str] = ..., offset: int = ..., size: int = ...) -> ListLogtailConfigResponse: ... + def create_logtail_pipeline_config(self, project_name: str, config_detail: LogtailPipelineConfigDetail) -> CreateLogtailPipelineConfigResponse: ... + def update_logtail_pipeline_config(self, project_name: str, config_detail: LogtailPipelineConfigDetail) -> UpdateLogtailPipelineConfigResponse: ... + def delete_logtail_pipeline_config(self, project_name: str, config_name: str) -> DeleteLogtailPipelineConfigResponse: ... + def get_logtail_pipeline_config(self, project_name: str, config_name: str) -> GetLogtailPipelineConfigResponse: ... + def list_logtail_pipeline_config(self, project_name: str, config_name: Optional[str] = ..., logstore_name: Optional[str] = ..., offset: int = ..., size: int = ...) -> ListLogtailPipelineConfigResponse: ... + def create_machine_group(self, project_name: str, group_detail: MachineGroupDetail) -> CreateMachineGroupResponse: ... + def delete_machine_group(self, project_name: str, group_name: str) -> DeleteMachineGroupResponse: ... + def update_machine_group(self, project_name: str, group_detail: MachineGroupDetail) -> UpdateMachineGroupResponse: ... + def get_machine_group(self, project_name: str, group_name: str) -> GetMachineGroupResponse: ... + def list_machine_group(self, project_name: str, offset: int = ..., size: int = ...) -> ListMachineGroupResponse: ... + def list_machines(self, project_name: str, group_name: str, offset: int = ..., size: int = ...) -> ListMachinesResponse: ... + def apply_config_to_machine_group(self, project_name: str, config_name: str, group_name: str) -> ApplyConfigToMachineGroupResponse: ... + def remove_config_to_machine_group(self, project_name: str, config_name: str, group_name: str) -> RemoveConfigToMachineGroupResponse: ... + def get_machine_group_applied_configs(self, project_name: str, group_name: str) -> GetMachineGroupAppliedConfigResponse: ... + def get_config_applied_machine_groups(self, project_name: str, config_name: str) -> GetConfigAppliedMachineGroupsResponse: ... + def get_shipper_tasks(self, project_name: str, logstore_name: str, shipper_name: str, start_time: int, end_time: int, status_type: str = ..., offset: int = ..., size: int = ...) -> GetShipperTasksResponse: ... + def retry_shipper_tasks(self, project_name: str, logstore_name: str, shipper_name: str, task_list: List[str]) -> RetryShipperTasksResponse: ... + def check_upsert_scheduled_sql(self, project_name: str, scheduled_sql: Any, method: str, resource: str) -> Tuple[Dict[str, Any], Dict[str, Any]]: ... + def create_scheduled_sql(self, project_name: str, scheduled_sql: ScheduledSQL) -> CreateScheduledSQLResponse: ... + def update_scheduled_sql(self, project_name: str, scheduled_sql: ScheduledSQL) -> UpdateScheduledSQLResponse: ... + def delete_scheduled_sql(self, project_name: str, job_name: str) -> DeleteScheduledSQLResponse: ... + def get_scheduled_sql(self, project_name: str, job_name: str) -> GetScheduledSQLResponse: ... + def list_scheduled_sql(self, project_name: str, offset: int = ..., size: int = ...) -> ListScheduledSQLResponse: ... + def list_scheduled_sql_job_instance(self, project: str, job_name: str, from_time: int, to_time: int, state: Optional[str] = ..., offset: int = ..., size: int = ...) -> ListScheduledSqlJobInstancesResponse: ... + def get_scheduled_sql_job_instance(self, project: str, job_name: str, instance_id: str, result: Optional[str] = ...) -> GetScheduledSqlJobInstanceResponse: ... + def modify_scheduled_sql_job_instance_state(self, project: str, job_name: str, instance_id: str, state: str) -> ModifyScheduledSqlJobStateResponse: ... + def create_project(self, project_name: str, project_des: str, resource_group_id: str = ..., data_redundancy_type: Optional[str] = ...) -> CreateProjectResponse: ... + def update_project(self, project_name: str, project_des: str) -> UpdateProjectResponse: ... + def get_project(self, project_name: str) -> GetProjectResponse: ... + def delete_project(self, project_name: str) -> DeleteProjectResponse: ... + def change_resource_group(self, resource_id: str, resource_group_id: str, resource_type: str = ...) -> LogResponse: ... + def tag_project(self, project_name: str, **tags: Any) -> LogResponse: ... + def untag_project(self, project_name: str, *tag_keys: Any) -> LogResponse: ... + def get_project_tags(self, project_name: str, **filer_tags: Any) -> Iterator[GetProjectTagsResponse]: ... + def tag_resources(self, resource_type: str, resource_id: str, **tags: Any) -> LogResponse: ... + def untag_resources(self, resource_type: str, resource_id: str, *tag_keys: Any) -> LogResponse: ... + def list_tag_resources(self, resource_type: str, resource_id: Optional[str], **filer_tags: Any) -> Iterator[GetResourceTagsResponse]: ... + def create_consumer_group(self, project: str, logstore: str, consumer_group: str, timeout: int, in_order: bool = ...) -> CreateConsumerGroupResponse: ... + def update_consumer_group(self, project: str, logstore: str, consumer_group: str, timeout: Optional[int] = ..., in_order: Optional[bool] = ...) -> UpdateConsumerGroupResponse: ... + def delete_consumer_group(self, project: str, logstore: str, consumer_group: str) -> DeleteConsumerGroupResponse: ... + def list_consumer_group(self, project: str, logstore: str) -> ListConsumerGroupResponse: ... + def update_check_point(self, project: str, logstore: str, consumer_group: str, shard: int, check_point: str, consumer: str = ..., force_success: bool = ...) -> ConsumerGroupUpdateCheckPointResponse: ... + def get_check_point(self, project: str, logstore: str, consumer_group: str, shard: int = ...) -> ConsumerGroupCheckPointResponse: ... + def get_check_point_fixed(self, project: str, logstore: str, consumer_group: str, shard: int = ...) -> ConsumerGroupCheckPointResponse: ... + def heart_beat(self, project: str, logstore: str, consumer_group: str, consumer: str, shards: Optional[List[int]] = ...) -> ConsumerGroupHeartBeatResponse: ... + def copy_project(self, from_project: str, to_project: str, to_client: Optional[LogClient] = ..., copy_machine_group: bool = ..., copy_dashboards: bool = ..., copy_alerts: bool = ...) -> None: ... + def copy_logstore(self, from_project: str, from_logstore: str, to_logstore: str, to_project: Optional[str] = ..., to_client: Optional[LogClient] = ..., to_region_endpoint: Optional[str] = ..., keep_config_name: Any = ...) -> None: ... + def copy_dashboard(self, from_project: str, from_dashboard_name: str, to_project: Optional[str] = ..., to_dashboard_name: Optional[str] = ..., to_client: Optional[LogClient] = ..., to_region_endpoint: Optional[str] = ...) -> None: ... + def copy_alert(self, from_project: str, from_alert_name: str, to_project: Optional[str] = ..., to_alert_name: Optional[str] = ..., to_client: Optional[LogClient] = ..., to_region_endpoint: Optional[str] = ...) -> None: ... + def list_project(self, offset: int = ..., size: int = ..., project_name_pattern: Optional[str] = ..., resource_group_id: str = ..., description: Optional[str] = ...) -> ListProjectResponse: ... + def es_migration(self, cache_path: str, hosts: str, project_name: str, indexes: Optional[str] = ..., query: Optional[str] = ..., logstore_index_mappings: Optional[str] = ..., pool_size: Optional[int] = ..., time_reference: Optional[str] = ..., source: Optional[str] = ..., topic: Optional[str] = ..., batch_size: Optional[int] = ..., wait_time_in_secs: Optional[int] = ..., auto_creation: bool = ..., retries_failed: Optional[int] = ..., cache_duration: str = ...) -> LogResponse: ... + def copy_data(self, project: str, logstore: str, from_time: Union[str, int], to_time: Optional[Union[str, int]] = ..., to_client: Optional[LogClient] = ..., to_project: Optional[str] = ..., to_logstore: Optional[str] = ..., shard_list: Optional[str] = ..., batch_size: Optional[int] = ..., compress: Optional[bool] = ..., new_topic: Optional[str] = ..., new_source: Optional[str] = ...) -> LogResponse: ... + def transform_data(self, project: str, logstore: str, config: str, from_time: Union[str, int], to_time: Optional[Union[str, int]] = ..., to_client: Optional[LogClient] = ..., to_project: Optional[str] = ..., to_logstore: Optional[str] = ..., shard_list: Optional[str] = ..., batch_size: Optional[int] = ..., compress: Optional[bool] = ..., cg_name: Optional[str] = ..., c_name: Optional[str] = ..., cg_heartbeat_interval: Optional[int] = ..., cg_data_fetch_interval: Optional[int] = ..., cg_in_order: Optional[bool] = ..., cg_worker_pool_size: Optional[int] = ...) -> LogResponse: ... + def get_resource_usage(self, project: Any) -> ResourceUsageResponse: ... + def arrange_shard(self, project: str, logstore: str, count: int) -> None: ... + def enable_alert(self, project_name: str, job_name: str) -> LogResponse: ... + def disable_alert(self, project_name: str, job_name: str) -> LogResponse: ... + def list_ingestion(self, project_name: str, logstore_name: Any = ..., offset: Any = ..., size: Any = ...) -> ListIngestionResponse: ... + def create_ingestion(self, project_name: str, ingestion_config: str) -> CreateIngestionResponse: ... + def update_ingestion(self, project_name: str, ingestion_name: str, ingestion_config: str) -> UpdateIngestionResponse: ... + def delete_ingestion(self, project_name: str, ingestion_name: str) -> DeleteIngestionResponse: ... + def get_ingestion(self, project_name: str, ingestion_name: str) -> GetIngestionResponse: ... + def start_ingestion(self, project_name: str, ingestion_name: str) -> StartIngestionResponse: ... + def restart_ingestion(self, project_name: str, ingestion_name: str, ingestion_config: Any) -> RestartIngestionResponse: ... + def stop_ingestion(self, project_name: str, ingestion_name: str) -> StopIngestionResponse: ... + def create_etl(self, project_name: str, name: str, configuration: Dict[str, Any], schedule: Dict[str, Any], display_name: str, description: Optional[str] = ...) -> CreateEtlResponse: ... + def get_etl(self, project_name: str, name: str) -> GetEtlResponse: ... + def update_etl(self, project_name: str, name: str, configuration: Dict[str, Any], schedule: Dict[str, Any], display_name: str, description: Optional[str] = ...) -> UpdateEtlResponse: ... + def start_etl(self, project_name: str, name: str) -> StartEtlResponse: ... + def stop_etl(self, project_name: str, name: str) -> StopEtlResponse: ... + def list_etls(self, project_name: str, offset: int = ..., size: int = ...) -> ListEtlsResponse: ... + def delete_etl(self, project_name: str, name: str) -> DeleteEtlResponse: ... + def create_substore(self, project_name: str, logstore_name: str, substore_name: str, keys: List[Any], ttl: int, sorted_key_count: int, time_index: Any) -> CreateSubStoreResponse: ... + def delete_substore(self, project_name: str, logstore_name: str, substore_name: str) -> DeleteSubStoreResponse: ... + def get_substore(self, project_name: str, logstore_name: str, substore_name: str) -> GetSubStoreResponse: ... + def update_substore(self, project_name: str, logstore_name: str, substore_name: str, keys: List[Any], ttl: int, sorted_key_count: int, time_index: Any) -> UpdateSubStoreResponse: ... + def list_substore(self, project_name: str, logstore_name: str) -> ListSubStoreResponse: ... + def get_substore_ttl(self, project_name: str, logstore_name: str) -> GetSubStoreTTLResponse: ... + def update_substore_ttl(self, project_name: str, logstore_name: str, ttl: int) -> UpdateSubStoreTTLResponse: ... + def create_metric_store(self, project_name: str, logstore_name: str, ttl: int = ..., shard_count: int = ..., enable_tracking: bool = ..., append_meta: bool = ..., auto_split: bool = ..., max_split_shard: int = ..., preserve_storage: bool = ..., encrypt_conf: Optional[Dict[str, Any]] = ..., hot_ttl: int = ..., mode: Optional[str] = ...) -> CreateMetricsStoreResponse: ... + def delete_metric_store(self, project_name: str, logstore_name: str) -> DeleteLogStoreResponse: ... + def get_metric_store(self, project_name: str, logstore_name: str) -> GetLogStoreResponse: ... + def update_metric_store(self, project_name: str, logstore_name: str, ttl: Optional[int] = ..., enable_tracking: Optional[bool] = ..., shard_count: Optional[int] = ..., append_meta: Optional[bool] = ..., auto_split: Optional[bool] = ..., max_split_shard: Optional[int] = ..., preserve_storage: Optional[bool] = ..., encrypt_conf: Optional[Dict[str, Any]] = ..., hot_ttl: int = ..., mode: Optional[str] = ...) -> UpdateLogStoreResponse: ... + def create_sql_instance(self, project_name: str, sql_instance: int, useAsDefault: Any) -> CreateSqlInstanceResponse: ... + def update_sql_instance(self, project_name: str, sql_instance: int, useAsDefault: Any) -> UpdateSqlInstanceResponse: ... + def list_sql_instance(self, project_name: str) -> ListSqlInstanceResponse: ... + def create_resource(self, resource: Resource) -> CreateResourceResponse: ... + def delete_resource(self, resource_name: str) -> DeleteResourceResponse: ... + def update_resource(self, resource: Resource) -> UpdateResourceResponse: ... + def get_resource(self, resource_name: str) -> GetResourceResponse: ... + def list_resources(self, offset: int = ..., size: int = ..., resource_type: Optional[str] = ..., resource_names: Optional[List[Any]] = ...) -> ListResourcesResponse: ... + def create_resource_record(self, resource_name: str, record: ResourceRecord) -> CreateRecordResponse: ... + def delete_resource_record(self, resource_name: str, record_ids: List[Any]) -> DeleteRecordResponse: ... + def update_resource_record(self, resource_name: str, record: ResourceRecord) -> UpdateRecordResponse: ... + def upsert_resource_record(self, resource_name: str, records: List[ResourceRecord]) -> UpsertRecordResponse: ... + def get_resource_record(self, resource_name: str, record_id: str) -> GetRecordResponse: ... + def list_resource_records(self, resource_name: str, tag: Optional[str] = ..., record_ids: Optional[List[str]] = ..., offset: int = ..., size: int = ...) -> ListRecordResponse: ... + def create_topostore(self, topostore: Topostore) -> CreateTopostoreResponse: ... + def update_topostore(self, topostore: Topostore) -> UpdateTopostoreResponse: ... + def delete_topostore(self, topostore_name: str) -> DeleteTopostoreResponse: ... + def get_topostore(self, topostore_name: str) -> GetTopostoreResponse: ... + def list_topostores(self, names: Optional[List[str]] = ..., tag_key: Optional[str] = ..., tag_value: Optional[str] = ..., offset: int = ..., size: int = ...) -> ListTopostoresResponse: ... + def create_topostore_node(self, topostore_name: str, node: TopostoreNode) -> CreateTopostoreNodeResponse: ... + def upsert_topostore_node(self, topostore_name: str, nodes: List[TopostoreNode]) -> UpsertTopostoreNodeResponse: ... + def update_topostore_node(self, topostore_name: str, node: TopostoreNode) -> UpdateTopostoreNodeResponse: ... + def delete_topostore_node(self, topostore_name: str, node_ids: List[Any]) -> DeleteTopostoreNodeResponse: ... + def get_topostore_node(self, topostore_name: str, node_id: str) -> GetTopostoreNodeResponse: ... + def list_topostore_node(self, topostore_name: str, node_ids: Optional[List[str]] = ..., node_types: Optional[List[str]] = ..., property_key: Optional[str] = ..., property_value: Optional[str] = ..., offset: int = ..., size: int = ...) -> ListTopostoreNodesResponse: ... + def create_topostore_relation(self, topostore_name: str, relation: TopostoreRelation) -> CreateTopostoreRelationResponse: ... + def upsert_topostore_relation(self, topostore_name: str, relations: List[TopostoreRelation]) -> UpsertTopostoreRelationResponse: ... + def update_topostore_relation(self, topostore_name: str, relation: TopostoreRelation) -> UpdateTopostoreRelationResponse: ... + def delete_topostore_relation(self, topostore_name: str, relation_ids: List[str]) -> DeleteTopostoreRelationResponse: ... + def get_topostore_relation(self, topostore_name: str, relation_id: str) -> GetTopostoreRelationResponse: ... + def list_topostore_relation(self, topostore_name: str, relation_ids: Optional[List[str]] = ..., relation_types: Optional[List[str]] = ..., src_node_ids: Optional[List[str]] = ..., dst_node_ids: Optional[List[str]] = ..., property_key: Optional[str] = ..., property_value: Optional[str] = ..., offset: int = ..., size: int = ...) -> ListTopostoreRelationsResponse: ... + def create_export(self, project_name: str, export: Export) -> CreateExportResponse: ... + def delete_export(self, project_name: str, job_name: str) -> DeleteExportResponse: ... + def update_export(self, project_name: str, job_name: str, export: str) -> UpdateExportResponse: ... + def get_export(self, project_name: str, job_name: Any) -> GetExportResponse: ... + def list_export(self, project_name: str, offset: int = ..., size: int = ...) -> ListExportResponse: ... + def list_logstore_export(self, project_name: str, logstore_name: str, offset: int = ..., size: int = ...) -> ListExportResponse: ... + def list_alert(self, project: str, offset: int = ..., size: int = ...) -> ListEntityResponse: ... + def get_alert(self, project: str, entity: str) -> GetEntityResponse: ... + def delete_alert(self, project: str, entity: str) -> DeleteEntityResponse: ... + def update_alert(self, project: str, detail: Union[Dict[str, Any], str]) -> UpdateEntityResponse: ... + def create_alert(self, project: str, detail: Union[Dict[str, Any], str]) -> CreateEntityResponse: ... + def list_dashboard(self, project: str, offset: int = ..., size: int = ...) -> ListEntityResponse: ... + def get_dashboard(self, project: str, entity: str) -> GetEntityResponse: ... + def delete_dashboard(self, project: str, entity: str) -> DeleteEntityResponse: ... + def update_dashboard(self, project: str, detail: Union[Dict[str, Any], str]) -> UpdateEntityResponse: ... + def create_dashboard(self, project: str, detail: Union[Dict[str, Any], str]) -> CreateEntityResponse: ... + def list_savedsearch(self, project: str, offset: int = ..., size: int = ...) -> ListEntityResponse: ... + def get_savedsearch(self, project: str, entity: str) -> GetEntityResponse: ... + def delete_savedsearch(self, project: str, entity: str) -> DeleteEntityResponse: ... + def update_savedsearch(self, project: str, detail: Union[Dict[str, Any], str]) -> UpdateEntityResponse: ... + def create_savedsearch(self, project: str, detail: Union[Dict[str, Any], str]) -> CreateEntityResponse: ... + def list_shipper(self, project: str, logstore: str, offset: int = ..., size: int = ...) -> ListEntityResponse: ... + def get_shipper(self, project: str, logstore: str, entity: str) -> GetEntityResponse: ... + def delete_shipper(self, project: str, logstore: str, entity: str) -> DeleteEntityResponse: ... + def update_shipper(self, project: str, logstore: str, detail: Union[Dict[str, Any], str]) -> UpdateEntityResponse: ... + def create_shipper(self, project: str, logstore: str, detail: Union[Dict[str, Any], str]) -> CreateEntityResponse: ... + def create_rebuild_index(self, project: str, logstore: str, job_name: str, display_name: str, from_time: int, to_time: int) -> CreateRebuildIndexResponse: ... + def get_rebuild_index(self, project: str, job_name: str) -> GetRebuildIndexResponse: ... + def list_store_views(self, project_name: str, offset: int = ..., size: int = ..., store_type: Optional[str] = ...) -> ListStoreViewsResponse: ... + def get_store_view(self, project_name: str, store_view_name: str) -> GetStoreViewResponse: ... + def update_store_view(self, project_name: str, store_view_name: str, store_view: StoreView) -> UpdateStoreViewResponse: ... + def create_store_view(self, project_name: str, store_view: StoreView) -> CreateStoreViewResponse: ... + def delete_store_view(self, project_name: str, store_view_name: str) -> DeleteStoreViewResponse: ... + def put_object(self, project_name: str, logstore_name: str, object_name: str, content: Union[bytes, str], headers: Optional[Dict[str, Any]] = ...) -> PutObjectResponse: ... + def get_object(self, project_name: str, logstore_name: str, object_name: str) -> GetObjectResponse: ... diff --git a/aliyun/log/logclient_operator.py b/aliyun/log/logclient_operator.py index ba1341d0..8d424bbf 100644 --- a/aliyun/log/logclient_operator.py +++ b/aliyun/log/logclient_operator.py @@ -25,8 +25,8 @@ logger = logging.getLogger(__name__) -# type: (LogClient, LogClient, str, str, bool, bool, bool) -> None def copy_project(from_client, to_client, from_project, to_project, copy_machine_group=False, copy_dashboards=False, copy_alerts=False): + # type: (LogClient, LogClient, str, str, bool, bool, bool) -> None """ copy project, logstore, machine group and logtail config to target project, will create the target project if it doesn't exist @@ -1142,4 +1142,3 @@ def copy_alert(from_client, from_project, from_alert_name, to_project=None, to_a else: raise - diff --git a/aliyun/log/logexception.pyi b/aliyun/log/logexception.pyi new file mode 100644 index 00000000..f50bd828 --- /dev/null +++ b/aliyun/log/logexception.pyi @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +import json + +class LogException(Exception): + def __init__(self, errorCode: str, errorMessage: str, requestId: str = ..., resp_status: Any = ..., resp_header: Any = ..., resp_body: Any = ...) -> None: ... + def __str__(self): ... + def get_error_code(self) -> str: ... + def get_error_message(self) -> str: ... + def get_request_id(self) -> str: ... + def get_resp_body(self) -> str: ... + def get_resp_status(self) -> int: ... diff --git a/aliyun/log/logitem.pyi b/aliyun/log/logitem.pyi new file mode 100644 index 00000000..b9de8364 --- /dev/null +++ b/aliyun/log/logitem.pyi @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +import time +import copy + +class LogItem(object): + def __init__(self, timestamp: Optional[int] = ..., contents: Optional[List[Tuple[str, str]]] = ..., time_nano_part: Optional[int] = ...) -> None: ... + def push_back(self, key: str, value: str) -> None: ... + def get_contents(self) -> List[Tuple[str, str]]: ... + def set_contents(self, contents: List[Tuple[str, str]]) -> None: ... + def get_time(self) -> int: ... + def get_time_nano_part(self) -> int: ... + def set_time(self, timestamp: int) -> None: ... + def set_time_nano_part(self, time_nano_part: int) -> None: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/logresponse.pyi b/aliyun/log/logresponse.pyi new file mode 100644 index 00000000..c0e48720 --- /dev/null +++ b/aliyun/log/logresponse.pyi @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +from .util import Util + +class LogResponse(object): + def __init__(self, headers: Dict[str, Any], body: Any = ...) -> None: ... + def get_request_id(self) -> str: ... + def get_body(self) -> Any: ... + def get_all_headers(self) -> Dict[str, Any]: ... + def get_header(self, key: str) -> str: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/machine_group_detail.pyi b/aliyun/log/machine_group_detail.pyi new file mode 100644 index 00000000..0eda7b43 --- /dev/null +++ b/aliyun/log/machine_group_detail.pyi @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +import time +from .util import Util + +class MachineGroupDetail(object): + def __init__(self, group_name: Optional[str] = ..., machine_type: Optional[str] = ..., machine_list: Optional[str] = ..., group_type: str = ..., group_attribute: Optional[Dict[str, Any]] = ...) -> None: ... + def to_json(self) -> Any: ... + def from_json(self, json_value: Any) -> None: ... + +class MachineStatus(object): + def __init__(self, ip: str, machine_unique_id: str, user_defined_id: str, heartbeat_time: int, binary: Any = ...) -> None: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/metering_mode_response.pyi b/aliyun/log/metering_mode_response.pyi new file mode 100644 index 00000000..e236b2ff --- /dev/null +++ b/aliyun/log/metering_mode_response.pyi @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +from .util import Util +from .logresponse import LogResponse + +class GetLogStoreMeteringModeResponse(LogResponse): + def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... + def get_metering_mode(self) -> str: ... + def log_print(self) -> None: ... + +class GetMetricStoreMeteringModeResponse(LogResponse): + def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... + def get_metering_mode(self) -> str: ... + def log_print(self) -> None: ... + +class UpdateLogStoreMeteringModeResponse(LogResponse): + def __init__(self, header: Dict[str, Any], resp: Any = ...) -> None: ... + def log_print(self) -> None: ... + +class UpdateMetricStoreMeteringModeResponse(LogResponse): + def __init__(self, header: Dict[str, Any], resp: Any = ...) -> None: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/multimodal_config_response.pyi b/aliyun/log/multimodal_config_response.pyi new file mode 100644 index 00000000..9fb2ab19 --- /dev/null +++ b/aliyun/log/multimodal_config_response.pyi @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +from .util import Util +from .logresponse import LogResponse + +class GetLogStoreMultimodalConfigurationResponse(LogResponse): + def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... + def get_status(self) -> str: ... + def get_anonymous_write(self) -> Optional[str]: ... + def log_print(self) -> None: ... + +class PutLogStoreMultimodalConfigurationResponse(LogResponse): + def __init__(self, header: Dict[str, Any], resp: Any = ...) -> None: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/object_response.pyi b/aliyun/log/object_response.pyi new file mode 100644 index 00000000..cf701986 --- /dev/null +++ b/aliyun/log/object_response.pyi @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from typing import Any, Dict, Optional + +from .logresponse import LogResponse + +__all__ = ['PutObjectResponse', 'GetObjectResponse'] + +class PutObjectResponse(LogResponse): + def __init__(self, header: Dict[str, Any], resp: str = ...) -> None: ... + def get_etag(self) -> Optional[str]: ... + def log_print(self) -> None: ... + +class GetObjectResponse(LogResponse): + def __init__(self, header: Dict[str, Any], resp: bytes) -> None: ... + def get_etag(self) -> Optional[str]: ... + def get_content_type(self) -> str: ... + def get_headers(self) -> Dict[str, Any]: ... + def get_body(self) -> bytes: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/pulllog_response.pyi b/aliyun/log/pulllog_response.pyi new file mode 100644 index 00000000..e3a010d4 --- /dev/null +++ b/aliyun/log/pulllog_response.pyi @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +from typing import Any, Dict, List, Optional + +from .logresponse import LogResponse + +DEFAULT_DECODE_LIST: tuple + +class PullLogResponse(LogResponse): + def __init__(self, resp: str, header: Dict[str, Any]) -> None: ... + @property + def loggroup_list(self) -> Any: ... + def get_body(self) -> Dict[str, Any]: ... + @property + def body(self) -> Dict[str, Any]: ... + @body.setter + def body(self, value: Any) -> None: ... + def get_next_cursor(self) -> str: ... + @property + def log_count(self) -> int: ... + def get_log_count(self) -> int: ... + def get_loggroup_count(self) -> int: ... + def get_loggroup_json_list(self) -> List[Any]: ... + def get_loggroup_list(self) -> Any: ... + def get_loggroup(self, index: int) -> Optional[Any]: ... + def get_raw_size(self) -> int: ... + def get_raw_log_group_count_before_query(self) -> int: ... + def get_raw_size_before_query(self) -> int: ... + def log_print(self) -> None: ... + @staticmethod + def get_log_count_from_group(loggroup_list: Any) -> int: ... + @staticmethod + def loggroups_to_flattern_list(loggroup_list: Any, time_as_str: bool = ..., decode_bytes: Any = ...) -> List[Dict[str, Any]]: ... + def get_flatten_logs_json(self, time_as_str: bool = ..., decode_bytes: Any = ...) -> List[Dict[str, Any]]: ... + def get_flatten_logs_json_auto(self) -> List[Dict[str, Any]]: ... diff --git a/aliyun/log/putlogsrequest.pyi b/aliyun/log/putlogsrequest.pyi new file mode 100644 index 00000000..315a8cd1 --- /dev/null +++ b/aliyun/log/putlogsrequest.pyi @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union +from .logitem import LogItem + + +from .logrequest import LogRequest + +class PutLogsRequest(LogRequest): + def __init__(self, project: Optional[str] = ..., logstore: Optional[str] = ..., topic: Optional[str] = ..., source: Optional[str] = ..., logitems: Optional[List[LogItem]] = ..., hashKey: Optional[str] = ..., compress: bool = ..., logtags: Optional[List[Tuple[str, str]]] = ..., compress_type: Optional[str] = ...) -> None: ... + def get_compress_type(self) -> Optional[str]: ... + def set_compress_type(self, compress_type: str) -> None: ... + def get_compress(self) -> bool: ... + def set_compress(self, compress: bool) -> None: ... + def get_logstore(self) -> str: ... + def set_logstore(self, logstore: str) -> None: ... + def get_topic(self) -> str: ... + def set_topic(self, topic: str) -> None: ... + def get_source(self) -> str: ... + def set_source(self, source: str) -> None: ... + def get_log_items(self) -> List[LogItem]: ... + def set_log_items(self, logitems: List[LogItem]) -> None: ... + def get_log_tags(self) -> List[Tuple[str, str]]: ... + def set_log_tags(self, logtags: List[Tuple[str, str]]) -> None: ... + def set_hash_key(self, hashKey: str) -> None: ... + def get_hash_key(self) -> Optional[str]: ... diff --git a/aliyun/log/putlogsresponse.pyi b/aliyun/log/putlogsresponse.pyi new file mode 100644 index 00000000..64b9f360 --- /dev/null +++ b/aliyun/log/putlogsresponse.pyi @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +from typing import Any, Dict + +from .logresponse import LogResponse + +class PutLogsResponse(LogResponse): + def __init__(self, header: Dict[str, Any], resp: str = ...) -> None: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/py.typed b/aliyun/log/py.typed new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/aliyun/log/py.typed @@ -0,0 +1 @@ + diff --git a/aliyun/log/queriedlog.pyi b/aliyun/log/queriedlog.pyi new file mode 100644 index 00000000..ae408ea3 --- /dev/null +++ b/aliyun/log/queriedlog.pyi @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from typing import Dict, Optional + +class QueriedLog: + timestamp: int + source: str + contents: Dict[str, str] + def __init__(self, timestamp: int, source: str, contents: Dict[str, str]) -> None: ... + def get_time(self) -> int: ... + def get_source(self) -> str: ... + def get_contents(self) -> Dict[str, str]: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/shipper_config.pyi b/aliyun/log/shipper_config.pyi new file mode 100644 index 00000000..3fb91ad3 --- /dev/null +++ b/aliyun/log/shipper_config.pyi @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + + +class OdpsShipperConfig(object): + def __init__(self, odps_endpoint: str, odps_project: str, odps_table: str, log_fields_list: List[str], partition_column: List[str], partition_time_format: str, bufferInterval: Any = ...) -> None: ... + def to_json(self) -> Any: ... + +class OssShipperConfig(object): + def __init__(self, oss_bucket: str, oss_prefix: str, oss_role_arn: str, buffer_interval: int = ..., buffer_mb: int = ..., compress_type: str = ...) -> None: ... + def to_json(self) -> Any: ... + +class ShipperTask(object): + def __init__(self, task_id: str, task_status: str, task_message: str, task_create_time: int, task_last_data_receive_time: int, task_finish_time: int) -> None: ... + def to_json(self) -> Any: ... diff --git a/aliyun/log/store_view.pyi b/aliyun/log/store_view.pyi new file mode 100644 index 00000000..c4ea73a1 --- /dev/null +++ b/aliyun/log/store_view.pyi @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + + +class StoreViewStore: + def __init__(self, project_name: str, store_name: str, query: Optional[str] = ...) -> None: ... + @property + def project_name(self) -> str: ... + @project_name.setter + def project_name(self, project_name: str) -> None: ... + @property + def store_name(self) -> str: ... + @store_name.setter + def store_name(self, store_name: str) -> None: ... + @property + def query(self) -> Optional[str]: ... + @query.setter + def query(self, query: Optional[str]) -> None: ... + def _to_json_dict(self): ... + @classmethod + def _from_json_dict(cls, json_data): ... + +class StoreView: + def __init__(self, name: str, store_type: str, stores: Optional[List[StoreViewStore]] = ...) -> None: ... + @property + def name(self) -> str: ... + @name.setter + def name(self, name: str) -> None: ... + @property + def store_type(self) -> str: ... + @store_type.setter + def store_type(self, store_type: str) -> None: ... + @property + def stores(self) -> List[StoreViewStore]: ... + @stores.setter + def stores(self, stores: List[StoreViewStore]) -> None: ... + def _to_json_dict(self): ... + @classmethod + def _from_json_dict(cls, json_data): ... diff --git a/aliyun/log/store_view_response.pyi b/aliyun/log/store_view_response.pyi new file mode 100644 index 00000000..2658f751 --- /dev/null +++ b/aliyun/log/store_view_response.pyi @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +__all__ = ['CreateStoreViewResponse', 'UpdateStoreViewResponse', 'DeleteStoreViewResponse', 'ListStoreViewsResponse', 'GetStoreViewResponse'] +from .store_view import StoreView +from .logresponse import LogResponse + +class CreateStoreViewResponse(LogResponse): + def __init__(self, header: Dict[str, Any], resp: Any = ...) -> None: ... + def log_print(self) -> None: ... + +class UpdateStoreViewResponse(LogResponse): + def __init__(self, header: Dict[str, Any], resp: Any = ...) -> None: ... + def log_print(self) -> None: ... + +class DeleteStoreViewResponse(LogResponse): + def __init__(self, header: Dict[str, Any], resp: Any = ...) -> None: ... + def log_print(self) -> None: ... + +class ListStoreViewsResponse(LogResponse): + def __init__(self, header: Dict[str, Any], resp: Any) -> None: ... + def get_count(self) -> int: ... + def get_total(self) -> int: ... + def get_store_views(self) -> List[Any]: ... + def log_print(self) -> None: ... + +class GetStoreViewResponse(LogResponse): + def __init__(self, header: Dict[str, Any], resp: Any) -> None: ... + def get_store_view(self) -> StoreView: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/submit_async_sql_request.pyi b/aliyun/log/submit_async_sql_request.pyi new file mode 100644 index 00000000..887beb85 --- /dev/null +++ b/aliyun/log/submit_async_sql_request.pyi @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union + +from .logrequest import LogRequest +from .util import parse_timestamp + +class SubmitAsyncSqlRequest(LogRequest): + def __init__(self, project: Optional[str] = ..., logstore: Optional[str] = ..., query: Optional[str] = ..., fromTime: Optional[Union[int, str]] = ..., toTime: Optional[Union[int, str]] = ..., power_sql: bool = ..., allow_incomplete: bool = ..., max_run_time: Optional[int] = ...) -> None: ... + def get_logstore(self) -> str: ... + def set_logstore(self, logstore: str) -> None: ... + def get_query(self) -> str: ... + def set_query(self, query: str) -> None: ... + def get_from(self) -> int: ... + def set_from(self, fromTime: int) -> None: ... + def get_to(self) -> int: ... + def set_to(self, toTime: int) -> None: ... + def get_power_sql(self) -> bool: ... + def set_power_sql(self, power_sql: bool) -> None: ... + def get_allow_incomplete(self) -> bool: ... + def set_allow_incomplete(self, allow_incomplete: bool) -> None: ... + def get_max_run_time(self) -> int: ... + def set_max_run_time(self, max_run_time: int) -> None: ... diff --git a/aliyun/py.typed b/aliyun/py.typed new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/aliyun/py.typed @@ -0,0 +1 @@ + diff --git a/setup.py b/setup.py index 1ee6be7d..4b6923f5 100755 --- a/setup.py +++ b/setup.py @@ -79,6 +79,12 @@ 'aliyun.log._proto_py2', ] +package_data = { + 'aliyun': ['*.pyi', 'py.typed'], + 'aliyun.log': ['*.pyi', 'py.typed'], + 'aliyun.log.consumer': ['*.pyi', 'py.typed'], +} + version = '' with open('aliyun/log/version.py', 'r') as fd: version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', @@ -112,6 +118,7 @@ url='https://github.com/aliyun/aliyun-log-python-sdk', install_requires=requirements, packages=packages, + package_data=package_data, classifiers=classifiers, long_description=long_description, extras_require = { diff --git a/tests/ci/run_public_type_smoke.py b/tests/ci/run_public_type_smoke.py new file mode 100644 index 00000000..58069f28 --- /dev/null +++ b/tests/ci/run_public_type_smoke.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python +# encoding: utf-8 + +import os +import subprocess +import sys +import tempfile + + +SMOKE_SOURCE = """\ +from aliyun.log.consumer import ( + ConsumerJsonProcessorBase, + ConsumerProcessorAdaptor, + ConsumerProcessorBase, + ConsumerWorker, + CursorPosition, + LogHubConfig, +) + + +class DemoProcessor(ConsumerProcessorBase): + def process(self, log_groups, check_point_tracker): + return None + + +class DemoJsonProcessor(ConsumerJsonProcessorBase): + def process(self, flattern_json_list, check_point_tracker): + return None + + +def build_processor(): + return DemoProcessor() + + +config = LogHubConfig( + endpoint='cn-hangzhou.log.aliyuncs.com', + access_key_id='ak', + access_key='sk', + project='project', + logstore='logstore', + consumer_group_name='group', + consumer_name='consumer', + cursor_position=CursorPosition.BEGIN_CURSOR, +) + +worker = ConsumerWorker(build_processor, config) +adaptor = ConsumerProcessorAdaptor(lambda shard_id, log_groups: True) +json_processor_cls = DemoJsonProcessor +""" + + +def main(): + temp_dir = tempfile.mkdtemp(prefix='aliyun-public-type-smoke-') + smoke_file = os.path.join(temp_dir, 'consumer_public_smoke.py') + with open(smoke_file, 'w') as fh: + fh.write(SMOKE_SOURCE) + + os.chdir(temp_dir) + cmd = [ + sys.executable, + '-m', + 'mypy', + '--python-version', + '3.12', + '--follow-imports=skip', + '--ignore-missing-imports', + smoke_file, + ] + subprocess.check_call(cmd) + + +if __name__ == '__main__': + main() diff --git a/tests/ci/run_stubtest.py b/tests/ci/run_stubtest.py new file mode 100644 index 00000000..34f790bb --- /dev/null +++ b/tests/ci/run_stubtest.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# encoding: utf-8 + +import os +import subprocess +import sys +import tempfile + + +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +MODULES_FILE = os.path.join(BASE_DIR, 'stubtest_modules.txt') +ALLOWLIST_FILE = os.path.join(BASE_DIR, 'stubtest_allowlist.txt') + + +def _read_non_empty_lines(path): + with open(path, 'r') as fh: + return [line.strip() for line in fh if line.strip() and not line.lstrip().startswith('#')] + + +def main(): + modules = _read_non_empty_lines(MODULES_FILE) + # Run outside the checkout so stubtest validates the installed package payload. + os.chdir(tempfile.gettempdir()) + for module in modules: + cmd = [sys.executable, '-m', 'mypy.stubtest', '--ignore-missing-stub'] + if os.path.exists(ALLOWLIST_FILE): + cmd.extend(['--allowlist', ALLOWLIST_FILE]) + cmd.append(module) + subprocess.check_call(cmd) + + +if __name__ == '__main__': + main() diff --git a/tests/ci/stubtest_allowlist.txt b/tests/ci/stubtest_allowlist.txt new file mode 100644 index 00000000..372098d7 --- /dev/null +++ b/tests/ci/stubtest_allowlist.txt @@ -0,0 +1,20 @@ +# stubtest allowlist +# Private methods that are intentionally omitted from stubs +aliyun\.log\.logclient\.LogClient\._replace_credentials +aliyun\.log\.logclient\.LogClient\._setendpoint +aliyun\.log\.logclient\.LogClient\._loadJson +aliyun\.log\.logclient\.LogClient\._get_http_sender +aliyun\.log\.logclient\.LogClient\._getHttpResponse +aliyun\.log\.logclient\.LogClient\._sendRequest +aliyun\.log\.logclient\.LogClient\._send +aliyun\.log\.logclient\.LogClient\._get_unicode +aliyun\.log\.logclient\.LogClient\._get_binary +aliyun\.log\.logclient\.LogClient\._get_cursor_as_int +aliyun\.log\.logclient\._is_auth_err +aliyun\.log\.logclient\._apply_cn_keys_patch +# Internal helpers in pulllog_response +aliyun\.log\.pulllog_response\.PullLogResponse\._parse_loggroup_list +aliyun\.log\.pulllog_response\.PullLogResponse\._transfer_to_json +aliyun\.log\.pulllog_response\.PullLogResponse\._b2u +# Internal method in getlogsresponse +aliyun\.log\.getlogsresponse\.GetLogsResponse\._from_v1_resp diff --git a/tests/ci/stubtest_modules.txt b/tests/ci/stubtest_modules.txt new file mode 100644 index 00000000..03d939be --- /dev/null +++ b/tests/ci/stubtest_modules.txt @@ -0,0 +1,28 @@ +aliyun.log.credentials +aliyun.log.cursor_response +aliyun.log.cursor_time_response +aliyun.log.gethistogramsrequest +aliyun.log.gethistogramsresponse +aliyun.log.getlogsrequest +aliyun.log.getlogsresponse +aliyun.log.index_config +aliyun.log.listlogstoresrequest +aliyun.log.listlogstoresresponse +aliyun.log.listtopicsrequest +aliyun.log.listtopicsresponse +aliyun.log.logclient +aliyun.log.logexception +aliyun.log.logitem +aliyun.log.logresponse +aliyun.log.machine_group_detail +aliyun.log.metering_mode_response +aliyun.log.multimodal_config_response +aliyun.log.object_response +aliyun.log.pulllog_response +aliyun.log.putlogsrequest +aliyun.log.putlogsresponse +aliyun.log.queriedlog +aliyun.log.shipper_config +aliyun.log.store_view +aliyun.log.store_view_response +aliyun.log.submit_async_sql_request From 3677cad50fee86d839a4dcebea41d0a714f21851 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Sat, 18 Apr 2026 15:09:59 +0800 Subject: [PATCH 2/8] fix(stubs): replace wildcard imports, add return types, strip runtime leakage - Replace all `from .module import *` in __init__.pyi with explicit named imports so type checkers can resolve every exported symbol - Add proper return type annotations to all methods in GetLogsResponseMeta, PhraseQueryInfo and Term inner classes in getlogsresponse.pyi - Remove stdlib/runtime imports (json, six, requests, logging, re, itertools), module-level variables and @require_python3 decorators leaked into logclient.pyi - Drop __path__: Any from aliyun/__init__.pyi (conflicts with implicit namespace pkg) Co-Authored-By: Claude Sonnet 4.6 --- aliyun/__init__.pyi | 3 -- aliyun/log/__init__.pyi | 42 +++++++-------- aliyun/log/getlogsresponse.pyi | 93 ++++++++++++++++------------------ aliyun/log/logclient.pyi | 91 +++++++++------------------------ 4 files changed, 90 insertions(+), 139 deletions(-) diff --git a/aliyun/__init__.pyi b/aliyun/__init__.pyi index 0cc7ebfb..e69de29b 100644 --- a/aliyun/__init__.pyi +++ b/aliyun/__init__.pyi @@ -1,3 +0,0 @@ -from typing import Any - -__path__: Any diff --git a/aliyun/log/__init__.pyi b/aliyun/log/__init__.pyi index 1d4bac5e..eecd807a 100644 --- a/aliyun/log/__init__.pyi +++ b/aliyun/log/__init__.pyi @@ -6,45 +6,45 @@ from .getlogsrequest import GetLogsRequest as GetLogsRequest, GetProjectLogsRequ from .index_config import IndexConfig as IndexConfig, IndexKeyConfig as IndexKeyConfig, IndexLineConfig as IndexLineConfig from .listtopicsrequest import ListTopicsRequest as ListTopicsRequest from .listlogstoresrequest import ListLogstoresRequest as ListLogstoresRequest -from .logtail_config_detail import * -from .logtail_pipeline_config_detail import * -from .logtail_pipeline_config_response import * +from .logtail_config_detail import PluginConfigDetail as PluginConfigDetail, SeperatorFileConfigDetail as SeperatorFileConfigDetail, SimpleFileConfigDetail as SimpleFileConfigDetail, FullRegFileConfigDetail as FullRegFileConfigDetail, JsonFileConfigDetail as JsonFileConfigDetail, ApsaraFileConfigDetail as ApsaraFileConfigDetail, SyslogConfigDetail as SyslogConfigDetail, LogtailConfigGenerator as LogtailConfigGenerator, CommonRegLogConfigDetail as CommonRegLogConfigDetail +from .logtail_pipeline_config_detail import LogtailPipelineConfigDetail as LogtailPipelineConfigDetail +from .logtail_pipeline_config_response import CreateLogtailPipelineConfigResponse as CreateLogtailPipelineConfigResponse, DeleteLogtailPipelineConfigResponse as DeleteLogtailPipelineConfigResponse, GetLogtailPipelineConfigResponse as GetLogtailPipelineConfigResponse, UpdateLogtailPipelineConfigResponse as UpdateLogtailPipelineConfigResponse, ListLogtailPipelineConfigResponse as ListLogtailPipelineConfigResponse from .machine_group_detail import MachineGroupDetail as MachineGroupDetail from .putlogsrequest import PutLogsRequest as PutLogsRequest from .shipper_config import ShipperTask as ShipperTask, OssShipperConfig as OssShipperConfig, OdpsShipperConfig as OdpsShipperConfig from .version import __version__ as __version__ from .logitem import LogItem as LogItem -from .consumer_group_request import * -from .external_store_config import * +from .consumer_group_request import CreateConsumerGroupRequest as CreateConsumerGroupRequest, ConsumerGroupGetCheckPointRequest as ConsumerGroupGetCheckPointRequest, ConsumerGroupHeartBeatRequest as ConsumerGroupHeartBeatRequest, ConsumerGroupUpdateCheckPointRequest as ConsumerGroupUpdateCheckPointRequest +from .external_store_config import ExternalStoreConfig as ExternalStoreConfig, ExternalStoreConfigBase as ExternalStoreConfigBase, ExternalStoreCsvConfig as ExternalStoreCsvConfig, ExternalStoreOssConfig as ExternalStoreOssConfig # response class -from .consumer_group_response import * +from .consumer_group_response import ConsumerGroupEntity as ConsumerGroupEntity, ConsumerGroupCheckPointResponse as ConsumerGroupCheckPointResponse, ConsumerGroupHeartBeatResponse as ConsumerGroupHeartBeatResponse, ConsumerGroupUpdateCheckPointResponse as ConsumerGroupUpdateCheckPointResponse, CreateConsumerGroupResponse as CreateConsumerGroupResponse, DeleteConsumerGroupResponse as DeleteConsumerGroupResponse, ListConsumerGroupResponse as ListConsumerGroupResponse, UpdateConsumerGroupResponse as UpdateConsumerGroupResponse from .cursor_response import GetCursorResponse as GetCursorResponse from .cursor_time_response import GetCursorTimeResponse as GetCursorTimeResponse from .gethistogramsresponse import GetHistogramsResponse as GetHistogramsResponse from .getlogsresponse import GetLogsResponse as GetLogsResponse from .histogram import Histogram as Histogram from .queriedlog import QueriedLog as QueriedLog -from .index_config_response import * +from .index_config_response import CreateIndexResponse as CreateIndexResponse, UpdateIndexResponse as UpdateIndexResponse, DeleteIndexResponse as DeleteIndexResponse, GetIndexResponse as GetIndexResponse from .listlogstoresresponse import ListLogstoresResponse as ListLogstoresResponse from .listtopicsresponse import ListTopicsResponse as ListTopicsResponse from .logresponse import LogResponse as LogResponse -from .logtail_config_response import * -from .machinegroup_response import * -from .project_response import * +from .logtail_config_response import CreateLogtailConfigResponse as CreateLogtailConfigResponse, DeleteLogtailConfigResponse as DeleteLogtailConfigResponse, GetLogtailConfigResponse as GetLogtailConfigResponse, UpdateLogtailConfigResponse as UpdateLogtailConfigResponse, ListLogtailConfigResponse as ListLogtailConfigResponse +from .machinegroup_response import CreateMachineGroupResponse as CreateMachineGroupResponse, DeleteMachineGroupResponse as DeleteMachineGroupResponse, GetMachineGroupResponse as GetMachineGroupResponse, UpdateMachineGroupResponse as UpdateMachineGroupResponse, ListMachineGroupResponse as ListMachineGroupResponse, ListMachinesResponse as ListMachinesResponse, ApplyConfigToMachineGroupResponse as ApplyConfigToMachineGroupResponse, RemoveConfigToMachineGroupResponse as RemoveConfigToMachineGroupResponse, GetMachineGroupAppliedConfigResponse as GetMachineGroupAppliedConfigResponse, GetConfigAppliedMachineGroupsResponse as GetConfigAppliedMachineGroupsResponse +from .project_response import CreateProjectResponse as CreateProjectResponse, UpdateProjectResponse as UpdateProjectResponse, DeleteProjectResponse as DeleteProjectResponse, GetProjectResponse as GetProjectResponse, ListProjectResponse as ListProjectResponse, GetProjectTagsResponse as GetProjectTagsResponse from .pulllog_response import PullLogResponse as PullLogResponse -from .shard_response import * -from .shipper_response import * -from .common_response import * -from .external_store_config_response import * +from .shard_response import ListShardResponse as ListShardResponse, DeleteShardResponse as DeleteShardResponse +from .shipper_response import CreateShipperResponse as CreateShipperResponse, UpdateShipperResponse as UpdateShipperResponse, DeleteShipperResponse as DeleteShipperResponse, GetShipperConfigResponse as GetShipperConfigResponse, ListShipperResponse as ListShipperResponse, GetShipperTasksResponse as GetShipperTasksResponse, RetryShipperTasksResponse as RetryShipperTasksResponse +from .common_response import CreateEntityResponse as CreateEntityResponse, UpdateEntityResponse as UpdateEntityResponse, DeleteEntityResponse as DeleteEntityResponse, GetEntityResponse as GetEntityResponse, ListEntityResponse as ListEntityResponse +from .external_store_config_response import CreateExternalStoreResponse as CreateExternalStoreResponse, DeleteExternalStoreResponse as DeleteExternalStoreResponse, GetExternalStoreResponse as GetExternalStoreResponse, UpdateExternalStoreResponse as UpdateExternalStoreResponse, ListExternalStoreResponse as ListExternalStoreResponse from .proto import LogGroupRaw as LogGroup -from .rebuild_index_response import * -from .deletelogsrequest import * -from .deletelogssresponse import * -from .getdeletelogsstatusrequest import * -from .getdeletelogsstatusresponse import * -from .listdeletelogsstasksrequest import * -from .listdeletelogsstasksresponse import * +from .rebuild_index_response import CreateRebuildIndexResponse as CreateRebuildIndexResponse, GetRebuildIndexResponse as GetRebuildIndexResponse +from .deletelogsrequest import DeleteLogsRequest as DeleteLogsRequest +from .deletelogssresponse import DeleteLogsResponse as DeleteLogsResponse +from .getdeletelogsstatusrequest import GetDeleteLogsStatusRequest as GetDeleteLogsStatusRequest +from .getdeletelogsstatusresponse import GetDeleteLogsStatusResponse as GetDeleteLogsStatusResponse +from .listdeletelogsstasksrequest import ListDeleteLogsTasksRequest as ListDeleteLogsTasksRequest +from .listdeletelogsstasksresponse import ListDeleteLogsTasksResponse as ListDeleteLogsTasksResponse # logging handler from .logger_hanlder import SimpleLogHandler as SimpleLogHandler, QueuedLogHandler as QueuedLogHandler, LogFields as LogFields, UwsgiQueuedLogHandler as UwsgiQueuedLogHandler from .metering_mode_response import GetLogStoreMeteringModeResponse as GetLogStoreMeteringModeResponse, \ diff --git a/aliyun/log/getlogsresponse.pyi b/aliyun/log/getlogsresponse.pyi index ea7a31e4..ec6d9f4a 100644 --- a/aliyun/log/getlogsresponse.pyi +++ b/aliyun/log/getlogsresponse.pyi @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- -from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union +from typing import Any, Dict, List, Optional +from enum import Enum from .logresponse import LogResponse from .queriedlog import QueriedLog -from .logexception import LogException -from .util import Util -from enum import Enum -import json class GetLogsResponse(LogResponse): class QueryMode(Enum): @@ -16,7 +13,7 @@ class GetLogsResponse(LogResponse): SCAN_SQL = 3 def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... @staticmethod - def _from_v1_resp(resp, header): ... + def _from_v1_resp(resp: Any, header: Any) -> GetLogsResponse: ... def get_count(self) -> int: ... def is_completed(self) -> bool: ... def get_logs(self) -> List[QueriedLog]: ... @@ -26,7 +23,7 @@ class GetLogsResponse(LogResponse): def get_where_query(self) -> str: ... def get_agg_query(self) -> str: ... def get_cpu_sec(self) -> float: ... - def get_cpu_cores(self) -> int: ... + def get_cpu_cores(self) -> float: ... def get_query_mode(self) -> GetLogsResponse.QueryMode: ... def get_scan_bytes(self) -> int: ... def get_begin_offset(self) -> int: ... @@ -37,47 +34,47 @@ class GetLogsResponse(LogResponse): def get_meta(self) -> GetLogsResponse.GetLogsResponseMeta: ... def merge(self, other: GetLogsResponse) -> GetLogsResponse: ... class GetLogsResponseMeta: - def __init__(self, meta) -> None: ... - def is_completed(self): ... - def merge(self, other): ... - def get_count(self): ... - def _to_dict(self): ... - def log_print(self): ... - def get_progress(self): ... - def get_processed_rows(self): ... - def get_elapsed_millisecond(self): ... - def get_has_sql(self): ... - def get_where_query(self): ... - def get_agg_query(self): ... - def get_cpu_sec(self): ... - def get_cpu_cores(self): ... - def get_mode(self): ... - def get_scan_bytes(self): ... - def get_phrase_query_info(self): ... - def get_limited(self): ... - def get_processed_bytes(self): ... - def get_telemetry_type(self): ... - def get_power_sql(self): ... - def get_inserted_sql(self): ... - def get_keys(self): ... - def get_marker(self): ... - def get_is_accurate(self): ... - def get_column_types(self): ... - def get_highlights(self): ... - def get_terms(self): ... + def __init__(self, meta: Any) -> None: ... + def is_completed(self) -> bool: ... + def merge(self, other: GetLogsResponse.GetLogsResponseMeta) -> GetLogsResponse.GetLogsResponseMeta: ... + def get_count(self) -> int: ... + def _to_dict(self) -> Dict[str, Any]: ... + def log_print(self) -> None: ... + def get_progress(self) -> str: ... + def get_processed_rows(self) -> int: ... + def get_elapsed_millisecond(self) -> int: ... + def get_has_sql(self) -> bool: ... + def get_where_query(self) -> str: ... + def get_agg_query(self) -> str: ... + def get_cpu_sec(self) -> float: ... + def get_cpu_cores(self) -> float: ... + def get_mode(self) -> int: ... + def get_scan_bytes(self) -> int: ... + def get_phrase_query_info(self) -> Optional[GetLogsResponse.PhraseQueryInfo]: ... + def get_limited(self) -> int: ... + def get_processed_bytes(self) -> int: ... + def get_telemetry_type(self) -> str: ... + def get_power_sql(self) -> bool: ... + def get_inserted_sql(self) -> str: ... + def get_keys(self) -> List[str]: ... + def get_marker(self) -> str: ... + def get_is_accurate(self) -> bool: ... + def get_column_types(self) -> List[str]: ... + def get_highlights(self) -> Any: ... + def get_terms(self) -> List[GetLogsResponse.Term]: ... class PhraseQueryInfo: - def __init__(self, pharse_query_info) -> None: ... - def get_begin_offset(self): ... - def get_end_offset(self): ... - def get_scan_all(self): ... - def get_end_time(self): ... - def _to_dict(self): ... - def log_print(self): ... + def __init__(self, pharse_query_info: Any) -> None: ... + def get_begin_offset(self) -> int: ... + def get_end_offset(self) -> int: ... + def get_scan_all(self) -> bool: ... + def get_end_time(self) -> int: ... + def _to_dict(self) -> Dict[str, Any]: ... + def log_print(self) -> None: ... class Term: - def __init__(self, key, term) -> None: ... + def __init__(self, key: str, term: str) -> None: ... @classmethod - def _from_dict(cls, data): ... - def get_key(self): ... - def get_term(self): ... - def _to_dict(self): ... - def log_print(self): ... + def _from_dict(cls, data: Dict[str, Any]) -> GetLogsResponse.Term: ... + def get_key(self) -> str: ... + def get_term(self) -> str: ... + def _to_dict(self) -> Dict[str, Any]: ... + def log_print(self) -> None: ... diff --git a/aliyun/log/logclient.pyi b/aliyun/log/logclient.pyi index 37610cc0..c788f59b 100644 --- a/aliyun/log/logclient.pyi +++ b/aliyun/log/logclient.pyi @@ -44,21 +44,9 @@ from .topostore_params import Topostore, TopostoreNode, TopostoreRelation from .topostore_response import CreateTopostoreNodeResponse, CreateTopostoreRelationResponse, CreateTopostoreResponse, DeleteTopostoreNodeResponse, DeleteTopostoreRelationResponse, DeleteTopostoreResponse, GetTopostoreNodeResponse, GetTopostoreRelationResponse, GetTopostoreResponse, ListTopostoreNodesResponse, ListTopostoreRelationsResponse, ListTopostoresResponse, UpdateTopostoreNodeResponse, UpdateTopostoreRelationResponse, UpdateTopostoreResponse, UpsertTopostoreNodeResponse, UpsertTopostoreRelationResponse -import json -import requests -import six -import time -from datetime import datetime -import logging -import re from .store_view_response import ListStoreViewsResponse, CreateStoreViewResponse, UpdateStoreViewResponse, DeleteStoreViewResponse, GetStoreViewResponse from .credentials import StaticCredentialsProvider from .scheduled_sql import ScheduledSQLConfiguration -from .scheduled_sql_response import * -from itertools import cycle -from .consumer_group_request import * -from .consumer_group_response import * -from .getlogsrequest import * from .cursor_response import GetCursorResponse from .cursor_time_response import GetCursorTimeResponse from .gethistogramsresponse import GetHistogramsResponse @@ -69,72 +57,44 @@ from .listdeletelogsstasksresponse import ListDeleteLogsTasksResponse from .getcontextlogsresponse import GetContextLogsResponse from .index_config_response import * from .ingestion_response import * -from .sql_instance_response import * +from .sql_instance_response import CreateSqlInstanceResponse, ListSqlInstanceResponse, UpdateSqlInstanceResponse from .listlogstoresresponse import ListLogstoresResponse from .listtopicsresponse import ListTopicsResponse from .logclient_operator import copy_project, list_more, query_more, pull_log_dump, copy_logstore, copy_data, \ get_resource_usage, arrange_shard, transform_data, copy_dashboard, copy_alert from .logexception import LogException -from .logstore_config_response import * -from .substore_config_response import * -from .logtail_config_response import * -from .logtail_pipeline_config_response import * -from .machinegroup_response import * -from .rebuild_index_response import * -from .project_response import * +from .logstore_config_response import CreateLogStoreResponse, DeleteLogStoreResponse, GetLogStoreResponse, ListLogStoreResponse, UpdateLogStoreResponse +from .substore_config_response import CreateSubStoreResponse, CreateMetricsStoreResponse, DeleteSubStoreResponse, GetSubStoreResponse, GetSubStoreTTLResponse, ListSubStoreResponse, UpdateSubStoreResponse, UpdateSubStoreTTLResponse +from .logtail_config_response import CreateLogtailConfigResponse, DeleteLogtailConfigResponse, GetLogtailConfigResponse, UpdateLogtailConfigResponse, ListLogtailConfigResponse +from .logtail_pipeline_config_response import CreateLogtailPipelineConfigResponse, DeleteLogtailPipelineConfigResponse, GetLogtailPipelineConfigResponse, UpdateLogtailPipelineConfigResponse, ListLogtailPipelineConfigResponse +from .machinegroup_response import CreateMachineGroupResponse, DeleteMachineGroupResponse, GetMachineGroupResponse, UpdateMachineGroupResponse, ListMachineGroupResponse, ListMachinesResponse, ApplyConfigToMachineGroupResponse, RemoveConfigToMachineGroupResponse, GetMachineGroupAppliedConfigResponse, GetConfigAppliedMachineGroupsResponse +from .rebuild_index_response import CreateRebuildIndexResponse, GetRebuildIndexResponse +from .project_response import CreateProjectResponse, DeleteProjectResponse, GetProjectResponse, ListProjectResponse, UpdateProjectResponse, GetProjectTagsResponse from .pulllog_response import PullLogResponse from .putlogsresponse import PutLogsResponse -from .shard_response import * -from .shipper_response import * -from .resource_response import * -from .resource_params import * +from .shard_response import ListShardResponse, DeleteShardResponse +from .shipper_response import CreateShipperResponse, UpdateShipperResponse, DeleteShipperResponse, GetShipperConfigResponse, ListShipperResponse, GetShipperTasksResponse, RetryShipperTasksResponse +from .resource_response import CreateRecordResponse, CreateResourceResponse, DeleteRecordResponse, DeleteResourceResponse, GetRecordResponse, GetResourceResponse, ListRecordResponse, ListResourcesResponse, UpdateRecordResponse, UpdateResourceResponse, UpsertRecordResponse +from .resource_params import Resource, ResourceRecord from .tag_response import GetResourceTagsResponse -from .topostore_response import * -from .topostore_params import * -from .util import base64_encodestring as b64e -from .util import base64_encodestring as e64, base64_decodestring as d64, Util -from .version import API_VERSION, USER_AGENT -if six.PY3: - from .async_sql_response import AsyncSqlResponse - from .get_async_sql_request import GetAsyncSqlRequest +from .topostore_response import CreateTopostoreNodeResponse, CreateTopostoreRelationResponse, CreateTopostoreResponse, DeleteTopostoreNodeResponse, DeleteTopostoreRelationResponse, DeleteTopostoreResponse, GetTopostoreNodeResponse, GetTopostoreRelationResponse, GetTopostoreResponse, ListTopostoreNodesResponse, ListTopostoreRelationsResponse, ListTopostoresResponse, UpdateTopostoreNodeResponse, UpdateTopostoreRelationResponse, UpdateTopostoreResponse, UpsertTopostoreNodeResponse, UpsertTopostoreRelationResponse +from .topostore_params import Topostore, TopostoreNode, TopostoreRelation +from .async_sql_response import AsyncSqlResponse +from .get_async_sql_request import GetAsyncSqlRequest from .proto import LogGroupRaw as LogGroup -from .external_store_config_response import * -import struct +from .external_store_config_response import CreateExternalStoreResponse, DeleteExternalStoreResponse, GetExternalStoreResponse, UpdateExternalStoreResponse, ListExternalStoreResponse from .logresponse import LogResponse -from copy import copy -from .pluralize import pluralize -from .etl_config_response import * -from .export_response import * -from .common_response import * -from .auth import * +from .etl_config_response import CreateEtlResponse, DeleteEtlResponse, GetEtlResponse, ListEtlsResponse, StartEtlResponse, StopEtlResponse, UpdateEtlResponse +from .export_response import CreateExportResponse, DeleteExportResponse, GetExportResponse, ListExportResponse, UpdateExportResponse +from .common_response import CreateEntityResponse, UpdateEntityResponse, DeleteEntityResponse, GetEntityResponse, ListEntityResponse from .compress import CompressType, Compressor -from .metering_mode_response import GetLogStoreMeteringModeResponse, \ - GetMetricStoreMeteringModeResponse, UpdateLogStoreMeteringModeResponse, \ - UpdateMetricStoreMeteringModeResponse -from .multimodal_config_response import GetLogStoreMultimodalConfigurationResponse, \ - PutLogStoreMultimodalConfigurationResponse +from .metering_mode_response import GetLogStoreMeteringModeResponse, GetMetricStoreMeteringModeResponse, UpdateLogStoreMeteringModeResponse, UpdateMetricStoreMeteringModeResponse +from .multimodal_config_response import GetLogStoreMultimodalConfigurationResponse, PutLogStoreMultimodalConfigurationResponse from .object_response import PutObjectResponse, GetObjectResponse -from .util import require_python3, object_name_encode -logger = logging.getLogger(__name__) -if six.PY3: - xrange = range -CONNECTION_TIME_OUT = 120 -MAX_LIST_PAGING_SIZE = 500 -MAX_GET_LOG_PAGING_SIZE = 100 -DEFAULT_QUERY_RETRY_COUNT = 5 -DEFAULT_QUERY_RETRY_INTERVAL = 0.5 -DEFAULT_REFRESH_RETRY_COUNT = 5 -DEFAULT_REFRESH_RETRY_DELAY = 30 -MIN_REFRESH_INTERVAL = 300 -_auth_code_set = {'Unauthorized', 'InvalidAccessKeyId.NotFound', 'SecurityToken.Expired', 'InvalidAccessKeyId', 'SecurityTokenExpired'} -_auth_partial_code_set = {'Unauthorized', 'InvalidAccessKeyId', 'SecurityToken'} - -def _is_auth_err(status, code, msg): ... - -def _apply_cn_keys_patch(): ... +from .version import API_VERSION class LogClient(object): - __version__ = API_VERSION + __version__: str Version = __version__ def __init__(self, endpoint: str, accessKeyId: Optional[str] = ..., accessKey: Optional[str] = ..., securityToken: Optional[str] = ..., source: Optional[str] = ..., auth_version: str = ..., region: str = ..., credentials_provider: Optional[CredentialsProvider] = ...) -> None: ... def set_credentials_auto_refresher(self, refresher: Callable[[], Tuple[str, str, Optional[str]]]) -> None: ... @@ -158,11 +118,8 @@ class LogClient(object): def get_log_all_v2(self, project: str, logstore: str, from_time: Union[int, str], to_time: Union[int, str], topic: Optional[str] = ..., query: Optional[str] = ..., reverse: bool = ..., offset: int = ..., power_sql: bool = ..., scan: bool = ..., forward: bool = ...) -> Iterator[GetLogsResponse]: ... def execute_logstore_sql(self, project: str, logstore: str, from_time: Union[int, str], to_time: Union[int, str], sql: str, power_sql: bool) -> GetLogsResponse: ... def execute_project_sql(self, project: str, sql: str, power_sql: bool) -> GetLogsResponse: ... - @require_python3 def submit_async_sql(self, request: SubmitAsyncSqlRequest) -> AsyncSqlResponse: ... - @require_python3 def get_async_sql(self, request: GetAsyncSqlRequest) -> AsyncSqlResponse: ... - @require_python3 def delete_async_sql(self, request: DeleteAsyncSqlRequest) -> AsyncSqlResponse: ... def get_context_logs(self, project: str, logstore: str, pack_id: str, pack_meta: str, back_lines: int, forward_lines: int) -> GetContextLogsResponse: ... def get_project_logs(self, request: GetProjectLogsRequest) -> GetLogsResponse: ... From 6b6022f1077c2c2f522e93dcc8226ee8b5bf0b7e Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Sat, 18 Apr 2026 16:06:11 +0800 Subject: [PATCH 3/8] simplify(stubs): remove duplicates, dead code, and private internals - logclient.pyi: collapse duplicate import block (18 module groups appeared twice); remove 2 remaining wildcard imports; fix Version as typed attribute annotation instead of runtime alias assignment - getlogsresponse.pyi: remove private _to_dict/_from_dict/_from_v1_resp from inner classes (not part of the public API contract) - __init__.pyi: drop stray section comments (# response class, # logging handler) - run_stubtest.py: hoist allowlist path construction out of the per-module loop - run_public_type_smoke.py: clean up temp dir in finally block; remove unused json_processor_cls variable from smoke source Co-Authored-By: Claude Sonnet 4.6 --- aliyun/log/__init__.pyi | 3 -- aliyun/log/getlogsresponse.pyi | 8 --- aliyun/log/logclient.pyi | 86 +++++++++++-------------------- tests/ci/run_public_type_smoke.py | 37 +++++++------ tests/ci/run_stubtest.py | 6 +-- 5 files changed, 51 insertions(+), 89 deletions(-) diff --git a/aliyun/log/__init__.pyi b/aliyun/log/__init__.pyi index eecd807a..d519bd5e 100644 --- a/aliyun/log/__init__.pyi +++ b/aliyun/log/__init__.pyi @@ -1,4 +1,3 @@ - from .logclient import LogClient as LogClient from .logexception import LogException as LogException from .gethistogramsrequest import GetHistogramsRequest as GetHistogramsRequest @@ -17,7 +16,6 @@ from .logitem import LogItem as LogItem from .consumer_group_request import CreateConsumerGroupRequest as CreateConsumerGroupRequest, ConsumerGroupGetCheckPointRequest as ConsumerGroupGetCheckPointRequest, ConsumerGroupHeartBeatRequest as ConsumerGroupHeartBeatRequest, ConsumerGroupUpdateCheckPointRequest as ConsumerGroupUpdateCheckPointRequest from .external_store_config import ExternalStoreConfig as ExternalStoreConfig, ExternalStoreConfigBase as ExternalStoreConfigBase, ExternalStoreCsvConfig as ExternalStoreCsvConfig, ExternalStoreOssConfig as ExternalStoreOssConfig -# response class from .consumer_group_response import ConsumerGroupEntity as ConsumerGroupEntity, ConsumerGroupCheckPointResponse as ConsumerGroupCheckPointResponse, ConsumerGroupHeartBeatResponse as ConsumerGroupHeartBeatResponse, ConsumerGroupUpdateCheckPointResponse as ConsumerGroupUpdateCheckPointResponse, CreateConsumerGroupResponse as CreateConsumerGroupResponse, DeleteConsumerGroupResponse as DeleteConsumerGroupResponse, ListConsumerGroupResponse as ListConsumerGroupResponse, UpdateConsumerGroupResponse as UpdateConsumerGroupResponse from .cursor_response import GetCursorResponse as GetCursorResponse from .cursor_time_response import GetCursorTimeResponse as GetCursorTimeResponse @@ -45,7 +43,6 @@ from .getdeletelogsstatusrequest import GetDeleteLogsStatusRequest as GetDeleteL from .getdeletelogsstatusresponse import GetDeleteLogsStatusResponse as GetDeleteLogsStatusResponse from .listdeletelogsstasksrequest import ListDeleteLogsTasksRequest as ListDeleteLogsTasksRequest from .listdeletelogsstasksresponse import ListDeleteLogsTasksResponse as ListDeleteLogsTasksResponse -# logging handler from .logger_hanlder import SimpleLogHandler as SimpleLogHandler, QueuedLogHandler as QueuedLogHandler, LogFields as LogFields, UwsgiQueuedLogHandler as UwsgiQueuedLogHandler from .metering_mode_response import GetLogStoreMeteringModeResponse as GetLogStoreMeteringModeResponse, \ GetMetricStoreMeteringModeResponse as GetMetricStoreMeteringModeResponse, \ diff --git a/aliyun/log/getlogsresponse.pyi b/aliyun/log/getlogsresponse.pyi index ec6d9f4a..add11a82 100644 --- a/aliyun/log/getlogsresponse.pyi +++ b/aliyun/log/getlogsresponse.pyi @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from typing import Any, Dict, List, Optional from enum import Enum @@ -12,8 +11,6 @@ class GetLogsResponse(LogResponse): SCAN = 2 SCAN_SQL = 3 def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... - @staticmethod - def _from_v1_resp(resp: Any, header: Any) -> GetLogsResponse: ... def get_count(self) -> int: ... def is_completed(self) -> bool: ... def get_logs(self) -> List[QueriedLog]: ... @@ -38,7 +35,6 @@ class GetLogsResponse(LogResponse): def is_completed(self) -> bool: ... def merge(self, other: GetLogsResponse.GetLogsResponseMeta) -> GetLogsResponse.GetLogsResponseMeta: ... def get_count(self) -> int: ... - def _to_dict(self) -> Dict[str, Any]: ... def log_print(self) -> None: ... def get_progress(self) -> str: ... def get_processed_rows(self) -> int: ... @@ -68,13 +64,9 @@ class GetLogsResponse(LogResponse): def get_end_offset(self) -> int: ... def get_scan_all(self) -> bool: ... def get_end_time(self) -> int: ... - def _to_dict(self) -> Dict[str, Any]: ... def log_print(self) -> None: ... class Term: def __init__(self, key: str, term: str) -> None: ... - @classmethod - def _from_dict(cls, data: Dict[str, Any]) -> GetLogsResponse.Term: ... def get_key(self) -> str: ... def get_term(self) -> str: ... - def _to_dict(self) -> Dict[str, Any]: ... def log_print(self) -> None: ... diff --git a/aliyun/log/logclient.pyi b/aliyun/log/logclient.pyi index c788f59b..5abea380 100644 --- a/aliyun/log/logclient.pyi +++ b/aliyun/log/logclient.pyi @@ -1,25 +1,39 @@ -# -*- coding: utf-8 -*- from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union +from .async_sql_response import AsyncSqlResponse from .common_response import CreateEntityResponse, DeleteEntityResponse, GetEntityResponse, ListEntityResponse, UpdateEntityResponse +from .compress import CompressType, Compressor from .consumer_group_response import ConsumerGroupCheckPointResponse, ConsumerGroupHeartBeatResponse, ConsumerGroupUpdateCheckPointResponse, CreateConsumerGroupResponse, DeleteConsumerGroupResponse, ListConsumerGroupResponse, UpdateConsumerGroupResponse -from .credentials import CredentialsProvider +from .credentials import CredentialsProvider, StaticCredentialsProvider +from .cursor_response import GetCursorResponse +from .cursor_time_response import GetCursorTimeResponse from .delete_async_sql_request import DeleteAsyncSqlRequest from .deletelogsrequest import DeleteLogsRequest +from .deletelogssresponse import DeleteLogsResponse from .etl_config_response import CreateEtlResponse, DeleteEtlResponse, GetEtlResponse, ListEtlsResponse, StartEtlResponse, StopEtlResponse, UpdateEtlResponse from .export_response import CreateExportResponse, DeleteExportResponse, GetExportResponse, ListExportResponse, UpdateExportResponse from .external_store_config import ExternalStoreConfigBase from .external_store_config_response import CreateExternalStoreResponse, DeleteExternalStoreResponse, GetExternalStoreResponse, ListExternalStoreResponse, UpdateExternalStoreResponse +from .get_async_sql_request import GetAsyncSqlRequest +from .getcontextlogsresponse import GetContextLogsResponse from .getdeletelogsstatusrequest import GetDeleteLogsStatusRequest +from .getdeletelogsstatusresponse import GetDeleteLogsStatusResponse from .gethistogramsrequest import GetHistogramsRequest +from .gethistogramsresponse import GetHistogramsResponse from .getlogsrequest import GetLogsRequest, GetProjectLogsRequest +from .getlogsresponse import GetLogsResponse from .index_config import IndexConfig from .index_config_response import CreateIndexResponse, DeleteIndexResponse, GetIndexResponse, UpdateIndexResponse from .ingestion_response import CreateIngestionResponse, DeleteIngestionResponse, GetIngestionResponse, ListIngestionResponse, RestartIngestionResponse, StartIngestionResponse, StopIngestionResponse, UpdateIngestionResponse from .job import Export from .listdeletelogsstasksrequest import ListDeleteLogsTasksRequest +from .listdeletelogsstasksresponse import ListDeleteLogsTasksResponse from .listlogstoresrequest import ListLogstoresRequest +from .listlogstoresresponse import ListLogstoresResponse from .listtopicsrequest import ListTopicsRequest -from .logclient_operator import ResourceUsageResponse +from .listtopicsresponse import ListTopicsResponse +from .logclient_operator import ResourceUsageResponse, copy_project, list_more, query_more, pull_log_dump, copy_logstore, copy_data, get_resource_usage, arrange_shard, transform_data, copy_dashboard, copy_alert +from .logexception import LogException +from .logresponse import LogResponse from .logstore_config_response import CreateLogStoreResponse, DeleteLogStoreResponse, GetLogStoreResponse, ListLogStoreResponse, UpdateLogStoreResponse from .logtail_config_detail import ApsaraFileConfigDetail, CommonRegLogConfigDetail, FullRegFileConfigDetail, JsonFileConfigDetail, LogtailConfigGenerator, SeperatorFileConfigDetail, SimpleFileConfigDetail, SyslogConfigDetail from .logtail_config_response import CreateLogtailConfigResponse, DeleteLogtailConfigResponse, GetLogtailConfigResponse, ListLogtailConfigResponse, UpdateLogtailConfigResponse @@ -27,75 +41,33 @@ from .logtail_pipeline_config_detail import LogtailPipelineConfigDetail from .logtail_pipeline_config_response import CreateLogtailPipelineConfigResponse, DeleteLogtailPipelineConfigResponse, GetLogtailPipelineConfigResponse, ListLogtailPipelineConfigResponse, UpdateLogtailPipelineConfigResponse from .machine_group_detail import MachineGroupDetail from .machinegroup_response import ApplyConfigToMachineGroupResponse, CreateMachineGroupResponse, DeleteMachineGroupResponse, GetConfigAppliedMachineGroupsResponse, GetMachineGroupAppliedConfigResponse, GetMachineGroupResponse, ListMachineGroupResponse, ListMachinesResponse, RemoveConfigToMachineGroupResponse, UpdateMachineGroupResponse +from .metering_mode_response import GetLogStoreMeteringModeResponse, GetMetricStoreMeteringModeResponse, UpdateLogStoreMeteringModeResponse, UpdateMetricStoreMeteringModeResponse +from .multimodal_config_response import GetLogStoreMultimodalConfigurationResponse, PutLogStoreMultimodalConfigurationResponse +from .object_response import PutObjectResponse, GetObjectResponse from .project_response import CreateProjectResponse, DeleteProjectResponse, GetProjectResponse, GetProjectTagsResponse, ListProjectResponse, UpdateProjectResponse +from .proto import LogGroupRaw as LogGroup +from .pulllog_response import PullLogResponse from .putlogsrequest import PutLogsRequest +from .putlogsresponse import PutLogsResponse from .rebuild_index_response import CreateRebuildIndexResponse, GetRebuildIndexResponse from .resource_params import Resource, ResourceRecord from .resource_response import CreateRecordResponse, CreateResourceResponse, DeleteRecordResponse, DeleteResourceResponse, GetRecordResponse, GetResourceResponse, ListRecordResponse, ListResourcesResponse, UpdateRecordResponse, UpdateResourceResponse, UpsertRecordResponse -from .scheduled_sql import ScheduledSQL +from .scheduled_sql import ScheduledSQL, ScheduledSQLConfiguration from .scheduled_sql_response import CreateScheduledSQLResponse, DeleteScheduledSQLResponse, GetScheduledSQLResponse, GetScheduledSqlJobInstanceResponse, ListScheduledSQLResponse, ListScheduledSqlJobInstancesResponse, ModifyScheduledSqlJobStateResponse, UpdateScheduledSQLResponse from .shard_response import DeleteShardResponse, ListShardResponse -from .shipper_response import GetShipperTasksResponse, RetryShipperTasksResponse +from .shipper_response import CreateShipperResponse, DeleteShipperResponse, GetShipperConfigResponse, GetShipperTasksResponse, ListShipperResponse, RetryShipperTasksResponse, UpdateShipperResponse from .sql_instance_response import CreateSqlInstanceResponse, ListSqlInstanceResponse, UpdateSqlInstanceResponse from .store_view import StoreView +from .store_view_response import CreateStoreViewResponse, DeleteStoreViewResponse, GetStoreViewResponse, ListStoreViewsResponse, UpdateStoreViewResponse +from .substore_config_response import CreateMetricsStoreResponse, CreateSubStoreResponse, DeleteSubStoreResponse, GetSubStoreResponse, GetSubStoreTTLResponse, ListSubStoreResponse, UpdateSubStoreResponse, UpdateSubStoreTTLResponse from .submit_async_sql_request import SubmitAsyncSqlRequest -from .substore_config_response import CreateSubStoreResponse, CreateMetricsStoreResponse, DeleteSubStoreResponse, GetSubStoreResponse, GetSubStoreTTLResponse, ListSubStoreResponse, UpdateSubStoreResponse, UpdateSubStoreTTLResponse -from .topostore_params import Topostore, TopostoreNode, TopostoreRelation -from .topostore_response import CreateTopostoreNodeResponse, CreateTopostoreRelationResponse, CreateTopostoreResponse, DeleteTopostoreNodeResponse, DeleteTopostoreRelationResponse, DeleteTopostoreResponse, GetTopostoreNodeResponse, GetTopostoreRelationResponse, GetTopostoreResponse, ListTopostoreNodesResponse, ListTopostoreRelationsResponse, ListTopostoresResponse, UpdateTopostoreNodeResponse, UpdateTopostoreRelationResponse, UpdateTopostoreResponse, UpsertTopostoreNodeResponse, UpsertTopostoreRelationResponse - - -from .store_view_response import ListStoreViewsResponse, CreateStoreViewResponse, UpdateStoreViewResponse, DeleteStoreViewResponse, GetStoreViewResponse -from .credentials import StaticCredentialsProvider -from .scheduled_sql import ScheduledSQLConfiguration -from .cursor_response import GetCursorResponse -from .cursor_time_response import GetCursorTimeResponse -from .gethistogramsresponse import GetHistogramsResponse -from .deletelogssresponse import DeleteLogsResponse -from .getlogsresponse import GetLogsResponse -from .getdeletelogsstatusresponse import GetDeleteLogsStatusResponse -from .listdeletelogsstasksresponse import ListDeleteLogsTasksResponse -from .getcontextlogsresponse import GetContextLogsResponse -from .index_config_response import * -from .ingestion_response import * -from .sql_instance_response import CreateSqlInstanceResponse, ListSqlInstanceResponse, UpdateSqlInstanceResponse -from .listlogstoresresponse import ListLogstoresResponse -from .listtopicsresponse import ListTopicsResponse -from .logclient_operator import copy_project, list_more, query_more, pull_log_dump, copy_logstore, copy_data, \ - get_resource_usage, arrange_shard, transform_data, copy_dashboard, copy_alert -from .logexception import LogException -from .logstore_config_response import CreateLogStoreResponse, DeleteLogStoreResponse, GetLogStoreResponse, ListLogStoreResponse, UpdateLogStoreResponse -from .substore_config_response import CreateSubStoreResponse, CreateMetricsStoreResponse, DeleteSubStoreResponse, GetSubStoreResponse, GetSubStoreTTLResponse, ListSubStoreResponse, UpdateSubStoreResponse, UpdateSubStoreTTLResponse -from .logtail_config_response import CreateLogtailConfigResponse, DeleteLogtailConfigResponse, GetLogtailConfigResponse, UpdateLogtailConfigResponse, ListLogtailConfigResponse -from .logtail_pipeline_config_response import CreateLogtailPipelineConfigResponse, DeleteLogtailPipelineConfigResponse, GetLogtailPipelineConfigResponse, UpdateLogtailPipelineConfigResponse, ListLogtailPipelineConfigResponse -from .machinegroup_response import CreateMachineGroupResponse, DeleteMachineGroupResponse, GetMachineGroupResponse, UpdateMachineGroupResponse, ListMachineGroupResponse, ListMachinesResponse, ApplyConfigToMachineGroupResponse, RemoveConfigToMachineGroupResponse, GetMachineGroupAppliedConfigResponse, GetConfigAppliedMachineGroupsResponse -from .rebuild_index_response import CreateRebuildIndexResponse, GetRebuildIndexResponse -from .project_response import CreateProjectResponse, DeleteProjectResponse, GetProjectResponse, ListProjectResponse, UpdateProjectResponse, GetProjectTagsResponse -from .pulllog_response import PullLogResponse -from .putlogsresponse import PutLogsResponse -from .shard_response import ListShardResponse, DeleteShardResponse -from .shipper_response import CreateShipperResponse, UpdateShipperResponse, DeleteShipperResponse, GetShipperConfigResponse, ListShipperResponse, GetShipperTasksResponse, RetryShipperTasksResponse -from .resource_response import CreateRecordResponse, CreateResourceResponse, DeleteRecordResponse, DeleteResourceResponse, GetRecordResponse, GetResourceResponse, ListRecordResponse, ListResourcesResponse, UpdateRecordResponse, UpdateResourceResponse, UpsertRecordResponse -from .resource_params import Resource, ResourceRecord from .tag_response import GetResourceTagsResponse -from .topostore_response import CreateTopostoreNodeResponse, CreateTopostoreRelationResponse, CreateTopostoreResponse, DeleteTopostoreNodeResponse, DeleteTopostoreRelationResponse, DeleteTopostoreResponse, GetTopostoreNodeResponse, GetTopostoreRelationResponse, GetTopostoreResponse, ListTopostoreNodesResponse, ListTopostoreRelationsResponse, ListTopostoresResponse, UpdateTopostoreNodeResponse, UpdateTopostoreRelationResponse, UpdateTopostoreResponse, UpsertTopostoreNodeResponse, UpsertTopostoreRelationResponse from .topostore_params import Topostore, TopostoreNode, TopostoreRelation -from .async_sql_response import AsyncSqlResponse -from .get_async_sql_request import GetAsyncSqlRequest -from .proto import LogGroupRaw as LogGroup -from .external_store_config_response import CreateExternalStoreResponse, DeleteExternalStoreResponse, GetExternalStoreResponse, UpdateExternalStoreResponse, ListExternalStoreResponse -from .logresponse import LogResponse -from .etl_config_response import CreateEtlResponse, DeleteEtlResponse, GetEtlResponse, ListEtlsResponse, StartEtlResponse, StopEtlResponse, UpdateEtlResponse -from .export_response import CreateExportResponse, DeleteExportResponse, GetExportResponse, ListExportResponse, UpdateExportResponse -from .common_response import CreateEntityResponse, UpdateEntityResponse, DeleteEntityResponse, GetEntityResponse, ListEntityResponse -from .compress import CompressType, Compressor -from .metering_mode_response import GetLogStoreMeteringModeResponse, GetMetricStoreMeteringModeResponse, UpdateLogStoreMeteringModeResponse, UpdateMetricStoreMeteringModeResponse -from .multimodal_config_response import GetLogStoreMultimodalConfigurationResponse, PutLogStoreMultimodalConfigurationResponse -from .object_response import PutObjectResponse, GetObjectResponse -from .version import API_VERSION +from .topostore_response import CreateTopostoreNodeResponse, CreateTopostoreRelationResponse, CreateTopostoreResponse, DeleteTopostoreNodeResponse, DeleteTopostoreRelationResponse, DeleteTopostoreResponse, GetTopostoreNodeResponse, GetTopostoreRelationResponse, GetTopostoreResponse, ListTopostoreNodesResponse, ListTopostoreRelationsResponse, ListTopostoresResponse, UpdateTopostoreNodeResponse, UpdateTopostoreRelationResponse, UpdateTopostoreResponse, UpsertTopostoreNodeResponse, UpsertTopostoreRelationResponse class LogClient(object): __version__: str - Version = __version__ + Version: str def __init__(self, endpoint: str, accessKeyId: Optional[str] = ..., accessKey: Optional[str] = ..., securityToken: Optional[str] = ..., source: Optional[str] = ..., auth_version: str = ..., region: str = ..., credentials_provider: Optional[CredentialsProvider] = ...) -> None: ... def set_credentials_auto_refresher(self, refresher: Callable[[], Tuple[str, str, Optional[str]]]) -> None: ... @property diff --git a/tests/ci/run_public_type_smoke.py b/tests/ci/run_public_type_smoke.py index 58069f28..ff4c0487 100644 --- a/tests/ci/run_public_type_smoke.py +++ b/tests/ci/run_public_type_smoke.py @@ -45,28 +45,31 @@ def build_processor(): worker = ConsumerWorker(build_processor, config) adaptor = ConsumerProcessorAdaptor(lambda shard_id, log_groups: True) -json_processor_cls = DemoJsonProcessor """ def main(): + import shutil temp_dir = tempfile.mkdtemp(prefix='aliyun-public-type-smoke-') - smoke_file = os.path.join(temp_dir, 'consumer_public_smoke.py') - with open(smoke_file, 'w') as fh: - fh.write(SMOKE_SOURCE) - - os.chdir(temp_dir) - cmd = [ - sys.executable, - '-m', - 'mypy', - '--python-version', - '3.12', - '--follow-imports=skip', - '--ignore-missing-imports', - smoke_file, - ] - subprocess.check_call(cmd) + try: + smoke_file = os.path.join(temp_dir, 'consumer_public_smoke.py') + with open(smoke_file, 'w') as fh: + fh.write(SMOKE_SOURCE) + + os.chdir(temp_dir) + cmd = [ + sys.executable, + '-m', + 'mypy', + '--python-version', + '3.12', + '--follow-imports=skip', + '--ignore-missing-imports', + smoke_file, + ] + subprocess.check_call(cmd) + finally: + shutil.rmtree(temp_dir, ignore_errors=True) if __name__ == '__main__': diff --git a/tests/ci/run_stubtest.py b/tests/ci/run_stubtest.py index 34f790bb..f9dae028 100644 --- a/tests/ci/run_stubtest.py +++ b/tests/ci/run_stubtest.py @@ -19,13 +19,11 @@ def _read_non_empty_lines(path): def main(): modules = _read_non_empty_lines(MODULES_FILE) + allowlist_args = ['--allowlist', ALLOWLIST_FILE] # Run outside the checkout so stubtest validates the installed package payload. os.chdir(tempfile.gettempdir()) for module in modules: - cmd = [sys.executable, '-m', 'mypy.stubtest', '--ignore-missing-stub'] - if os.path.exists(ALLOWLIST_FILE): - cmd.extend(['--allowlist', ALLOWLIST_FILE]) - cmd.append(module) + cmd = [sys.executable, '-m', 'mypy.stubtest', '--ignore-missing-stub'] + allowlist_args + [module] subprocess.check_call(cmd) From 79c6b6bc78de703359c0beca5e9d5a8354b83a75 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Sat, 18 Apr 2026 16:20:29 +0800 Subject: [PATCH 4/8] fix(stubs): mark nullable get_* return types as Optional in response stubs Methods backed by bare dict.get() calls or explicit `return None` branches were typed as non-optional. Updated: - GetLogsResponse: get_begin_offset, get_end_offset, get_scan_all - GetLogsResponseMeta: get_progress, get_agg_query, get_limited, get_processed_bytes, get_telemetry_type, get_inserted_sql, get_keys, get_marker, get_is_accurate, get_column_types - PhraseQueryInfo: get_begin_offset, get_end_offset, get_scan_all, get_end_time - Term: get_key, get_term - ListTopicsResponse: get_next_token Co-Authored-By: Claude Sonnet --- aliyun/log/getlogsresponse.pyi | 38 +++++++++++++++---------------- aliyun/log/listtopicsresponse.pyi | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/aliyun/log/getlogsresponse.pyi b/aliyun/log/getlogsresponse.pyi index add11a82..41864d2d 100644 --- a/aliyun/log/getlogsresponse.pyi +++ b/aliyun/log/getlogsresponse.pyi @@ -23,9 +23,9 @@ class GetLogsResponse(LogResponse): def get_cpu_cores(self) -> float: ... def get_query_mode(self) -> GetLogsResponse.QueryMode: ... def get_scan_bytes(self) -> int: ... - def get_begin_offset(self) -> int: ... - def get_end_offset(self) -> int: ... - def get_scan_all(self) -> bool: ... + def get_begin_offset(self) -> Optional[int]: ... + def get_end_offset(self) -> Optional[int]: ... + def get_scan_all(self) -> Optional[bool]: ... def log_print(self) -> None: ... def get_log_list(self) -> List[QueriedLog]: ... def get_meta(self) -> GetLogsResponse.GetLogsResponseMeta: ... @@ -36,37 +36,37 @@ class GetLogsResponse(LogResponse): def merge(self, other: GetLogsResponse.GetLogsResponseMeta) -> GetLogsResponse.GetLogsResponseMeta: ... def get_count(self) -> int: ... def log_print(self) -> None: ... - def get_progress(self) -> str: ... + def get_progress(self) -> Optional[str]: ... def get_processed_rows(self) -> int: ... def get_elapsed_millisecond(self) -> int: ... def get_has_sql(self) -> bool: ... def get_where_query(self) -> str: ... - def get_agg_query(self) -> str: ... + def get_agg_query(self) -> Optional[str]: ... def get_cpu_sec(self) -> float: ... def get_cpu_cores(self) -> float: ... def get_mode(self) -> int: ... def get_scan_bytes(self) -> int: ... def get_phrase_query_info(self) -> Optional[GetLogsResponse.PhraseQueryInfo]: ... - def get_limited(self) -> int: ... - def get_processed_bytes(self) -> int: ... - def get_telemetry_type(self) -> str: ... + def get_limited(self) -> Optional[int]: ... + def get_processed_bytes(self) -> Optional[int]: ... + def get_telemetry_type(self) -> Optional[str]: ... def get_power_sql(self) -> bool: ... - def get_inserted_sql(self) -> str: ... - def get_keys(self) -> List[str]: ... - def get_marker(self) -> str: ... - def get_is_accurate(self) -> bool: ... - def get_column_types(self) -> List[str]: ... + def get_inserted_sql(self) -> Optional[str]: ... + def get_keys(self) -> Optional[List[str]]: ... + def get_marker(self) -> Optional[str]: ... + def get_is_accurate(self) -> Optional[bool]: ... + def get_column_types(self) -> Optional[List[str]]: ... def get_highlights(self) -> Any: ... def get_terms(self) -> List[GetLogsResponse.Term]: ... class PhraseQueryInfo: def __init__(self, pharse_query_info: Any) -> None: ... - def get_begin_offset(self) -> int: ... - def get_end_offset(self) -> int: ... - def get_scan_all(self) -> bool: ... - def get_end_time(self) -> int: ... + def get_begin_offset(self) -> Optional[int]: ... + def get_end_offset(self) -> Optional[int]: ... + def get_scan_all(self) -> Optional[bool]: ... + def get_end_time(self) -> Optional[int]: ... def log_print(self) -> None: ... class Term: def __init__(self, key: str, term: str) -> None: ... - def get_key(self) -> str: ... - def get_term(self) -> str: ... + def get_key(self) -> Optional[str]: ... + def get_term(self) -> Optional[str]: ... def log_print(self) -> None: ... diff --git a/aliyun/log/listtopicsresponse.pyi b/aliyun/log/listtopicsresponse.pyi index ffbe0628..096025a3 100644 --- a/aliyun/log/listtopicsresponse.pyi +++ b/aliyun/log/listtopicsresponse.pyi @@ -8,5 +8,5 @@ class ListTopicsResponse(LogResponse): def __init__(self, resp: Dict[str, Any], header: Dict[str, Any]) -> None: ... def get_count(self) -> int: ... def get_topics(self) -> List[Any]: ... - def get_next_token(self) -> str: ... + def get_next_token(self) -> Optional[str]: ... def log_print(self) -> None: ... From fa62d530fb304a60a87b438fa03905eb210ff51e Mon Sep 17 00:00:00 2001 From: Crimson <39024757+crimson-gao@users.noreply.github.com> Date: Sat, 18 Apr 2026 16:21:57 +0800 Subject: [PATCH 5/8] Potential fix for pull request finding 'CodeQL / Workflow does not contain permissions' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3d774f6b..01525c4a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -6,6 +6,9 @@ on: pull_request: branches: [ master ] +permissions: + contents: read + jobs: test: runs-on: ubuntu-latest From d8c9d94d53dfa9348f542f7a33fcd4b41cc04f66 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Sat, 18 Apr 2026 16:40:53 +0800 Subject: [PATCH 6/8] test(ci): replace smoke test with stub signature checker, batch stubtest - Remove run_public_type_smoke.py: ineffective due to --follow-imports=skip and --ignore-missing-imports making mypy pass even with deleted stubs - Add check_stub_signatures.py: AST-based check that parameter names in each .pyi match the corresponding .py source file - Batch all 28 stubtest modules into a single subprocess call instead of 28 separate invocations; reports all failures before exiting Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/build.yaml | 4 +- tests/ci/check_stub_signatures.py | 82 +++++++++++++++++++++++++++++++ tests/ci/run_public_type_smoke.py | 76 ---------------------------- tests/ci/run_stubtest.py | 10 ++-- 4 files changed, 90 insertions(+), 82 deletions(-) create mode 100644 tests/ci/check_stub_signatures.py delete mode 100644 tests/ci/run_public_type_smoke.py diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 01525c4a..24ba1ab0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -66,6 +66,6 @@ jobs: run: | python tests/ci/run_stubtest.py - - name: Run public type smoke + - name: Check stub signatures match source run: | - python tests/ci/run_public_type_smoke.py + python tests/ci/check_stub_signatures.py diff --git a/tests/ci/check_stub_signatures.py b/tests/ci/check_stub_signatures.py new file mode 100644 index 00000000..e8137a3c --- /dev/null +++ b/tests/ci/check_stub_signatures.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +# encoding: utf-8 +""" +Verify that every method stubbed in a .pyi file has parameter names that match +the corresponding .py source. Only checks names present in BOTH files. +Exit 1 if any mismatches are found. +""" + +import ast +import os +import sys + + +def _func_params(func_node): + names = [a.arg for a in func_node.args.args] + return names + + +def _collect_funcs(tree): + """Return { qualified_name -> param_names } for all module-level and class-level functions.""" + result = {} + for node in tree.body: + if isinstance(node, ast.ClassDef): + for item in node.body: + if isinstance(item, ast.FunctionDef): + result[f"{node.name}.{item.name}"] = _func_params(item) + elif isinstance(node, ast.FunctionDef): + result[node.name] = _func_params(node) + return result + + +def _parse(path): + with open(path, 'r', encoding='utf-8') as fh: + return ast.parse(fh.read(), filename=path) + + +def check_pair(py_path, pyi_path): + py_funcs = _collect_funcs(_parse(py_path)) + pyi_funcs = _collect_funcs(_parse(pyi_path)) + + mismatches = [] + for name, stub_params in pyi_funcs.items(): + if name not in py_funcs: + continue + stub_pos = [p for p in stub_params if p not in ('self', 'cls')] + src_pos = [p for p in py_funcs[name] if p not in ('self', 'cls')] + if stub_pos != src_pos: + mismatches.append(f" {name}: stub {stub_pos} != source {src_pos}") + return mismatches + + +def main(): + repo_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + log_dir = os.path.join(repo_root, 'aliyun', 'log') + + all_mismatches = {} + checked = 0 + + for pyi_name in sorted(f for f in os.listdir(log_dir) if f.endswith('.pyi')): + py_path = os.path.join(log_dir, pyi_name[:-1]) + if not os.path.exists(py_path): + continue + mismatches = check_pair(py_path, os.path.join(log_dir, pyi_name)) + checked += 1 + if mismatches: + all_mismatches[pyi_name] = mismatches + + if all_mismatches: + print('STUB SIGNATURE MISMATCHES FOUND:') + for fname, issues in all_mismatches.items(): + print(f'\n{fname}:') + for issue in issues: + print(issue) + total = sum(len(v) for v in all_mismatches.values()) + print(f'\n{total} mismatch(es) across {len(all_mismatches)} file(s).') + sys.exit(1) + else: + print(f'OK — {checked} stub/source pair(s) checked, all signatures match.') + + +if __name__ == '__main__': + main() diff --git a/tests/ci/run_public_type_smoke.py b/tests/ci/run_public_type_smoke.py deleted file mode 100644 index ff4c0487..00000000 --- a/tests/ci/run_public_type_smoke.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -import os -import subprocess -import sys -import tempfile - - -SMOKE_SOURCE = """\ -from aliyun.log.consumer import ( - ConsumerJsonProcessorBase, - ConsumerProcessorAdaptor, - ConsumerProcessorBase, - ConsumerWorker, - CursorPosition, - LogHubConfig, -) - - -class DemoProcessor(ConsumerProcessorBase): - def process(self, log_groups, check_point_tracker): - return None - - -class DemoJsonProcessor(ConsumerJsonProcessorBase): - def process(self, flattern_json_list, check_point_tracker): - return None - - -def build_processor(): - return DemoProcessor() - - -config = LogHubConfig( - endpoint='cn-hangzhou.log.aliyuncs.com', - access_key_id='ak', - access_key='sk', - project='project', - logstore='logstore', - consumer_group_name='group', - consumer_name='consumer', - cursor_position=CursorPosition.BEGIN_CURSOR, -) - -worker = ConsumerWorker(build_processor, config) -adaptor = ConsumerProcessorAdaptor(lambda shard_id, log_groups: True) -""" - - -def main(): - import shutil - temp_dir = tempfile.mkdtemp(prefix='aliyun-public-type-smoke-') - try: - smoke_file = os.path.join(temp_dir, 'consumer_public_smoke.py') - with open(smoke_file, 'w') as fh: - fh.write(SMOKE_SOURCE) - - os.chdir(temp_dir) - cmd = [ - sys.executable, - '-m', - 'mypy', - '--python-version', - '3.12', - '--follow-imports=skip', - '--ignore-missing-imports', - smoke_file, - ] - subprocess.check_call(cmd) - finally: - shutil.rmtree(temp_dir, ignore_errors=True) - - -if __name__ == '__main__': - main() diff --git a/tests/ci/run_stubtest.py b/tests/ci/run_stubtest.py index f9dae028..7d9eae87 100644 --- a/tests/ci/run_stubtest.py +++ b/tests/ci/run_stubtest.py @@ -19,12 +19,14 @@ def _read_non_empty_lines(path): def main(): modules = _read_non_empty_lines(MODULES_FILE) - allowlist_args = ['--allowlist', ALLOWLIST_FILE] # Run outside the checkout so stubtest validates the installed package payload. os.chdir(tempfile.gettempdir()) - for module in modules: - cmd = [sys.executable, '-m', 'mypy.stubtest', '--ignore-missing-stub'] + allowlist_args + [module] - subprocess.check_call(cmd) + cmd = ( + [sys.executable, '-m', 'mypy.stubtest', '--ignore-missing-stub', + '--allowlist', ALLOWLIST_FILE] + + modules + ) + subprocess.check_call(cmd) if __name__ == '__main__': From a293037e09319f09e0150dda03b6b356e15964db Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Sat, 18 Apr 2026 16:43:12 +0800 Subject: [PATCH 7/8] chore: remove migration summary doc Co-Authored-By: Claude Sonnet 4.6 --- TYPE_STUB_MIGRATION_SUMMARY.md | 111 --------------------------------- 1 file changed, 111 deletions(-) delete mode 100644 TYPE_STUB_MIGRATION_SUMMARY.md diff --git a/TYPE_STUB_MIGRATION_SUMMARY.md b/TYPE_STUB_MIGRATION_SUMMARY.md deleted file mode 100644 index 89a69280..00000000 --- a/TYPE_STUB_MIGRATION_SUMMARY.md +++ /dev/null @@ -1,111 +0,0 @@ -# Type Stub Migration Summary - -## Background - -This change migrates the SDK typing approach from inline Python 2 style `# type:` comments in runtime `.py` files to colocated `.pyi` stub files. - -The goal is: - -- keep runtime behavior unchanged for Python 2 / Python 3 users -- avoid adding `typing` imports into runtime modules -- make type information available to static type checkers through standard PEP 561 packaging -- add CI validation with `mypy.stubtest` - -## What Changed - -### 1. Added `.pyi` stubs for public SDK modules - -New stub files were added under [aliyun/log](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log), including: - -- [aliyun/log/logclient.pyi](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/logclient.pyi) -- [aliyun/log/putlogsrequest.pyi](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/putlogsrequest.pyi) -- [aliyun/log/getlogsresponse.pyi](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/getlogsresponse.pyi) -- [aliyun/log/__init__.pyi](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/__init__.pyi) - -In total, 26 `.pyi` files were generated for the modules covered by this migration. - -These stubs now carry the type information that had previously been expressed as inline comments. - -### 2. Enabled PEP 561 packaging - -Packaging was updated so installed distributions include the stub files: - -- [setup.py](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/setup.py) -- [MANIFEST.in](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/MANIFEST.in) -- [aliyun/log/py.typed](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/py.typed) - -This ensures downstream type checkers can discover the package typing metadata after installation. - -### 3. Added CI stub validation - -GitHub Actions was updated to run `stubtest` in a dedicated typing job: - -- [build.yaml](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/.github/workflows/build.yaml) -- [tests/ci/run_stubtest.py](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/tests/ci/run_stubtest.py) -- [tests/ci/stubtest_modules.txt](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/tests/ci/stubtest_modules.txt) - -The typing job installs: - -- `mypy` -- `types-requests` -- `types-six` - -Then it installs the SDK itself and runs: - -```bash -python tests/ci/run_stubtest.py -``` - -The runner changes to a temporary directory before invoking `mypy.stubtest`, so validation targets the installed package payload instead of the source checkout. - -## Runtime Code Adjustments - -The migration target is `.pyi`, not runtime annotations. Two runtime files were adjusted only because existing historical type comments were not valid for `mypy` parsing: - -- [aliyun/log/logclient_operator.py](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/logclient_operator.py) -- [aliyun/log/consumer/tasks.py](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/aliyun/log/consumer/tasks.py) - -These were mechanical syntax fixes to existing type-comment style so `mypy` could import the runtime package during `stubtest`. - -## Validation Performed - -Local validation was executed in a dedicated virtualenv: - -- local env: [`.venv-stubtest`](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/.venv-stubtest) -- installed package: current working tree version -- installed typing tools: `mypy`, `types-requests`, `types-six` - -Checks performed: - -1. Parsed all generated `.pyi` files successfully. -2. Confirmed installed wheel contains: - - `aliyun/log/logclient.pyi` - - `aliyun/log/putlogsrequest.pyi` - - `aliyun/log/py.typed` -3. Ran: - -```bash -.venv-stubtest/bin/python tests/ci/run_stubtest.py -``` - -Observed result: - -```text -Success: no issues found in 25 modules -``` - -## Current Scope - -The current `stubtest` scope is the explicit module list in [tests/ci/stubtest_modules.txt](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/tests/ci/stubtest_modules.txt). - -It intentionally validates the migrated modules directly, instead of validating the package root export surface in one step. That keeps CI narrower and avoids mixing this migration with unrelated package-export cleanup. - -## Notes - -- [`.venv-stubtest`](/Users/shuizhao.gh/Desktop/workspace/aliyun-log-python-sdk/.venv-stubtest) is only a local verification environment and should not be committed. -- Relative to `master`, the intended deliverable is: - - new `.pyi` files - - `py.typed` - - packaging changes - - CI `stubtest` integration - - the two runtime syntax fixes needed for `mypy` importability From ecbed2ec0c2ba73a78a3543ac801995aff769b05 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Sat, 18 Apr 2026 16:46:08 +0800 Subject: [PATCH 8/8] fix(stubs): fix pulllog_response time_as_str type, silence unused allowlist - pulllog_response.pyi: time_as_str default is None at runtime, so type must be Optional[bool] not bool in both loggroups_to_flattern_list and get_flatten_logs_json - run_stubtest.py: add --ignore-unused-allowlist since --ignore-missing-stub already suppresses private member errors, making allowlist entries appear unused to stubtest Co-Authored-By: Claude Sonnet 4.6 --- aliyun/log/pulllog_response.pyi | 4 ++-- tests/ci/run_stubtest.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aliyun/log/pulllog_response.pyi b/aliyun/log/pulllog_response.pyi index e3a010d4..46814096 100644 --- a/aliyun/log/pulllog_response.pyi +++ b/aliyun/log/pulllog_response.pyi @@ -29,6 +29,6 @@ class PullLogResponse(LogResponse): @staticmethod def get_log_count_from_group(loggroup_list: Any) -> int: ... @staticmethod - def loggroups_to_flattern_list(loggroup_list: Any, time_as_str: bool = ..., decode_bytes: Any = ...) -> List[Dict[str, Any]]: ... - def get_flatten_logs_json(self, time_as_str: bool = ..., decode_bytes: Any = ...) -> List[Dict[str, Any]]: ... + def loggroups_to_flattern_list(loggroup_list: Any, time_as_str: Optional[bool] = ..., decode_bytes: Any = ...) -> List[Dict[str, Any]]: ... + def get_flatten_logs_json(self, time_as_str: Optional[bool] = ..., decode_bytes: Any = ...) -> List[Dict[str, Any]]: ... def get_flatten_logs_json_auto(self) -> List[Dict[str, Any]]: ... diff --git a/tests/ci/run_stubtest.py b/tests/ci/run_stubtest.py index 7d9eae87..67c5bf18 100644 --- a/tests/ci/run_stubtest.py +++ b/tests/ci/run_stubtest.py @@ -23,7 +23,7 @@ def main(): os.chdir(tempfile.gettempdir()) cmd = ( [sys.executable, '-m', 'mypy.stubtest', '--ignore-missing-stub', - '--allowlist', ALLOWLIST_FILE] + '--ignore-unused-allowlist', '--allowlist', ALLOWLIST_FILE] + modules ) subprocess.check_call(cmd)