Skip to content

Commit

Permalink
Add full stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
vemel committed Aug 30, 2024
1 parent a606072 commit 0143b76
Show file tree
Hide file tree
Showing 12 changed files with 147 additions and 80 deletions.
28 changes: 28 additions & 0 deletions boto3-stubs/docs/action.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from typing import Dict, List, Any
from boto3.docs.base import NestedDocumenter
from botocore.hooks import BaseEventHooks

PUT_DATA_WARNING_MESSAGE: str
WARNING_MESSAGES: Dict[str, Dict[str, str]]
IGNORE_PARAMS: Dict[str, Dict[str, List[str]]]

class ActionDocumenter(NestedDocumenter):
def document_actions(self, section: Any) -> None: ...

def document_action(
section: Any,
resource_name: str,
event_emitter: BaseEventHooks,
action_model: Any,
service_model: Any,
include_signature: bool = ...,
) -> None: ...
def document_load_reload_action(
section: Any,
action_name: str,
resource_name: str,
event_emitter: BaseEventHooks,
load_model: Any,
service_model: Any,
include_signature: bool = ...,
) -> None: ...
22 changes: 22 additions & 0 deletions boto3-stubs/docs/attr.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from typing import Any
from botocore.docs.params import ResponseParamsDocumenter
from botocore.hooks import BaseEventHooks

class ResourceShapeDocumenter(ResponseParamsDocumenter):
EVENT_NAME: str

def document_attribute(
section: Any,
service_name: str,
resource_name: str,
attr_name: str,
event_emitter: BaseEventHooks,
attr_model: Any,
include_signature: bool = True,
) -> None: ...
def document_identifier(
section: Any, resource_name: str, identifier_model: Any, include_signature: bool = ...
) -> None: ...
def document_reference(
section: Any, reference_model: Any, include_signature: bool = ...
) -> None: ...
13 changes: 13 additions & 0 deletions boto3-stubs/docs/base.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from typing import Any, Dict

class BaseDocumenter:
member_map: Dict[str, Any]
represents_service_resource: Any
def __init__(self, resource: Any) -> None: ...
@property
def class_name(self) -> str: ...

class NestedDocumenter(BaseDocumenter):
def __init__(self, resource: Any, root_docs_path: str) -> None: ...
@property
def class_name(self) -> str: ...
3 changes: 3 additions & 0 deletions boto3-stubs/docs/client.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from botocore.docs.client import ClientDocumenter

class Boto3ClientDocumenter(ClientDocumenter): ...
28 changes: 28 additions & 0 deletions boto3-stubs/docs/collection.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from typing import Any
from boto3.docs.base import NestedDocumenter
from botocore.hooks import BaseEventHooks

class CollectionDocumenter(NestedDocumenter):
def document_collections(self, section: Any) -> None: ...

def document_collection_object(
section: Any, collection_model: Any, include_signature: bool = ...
) -> None: ...
def document_batch_action(
section: Any,
resource_name: str,
event_emitter: BaseEventHooks,
batch_action_model: Any,
service_model: Any,
collection_model: Any,
include_signature: bool = ...,
) -> None: ...
def document_collection_method(
section: Any,
resource_name: str,
action_name: str,
event_emitter: BaseEventHooks,
collection_model: Any,
service_model: Any,
include_signature: bool = ...,
) -> None: ...
12 changes: 12 additions & 0 deletions boto3-stubs/docs/docstring.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from botocore.docs.docstring import LazyLoadedDocstring

class ActionDocstring(LazyLoadedDocstring): ...
class LoadReloadDocstring(LazyLoadedDocstring): ...
class SubResourceDocstring(LazyLoadedDocstring): ...
class AttributeDocstring(LazyLoadedDocstring): ...
class IdentifierDocstring(LazyLoadedDocstring): ...
class ReferenceDocstring(LazyLoadedDocstring): ...
class CollectionDocstring(LazyLoadedDocstring): ...
class CollectionMethodDocstring(LazyLoadedDocstring): ...
class BatchActionDocstring(LazyLoadedDocstring): ...
class ResourceWaiterDocstring(LazyLoadedDocstring): ...
18 changes: 18 additions & 0 deletions boto3-stubs/docs/method.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from typing import Any, Optional
from botocore.hooks import BaseEventHooks

def document_model_driven_resource_method(
section: Any,
method_name: str,
operation_model: Any,
event_emitter: BaseEventHooks,
method_description: Optional[str] = ...,
example_prefix: Optional[str] = ...,
include_input: Optional[Any] = ...,
include_output: Optional[Any] = ...,
exclude_input: Optional[Any] = ...,
exclude_output: Optional[Any] = ...,
document_output: bool = ...,
resource_action_model: Optional[Any] = ...,
include_signature: bool = ...,
) -> None: ...
10 changes: 10 additions & 0 deletions boto3-stubs/docs/resource.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from typing import Any
from boto3.docs.base import BaseDocumenter

class ResourceDocumenter(BaseDocumenter):
def __init__(self, resource: Any, botocore_session: Any, root_docs_path: str) -> None: ...
def document_resource(self, section: Any) -> None: ...

class ServiceResourceDocumenter(ResourceDocumenter):
@property
def class_name(self) -> str: ...
10 changes: 10 additions & 0 deletions boto3-stubs/docs/service.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from typing import Any, List
from botocore.docs.service import ServiceDocumenter as BaseServiceDocumenter

class ServiceDocumenter(BaseServiceDocumenter):
EXAMPLE_PATH: str
sections: List[str]
def __init__(self, service_name: str, session: Any, root_docs_path: str) -> None: ...
def document_service(self) -> bytes: ...
def client_api(self, section: Any) -> None: ...
def resource_section(self, section: Any) -> None: ...
5 changes: 3 additions & 2 deletions boto3-stubs/resources/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ class ResourceMeta:
def copy(self: _ResourceMeta) -> _ResourceMeta: ...

class ServiceResource:
meta: ResourceMeta # type: ignore
meta: None # type: ignore

def __init__(self, *args: Any, client: Optional[BaseClient] = ..., **kwargs: Any) -> None: ...
def __init__(self, *args: Any, client: Optional[BaseClient] = ..., **kwargs: Any) -> None:
self.meta: ResourceMeta
def __repr__(self) -> str: ...
def __eq__(self, other: Any) -> bool: ...
def __hash__(self) -> int: ...
73 changes: 0 additions & 73 deletions istub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,76 +6,3 @@ packages:
pyright: false
mypy: false
stubtest: true
snapshots:
stubtest: |-
error: boto3.resources.base.ServiceResource.meta variable differs from runtime type None
Stub: in file ./boto3-stubs/resources/base.pyi:31
boto3.resources.base.ResourceMeta
Runtime:
None
error: boto3.docs.action failed to find stubs
Stub:
MISSING
Runtime:
<module 'boto3.docs.action' from './boto3/docs/action.py'>
error: boto3.docs.attr failed to find stubs
Stub:
MISSING
Runtime:
<module 'boto3.docs.attr' from './boto3/docs/attr.py'>
error: boto3.docs.base failed to find stubs
Stub:
MISSING
Runtime:
<module 'boto3.docs.base' from './boto3/docs/base.py'>
error: boto3.docs.client failed to find stubs
Stub:
MISSING
Runtime:
<module 'boto3.docs.client' from './boto3/docs/client.py'>
error: boto3.docs.collection failed to find stubs
Stub:
MISSING
Runtime:
<module 'boto3.docs.collection' from './boto3/docs/collection.py'>
error: boto3.docs.docstring failed to find stubs
Stub:
MISSING
Runtime:
<module 'boto3.docs.docstring' from './boto3/docs/docstring.py'>
error: boto3.docs.method failed to find stubs
Stub:
MISSING
Runtime:
<module 'boto3.docs.method' from './boto3/docs/method.py'>
error: boto3.docs.resource failed to find stubs
Stub:
MISSING
Runtime:
<module 'boto3.docs.resource' from './boto3/docs/resource.py'>
error: boto3.docs.service failed to find stubs
Stub:
MISSING
Runtime:
<module 'boto3.docs.service' from './boto3/docs/service.py'>
error: boto3.docs.subresource failed to find stubs
Stub:
MISSING
Runtime:
<module 'boto3.docs.subresource' from './boto3/docs/subresource.py'>
error: boto3.docs.waiter failed to find stubs
Stub:
MISSING
Runtime:
<module 'boto3.docs.waiter' from './boto3/docs/waiter.py'>
5 changes: 0 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ build-backend = 'setuptools.build_meta'
[tool.setuptools]
packages = [
"boto3-stubs",
"boto3-stubs.docs",
"boto3-stubs.dynamodb",
"boto3-stubs.ec2",
"boto3-stubs.resources",
"boto3-stubs.s3",
]

[tool.pyright]
Expand Down

0 comments on commit 0143b76

Please sign in to comment.