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

View file

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