don't use operator module

This commit is contained in:
Jörn-Michael Miehe 2023-10-26 23:12:51 +02:00
parent afc859dff7
commit b942aeee23
2 changed files with 6 additions and 8 deletions

View file

@ -1,6 +1,5 @@
import functools
import logging
import operator
from datetime import datetime, timedelta
from typing import cast
@ -42,7 +41,7 @@ class CalDAV:
@property
@asyncify
@cachedmethod(
cache=operator.attrgetter("_cache"),
cache=lambda cls: cls._cache,
key=functools.partial(davkey, "calendars"),
)
def calendars(cls) -> list[str]:
@ -56,7 +55,7 @@ class CalDAV:
@classmethod
@asyncify
@cachedmethod(
cache=operator.attrgetter("_cache"),
cache=lambda cls: cls._cache,
key=functools.partial(davkey, "get_calendar"),
)
def get_calendar(cls, calendar_name: str) -> Calendar:
@ -69,7 +68,7 @@ class CalDAV:
@classmethod
@asyncify
@cachedmethod(
cache=operator.attrgetter("_cache"),
cache=lambda cls: cls._cache,
key=functools.partial(davkey, "get_events"),
)
def get_events(cls, calendar_name: str, cfg: Config) -> list[CalEvent]:

View file

@ -1,6 +1,5 @@
import functools
import logging
import operator
import re
from io import BytesIO
@ -56,7 +55,7 @@ class WebDAV:
@classmethod
@asyncify
@cachedmethod(
cache=operator.attrgetter("_cache"),
cache=lambda cls: cls._cache,
key=functools.partial(davkey, "list_files"),
)
def list_files(
@ -77,7 +76,7 @@ class WebDAV:
@classmethod
@asyncify
@cachedmethod(
cache=operator.attrgetter("_cache"),
cache=lambda cls: cls._cache,
key=functools.partial(davkey, "exists"),
)
def exists(cls, path: str) -> bool:
@ -91,7 +90,7 @@ class WebDAV:
@classmethod
@asyncify
@cachedmethod(
cache=operator.attrgetter("_cache"),
cache=lambda cls: cls._cache,
key=functools.partial(davkey, "read_bytes"),
)
def read_bytes(cls, path: str) -> bytes: