ffbot 1.2.10__tar.gz → 1.2.12__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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: ffbot
3
- Version: 1.2.10
3
+ Version: 1.2.12
4
4
  Summary: Automate playing Yahoo Fantasy Football
5
5
  Home-page: https://github.com/amarvin/fantasy-football-bot
6
6
  Author: Alex Marvin
@@ -8,10 +8,36 @@ Author-email: alex.marvin@gmail.com
8
8
  Keywords: fantasy-football bot yahoo
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python
11
12
  Classifier: Programming Language :: Python :: 3
12
- Requires-Python: >=3.0
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Requires-Python: >=3.10
13
20
  Description-Content-Type: text/markdown
14
21
  License-File: LICENSE
22
+ Requires-Dist: beautifulsoup4
23
+ Requires-Dist: loguru
24
+ Requires-Dist: lxml
25
+ Requires-Dist: pandas
26
+ Requires-Dist: pulp
27
+ Requires-Dist: requests
28
+ Requires-Dist: tqdm
29
+ Requires-Dist: user_agent
30
+ Dynamic: author
31
+ Dynamic: author-email
32
+ Dynamic: classifier
33
+ Dynamic: description
34
+ Dynamic: description-content-type
35
+ Dynamic: home-page
36
+ Dynamic: keywords
37
+ Dynamic: license-file
38
+ Dynamic: requires-dist
39
+ Dynamic: requires-python
40
+ Dynamic: summary
15
41
 
16
42
  # fantasy-football-bot (ffbot)
17
43
 
@@ -0,0 +1 @@
1
+ VERSION = "1.2.12"
@@ -21,7 +21,7 @@ IR_STATUSES = {
21
21
  "O",
22
22
  "PUP", # e.g. PUP-R
23
23
  }
24
- SOLVER_SETTINGS = PULP_CBC_CMD(msg=0)
24
+ SOLVER_SETTINGS = PULP_CBC_CMD(msg=False)
25
25
 
26
26
 
27
27
  def optimize(df, week, team, positions):
@@ -335,6 +335,10 @@ def optimize(df, week, team, positions):
335
335
 
336
336
  df_opt = pd.DataFrame(solutions, columns=solutions_headers)
337
337
  df_opt = df_opt.round(2)
338
+ for col, dtype in df_opt.dtypes.items():
339
+ if dtype != "string":
340
+ # Allow missing values
341
+ df_opt[col] = df_opt[col].astype("object")
338
342
  df_opt.fillna("", inplace=True)
339
343
  logger.info("Optimizer finished")
340
344
  return df_opt
@@ -14,7 +14,7 @@ from user_agent import generate_user_agent
14
14
 
15
15
  # A public league for current week and player IDs
16
16
  PUBLIC_LEAGUE = 101
17
- PUBLIC_LEAGUE_IDP = 413
17
+ PUBLIC_LEAGUE_IDP = 216
18
18
  SEARCH_PLAYER_GROUPS = ["QB", "WR", "RB", "TE", "K", "DEF"]
19
19
  SEARCH_PLAYER_GROUPS_IDP = ["QB", "WR", "RB", "TE", "K", "D", "DB", "DL", "LB"]
20
20
 
@@ -78,10 +78,9 @@ def scrape(league, is_IDP: bool = False):
78
78
  if not rows:
79
79
  break
80
80
  for row in rows:
81
- td = row.select("td")[1]
82
- ID = td.select_one(".player-status a")["data-ys-playerid"]
81
+ ID = row.select_one(".player-status a")["data-ys-playerid"]
83
82
  ID = int(ID)
84
- team = td.select_one(".ysf-player-name .D-b span").text
83
+ team = row.select_one(".ysf-player-name .D-b span").text
85
84
  team = team.split()[0]
86
85
  data.add((ID, team))
87
86
 
@@ -131,16 +130,16 @@ def scrape(league, is_IDP: bool = False):
131
130
  points = row2.get("Fan Pts")
132
131
  if points is None:
133
132
  continue
133
+ elif pd.isna(points) or points == "-":
134
+ # Bye week
135
+ row[week] = 0
136
+ # row[week + ' projection'] = 0
137
+ # row[week + ' actual'] = 0
134
138
  elif points[0] == "*":
135
139
  # Game hasn't occured yet
136
140
  row[week] = float(points[1:])
137
141
  # row[week + ' projection'] = float(points[1:])
138
142
  # row[week + ' actual'] = np.nan
139
- elif points == "-":
140
- # Bye week
141
- row[week] = 0
142
- # row[week + ' projection'] = 0
143
- # row[week + ' actual'] = 0
144
143
  else:
145
144
  # Game completed
146
145
  row[week] = float(points)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: ffbot
3
- Version: 1.2.10
3
+ Version: 1.2.12
4
4
  Summary: Automate playing Yahoo Fantasy Football
5
5
  Home-page: https://github.com/amarvin/fantasy-football-bot
6
6
  Author: Alex Marvin
@@ -8,10 +8,36 @@ Author-email: alex.marvin@gmail.com
8
8
  Keywords: fantasy-football bot yahoo
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python
11
12
  Classifier: Programming Language :: Python :: 3
12
- Requires-Python: >=3.0
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Requires-Python: >=3.10
13
20
  Description-Content-Type: text/markdown
14
21
  License-File: LICENSE
22
+ Requires-Dist: beautifulsoup4
23
+ Requires-Dist: loguru
24
+ Requires-Dist: lxml
25
+ Requires-Dist: pandas
26
+ Requires-Dist: pulp
27
+ Requires-Dist: requests
28
+ Requires-Dist: tqdm
29
+ Requires-Dist: user_agent
30
+ Dynamic: author
31
+ Dynamic: author-email
32
+ Dynamic: classifier
33
+ Dynamic: description
34
+ Dynamic: description-content-type
35
+ Dynamic: home-page
36
+ Dynamic: keywords
37
+ Dynamic: license-file
38
+ Dynamic: requires-dist
39
+ Dynamic: requires-python
40
+ Dynamic: summary
15
41
 
16
42
  # fantasy-football-bot (ffbot)
17
43
 
@@ -11,4 +11,6 @@ ffbot.egg-info/PKG-INFO
11
11
  ffbot.egg-info/SOURCES.txt
12
12
  ffbot.egg-info/dependency_links.txt
13
13
  ffbot.egg-info/requires.txt
14
- ffbot.egg-info/top_level.txt
14
+ ffbot.egg-info/top_level.txt
15
+ tests/test_optimizer.py
16
+ tests/test_utils.py
@@ -1,2 +1,3 @@
1
1
  [tool.isort]
2
+ color_output = true
2
3
  profile = "black"
@@ -34,11 +34,18 @@ setup(
34
34
  classifiers=[
35
35
  "Development Status :: 5 - Production/Stable",
36
36
  "License :: OSI Approved :: MIT License",
37
+ "Programming Language :: Python",
37
38
  "Programming Language :: Python :: 3",
39
+ "Programming Language :: Python :: 3 :: Only",
40
+ "Programming Language :: Python :: 3.10",
41
+ "Programming Language :: Python :: 3.11",
42
+ "Programming Language :: Python :: 3.12",
43
+ "Programming Language :: Python :: 3.13",
44
+ "Programming Language :: Python :: 3.14",
38
45
  ],
39
46
  keywords="fantasy-football bot yahoo",
40
47
  packages=find_packages(exclude=["contrib", "docs", "tests"]),
41
- python_requires=">=3.0",
48
+ python_requires=">=3.10",
42
49
  install_requires=get_requirements(),
43
50
  extra_require={
44
51
  "test": get_requirements("test"),
@@ -0,0 +1,23 @@
1
+ import pandas as pd
2
+
3
+ import ffbot
4
+
5
+ from . import POSITIONS, SCRAPER_FILE, TEAM
6
+
7
+
8
+ def test_optimize():
9
+ df, week = ffbot.load(SCRAPER_FILE)
10
+ assert week == 4
11
+ df_opt = ffbot.optimize(df, week, TEAM, POSITIONS)
12
+ desired_df_opt = """ Add Drop Total points Discounted points VOR
13
+ 0 Player 200 (WR)
14
+ 1 <current roster> 1723.27 420.2 515.9
15
+ 2 Player 221 (TE) 6.11 0.58 -19.01
16
+ 3 Player 143 (DEF) Player 101 (QB) -10.41 2.33 -16.19
17
+ 4 Player 157 (K) Player 177 (K) 4.06 2.01 4.06
18
+ 5 Player 162 (DEF) Player 140 (DEF) -1.62 0.64 -5.79
19
+ 6 Player 135 (K) Player 59 (RB) 9.26 0.37 -39.68
20
+ 7 Player 90 (WR) - Waivers (Jan 2) 9.45 3.23 17.22
21
+ 8 Player 132 (WR) 0.0 0.0 0.0
22
+ 9 Player 129 (QB) - Free Agent Player 174 (WR) 14.53 0.85 11.16""" # noqa: W291
23
+ assert df_opt.to_string() == desired_df_opt
@@ -0,0 +1,14 @@
1
+ import pandas as pd
2
+ from pandas.testing import assert_frame_equal
3
+
4
+ import ffbot
5
+
6
+ from . import SCRAPER_FILE
7
+
8
+
9
+ def test_load():
10
+ df, week = ffbot.load(SCRAPER_FILE)
11
+ desired_week = 4
12
+ assert week == desired_week
13
+ desired_df = pd.read_csv(SCRAPER_FILE)
14
+ assert_frame_equal(df, desired_df)
@@ -1 +0,0 @@
1
- VERSION = "1.2.10"
File without changes
File without changes
File without changes
File without changes
File without changes