-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewBase.py
executable file
·51 lines (36 loc) · 1.32 KB
/
viewBase.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
48
49
50
51
#!/usr/bin/python3.4
import pickle
import os
import pprint
usersFile = "usersBase"
citiesFile = "citiesBase"
neededCities = "neededCities"
neededSongs = "neededSongs"
analizedUsers = "analizedUsers"
usersSongs = "usersSongs"
def loadData(file):
with open(file, 'rb') as f:
return pickle.load(f)
if os.stat(usersFile).st_size != 0:
users = loadData(usersFile)
if os.stat(citiesFile).st_size != 0:
cities = loadData(citiesFile)
if os.stat(neededCities).st_size != 0:
needed_cities = loadData(neededCities)
if os.stat(neededSongs).st_size != 0:
needed_songs = loadData(neededSongs)
if os.stat(analizedUsers).st_size != 0:
analized_users = loadData(analizedUsers)
if os.stat(usersSongs).st_size != 0:
users_songs = loadData(usersSongs)
print("Cities:")
for city in sorted(cities.values(), key = lambda x : x["uc"], reverse=True):
city_id = city["id"]
if city["uc"] != -1 and users.get(city_id) is not None:
print(city_id, ":\t", city["title"], " = ", len(users[city_id]["users"]), "/", city["uc"])
# print("Users:")
# for user in users_songs.keys():
# print(user, ": ", users_songs[user])
print("Analized users: ", len(analized_users), "Needed: ", len(analized_users & users_songs.keys()))
print("Statistics:")
print("Good users: ", len(users_songs.keys()), " of ", len(analized_users))