-
Notifications
You must be signed in to change notification settings - Fork 0
/
Core.py
47 lines (44 loc) · 1.19 KB
/
Core.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from DataModule import (
AData,
Hair,
StarHouse,
PoopSanctuary,
AVP,
Seveso,
Radar,
Blood,
VaccinCenter,
Blood,
FiveG,
Speed,
)
from DataModule import Coord
import random
class Core:
def __init__(self, *args) -> None:
self.__datasets: list[AData] = [
Hair('Hair'),
StarHouse('StarHouse'),
PoopSanctuary('PoopSanctuary'),
AVP('AVP'),
Blood('Blood'),
FiveG('FiveG'),
Speed('Speed'),
AVP('AVP'),
Seveso('Seveso'),
Radar('Radar'),
Blood('Blood'),
VaccinCenter('VaccinCenter')
]
def getByCoord(self, vec: dict) -> dict:
valids = []
unvalids = []
total = []
vec = Coord(float(vec['lng']), float(vec['lat']))
random.shuffle(self.__datasets)
random.shuffle([valids.extend(e.extractByCoord(vec)) for e in self.__datasets])
random.shuffle(self.__datasets)
random.shuffle([unvalids.extend(e.extractRandom()) for e in self.__datasets])
valids.extend(unvalids)
random.shuffle(valids)
return valids[:(random.randint(4, 7))]