Skip to content

Commit

Permalink
Replace PEP 440 with Python Packaging version specifiers, ruff update
Browse files Browse the repository at this point in the history
  • Loading branch information
vemel committed Jan 10, 2025
1 parent f58bef7 commit 342219e
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 60 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Do you want more? Check the [documentation](https://youtype.github.io/boto3_stub
## Versioning

`mypy_boto3_builder` version is not related to `boto3` version and follows
[PEP 440](https://www.python.org/dev/peps/pep-0440/).
[Python Packaging version specifiers](https://packaging.python.org/en/latest/specifications/version-specifiers/).

## Latest changes

Expand Down
2 changes: 1 addition & 1 deletion docsmd/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ See how it helps to find and fix potential bugs:
## Versioning

`mypy_boto3_builder` version is not related to `boto3` version and follows
[PEP 440](https://www.python.org/dev/peps/pep-0440/).
[Python Packaging version specifiers](https://packaging.python.org/en/latest/specifications/version-specifiers/).

## Latest changes

Expand Down
7 changes: 4 additions & 3 deletions mypy_boto3_builder/boto3_ports/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
Copyright 2024 Vlad Emelianov
"""

from dataclasses import dataclass
from typing import Any

from botocore import xform_name
from botocore.model import Shape, StructureShape


@dataclass
class Identifier:
"""
A resource identifier, given by its name.
"""

def __init__(self, name: str, member_name: str | None = None) -> None:
self.name = name
self.member_name = member_name
name: str
member_name: str | None = None


class Action:
Expand Down
2 changes: 1 addition & 1 deletion mypy_boto3_builder/chat/chat_buddy.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _linebreak() -> None:


def _join_and(items: Sequence[MessageToken], name: str = "") -> Message:
name_suffix = f" {name}{"" if len(items) == 1 else "s"}" if name else ""
name_suffix = f" {name}{'' if len(items) == 1 else 's'}" if name else ""
if not items:
return ("no ", name_suffix)
if len(items) == 1:
Expand Down
6 changes: 3 additions & 3 deletions mypy_boto3_builder/chat/prompts/base_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from abc import ABC, abstractmethod
from collections.abc import Iterator
from contextlib import contextmanager
from typing import Any, ClassVar, Final, Generic, NoReturn, TypeVar
from typing import Any, ClassVar, Final, Generic, TypeVar
from unittest.mock import patch

from prompt_toolkit import PromptSession
Expand Down Expand Up @@ -82,7 +82,7 @@ def get_prompt_tokens(self) -> list[tuple[str, str]]:
return TextStyle.text.stylize(self._get_prompt_tokens())

@abstractmethod
def _get_prompt_tokens(self) -> NoReturn:
def _get_prompt_tokens(self) -> Message:
raise NotImplementedError("Method is not implemented")

def _is_answered(self) -> bool:
Expand All @@ -100,7 +100,7 @@ def get_question(self) -> Question:
return self._question

@abstractmethod
def _create_question(self) -> NoReturn:
def _create_question(self) -> Question:
raise NotImplementedError("Method is not implemented")

def _patch_answer(self) -> None:
Expand Down
4 changes: 1 addition & 3 deletions mypy_boto3_builder/enums/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ def get_type(self) -> ProductType:
):
return ProductType.docs
case (
Product.types_boto3_full
| Product.boto3_stubs_full
| Product.types_aiobotocore_full
Product.types_boto3_full | Product.boto3_stubs_full | Product.types_aiobotocore_full
):
return ProductType.full
case (
Expand Down
6 changes: 2 additions & 4 deletions mypy_boto3_builder/parsers/resource_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ def _parse_attributes(self, collections: Iterable[Collection]) -> list[Attribute
for attribute in references:
if attribute.name in existing_attribute_names:
self._logger.warning(
f"Duplicate attribute name {self.name}.{attribute.name}"
" in reference, renaming"
f"Duplicate attribute name {self.name}.{attribute.name} in reference, renaming"
)
attribute.name = f"{attribute.name}_reference"
existing_attribute_names.add(attribute.name)
Expand All @@ -89,8 +88,7 @@ def _parse_attributes(self, collections: Iterable[Collection]) -> list[Attribute
)
if attribute.name in existing_attribute_names:
self._logger.warning(
f"Duplicate attribute name {self.name}.{attribute.name}"
" in collection, renaming"
f"Duplicate attribute name {self.name}.{attribute.name} in collection, renaming"
)
attribute.name = f"{attribute.name}_collection"
collection_attributes.append(attribute)
Expand Down
3 changes: 1 addition & 2 deletions mypy_boto3_builder/structures/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def boto3_doc_link(self) -> str:
List to boto3 docs page.
"""
return (
f"{self.service_name.boto3_doc_link_parent}.html"
f"#{self.service_name.class_name}.Client"
f"{self.service_name.boto3_doc_link_parent}.html#{self.service_name.class_name}.Client"
)

def get_all_names(self) -> list[str]:
Expand Down
2 changes: 1 addition & 1 deletion mypy_boto3_builder/templates/common/footer.md.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Builder changelog can be found in [Releases]({{ builder_repo_url }}/releases).
## Versioning

`{{ package.pypi_name }}` version is the same as related `{{ package.library_name }}` version and follows
[PEP 440](https://www.python.org/dev/peps/pep-0440/) format.
[Python Packaging version specifiers](https://packaging.python.org/en/latest/specifications/version-specifiers/).

## Thank you

Expand Down
2 changes: 1 addition & 1 deletion mypy_boto3_builder/templates/mypy-boto3/README.md.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Full changelog can be found in [Releases](https://github.com/youtype/mypy_boto3_
## Versioning

`{{ package.pypi_name }}` version is the same as related `boto3` version and follows
[PEP 440](https://www.python.org/dev/peps/pep-0440/) format.
[Python Packaging version specifiers](https://packaging.python.org/en/latest/specifications/version-specifiers/).

## Support and contributing

Expand Down
2 changes: 1 addition & 1 deletion mypy_boto3_builder/utils/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_short_docstring(doc: str) -> str:
"""
doc = str(doc)
if len(doc) > DOCSTRING_MAX_LENGTH:
doc = f"{doc[:DOCSTRING_MAX_LENGTH - 3]}..."
doc = f"{doc[: DOCSTRING_MAX_LENGTH - 3]}..."
result: list[str] = []
if not doc:
return ""
Expand Down
6 changes: 3 additions & 3 deletions scripts/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ def updated_ago(self) -> str:
return "never"
delta = get_now() - self.started_at
if delta.days:
return f"{delta.days} day{'s' if delta.days > 1 else '' } ago"
return f"{delta.days} day{'s' if delta.days > 1 else ''} ago"
if delta.seconds > 60 * 60:
hours = delta.seconds // 60 // 60
return f"{hours} hour{'s' if hours > 1 else '' } ago"
return f"{hours} hour{'s' if hours > 1 else ''} ago"
if delta.seconds > 60: # noqa: PLR2004
minutes = delta.seconds // 60
return f"{minutes} minute{'s' if minutes > 1 else '' } ago"
return f"{minutes} minute{'s' if minutes > 1 else ''} ago"
if delta.seconds > 5: # noqa: PLR2004
return f"{delta.seconds} seconds ago"

Expand Down
Loading

0 comments on commit 342219e

Please sign in to comment.