Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use datetime objects #24

Merged
merged 1 commit into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ API docs: https://cloud.yandex.com/en/docs/tracker/about-api
## Attention!
* All `self` properties renamed to `url` cause it's incompatible with Python.
* All `camelCase` properties renamed to `pythonic_case`.
* All datetime values converted to python's `datetime.datetime` objects.
* Methods named by author, cause Yandex API has no clear method names.


Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ classifiers = [
dependencies = [
"aiohttp~=3.8.5",
"certifi>=2023",
"msgspec~=0.18.1",
"msgspec~=0.18.2",
]

[project.optional-dependencies]
Expand Down Expand Up @@ -205,7 +205,7 @@ target-version = "py310"
max-complexity = 10

[tool.ruff.flake8-type-checking]
runtime-evaluated-base-classes = ["msgspec.Struct"]
runtime-evaluated-base-classes = ["msgspec.Struct", "yatracker.types.base.Base"]

[tool.ruff.per-file-ignores]
"tests/*" = ["S101", "INP001"]
Expand Down
5 changes: 4 additions & 1 deletion yatracker/types/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

__all__ = ["Attachment"]


from datetime import datetime

from .base import Base, field
from .user import User

Expand All @@ -15,7 +18,7 @@ class Attachment(Base, kw_only=True, frozen=True):
content: str
thumbnail: str | None = None
created_by: User
created_at: str
created_at: datetime
mimetype: str
size: int
metadata: Metadata | None = None
Expand Down
6 changes: 4 additions & 2 deletions yatracker/types/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

__all__ = ["Comment"]

from datetime import datetime

from .base import Base, field
from .user import User

Expand All @@ -12,6 +14,6 @@ class Comment(Base, kw_only=True, frozen=True):
text: str
created_by: User
updated_by: User | None = None
created_at: str
updated_at: str | None = None
created_at: datetime
updated_at: datetime | None = None
version: int
9 changes: 6 additions & 3 deletions yatracker/types/full_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

__all__ = ["FullIssue"]


from datetime import datetime

from .base import Base, field
from .comment import Comment
from .issue import Issue
Expand Down Expand Up @@ -32,13 +35,13 @@ class FullIssue(Base, kw_only=True, frozen=True):
favorite: bool
assignee: User | None = None

last_comment_update_at: str | None = None
last_comment_update_at: datetime | None = None
aliases: list[str] | None = None
updated_by: User | None = None
created_at: str
created_at: datetime
created_by: User
votes: int
updated_at: str | None = None
updated_at: datetime | None = None
status: Status
previous_status: Status | None = None
direction: str | None = None
Expand Down