src.lib package¶
Submodules¶
src.lib.bs module¶
- exception src.lib.bs.BeakscriptInterpretError[source]¶
Bases:
RuntimeErrorRepresents an error encountered while evaluating a beakscript expression
- curr_eq_name: str = ''¶
- curr_equation: str = ''¶
- class src.lib.bs.TOKENS(*values)[source]¶
Bases:
EnumA list of the tokens to parse for
- BINARY_OP = 0¶
- HEADER = 3¶
- HEADER_COND = 4¶
- LIST_LITERAL = 6¶
- LITERAL = 2¶
- PAREN = 5¶
- UNARY_OP = 1¶
- class src.lib.bs.Token(token, symbol, column=0)[source]¶
Bases:
objectrepresents a token: the token enum value, the character(s) matched, and the position of ther character
- class src.lib.bs.UnpackList(iterable=(), /)[source]¶
Bases:
listMarker class designating a list intended to be unpacked by the * operator
- src.lib.bs.attempt_slice(x)[source]¶
tries to interpret the input (if a str) as a str representation of a slice, otherwise returns x
- src.lib.bs.eval_beakscript(equation, df, equation_label='')[source]¶
Main function for evaluating the inputted beakscript equation
- Parameters:
equation (str)
df (DataFrame)
- src.lib.bs.evaluate_binary_operator(lhs, rhs, op, index)[source]¶
evalutaes lhs op rhs, trying its best to return a string
- src.lib.bs.evaluate_unary_operator(x, op, index)[source]¶
evaluates op on x, trying its best to return a string
- src.lib.bs.parse_equation(equation, df)[source]¶
Tokenizes an equation string
- Parameters:
equation (str)
df (DataFrame)
- Return type:
list[Token]
- src.lib.bs.preproc_implicit_ops(tokens)[source]¶
Convert HEADER_COND tokens <h[expr]> into binary operators h [] (expr) to make rpn easier
- Parameters:
tokens (list[Token])
- src.lib.bs.rpn(tokens)[source]¶
Converts tokens into a list of reverse polish notation tokens to make parsing much easier
- Parameters:
tokens (list[Token])
- src.lib.bs.solve_rpn(rpn_tokens, df)[source]¶
parses rpn_tokens, using df to evaluate the headers
- Parameters:
rpn_tokens (list[Token])
df (DataFrame)
src.lib.data_config module¶
- class src.lib.data_config.GrafanaDataPreset(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumDefines a list of grafana field presets to auto-cast different datasets into numbers or other types
- MATCH()¶
- NONE()¶
- PREMATCH()¶
- PREMATCH_SCORE()¶
- TEAM()¶
- src.lib.data_config.get_svd_headers(svd)[source]¶
adds a ‘x Variance’ header to the input svd header to account for the variance metrics generated
- Return type:
list[str]
src.lib.data_main module¶
- class src.lib.data_main.DataField(name, data, filters)[source]¶
Bases:
objectRepresents a list of data for a field
- calc_map = {'avg': <function DataField.average>, 'fil': <function DataField.filter>, 'max': <function DataField.max>}¶
- class src.lib.data_main.Event(name='')[source]¶
Bases:
GenericRepresents a FIFO sequence of events to be run asynchrounously from the main thread (but sync with other events) that should be triggered upon an occurance
- Parameters:
name (str)
- current_event = ''¶
- current_event_len = 0¶
- current_handle_index_progress: float = 0.0¶
- event_progress = {}¶
- async fire(logging_callback, *args, **kwargs)[source]¶
Fires the event logging to logging_callback with the inputted args, which should match the type specification of the Event type parameter
- Parameters:
logging_callback (Callable[[str], None])
- global_lock = <asyncio.locks.Lock object at 0x7fc0455230e0 [unlocked]>¶
- task: Task | None¶
- class src.lib.data_main.MatchStruct[source]¶
Bases:
objectRepresents a dictionary of data for teams in a match
- class src.lib.data_main.ObjectHolder(object)[source]¶
Bases:
GenericSimple wrapper for pass-by-reference in functions
- Parameters:
object (T)
- class src.lib.data_main.Processor(disable_last_opr, tba_key, year, config_data, load_from_cache=True)[source]¶
Bases:
objectMain class of data calculation, handles all calculation basically
- NUM_TABLES = 5¶
- delete_match_scouter(mn, si)[source]¶
Deletes a match from a scouter
- Parameters:
data_filepath (str)
mn (str)
si (str)
- Return type:
None
- get_team_pred_score(team)[source]¶
Gets the predicted score of a team based on the p-metric in the config
- static mad_filter(data, c=2)[source]¶
Filters the inputted np.array by removing all entries that are farther than c * MAD from the median