Skip to content

Commit 3068868

Browse files
committed
squash import fixes into initial commit
1 parent a5881f2 commit 3068868

File tree

8 files changed

+965
-602
lines changed

8 files changed

+965
-602
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ $ soccer --help
145145

146146
For a full list of supported team and team codes [see this](soccer/teams.json).
147147

148+
A list of league and team codes is also available with:
149+
150+
```bash
151+
$ soccer --list
152+
```
153+
148154
Demo
149155
====
150156

soccer/jsonhandler.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os
2+
import json
3+
4+
def load_json(file):
5+
"""Load JSON file at app start"""
6+
here = os.path.dirname(os.path.abspath(__file__))
7+
with open(os.path.join(here, file)) as jfile:
8+
data = json.load(jfile)
9+
return data
10+
11+
TEAM_DATA = load_json("teams.json")["teams"]
12+
TEAM_NAMES = {team["code"]: team["id"] for team in TEAM_DATA}
13+
LEAGUE_DATA = load_json("leagues.json")["leagues"]
14+
LEAGUE_IDS = {league["code"]: league["id"] for league in LEAGUE_DATA}
15+
LEAGUE_PROPERTIES = {league["code"]: league["properties"] for league in LEAGUE_DATA if league["properties"] != "null"}

soccer/leagueids.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

soccer/leagueproperties.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

soccer/leagues.json

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
{
2+
"leagues":[
3+
{
4+
"properties":{
5+
"cl":[
6+
1,
7+
3
8+
],
9+
"el":[
10+
4,
11+
4
12+
],
13+
"rl":[
14+
19,
15+
20
16+
]
17+
},
18+
"name":"Ligue 1",
19+
"code":"FL",
20+
"id":396
21+
},
22+
{
23+
"properties":{
24+
"cl":[
25+
1,
26+
2
27+
],
28+
"el":[
29+
3,
30+
6
31+
],
32+
"rl":[
33+
21,
34+
24
35+
]
36+
},
37+
"name":"League One",
38+
"code":"EL1",
39+
"id":425
40+
},
41+
{
42+
"properties":{
43+
"cl":[
44+
1,
45+
3
46+
],
47+
"el":[
48+
4,
49+
5
50+
],
51+
"rl":[
52+
17,
53+
18
54+
]
55+
},
56+
"name":"Primeira Liga",
57+
"code":"PPL",
58+
"id":402
59+
},
60+
{
61+
"properties":{
62+
"cl":[
63+
1,
64+
2
65+
],
66+
"el":[
67+
3,
68+
6
69+
],
70+
"rl":[
71+
19,
72+
22
73+
]
74+
},
75+
"name":"Segunda Division",
76+
"code":"SD",
77+
"id":400
78+
},
79+
{
80+
"properties":{
81+
"cl":[
82+
1,
83+
4
84+
],
85+
"el":[
86+
5,
87+
5
88+
],
89+
"rl":[
90+
18,
91+
20
92+
]
93+
},
94+
"name":"Premier League",
95+
"code":"EPL",
96+
"id":398
97+
},
98+
{
99+
"properties":{
100+
"cl":[
101+
1,
102+
3
103+
],
104+
"el":[
105+
4,
106+
5
107+
],
108+
"rl":[
109+
18,
110+
20
111+
]
112+
},
113+
"name":"Serie A",
114+
"code":"SA",
115+
"id":401
116+
},
117+
{
118+
"properties":{
119+
"cl":[
120+
1,
121+
2
122+
],
123+
"el":[
124+
3,
125+
3
126+
],
127+
"rl":[
128+
18,
129+
20
130+
]
131+
},
132+
"name":"3. Liga",
133+
"code":"BL3",
134+
"id":403
135+
},
136+
{
137+
"properties":{
138+
"cl":[
139+
1,
140+
4
141+
],
142+
"el":[
143+
5,
144+
6
145+
],
146+
"rl":[
147+
18,
148+
20
149+
]
150+
},
151+
"name":"La Liga",
152+
"code":"LLIGA",
153+
"id":399
154+
},
155+
{
156+
"properties":{
157+
"cl":[
158+
1,
159+
2
160+
],
161+
"el":[
162+
3,
163+
3
164+
],
165+
"rl":[
166+
16,
167+
18
168+
]
169+
},
170+
"name":"2. Bundesliga",
171+
"code":"BL2",
172+
"id":395
173+
},
174+
{
175+
"properties":{
176+
"cl":[
177+
1,
178+
3
179+
],
180+
"el":[
181+
0,
182+
0
183+
],
184+
"rl":[
185+
18,
186+
20
187+
]
188+
},
189+
"name":"Ligue 2",
190+
"code":"FL2",
191+
"id":397
192+
},
193+
{
194+
"properties":{
195+
"cl":[
196+
1,
197+
4
198+
],
199+
"el":[
200+
5,
201+
6
202+
],
203+
"rl":[
204+
16,
205+
18
206+
]
207+
},
208+
"name":"Bundesliga",
209+
"code":"BL",
210+
"id":394
211+
},
212+
{
213+
"properties":{
214+
"cl":[
215+
1,
216+
2
217+
],
218+
"el":[
219+
3,
220+
3
221+
],
222+
"rl":[
223+
16,
224+
18
225+
]
226+
},
227+
"name":"Eredivisie",
228+
"code":"DED",
229+
"id":404
230+
},
231+
{
232+
"properties":"null",
233+
"name":"Champions League",
234+
"code":"CL",
235+
"id":405
236+
}
237+
]
238+
}

0 commit comments

Comments
 (0)