use methods instead of properties
This commit is contained in:
@@ -80,9 +80,9 @@ async def save_proxies(*, settings: Settings, storage: ProxyStorage) -> None:
|
||||
if mmdb is not None:
|
||||
await asyncio.to_thread(mmdb.close)
|
||||
if settings.output_txt:
|
||||
sorted_proxies = sorted(storage, key=settings.sorting_key)
|
||||
sorted_proxies = sorted(storage, key=settings.get_sorting_key())
|
||||
grouped_proxies = tuple(
|
||||
(k, sorted(v, key=settings.sorting_key))
|
||||
(k, sorted(v, key=settings.get_sorting_key()))
|
||||
for k, v in storage.get_grouped().items()
|
||||
)
|
||||
for folder, anonymous_only in (
|
||||
|
||||
@@ -42,7 +42,6 @@ class Proxy:
|
||||
timeout: float | None = attrs.field(default=None, init=False, eq=False)
|
||||
exit_ip: str | None = attrs.field(default=None, init=False, eq=False)
|
||||
|
||||
@property
|
||||
def is_checked(self) -> bool:
|
||||
return self.timeout is not None
|
||||
|
||||
|
||||
@@ -231,8 +231,7 @@ class Settings:
|
||||
)
|
||||
timeout: ClientTimeout = attrs.field(converter=_timeout_converter)
|
||||
|
||||
@property
|
||||
def sorting_key(
|
||||
def get_sorting_key(
|
||||
self,
|
||||
) -> Callable[[Proxy], float] | Callable[[Proxy], tuple[int, ...]]:
|
||||
return (
|
||||
|
||||
@@ -56,7 +56,7 @@ class ProxyStorage:
|
||||
|
||||
def remove_unchecked(self) -> None:
|
||||
for p in self._proxies.copy():
|
||||
if not p.is_checked:
|
||||
if not p.is_checked():
|
||||
self._proxies.remove(p)
|
||||
|
||||
def __iter__(self) -> Iterator[Proxy]:
|
||||
|
||||
Reference in New Issue
Block a user