mirror of
https://github.com/aclist/dztui.git
synced 2026-11-11 04:20:39 +01:00
fix: define constants outside of FiltrationManager
This commit is contained in:
1 parent
504a2a724c
commit
7322970c54
1 file changed
+5
-4
@@ -14,6 +14,9 @@ if TYPE_CHECKING:
|
|||||||
from dzgui.api.servers import Record
|
from dzgui.api.servers import Record
|
||||||
from dzgui.model.servers import NewPlayerCount
|
from dzgui.model.servers import NewPlayerCount
|
||||||
|
|
||||||
|
DAY_REG = r"([0][6-9]|[1][0-7])"
|
||||||
|
NIGHT_REG = r"([0][0-5]|[1][8-9]|[2][0-3])"
|
||||||
|
|
||||||
|
|
||||||
@dataclass(slots=True, frozen=True)
|
@dataclass(slots=True, frozen=True)
|
||||||
class ServerRow:
|
class ServerRow:
|
||||||
@@ -58,8 +61,6 @@ class ServerRow:
|
|||||||
|
|
||||||
class FiltrationManager:
|
class FiltrationManager:
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.DAY_REG = r"([0][6-9]|[1][0-7])"
|
|
||||||
self.NIGHT_REG = r"([0][0-5]|[1][8-9]|[2][0-3])"
|
|
||||||
|
|
||||||
self.filter_map = {
|
self.filter_map = {
|
||||||
strings.filter_3pp: self.filter_3pp,
|
strings.filter_3pp: self.filter_3pp,
|
||||||
@@ -106,10 +107,10 @@ class FiltrationManager:
|
|||||||
return rows
|
return rows
|
||||||
|
|
||||||
def filter_day(self, rows: list[ServerRow]) -> list[ServerRow]:
|
def filter_day(self, rows: list[ServerRow]) -> list[ServerRow]:
|
||||||
return [row for row in rows if not re.match(self.DAY_REG, row.time)]
|
return [row for row in rows if not re.match(DAY_REG, row.time)]
|
||||||
|
|
||||||
def filter_night(self, rows: list[ServerRow]) -> list[ServerRow]:
|
def filter_night(self, rows: list[ServerRow]) -> list[ServerRow]:
|
||||||
return [row for row in rows if not re.match(self.NIGHT_REG, row.time)]
|
return [row for row in rows if not re.match(NIGHT_REG, row.time)]
|
||||||
|
|
||||||
def filter_nonascii(self, rows: list[ServerRow]) -> list[ServerRow]:
|
def filter_nonascii(self, rows: list[ServerRow]) -> list[ServerRow]:
|
||||||
return [row for row in rows if row.name.isascii()]
|
return [row for row in rows if row.name.isascii()]
|
||||||
|
|||||||
Reference in new issue
Block a user