Files
proxy-scraper-checker/proxy_scraper_checker/folder.py
T

25 lines
541 B
Python
Raw Normal View History

2023-01-02 00:09:55 +03:00
from __future__ import annotations
2023-01-15 00:22:17 +03:00
from dataclasses import dataclass
2023-01-02 00:09:55 +03:00
from pathlib import Path
from shutil import rmtree
2023-02-19 00:07:19 +03:00
@dataclass(repr=False, eq=False)
2023-01-02 00:09:55 +03:00
class Folder:
2023-02-19 00:07:19 +03:00
__slots__ = ("path", "is_enabled", "for_anonymous", "for_geolocation")
2023-01-15 00:22:17 +03:00
path: Path
is_enabled: bool
for_anonymous: bool
for_geolocation: bool
2023-01-02 00:09:55 +03:00
def remove(self) -> None:
try:
rmtree(self.path)
except FileNotFoundError:
pass
def create(self) -> None:
self.path.mkdir(parents=True, exist_ok=True)