James McCool
commited on
Commit
·
0512365
1
Parent(s):
24c170e
Remove docstrings from position eligibility functions in exposure_spread.py to streamline code and improve readability.
Browse files- global_func/exposure_spread.py +0 -111
global_func/exposure_spread.py
CHANGED
|
@@ -10,16 +10,6 @@ import math
|
|
| 10 |
#### makes sure to check if the player is eligible for the position before replacing them
|
| 11 |
|
| 12 |
def check_nba_position_eligibility(column_name, player_positions):
|
| 13 |
-
"""
|
| 14 |
-
Check if a player is eligible for a specific NBA column position.
|
| 15 |
-
|
| 16 |
-
Args:
|
| 17 |
-
column_name (str): The column name (PG, PG1, PG2, SG, SG1, SG2, etc.)
|
| 18 |
-
player_positions (list): List of positions the player is eligible for
|
| 19 |
-
|
| 20 |
-
Returns:
|
| 21 |
-
bool: True if player is eligible for the column
|
| 22 |
-
"""
|
| 23 |
if any(pos in column_name for pos in ['PG', 'SG', 'SF', 'PF', 'C']):
|
| 24 |
# Extract the base position from the column name
|
| 25 |
base_position = next(pos for pos in ['PG', 'SG', 'SF', 'PF', 'C'] if pos in column_name)
|
|
@@ -33,16 +23,6 @@ def check_nba_position_eligibility(column_name, player_positions):
|
|
| 33 |
return False
|
| 34 |
|
| 35 |
def check_lol_position_eligibility(column_name, player_positions):
|
| 36 |
-
"""
|
| 37 |
-
Check if a player is eligible for a specific LOL column position.
|
| 38 |
-
|
| 39 |
-
Args:
|
| 40 |
-
column_name (str): The column name (TOP, JNG, MID, ADC, SUP, UTIL)
|
| 41 |
-
player_positions (list): List of positions the player is eligible for
|
| 42 |
-
|
| 43 |
-
Returns:
|
| 44 |
-
bool: True if player is eligible for the column
|
| 45 |
-
"""
|
| 46 |
if any(pos in column_name for pos in ['TOP', 'JNG', 'MID', 'ADC', 'SUP', 'Team']):
|
| 47 |
# Extract the base position from the column name
|
| 48 |
base_position = next(pos for pos in ['TOP', 'JNG', 'MID', 'ADC', 'SUP', 'Team'] if pos in column_name)
|
|
@@ -52,16 +32,6 @@ def check_lol_position_eligibility(column_name, player_positions):
|
|
| 52 |
return False
|
| 53 |
|
| 54 |
def check_mlb_position_eligibility(column_name, player_positions):
|
| 55 |
-
"""
|
| 56 |
-
Check if a player is eligible for a specific MLB column position.
|
| 57 |
-
|
| 58 |
-
Args:
|
| 59 |
-
column_name (str): The column name (P, SP, RP, C, 1B, 2B, 3B, SS, OF)
|
| 60 |
-
player_positions (list): List of positions the player is eligible for
|
| 61 |
-
|
| 62 |
-
Returns:
|
| 63 |
-
bool: True if player is eligible for the column
|
| 64 |
-
"""
|
| 65 |
if any(pos in column_name for pos in ['P', 'SP', 'RP']):
|
| 66 |
return any(pos in ['P', 'SP', 'RP'] for pos in player_positions)
|
| 67 |
elif any(pos in column_name for pos in ['C', '1B', '2B', '3B', 'SS', 'OF']):
|
|
@@ -69,16 +39,6 @@ def check_mlb_position_eligibility(column_name, player_positions):
|
|
| 69 |
return False
|
| 70 |
|
| 71 |
def check_nfl_position_eligibility(column_name, player_positions):
|
| 72 |
-
"""
|
| 73 |
-
Check if a player is eligible for a specific NFL column position.
|
| 74 |
-
|
| 75 |
-
Args:
|
| 76 |
-
column_name (str): The column name (QB, RB, WR, TE, FLEX, DST)
|
| 77 |
-
player_positions (list): List of positions the player is eligible for
|
| 78 |
-
|
| 79 |
-
Returns:
|
| 80 |
-
bool: True if player is eligible for the column
|
| 81 |
-
"""
|
| 82 |
if any(pos in column_name for pos in ['QB', 'RB', 'WR', 'TE', 'DST']):
|
| 83 |
return any(pos in ['QB', 'RB', 'WR', 'TE', 'DST'] for pos in player_positions)
|
| 84 |
elif 'FLEX' in column_name:
|
|
@@ -88,76 +48,26 @@ def check_nfl_position_eligibility(column_name, player_positions):
|
|
| 88 |
return False
|
| 89 |
|
| 90 |
def check_golf_position_eligibility(column_name, player_positions):
|
| 91 |
-
"""
|
| 92 |
-
Check if a player is eligible for a specific Golf column position.
|
| 93 |
-
|
| 94 |
-
Args:
|
| 95 |
-
column_name (str): The column name (G)
|
| 96 |
-
player_positions (list): List of positions the player is eligible for
|
| 97 |
-
|
| 98 |
-
Returns:
|
| 99 |
-
bool: True if player is eligible for the column
|
| 100 |
-
"""
|
| 101 |
if 'FLEX' in column_name:
|
| 102 |
return any(pos in ['G'] for pos in player_positions)
|
| 103 |
return True
|
| 104 |
|
| 105 |
def check_tennis_position_eligibility(column_name, player_positions):
|
| 106 |
-
"""
|
| 107 |
-
Check if a player is eligible for a specific Tennis column position.
|
| 108 |
-
|
| 109 |
-
Args:
|
| 110 |
-
column_name (str): The column name (TEN)
|
| 111 |
-
player_positions (list): List of positions the player is eligible for
|
| 112 |
-
|
| 113 |
-
Returns:
|
| 114 |
-
bool: True if player is eligible for the column
|
| 115 |
-
"""
|
| 116 |
if 'FLEX' in column_name:
|
| 117 |
return any(pos in ['T'] for pos in player_positions)
|
| 118 |
return True
|
| 119 |
|
| 120 |
def check_mma_position_eligibility(column_name, player_positions):
|
| 121 |
-
"""
|
| 122 |
-
Check if a player is eligible for a specific MMA column position.
|
| 123 |
-
|
| 124 |
-
Args:
|
| 125 |
-
column_name (str): The column name (MMA)
|
| 126 |
-
player_positions (list): List of positions the player is eligible for
|
| 127 |
-
|
| 128 |
-
Returns:
|
| 129 |
-
bool: True if player is eligible for the column
|
| 130 |
-
"""
|
| 131 |
if 'FLEX' in column_name:
|
| 132 |
return any(pos in ['F'] for pos in player_positions)
|
| 133 |
return True
|
| 134 |
|
| 135 |
def check_nascar_position_eligibility(column_name, player_positions):
|
| 136 |
-
"""
|
| 137 |
-
Check if a player is eligible for a specific NASCAR column position.
|
| 138 |
-
|
| 139 |
-
Args:
|
| 140 |
-
column_name (str): The column name (NAS)
|
| 141 |
-
player_positions (list): List of positions the player is eligible for
|
| 142 |
-
|
| 143 |
-
Returns:
|
| 144 |
-
bool: True if player is eligible for the column
|
| 145 |
-
"""
|
| 146 |
if 'FLEX' in column_name:
|
| 147 |
return any(pos in ['D'] for pos in player_positions)
|
| 148 |
return True
|
| 149 |
|
| 150 |
def check_cfb_position_eligibility(column_name, player_positions):
|
| 151 |
-
"""
|
| 152 |
-
Check if a player is eligible for a specific CFB column position.
|
| 153 |
-
|
| 154 |
-
Args:
|
| 155 |
-
column_name (str): The column name (QB, RB, WR, TE, FLEX, DST)
|
| 156 |
-
player_positions (list): List of positions the player is eligible for
|
| 157 |
-
|
| 158 |
-
Returns:
|
| 159 |
-
bool: True if player is eligible for the column
|
| 160 |
-
"""
|
| 161 |
if any(pos in column_name for pos in ['QB', 'RB', 'WR']):
|
| 162 |
return any(pos in ['QB', 'RB', 'WR'] for pos in player_positions)
|
| 163 |
elif 'FLEX' in column_name:
|
|
@@ -167,16 +77,6 @@ def check_cfb_position_eligibility(column_name, player_positions):
|
|
| 167 |
return False
|
| 168 |
|
| 169 |
def check_nhl_position_eligibility(column_name, player_positions):
|
| 170 |
-
"""
|
| 171 |
-
Check if a player is eligible for a specific NHL column position.
|
| 172 |
-
|
| 173 |
-
Args:
|
| 174 |
-
column_name (str): The column name (C, LW, RW, D, G, UTIL)
|
| 175 |
-
player_positions (list): List of positions the player is eligible for
|
| 176 |
-
|
| 177 |
-
Returns:
|
| 178 |
-
bool: True if player is eligible for the column
|
| 179 |
-
"""
|
| 180 |
if any(pos in column_name for pos in ['C', 'W', 'D', 'G']):
|
| 181 |
return any(pos in ['C', 'W', 'D', 'G'] for pos in player_positions)
|
| 182 |
elif 'FLEX' in column_name:
|
|
@@ -186,17 +86,6 @@ def check_nhl_position_eligibility(column_name, player_positions):
|
|
| 186 |
return False
|
| 187 |
|
| 188 |
def check_position_eligibility(sport, column_name, player_positions):
|
| 189 |
-
"""
|
| 190 |
-
Main function to check position eligibility based on sport.
|
| 191 |
-
|
| 192 |
-
Args:
|
| 193 |
-
sport (str): The sport (NBA, MLB, NFL, NHL)
|
| 194 |
-
column_name (str): The column name
|
| 195 |
-
player_positions (list): List of positions the player is eligible for
|
| 196 |
-
|
| 197 |
-
Returns:
|
| 198 |
-
bool: True if player is eligible for the column
|
| 199 |
-
"""
|
| 200 |
if sport == 'NBA':
|
| 201 |
return check_nba_position_eligibility(column_name, player_positions)
|
| 202 |
elif sport == 'MLB':
|
|
|
|
| 10 |
#### makes sure to check if the player is eligible for the position before replacing them
|
| 11 |
|
| 12 |
def check_nba_position_eligibility(column_name, player_positions):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
if any(pos in column_name for pos in ['PG', 'SG', 'SF', 'PF', 'C']):
|
| 14 |
# Extract the base position from the column name
|
| 15 |
base_position = next(pos for pos in ['PG', 'SG', 'SF', 'PF', 'C'] if pos in column_name)
|
|
|
|
| 23 |
return False
|
| 24 |
|
| 25 |
def check_lol_position_eligibility(column_name, player_positions):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
if any(pos in column_name for pos in ['TOP', 'JNG', 'MID', 'ADC', 'SUP', 'Team']):
|
| 27 |
# Extract the base position from the column name
|
| 28 |
base_position = next(pos for pos in ['TOP', 'JNG', 'MID', 'ADC', 'SUP', 'Team'] if pos in column_name)
|
|
|
|
| 32 |
return False
|
| 33 |
|
| 34 |
def check_mlb_position_eligibility(column_name, player_positions):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
if any(pos in column_name for pos in ['P', 'SP', 'RP']):
|
| 36 |
return any(pos in ['P', 'SP', 'RP'] for pos in player_positions)
|
| 37 |
elif any(pos in column_name for pos in ['C', '1B', '2B', '3B', 'SS', 'OF']):
|
|
|
|
| 39 |
return False
|
| 40 |
|
| 41 |
def check_nfl_position_eligibility(column_name, player_positions):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
if any(pos in column_name for pos in ['QB', 'RB', 'WR', 'TE', 'DST']):
|
| 43 |
return any(pos in ['QB', 'RB', 'WR', 'TE', 'DST'] for pos in player_positions)
|
| 44 |
elif 'FLEX' in column_name:
|
|
|
|
| 48 |
return False
|
| 49 |
|
| 50 |
def check_golf_position_eligibility(column_name, player_positions):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
if 'FLEX' in column_name:
|
| 52 |
return any(pos in ['G'] for pos in player_positions)
|
| 53 |
return True
|
| 54 |
|
| 55 |
def check_tennis_position_eligibility(column_name, player_positions):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
if 'FLEX' in column_name:
|
| 57 |
return any(pos in ['T'] for pos in player_positions)
|
| 58 |
return True
|
| 59 |
|
| 60 |
def check_mma_position_eligibility(column_name, player_positions):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
if 'FLEX' in column_name:
|
| 62 |
return any(pos in ['F'] for pos in player_positions)
|
| 63 |
return True
|
| 64 |
|
| 65 |
def check_nascar_position_eligibility(column_name, player_positions):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
if 'FLEX' in column_name:
|
| 67 |
return any(pos in ['D'] for pos in player_positions)
|
| 68 |
return True
|
| 69 |
|
| 70 |
def check_cfb_position_eligibility(column_name, player_positions):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
if any(pos in column_name for pos in ['QB', 'RB', 'WR']):
|
| 72 |
return any(pos in ['QB', 'RB', 'WR'] for pos in player_positions)
|
| 73 |
elif 'FLEX' in column_name:
|
|
|
|
| 77 |
return False
|
| 78 |
|
| 79 |
def check_nhl_position_eligibility(column_name, player_positions):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
if any(pos in column_name for pos in ['C', 'W', 'D', 'G']):
|
| 81 |
return any(pos in ['C', 'W', 'D', 'G'] for pos in player_positions)
|
| 82 |
elif 'FLEX' in column_name:
|
|
|
|
| 86 |
return False
|
| 87 |
|
| 88 |
def check_position_eligibility(sport, column_name, player_positions):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
if sport == 'NBA':
|
| 90 |
return check_nba_position_eligibility(column_name, player_positions)
|
| 91 |
elif sport == 'MLB':
|