mirror of
https://github.com/aclist/dztui.git
synced 2026-08-25 17:32:36 +02:00
change: import regex directly from proxy model
This commit is contained in:
parent
e2a6fa0c7e
commit
493818b770
@ -12,6 +12,9 @@ if TYPE_CHECKING:
|
||||
from dzgui.api.servers import Record
|
||||
from dzgui.model.servers import NewPlayerCount
|
||||
|
||||
DAY_REG = r"([0][7-9]|[1][0-6])"
|
||||
NIGHT_REG = r"([0][0-6]|[1][7-9]|[2][0-3])"
|
||||
|
||||
|
||||
class ProxyModelManager:
|
||||
"""
|
||||
@ -231,11 +234,9 @@ class ProxyModelManager:
|
||||
final.append(row)
|
||||
rows = final
|
||||
case strings.filter_day:
|
||||
reg = r"([0][7-9]|[1][0-6])"
|
||||
rows = [row for row in rows if not re.match(reg, row[3])]
|
||||
rows = [row for row in rows if not re.match(DAY_REG, row[3])]
|
||||
case strings.filter_night:
|
||||
reg = r"([0][0-6]|[1][7-9]|[2][0-3])"
|
||||
rows = [row for row in rows if not re.match(reg, row[3])]
|
||||
rows = [row for row in rows if not re.match(NIGHT_REG, row[3])]
|
||||
case strings.filter_nonascii:
|
||||
rows = [row for row in rows if row[0].isascii()]
|
||||
case strings.filter_lowpop:
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import re
|
||||
|
||||
day = r"([0][7-9]|[1][0-6])"
|
||||
night = r"([0][0-6]|[1][7-9]|[2][0-3])"
|
||||
from dzgui.model.proxy_model import DAY_REG, NIGHT_REG
|
||||
|
||||
|
||||
def iterate(h: str, r: str) -> None:
|
||||
for m in range(60):
|
||||
@ -13,11 +13,11 @@ def test_day() -> None:
|
||||
for h in range(17):
|
||||
if h < 7:
|
||||
continue
|
||||
iterate(h, day)
|
||||
iterate(h, DAY_REG)
|
||||
|
||||
|
||||
def test_night() -> None:
|
||||
for h in range(24):
|
||||
if 6 < h < 17:
|
||||
continue
|
||||
iterate(h, night)
|
||||
iterate(h, NIGHT_REG)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user