Skip to content

Commit

Permalink
feat: switch to using fast cached_property from propcache (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Oct 3, 2024
1 parent bf2c9d2 commit e5ce415
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 19 deletions.
117 changes: 102 additions & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pyjwt = ">=2.6"
yarl = ">=1.9"
typer = ">=0.12.3"
convertertools = ">=0.5.0"
propcache = ">=0.0.0"

[tool.poetry.group.dev.dependencies]
pytest = ">=7,<9"
Expand Down
3 changes: 2 additions & 1 deletion src/uiprotect/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import time
from collections.abc import Callable
from datetime import datetime, timedelta
from functools import cached_property, partial
from functools import partial
from http import HTTPStatus
from http.cookies import Morsel, SimpleCookie
from ipaddress import IPv4Address, IPv6Address
Expand All @@ -25,6 +25,7 @@
from aiofiles import os as aos
from aiohttp import CookieJar, client_exceptions
from platformdirs import user_cache_dir, user_config_dir
from propcache import cached_property
from yarl import URL

from .data import (
Expand Down
3 changes: 2 additions & 1 deletion src/uiprotect/data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
import logging
from collections.abc import Callable
from datetime import datetime, timedelta
from functools import cache, cached_property
from functools import cache
from ipaddress import IPv4Address
from typing import TYPE_CHECKING, Any, NamedTuple, TypeVar
from uuid import UUID

from convertertools import pop_dict_set_if_none, pop_dict_tuple
from propcache import cached_property
from pydantic.v1 import BaseModel
from pydantic.v1.fields import SHAPE_DICT, SHAPE_LIST, PrivateAttr

Expand Down
3 changes: 2 additions & 1 deletion src/uiprotect/data/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import enum
from collections.abc import Callable, Coroutine
from functools import cache, cached_property
from functools import cache
from typing import Any, Literal, Optional, TypeVar, Union

from packaging.version import Version as BaseVersion
from propcache import cached_property
from pydantic.v1 import BaseModel, ConstrainedInt
from pydantic.v1.color import Color as BaseColor
from pydantic.v1.types import ConstrainedFloat, ConstrainedStr
Expand Down
3 changes: 2 additions & 1 deletion src/uiprotect/data/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
import struct
import zlib
from dataclasses import dataclass
from functools import cache, cached_property
from functools import cache
from typing import TYPE_CHECKING, Any

import orjson
from propcache import cached_property

from ..exceptions import WSDecodeError, WSEncodeError
from .types import ProtectWSPayloadFormat
Expand Down

0 comments on commit e5ce415

Please sign in to comment.