Skip to content

Commit

Permalink
Fix Identifier stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
vemel committed Nov 26, 2019
1 parent 8f689fd commit 406611a
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ ResourceModelDefinition = TypedDict(
)

class Identifier:
def __init__(self, name: str, member_name: Optional[str] = None) -> None: ...
def __init__(self, name: str, member_name: Optional[str] = None) -> None:
self.name: str
self.member_name: str

class Action:
def __init__(
Expand Down
3 changes: 0 additions & 3 deletions builder/mypy_boto3_builder/parsers/fake_service_package.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""
Fake parser that produces `structures.ServiceModule` for master module and stubs.
"""
from typing import Optional

from boto3.session import Session

from mypy_boto3_builder.structures.client import Client
Expand Down Expand Up @@ -37,7 +35,6 @@ def parse_fake_service_package(
)

boto3_client = get_boto3_client(session, service_name)
boto3_resource: Optional[ServiceResource] = None
boto3_resource = get_boto3_resource(session, service_name)

if boto3_resource is not None:
Expand Down
4 changes: 2 additions & 2 deletions builder/mypy_boto3_builder/structures/service_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Boto3 ServiceResource.
"""
from dataclasses import dataclass, field
from typing import List, Set
from typing import List, Set, Optional

from boto3.resources.base import ServiceResource as Boto3ServiceResource

Expand All @@ -25,7 +25,7 @@ class ServiceResource(ClassRecord):

name: str = "ServiceResource"
service_name: ServiceName = ServiceName.ec2
boto3_service_resource: Boto3ServiceResource = None
boto3_service_resource: Optional[Boto3ServiceResource] = None
collections: List[Collection] = field(default_factory=lambda: [])
sub_resources: List[Resource] = field(default_factory=lambda: [])
bases: List[FakeAnnotation] = field(
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ docker run -v `pwd`/output:/output -ti mypy_boto3_builder
docker run -v `pwd`/output:/output -ti mypy_boto3_builder -s s3

# generate stubs for a specific boto3 version
docker run -e BOTO3_VERSION=1.10.18 -v `pwd`/output:/output -ti mypy_boto3_builder
docker run -e BOTO3_VERSION=1.10.18 BOTOCORE_VERSION=1.13.18 -v `pwd`/output:/output -ti mypy_boto3_builder
```

- Install packages from `output` directory as described above
Expand Down
2 changes: 1 addition & 1 deletion docs/builder/mypy_boto3_builder/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Main entrypoint for builder.

## main

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/main.py#L27)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/main.py#L29)

```python
def main() -> None:
Expand Down
2 changes: 1 addition & 1 deletion docs/builder/mypy_boto3_builder/parsers/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Boto3 client parser, produces `structures.Client`.

## parse_client

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/client.py#L21)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/client.py#L20)

```python
def parse_client(session: Session, service_name: ServiceName) -> Client:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Fake parser that produces `structures.ServiceModule` for master module and stubs

## parse_fake_service_package

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/fake_service_package.py#L17)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/fake_service_package.py#L15)

```python
def parse_fake_service_package(
Expand Down
4 changes: 2 additions & 2 deletions docs/builder/mypy_boto3_builder/parsers/helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Helpers for parsing methods and attributes.
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/helpers.py#L18)

```python
def get_public_methods(inspect_class: type) -> Dict[str, FunctionType]:
def get_public_methods(inspect_class: Any) -> Dict[str, FunctionType]:
```

Extract public methods from any class.
Expand Down Expand Up @@ -47,7 +47,7 @@ A list of Attribute structures.

## parse_method

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/helpers.py#L65)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/helpers.py#L69)

```python
def parse_method(parent_name: str, name: str, method: FunctionType) -> Method:
Expand Down
6 changes: 3 additions & 3 deletions docs/builder/mypy_boto3_builder/parsers/resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Parser for Boto3 ServiceResource sub-resource, produces `structures.Resource`

## get_resource_public_methods

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/resource.py#L64)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/resource.py#L62)

```python
def get_resource_public_methods(
resource_class: Boto3ResourceMeta,
resource_class: Type[Boto3ServiceResource],
) -> Dict[str, FunctionType]:
```

Expand All @@ -30,7 +30,7 @@ A dictionary of method name and method.

## parse_resource

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/resource.py#L23)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/resource.py#L21)

```python
def parse_resource(
Expand Down
4 changes: 2 additions & 2 deletions docs/builder/mypy_boto3_builder/parsers/service_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Parser that produces `structures.ServiceModule`.

## get_helper_body

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/service_package.py#L233)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/service_package.py#L232)

```python
def get_helper_body(
Expand All @@ -22,7 +22,7 @@ def get_helper_body(

## parse_service_package

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/service_package.py#L34)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/service_package.py#L33)

```python
def parse_service_package(
Expand Down
6 changes: 3 additions & 3 deletions docs/builder/mypy_boto3_builder/parsers/service_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Parser for Boto3 ServiceResource, produces `structires.ServiceResource`.

## get_sub_resources

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/service_resource.py#L81)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/service_resource.py#L79)

```python
def get_sub_resources(
session: Session,
service_name: ServiceName,
resource: Boto3ResourceMeta,
resource: Boto3ServiceResource,
) -> List[Boto3ServiceResource]:
```

Expand All @@ -34,7 +34,7 @@ A list of initialized `Boto3ServiceResource`.

## parse_service_resource

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/service_resource.py#L31)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/parsers/service_resource.py#L29)

```python
def parse_service_resource(
Expand Down
12 changes: 6 additions & 6 deletions docs/builder/mypy_boto3_builder/utils/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Multiple string utils collection.

## clean_doc

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/utils/strings.py#L65)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/utils/strings.py#L75)

```python
def clean_doc(doc: Optional[str], max_length: int = LINE_LENGTH) -> str:
def clean_doc(doc: Optional[str], max_length: int) -> str:
```

Clean docstring to be safely rendered.
Expand All @@ -28,7 +28,7 @@ Clean docstring to be safely rendered.
- Returns extra empty lines.
- Escapes backslashes.
- Replace trible doublequotes with triple single quotes.
- Tries to fit docstring to `LINE_LENGTH`
- Tries to fit docstring to `max_length`

#### Arguments

Expand All @@ -41,7 +41,7 @@ Cleaned docstring.

## get_class_prefix

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/utils/strings.py#L109)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/utils/strings.py#L119)

```python
def get_class_prefix(func_name: str) -> str:
Expand All @@ -59,7 +59,7 @@ String with a class prefix.

## wrap_code_line

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/utils/strings.py#L32)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/utils/strings.py#L36)

```python
def wrap_code_line(line: str, max_length: int) -> Iterator[str]:
Expand All @@ -78,7 +78,7 @@ A string of wrapped text.

## wrap_line

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/utils/strings.py#L14)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/utils/strings.py#L12)

```python
def wrap_line(line: str, max_length: int) -> Iterator[str]:
Expand Down
6 changes: 3 additions & 3 deletions docs/builder/mypy_boto3_builder/writers/processors.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Processors for parsing and writing modules.

## process_boto3_stubs

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/writers/processors.py#L27)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/writers/processors.py#L28)

```python
def process_boto3_stubs(
Expand All @@ -23,7 +23,7 @@ def process_boto3_stubs(

## process_master

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/writers/processors.py#L41)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/writers/processors.py#L42)

```python
def process_master(
Expand All @@ -35,7 +35,7 @@ def process_master(

## process_service

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/writers/processors.py#L55)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/writers/processors.py#L56)

```python
def process_service(
Expand Down
2 changes: 1 addition & 1 deletion docs/builder/mypy_boto3_builder/writers/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Formatted python code.

## render_jinja2_template

[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/writers/utils.py#L58)
[[find in source code]](https://github.com/vemel/mypy_boto3/blob/master/builder/mypy_boto3_builder/writers/utils.py#L60)

```python
def render_jinja2_template(
Expand Down

0 comments on commit 406611a

Please sign in to comment.