Merge branch 'main' into ai/paper-dynasty-card-creation-15
This commit is contained in:
commit
3fd07b6d89
@ -1,8 +1,14 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
AUTH_TOKEN = {"Authorization": "Bearer Tp3aO3jhYve5NJF1IqOmJTmk"}
|
# Add project root so we can import db_calls
|
||||||
|
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||||
|
from db_calls import AUTH_TOKEN
|
||||||
|
|
||||||
PROD_URL = "https://pd.manticorum.com/api"
|
PROD_URL = "https://pd.manticorum.com/api"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
.env.example
Normal file
2
.env.example
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Paper Dynasty API
|
||||||
|
PD_API_TOKEN=your-bearer-token-here
|
||||||
@ -573,7 +573,7 @@ def stealing_line(steal_data: dict):
|
|||||||
else:
|
else:
|
||||||
good_jump = "2-12"
|
good_jump = "2-12"
|
||||||
|
|
||||||
return f'{"*" if sd[2] else ""}{good_jump}/- ({sd[1] if sd[1] else "-"}-{sd[0] if sd[0] else "-"})'
|
return f"{'*' if sd[2] else ''}{good_jump}/- ({sd[1] if sd[1] else '-'}-{sd[0] if sd[0] else '-'})"
|
||||||
|
|
||||||
|
|
||||||
def running(extra_base_pct: str):
|
def running(extra_base_pct: str):
|
||||||
@ -583,7 +583,7 @@ def running(extra_base_pct: str):
|
|||||||
xb_pct = float(extra_base_pct.strip("%")) / 80
|
xb_pct = float(extra_base_pct.strip("%")) / 80
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"calcs_batter running - {e}")
|
logger.error(f"calcs_batter running - {e}")
|
||||||
xb_pct = 20
|
return 8
|
||||||
|
|
||||||
return max(min(round(6 + (10 * xb_pct)), 17), 8)
|
return max(min(round(6 + (10 * xb_pct)), 17), 8)
|
||||||
|
|
||||||
@ -693,11 +693,11 @@ def get_batter_ratings(df_data) -> List[dict]:
|
|||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"all on base: {vl.hbp + vl.walk + vl.total_hits()} / all chances: {vl.total_chances()}"
|
f"all on base: {vl.hbp + vl.walk + vl.total_hits()} / all chances: {vl.total_chances()}"
|
||||||
f'{"*******ERROR ABOVE*******" if vl.hbp + vl.walk + vl.total_hits() != vl.total_chances() else ""}'
|
f"{'*******ERROR ABOVE*******' if vl.hbp + vl.walk + vl.total_hits() != vl.total_chances() else ''}"
|
||||||
)
|
)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"all on base: {vr.hbp + vr.walk + vr.total_hits()} / all chances: {vr.total_chances()}"
|
f"all on base: {vr.hbp + vr.walk + vr.total_hits()} / all chances: {vr.total_chances()}"
|
||||||
f'{"*******ERROR ABOVE*******" if vr.hbp + vr.walk + vr.total_hits() != vr.total_chances() else ""}'
|
f"{'*******ERROR ABOVE*******' if vr.hbp + vr.walk + vr.total_hits() != vr.total_chances() else ''}"
|
||||||
)
|
)
|
||||||
|
|
||||||
vl.calculate_strikeouts(df_data["SO_vL"], df_data["AB_vL"], df_data["H_vL"])
|
vl.calculate_strikeouts(df_data["SO_vL"], df_data["AB_vL"], df_data["H_vL"])
|
||||||
|
|||||||
@ -533,7 +533,7 @@ def get_pitching_peripherals(season: int):
|
|||||||
row_data.append(player_id)
|
row_data.append(player_id)
|
||||||
if len(headers) == 0:
|
if len(headers) == 0:
|
||||||
col_names.append("key_bbref")
|
col_names.append("key_bbref")
|
||||||
except Exception:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
row_data.append(cell.text)
|
row_data.append(cell.text)
|
||||||
if len(headers) == 0:
|
if len(headers) == 0:
|
||||||
@ -595,21 +595,21 @@ def legal_splits(tot_chances):
|
|||||||
|
|
||||||
|
|
||||||
def result_string(tba_data, row_num, split_min=None, split_max=None):
|
def result_string(tba_data, row_num, split_min=None, split_max=None):
|
||||||
bold1 = f'{"<b>" if tba_data["bold"] else ""}'
|
bold1 = f"{'<b>' if tba_data['bold'] else ''}"
|
||||||
bold2 = f'{"</b>" if tba_data["bold"] else ""}'
|
bold2 = f"{'</b>' if tba_data['bold'] else ''}"
|
||||||
row_string = f'{"<b> </b>" if int(row_num) < 10 else ""}{row_num}'
|
row_string = f"{'<b> </b>' if int(row_num) < 10 else ''}{row_num}"
|
||||||
if TESTING:
|
if TESTING:
|
||||||
print(
|
print(
|
||||||
f'adding {tba_data["string"]} to row {row_num} / '
|
f"adding {tba_data['string']} to row {row_num} / "
|
||||||
f"split_min: {split_min} / split_max: {split_max}"
|
f"split_min: {split_min} / split_max: {split_max}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# No splits; standard result
|
# No splits; standard result
|
||||||
if not split_min:
|
if not split_min:
|
||||||
return f'{bold1}{row_string}-{tba_data["string"]}{bold2}'
|
return f"{bold1}{row_string}-{tba_data['string']}{bold2}"
|
||||||
|
|
||||||
# With splits
|
# With splits
|
||||||
split_nums = f'{split_min if split_min != 20 else ""}{"-" if split_min != 20 else ""}{split_max}'
|
split_nums = f"{split_min if split_min != 20 else ''}{'-' if split_min != 20 else ''}{split_max}"
|
||||||
data_string = (
|
data_string = (
|
||||||
tba_data["sm-string"] if "sm-string" in tba_data.keys() else tba_data["string"]
|
tba_data["sm-string"] if "sm-string" in tba_data.keys() else tba_data["string"]
|
||||||
)
|
)
|
||||||
@ -618,10 +618,10 @@ def result_string(tba_data, row_num, split_min=None, split_max=None):
|
|||||||
spaces -= 3
|
spaces -= 3
|
||||||
elif "SI**" in data_string:
|
elif "SI**" in data_string:
|
||||||
spaces += 1
|
spaces += 1
|
||||||
|
elif "DO**" in data_string:
|
||||||
|
spaces -= 2
|
||||||
elif "DO*" in data_string:
|
elif "DO*" in data_string:
|
||||||
spaces -= 1
|
spaces -= 1
|
||||||
elif "DO*" in data_string:
|
|
||||||
spaces -= 2
|
|
||||||
elif "so" in data_string:
|
elif "so" in data_string:
|
||||||
spaces += 3
|
spaces += 3
|
||||||
elif "gb" in data_string:
|
elif "gb" in data_string:
|
||||||
@ -638,41 +638,39 @@ def result_string(tba_data, row_num, split_min=None, split_max=None):
|
|||||||
row_output = "<b> </b>"
|
row_output = "<b> </b>"
|
||||||
if TESTING:
|
if TESTING:
|
||||||
print(f"row_output: {row_output}")
|
print(f"row_output: {row_output}")
|
||||||
return f'{bold1}{row_output}{data_string}{" " * spaces}{split_nums}{bold2}'
|
return f"{bold1}{row_output}{data_string}{' ' * spaces}{split_nums}{bold2}"
|
||||||
|
|
||||||
|
|
||||||
def result_data(
|
def result_data(
|
||||||
tba_data, row_num, tba_data_bottom=None, top_split_max=None, fatigue=False
|
tba_data, row_num, tba_data_bottom=None, top_split_max=None, fatigue=False
|
||||||
):
|
):
|
||||||
ret_data = {}
|
ret_data = {}
|
||||||
top_bold1 = f'{"<b>" if tba_data["bold"] else ""}'
|
top_bold1 = f"{'<b>' if tba_data['bold'] else ''}"
|
||||||
top_bold2 = f'{"</b>" if tba_data["bold"] else ""}'
|
top_bold2 = f"{'</b>' if tba_data['bold'] else ''}"
|
||||||
bot_bold1 = None
|
bot_bold1 = None
|
||||||
bot_bold2 = None
|
bot_bold2 = None
|
||||||
if tba_data_bottom:
|
if tba_data_bottom:
|
||||||
bot_bold1 = f'{"<b>" if tba_data_bottom["bold"] else ""}'
|
bot_bold1 = f"{'<b>' if tba_data_bottom['bold'] else ''}"
|
||||||
bot_bold2 = f'{"</b>" if tba_data_bottom["bold"] else ""}'
|
bot_bold2 = f"{'</b>' if tba_data_bottom['bold'] else ''}"
|
||||||
|
|
||||||
if tba_data_bottom is None:
|
if tba_data_bottom is None:
|
||||||
ret_data["2d6"] = f"{top_bold1}{int(row_num)}-{top_bold2}"
|
ret_data["2d6"] = f"{top_bold1}{int(row_num)}-{top_bold2}"
|
||||||
ret_data["splits"] = f"{top_bold1}{top_bold2}"
|
ret_data["splits"] = f"{top_bold1}{top_bold2}"
|
||||||
ret_data["result"] = (
|
ret_data["result"] = (
|
||||||
f"{top_bold1}"
|
f"{top_bold1}{tba_data['string']}{' •' if fatigue else ''}{top_bold2}"
|
||||||
f'{tba_data["string"]}{" •" if fatigue else ""}'
|
|
||||||
f"{top_bold2}"
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
ret_data["2d6"] = f"{top_bold1}{int(row_num)}-{top_bold2}\n"
|
ret_data["2d6"] = f"{top_bold1}{int(row_num)}-{top_bold2}\n"
|
||||||
ret_data["splits"] = (
|
ret_data["splits"] = (
|
||||||
f'{top_bold1}1{"-" if top_split_max != 1 else ""}'
|
f"{top_bold1}1{'-' if top_split_max != 1 else ''}"
|
||||||
f'{top_split_max if top_split_max != 1 else ""}{top_bold2}\n'
|
f"{top_split_max if top_split_max != 1 else ''}{top_bold2}\n"
|
||||||
f'{bot_bold1}{top_split_max+1}{"-20" if top_split_max != 19 else ""}{bot_bold2}'
|
f"{bot_bold1}{top_split_max + 1}{'-20' if top_split_max != 19 else ''}{bot_bold2}"
|
||||||
)
|
)
|
||||||
ret_data["result"] = (
|
ret_data["result"] = (
|
||||||
f'{top_bold1}{tba_data["sm-string"] if "sm-string" in tba_data.keys() else tba_data["string"]}'
|
f"{top_bold1}{tba_data['sm-string'] if 'sm-string' in tba_data.keys() else tba_data['string']}"
|
||||||
f"{top_bold2}\n"
|
f"{top_bold2}\n"
|
||||||
f"{bot_bold1}"
|
f"{bot_bold1}"
|
||||||
f'{tba_data_bottom["sm-string"] if "sm-string" in tba_data_bottom.keys() else tba_data_bottom["string"]}'
|
f"{tba_data_bottom['sm-string'] if 'sm-string' in tba_data_bottom.keys() else tba_data_bottom['string']}"
|
||||||
f"{bot_bold2}"
|
f"{bot_bold2}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -688,9 +686,9 @@ def get_of(batter_hand, pitcher_hand, pull_side=True):
|
|||||||
|
|
||||||
if batter_hand == "S":
|
if batter_hand == "S":
|
||||||
if pitcher_hand == "L":
|
if pitcher_hand == "L":
|
||||||
return "rf" if pull_side else "rf"
|
return "lf" if pull_side else "rf"
|
||||||
else:
|
else:
|
||||||
return "lf" if pull_side else "lf"
|
return "rf" if pull_side else "lf"
|
||||||
|
|
||||||
|
|
||||||
def get_col(col_num):
|
def get_col(col_num):
|
||||||
@ -729,7 +727,7 @@ def get_position_string(all_pos: list, inc_p: bool):
|
|||||||
|
|
||||||
for x in all_pos:
|
for x in all_pos:
|
||||||
if x.position == "OF":
|
if x.position == "OF":
|
||||||
of_arm = f'{"+" if "-" not in x.arm else ""}{x.arm}'
|
of_arm = f"{'+' if '-' not in x.arm else ''}{x.arm}"
|
||||||
of_error = x.error
|
of_error = x.error
|
||||||
of_innings = x.innings
|
of_innings = x.innings
|
||||||
elif x.position == "CF":
|
elif x.position == "CF":
|
||||||
@ -744,7 +742,7 @@ def get_position_string(all_pos: list, inc_p: bool):
|
|||||||
elif x.position == "C":
|
elif x.position == "C":
|
||||||
all_def.append(
|
all_def.append(
|
||||||
(
|
(
|
||||||
f'c-{x.range}({"+" if int(x.arm) >= 0 else ""}{x.arm}) e{x.error} T-{x.overthrow}(pb-{x.pb})',
|
f"c-{x.range}({'+' if int(x.arm) >= 0 else ''}{x.arm}) e{x.error} T-{x.overthrow}(pb-{x.pb})",
|
||||||
x.innings,
|
x.innings,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -1079,7 +1077,7 @@ def mlbteam_and_franchise(mlbam_playerid):
|
|||||||
p_data["franchise"] = normalize_franchise(data["currentTeam"]["name"])
|
p_data["franchise"] = normalize_franchise(data["currentTeam"]["name"])
|
||||||
else:
|
else:
|
||||||
logger.error(
|
logger.error(
|
||||||
f'Could not set team for {mlbam_playerid}; received {data["currentTeam"]["name"]}'
|
f"Could not set team for {mlbam_playerid}; received {data['currentTeam']['name']}"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.error(
|
logger.error(
|
||||||
@ -1222,5 +1220,5 @@ def get_hand(df_data):
|
|||||||
else:
|
else:
|
||||||
return "R"
|
return "R"
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.error(f'Error in get_hand for {df_data["Name"]}')
|
logger.error(f"Error in get_hand for {df_data['Name']}")
|
||||||
return "R"
|
return "R"
|
||||||
|
|||||||
18
db_calls.py
18
db_calls.py
@ -1,10 +1,18 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import pybaseball as pb
|
import pybaseball as pb
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
from exceptions import logger
|
from exceptions import logger
|
||||||
|
|
||||||
AUTH_TOKEN = {"Authorization": "Bearer Tp3aO3jhYve5NJF1IqOmJTmk"}
|
load_dotenv()
|
||||||
|
|
||||||
|
_token = os.environ.get("PD_API_TOKEN")
|
||||||
|
if not _token:
|
||||||
|
raise EnvironmentError("PD_API_TOKEN environment variable is required")
|
||||||
|
AUTH_TOKEN = {"Authorization": f"Bearer {_token}"}
|
||||||
DB_URL = "https://pd.manticorum.com/api"
|
DB_URL = "https://pd.manticorum.com/api"
|
||||||
master_debug = True
|
master_debug = True
|
||||||
alt_database = None
|
alt_database = None
|
||||||
@ -25,7 +33,7 @@ def param_char(other_params):
|
|||||||
def get_req_url(
|
def get_req_url(
|
||||||
endpoint: str, api_ver: int = 2, object_id: int = None, params: list = None
|
endpoint: str, api_ver: int = 2, object_id: int = None, params: list = None
|
||||||
):
|
):
|
||||||
req_url = f'{DB_URL}/v{api_ver}/{endpoint}{"/" if object_id is not None else ""}{object_id if object_id is not None else ""}'
|
req_url = f"{DB_URL}/v{api_ver}/{endpoint}{'/' if object_id is not None else ''}{object_id if object_id is not None else ''}"
|
||||||
|
|
||||||
if params:
|
if params:
|
||||||
other_params = False
|
other_params = False
|
||||||
@ -39,11 +47,11 @@ def get_req_url(
|
|||||||
def log_return_value(log_string: str):
|
def log_return_value(log_string: str):
|
||||||
if master_debug:
|
if master_debug:
|
||||||
logger.info(
|
logger.info(
|
||||||
f'return: {log_string[:1200]}{" [ S N I P P E D ]" if len(log_string) > 1200 else ""}\n'
|
f"return: {log_string[:1200]}{' [ S N I P P E D ]' if len(log_string) > 1200 else ''}\n"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f'return: {log_string[:1200]}{" [ S N I P P E D ]" if len(log_string) > 1200 else ""}\n'
|
f"return: {log_string[:1200]}{' [ S N I P P E D ]' if len(log_string) > 1200 else ''}\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -183,4 +191,4 @@ def get_player_data(
|
|||||||
def player_desc(this_player) -> str:
|
def player_desc(this_player) -> str:
|
||||||
if this_player["p_name"] in this_player["description"]:
|
if this_player["p_name"] in this_player["description"]:
|
||||||
return this_player["description"]
|
return this_player["description"]
|
||||||
return f'{this_player["description"]} {this_player["p_name"]}'
|
return f"{this_player['description']} {this_player['p_name']}"
|
||||||
|
|||||||
@ -355,7 +355,7 @@ async def create_position(
|
|||||||
try:
|
try:
|
||||||
pit_positions.append(
|
pit_positions.append(
|
||||||
{
|
{
|
||||||
"player_id": int(df_data["key_bbref"]),
|
"player_id": int(float(df_data["player_id"])),
|
||||||
"position": "P",
|
"position": "P",
|
||||||
"innings": 1,
|
"innings": 1,
|
||||||
"range": 5,
|
"range": 5,
|
||||||
|
|||||||
@ -23,6 +23,8 @@ dependencies = [
|
|||||||
"pydantic>=2.9.0",
|
"pydantic>=2.9.0",
|
||||||
# AWS
|
# AWS
|
||||||
"boto3>=1.35.0",
|
"boto3>=1.35.0",
|
||||||
|
# Environment
|
||||||
|
"python-dotenv>=1.0.0",
|
||||||
# Scraping
|
# Scraping
|
||||||
"beautifulsoup4>=4.12.0",
|
"beautifulsoup4>=4.12.0",
|
||||||
"lxml>=5.0.0",
|
"lxml>=5.0.0",
|
||||||
|
|||||||
@ -23,9 +23,9 @@ multidict==6.1.0
|
|||||||
numpy==2.1.2
|
numpy==2.1.2
|
||||||
packaging==24.1
|
packaging==24.1
|
||||||
pandas==2.2.3
|
pandas==2.2.3
|
||||||
peewee
|
peewee==3.19.0
|
||||||
pillow==11.0.0
|
pillow==11.0.0
|
||||||
polars
|
polars==1.36.1
|
||||||
pluggy==1.5.0
|
pluggy==1.5.0
|
||||||
propcache==0.2.0
|
propcache==0.2.0
|
||||||
# pyarrow==17.0.0
|
# pyarrow==17.0.0
|
||||||
|
|||||||
@ -67,7 +67,7 @@ START_DATE = 20050403 # YYYYMMDD format - 2005 Opening Day
|
|||||||
# END_DATE = 20050531 # YYYYMMDD format - May PotM
|
# END_DATE = 20050531 # YYYYMMDD format - May PotM
|
||||||
END_DATE = 20050731 # End of July 2005
|
END_DATE = 20050731 # End of July 2005
|
||||||
POST_DATA = True
|
POST_DATA = True
|
||||||
LAST_WEEK_RATIO = 0.0 if PLAYER_DESCRIPTION == "Live" else 0.0
|
LAST_WEEK_RATIO = 0.0
|
||||||
LAST_TWOWEEKS_RATIO = 0.0
|
LAST_TWOWEEKS_RATIO = 0.0
|
||||||
LAST_MONTH_RATIO = 0.0
|
LAST_MONTH_RATIO = 0.0
|
||||||
|
|
||||||
|
|||||||
@ -1,75 +0,0 @@
|
|||||||
from typing import Literal
|
|
||||||
import requests
|
|
||||||
from exceptions import logger, log_exception
|
|
||||||
|
|
||||||
AUTH_TOKEN = {
|
|
||||||
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNucGhwbnV2aGp2cXprY2J3emRrIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc0NTgxMTc4NCwiZXhwIjoyMDYxMzg3Nzg0fQ.7dG_y2zU2PajBwTD8vut5GcWf3CSaZePkYW_hMf0fVg",
|
|
||||||
"apikey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNucGhwbnV2aGp2cXprY2J3emRrIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc0NTgxMTc4NCwiZXhwIjoyMDYxMzg3Nzg0fQ.7dG_y2zU2PajBwTD8vut5GcWf3CSaZePkYW_hMf0fVg",
|
|
||||||
}
|
|
||||||
DB_URL = "https://cnphpnuvhjvqzkcbwzdk.supabase.co/rest/v1"
|
|
||||||
|
|
||||||
|
|
||||||
def get_req_url(endpoint: str, params: list = None):
|
|
||||||
req_url = f"{DB_URL}/{endpoint}?"
|
|
||||||
|
|
||||||
if params:
|
|
||||||
other_params = False
|
|
||||||
for x in params:
|
|
||||||
req_url += f'{"&" if other_params else "?"}{x[0]}={x[1]}'
|
|
||||||
other_params = True
|
|
||||||
|
|
||||||
return req_url
|
|
||||||
|
|
||||||
|
|
||||||
def log_return_value(log_string: str, log_type: Literal["info", "debug"]):
|
|
||||||
if log_type == "info":
|
|
||||||
logger.info(
|
|
||||||
f'return: {log_string[:1200]}{" [ S N I P P E D ]" if len(log_string) > 1200 else ""}\n'
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
logger.debug(
|
|
||||||
f'return: {log_string[:1200]}{" [ S N I P P E D ]" if len(log_string) > 1200 else ""}\n'
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def db_get(
|
|
||||||
endpoint: str,
|
|
||||||
params: dict = None,
|
|
||||||
limit: int = 1000,
|
|
||||||
offset: int = 0,
|
|
||||||
none_okay: bool = True,
|
|
||||||
timeout: int = 3,
|
|
||||||
):
|
|
||||||
req_url = f"{DB_URL}/{endpoint}?limit={limit}&offset={offset}"
|
|
||||||
logger.info(f"HTTP GET: {req_url}, params: {params}")
|
|
||||||
|
|
||||||
response = requests.request("GET", req_url, params=params, headers=AUTH_TOKEN)
|
|
||||||
logger.info(response)
|
|
||||||
|
|
||||||
if response.status_code != requests.codes.ok:
|
|
||||||
log_exception(Exception, response.text)
|
|
||||||
|
|
||||||
data = response.json()
|
|
||||||
if isinstance(data, list) and len(data) == 0:
|
|
||||||
if none_okay:
|
|
||||||
return None
|
|
||||||
else:
|
|
||||||
log_exception(Exception, "Query returned no results and none_okay = False")
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
# async with aiohttp.ClientSession(headers=AUTH_TOKEN) as session:
|
|
||||||
# async with session.get(req_url) as r:
|
|
||||||
# logger.info(f'session info: {r}')
|
|
||||||
# if r.status == 200:
|
|
||||||
# js = await r.json()
|
|
||||||
# log_return_value(f'{js}')
|
|
||||||
# return js
|
|
||||||
# elif none_okay:
|
|
||||||
# e = await r.text()
|
|
||||||
# logger.error(e)
|
|
||||||
# return None
|
|
||||||
# else:
|
|
||||||
# e = await r.text()
|
|
||||||
# logger.error(e)
|
|
||||||
# raise ValueError(f'DB: {e}')
|
|
||||||
@ -1,10 +1,4 @@
|
|||||||
from creation_helpers import pd_positions_df, mround, sanitize_chance_output
|
from creation_helpers import mround, sanitize_chance_output
|
||||||
|
|
||||||
|
|
||||||
def test_positions_df():
|
|
||||||
cardset_19_pos = pd_positions_df(19)
|
|
||||||
|
|
||||||
assert True == True
|
|
||||||
|
|
||||||
|
|
||||||
def test_mround():
|
def test_mround():
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user