Skip to content

Commit a06be18

Browse files
authored
Merge pull request vuejs#1 from American-Soccer-Analysis/python-package
Create ASA python package
2 parents e341126 + 6b541b2 commit a06be18

File tree

16 files changed

+466
-14
lines changed

16 files changed

+466
-14
lines changed

.github/workflows/cran-publish.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: CRAN publish
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
cran-publish:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out repository code
11+
uses: actions/checkout@v2
12+
- name: Install R
13+
uses: r-lib/actions/setup-r@v1
14+
# TODO publish to CRAN

.github/workflows/python-tests.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
10+
python-version: [3.6, 3.7, 3.8, 3.9]
1111

1212
steps:
1313
- uses: actions/checkout@v2
@@ -18,8 +18,12 @@ jobs:
1818
- name: Install dependencies
1919
run: |
2020
python -m pip install --upgrade pip
21-
pip install pytest
22-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
21+
cd python-package && pip install --editable .
22+
if [ -f requirements.dev.txt ]; then pip install -r requirements.dev.txt; fi
2323
- name: Test with pytest
2424
run: |
2525
pytest tests/python/
26+
- name: Behave tests
27+
run: |
28+
cd tests
29+
behave

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Created by https://www.toptal.com/developers/gitignore/api/r,python,macos,windows,visualstudio,visualstudiocode
32
# Edit at https://www.toptal.com/developers/gitignore?templates=r,python,macos,windows,visualstudio,visualstudiocode
43

@@ -110,6 +109,7 @@ target/
110109

111110
# Jupyter Notebook
112111
.ipynb_checkpoints
112+
**.ipynb
113113

114114
# IPython
115115
profile_default/

python-package/README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,48 @@
1-
# Python package
1+
# itscalledsoccer
2+
3+
[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
4+
5+
## Table of Contents
6+
7+
- [itscalledsoccer](#itscalledsoccer)
8+
- [Table of Contents](#table-of-contents)
9+
- [Install](#install)
10+
- [Usage](#usage)
11+
- [Teams](#teams)
12+
- [Players](#players)
13+
- [Stadia](#stadia)
14+
- [Managers](#managers)
15+
- [Referees](#referees)
16+
- [Maintainers](#maintainers)
17+
- [Contributing](#contributing)
18+
- [License](#license)
19+
20+
## Install
21+
22+
```sh
23+
pip install itscalledsoccer
24+
```
25+
26+
## Usage
27+
28+
```python
29+
from itscalledsoccer.client import AmericanSoccerAnalysis
30+
31+
asa = AmericanSoccerAnalysis()
32+
```
33+
34+
### Teams
35+
36+
### Players
37+
38+
### Stadia
39+
40+
### Managers
41+
42+
### Referees
43+
44+
## Maintainers
45+
46+
## Contributing
47+
48+
## License

python-package/asa-package/core.py

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
from typing import List
2+
3+
4+
class Game:
5+
def __init__(
6+
self,
7+
game_id: str,
8+
date_time_utc: str,
9+
home_score: int,
10+
away_score: int,
11+
home_team_id: str,
12+
away_team_id: str,
13+
referee_id: str,
14+
stadium_id: str,
15+
home_manager_id: str,
16+
away_manager_id: str,
17+
expanded_minutes: int,
18+
season_name: str,
19+
matchday: int,
20+
attendance: int,
21+
knockout_game: bool,
22+
last_updated_utc: str,
23+
) -> None:
24+
self.game_id = game_id
25+
self.date_time_utc = date_time_utc
26+
self.home_score = home_score
27+
self.away_score = away_score
28+
self.home_team_id = home_team_id
29+
self.away_team_id = away_team_id
30+
self.referee_id = referee_id
31+
self.stadium_id = stadium_id
32+
self.home_manager_id = home_manager_id
33+
self.away_manager_id = away_manager_id
34+
self.expanded_minutes = expanded_minutes
35+
self.season_name = season_name
36+
self.matchday = matchday
37+
self.attendance = attendance
38+
self.knockout_game = knockout_game
39+
self.last_updated_utc = last_updated_utc
40+
41+
42+
class Manager:
43+
def __init__(self, manager_id: str, manager_name: str, nationality: str) -> None:
44+
self.manager_id = manager_id
45+
self.manager_name = manager_name
46+
self.nationality = nationality
47+
48+
49+
class Player:
50+
def __init__(
51+
self,
52+
player_id: str,
53+
player_name: str,
54+
birth_date: str,
55+
height_ft: int,
56+
height_in: int,
57+
weight_lb: int,
58+
nationality: str,
59+
primary_broad_position: str,
60+
primary_general_position: str,
61+
secondary_broad_position: str = None,
62+
secondary_general_position: str = None,
63+
season_name: List[str] = [],
64+
) -> None:
65+
self.player_id = player_id
66+
self.player_name = player_name
67+
self.birth_date = birth_date
68+
self.height_ft = height_ft
69+
self.height_in = height_in
70+
self.weight_lb = weight_lb
71+
self.nationality = nationality
72+
self.primary_broad_position = primary_broad_position
73+
self.primary_general_position = primary_general_position
74+
self.secondary_broad_position = secondary_broad_position
75+
self.secondary_general_position = secondary_general_position
76+
self.season_name = season_name
77+
78+
79+
class Referee:
80+
def __init__(self, referee_id: str, referee_name: str, nationality: str) -> None:
81+
self.referee_id = referee_id
82+
self.referee_name = referee_name
83+
self.nationality = nationality
84+
85+
86+
class Stadium:
87+
def __init__(
88+
self,
89+
stadium_id: str,
90+
stadium_name: str,
91+
capacity: int = None,
92+
year_built: int = None,
93+
roof: bool = None,
94+
turf: bool = None,
95+
street: str = None,
96+
city: str = None,
97+
province: str = None,
98+
country: str = None,
99+
postal_code: str = None,
100+
latitude: float = None,
101+
longitude: float = None,
102+
field_x: int = None,
103+
field_y: int = None,
104+
) -> None:
105+
self.stadium_id = stadium_id
106+
self.stadium_name = stadium_name
107+
self.capacity = capacity
108+
self.year_built = year_built
109+
self.roof = roof
110+
self.turf = turf
111+
self.street = street
112+
self.city = city
113+
self.province = province
114+
self.country = country
115+
self.postal_code = postal_code
116+
self.latitude = latitude
117+
self.longitude = longitude
118+
self.field_x = field_x
119+
self.field_y = field_y
120+
121+
122+
class Team:
123+
def __init__(
124+
self, team_id: str, team_name: str, team_short_name: str, team_abbreviation: str
125+
) -> None:
126+
self.team_id = team_id
127+
self.team_name = team_name
128+
self.team_short_name = team_short_name
129+
self.team_abbreviation = team_abbreviation

0 commit comments

Comments
 (0)