rustat-python-api 0.5.6__tar.gz → 0.5.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. {rustat-python-api-0.5.6/rustat_python_api.egg-info → rustat-python-api-0.5.8}/PKG-INFO +1 -1
  2. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/rustat_python_api/parser.py +14 -0
  3. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/rustat_python_api/pitch_control.py +7 -5
  4. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8/rustat_python_api.egg-info}/PKG-INFO +1 -1
  5. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/setup.py +1 -1
  6. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/LICENSE +0 -0
  7. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/README.md +0 -0
  8. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/pyproject.toml +0 -0
  9. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/rustat_python_api/__init__.py +0 -0
  10. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/rustat_python_api/config.py +0 -0
  11. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/rustat_python_api/models_api.py +0 -0
  12. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/rustat_python_api/processing.py +0 -0
  13. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/rustat_python_api/urls.py +0 -0
  14. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/rustat_python_api.egg-info/SOURCES.txt +0 -0
  15. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/rustat_python_api.egg-info/dependency_links.txt +0 -0
  16. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/rustat_python_api.egg-info/requires.txt +0 -0
  17. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/rustat_python_api.egg-info/top_level.txt +0 -0
  18. {rustat-python-api-0.5.6 → rustat-python-api-0.5.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rustat-python-api
3
- Version: 0.5.6
3
+ Version: 0.5.8
4
4
  Summary: A Python wrapper for RuStat API
5
5
  Home-page: https://github.com/dailydaniel/rustat-python-api
6
6
  Author: Daniel Zholkovsky
@@ -32,6 +32,20 @@ class RuStatParser:
32
32
  response = requests.get(query)
33
33
  return response.json()
34
34
 
35
+ def get_season_teams(self, season_id: int):
36
+ data = self.resp2data(
37
+ self.urls["tournament_teams"].format(
38
+ user=self.user,
39
+ password=self.password,
40
+ season_id=season_id
41
+ )
42
+ )
43
+
44
+ if data:
45
+ return data['data']['row']
46
+ else:
47
+ return []
48
+
35
49
  def get_rpl_info(self):
36
50
  for season_id in tqdm(range(1, 36)):
37
51
  data = self.resp2data(
@@ -148,7 +148,8 @@ class PitchControl:
148
148
  location: np.ndarray,
149
149
  time_index: int,
150
150
  home_or_away: str,
151
- half: int
151
+ half: int,
152
+ verbose: bool = False
152
153
  ):
153
154
  if home_or_away == 'h':
154
155
  data = self.locs_home[half].copy()
@@ -193,11 +194,12 @@ class PitchControl:
193
194
  Sigma = np.matmul(Sigma, np.linalg.inv(R)) ## this is not efficient, forgive me.
194
195
  out = mvn.pdf(location, mu, Sigma) / mvn.pdf(data[player_index][time_index, :], mu, Sigma)
195
196
  else:
196
- print("Data is not finite.")
197
+ if verbose:
198
+ print("Data is not finite.")
197
199
  out = np.zeros(location.shape[0])
198
200
  return out
199
201
 
200
- def fit(self, half: int, tp: int, dt: int) -> tuple:
202
+ def fit(self, half: int, tp: int, dt: int, verbose: bool = False) -> tuple:
201
203
  x = np.linspace(0, 105, dt)
202
204
  y = np.linspace(0, 68, dt)
203
205
  xx, yy = np.meshgrid(x, y)
@@ -209,10 +211,10 @@ class PitchControl:
209
211
 
210
212
  for k in self.locs_home[half].keys():
211
213
  # if len(self.locs_home[half][k]) >= tp:
212
- Zh += self.influence_function(k, locations, tp, 'h', half)
214
+ Zh += self.influence_function(k, locations, tp, 'h', half, verbose)
213
215
  for k in self.locs_away[half].keys():
214
216
  # if len(self.locs_away[half][k]) >= tp:
215
- Za += self.influence_function(k, locations, tp, 'a', half)
217
+ Za += self.influence_function(k, locations, tp, 'a', half, verbose)
216
218
 
217
219
  Zh = Zh.reshape((dt, dt))
218
220
  Za = Za.reshape((dt, dt))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rustat-python-api
3
- Version: 0.5.6
3
+ Version: 0.5.8
4
4
  Summary: A Python wrapper for RuStat API
5
5
  Home-page: https://github.com/dailydaniel/rustat-python-api
6
6
  Author: Daniel Zholkovsky
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='rustat-python-api',
5
- version='0.5.6',
5
+ version='0.5.8',
6
6
  description='A Python wrapper for RuStat API',
7
7
  long_description=open('README.md').read(),
8
8
  long_description_content_type='text/markdown',