Skip to content

Commit

Permalink
Use datetime objects (#24)
Browse files Browse the repository at this point in the history
Closes #11
  • Loading branch information
Olegt0rr authored Aug 27, 2023
2 parents 364cccc + 0a46423 commit 727a5df
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
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

0 comments on commit 727a5df

Please sign in to comment.