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

23 lines
456 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-01-15 00:22:17 +03:00
@dataclass(frozen=True)
2023-01-02 00:09:55 +03:00
class Folder:
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)