MCPcopy
hub / github.com/spaceandtimefdn/SxT-Python-SDK / prep_biscuits

Method prep_biscuits

src/spaceandtime/sxtbaseapi.py:56–89  ·  view source on GitHub ↗

-------------------- Accepts biscuits in various data types, and returns a list of biscuit_tokens as strings (list of str). Primary use-case is class-internal. Args: biscuits (list | str | SXTBiscuit): biscuit_tokens as a list, str, or SXTBiscuit type.

(self, biscuits=[])

Source from the content-addressed store, hash-verified

54 self.__au__ = value
55
56 def prep_biscuits(self, biscuits=[]) -> list:
57 """--------------------
58 Accepts biscuits in various data types, and returns a list of biscuit_tokens as strings (list of str).
59 Primary use-case is class-internal.
60
61 Args:
62 biscuits (list | str | SXTBiscuit): biscuit_tokens as a list, str, or SXTBiscuit type.
63
64 Returns:
65 list: biscuit_tokens as a list.
66
67 Examples:
68 >>> sxt = SpaceAndTime()
69 >>> biscuits = sxt.user.base_api.prep_biscuits(['a',['b','c'], 'd'])
70 >>> biscuits == ['a', 'b', 'c', 'd']
71 True
72 """
73 if biscuits == None or len(biscuits) == 0:
74 return []
75 elif type(biscuits) == str:
76 return [biscuits]
77 elif 'SXTBiscuit' in str(type(biscuits)):
78 return [biscuits.biscuit_token]
79 elif type(biscuits) == list:
80 rtn=[]
81 for biscuit in biscuits:
82 rtn = rtn + self.prep_biscuits(biscuit)
83 return rtn
84 else:
85 self.logger.warning(f"""Biscuit provided was an unexpected type: {type(biscuits)}
86 Type must be one of [ str | list | SXTBiscuit object | None ]
87 Ingnoring this biscuit entry. Biscuit value provided:
88 {biscuits}""")
89 return []
90
91
92 def prep_sql(self, sql_text:str) -> str:

Callers 3

sql_execMethod · 0.95
sql_exec_tamperproofMethod · 0.95

Calls

no outgoing calls

Tested by 1