text stringlengths 0 828 |
|---|
else: |
tmp = FailSafe(symname=symbol, |
ind=ind, |
val=val, |
dt_log=dt_log, |
user=user, |
comment=comment, |
fsnum=next_num) |
self.ses.add(tmp) |
self.ses.commit()" |
1854,"def add_override(self, symbol, ind, val, dt_log=None, user=None, comment=None): |
"""""" |
Appends a single indexed-value pair, to a symbol object, to be |
used during the final steps of the aggregation of the datatable. |
With default settings Overrides, get applied with highest priority. |
Parameters |
---------- |
symbol : Symbol or str |
The Symbol to override |
ind : obj |
The index value where the override should be applied |
val : obj |
The data value which will be used in the override |
dt_log : datetime |
A log entry, for saving when this override was created. |
user : str |
A string representing which user made the override |
comment : str |
A string to store any notes related to this override. |
"""""" |
self._add_orfs('override', symbol, ind, val, dt_log, user, comment)" |
1855,"def get_converted(self, symbol, units='CAD', system=None, tag=None): |
"""""" |
Uses a Symbol's Dataframe, to build a new Dataframe, |
with the data converted to the new units |
Parameters |
---------- |
symbol : str or tuple of the form (Dataframe, str) |
String representing a symbol's name, or a dataframe |
with the data required to be converted. If supplying a |
dataframe, units must be passed. |
units : str, optional |
Specify the units to convert the symbol to, default to CAD |
system : str, optional |
If None, the default system specified at instantiation |
is used. System defines which conversion approach to take. |
tag : str, optional |
Tags define which set of conversion data is used. If None, the |
default tag specified at instantiation is used. |
"""""" |
if isinstance(symbol, (str, unicode)): |
sym = self.get(symbol) |
df = sym.df |
curu = sym.units |
requ = units |
elif isinstance(symbol, tuple): |
df = symbol[0] |
curu = symbol[1] |
requ = units |
else: |
raise TypeError(""Expected str or (DataFrame, str), found {}"".format(type(symbol))) |
system = system or self.default_system |
tag = tag or self.default_tag |
conv = self.converters[system][tag] |
newdf = conv.convert(df, curu, requ) |
newdf = pd.merge(df, newdf, left_index=True, right_index=True) |
newdf = newdf[df.columns[0] + ""_y""].to_frame() |
newdf.columns = df.columns |
return newdf" |
1856,"def last_cache(self,result='COMPLETE'): |
"""""" |
The date and time of the previous cache. |
Parameters |
---------- |
result : string, default 'COMPLETE' |
A string to choose which point in the log, |
should be returned. |
- COMPLETE - the last time a cache was completed |
- STARTED - the last time a cache was started |
Returns |
------- |
datetime.datetime |
"""""" |
crit = and_(SymbolLogEvent.event == 'CACHE', |
SymbolLogEvent.evresult == result) |
qry = self.log.filter(crit) |
qry = qry.order_by(SymbolLogEvent.evtime.desc()) |
t = qry.first() |
if t: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.