code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
system_modules = sys.modules.keys()
for module in list(self.loaded_modules):
if module not in system_modules:
self.processed_filepaths.pop(module)
self.loaded_modules.remove(module) | def _update_loaded_modules(self) | Updates the loaded modules by checking if they are still in sys.modules | 3.912244 | 3.029567 | 1.291354 |
self.axes.cla()
self.conf.ntrace = 0
self.conf.xlabel = ''
self.conf.ylabel = ''
self.conf.title = '' | def clear(self) | clear plot | 4.869579 | 4.049061 | 1.202644 |
if len(self.conf.zoom_lims) > 0:
self.conf.zoom_lims = [self.conf.zoom_lims[0]]
self.unzoom(event) | def unzoom_all(self, event=None) | zoom out full data range | 3.717345 | 3.536016 | 1.051281 |
lims = None
if len(self.conf.zoom_lims) > 1:
lims = self.conf.zoom_lims.pop()
ax = self.axes
# print 'base unzoom ', lims, set_bounds
if lims is None: # auto scale
self.conf.zoom_lims = [None]
xmin, xmax, ymin, ymax = self.data_range
... | def unzoom(self, event=None, set_bounds=True) | zoom out 1 level, or to full data range | 3.280321 | 3.21351 | 1.020791 |
"create, if needed, and return right-hand y axes"
if len(self.fig.get_axes()) < 2:
ax = self.axes.twinx()
return self.fig.get_axes()[1] | def get_right_axes(self) | create, if needed, and return right-hand y axes | 6.351916 | 3.763191 | 1.687907 |
"set plot title"
self.conf.relabel(title=s, delay_draw=delay_draw) | def set_title(self, s, delay_draw=False) | set plot title | 10.614234 | 9.317862 | 1.139128 |
"set plot xlabel"
self.conf.relabel(xlabel=s, delay_draw=delay_draw) | def set_xlabel(self, s, delay_draw=False) | set plot xlabel | 9.121777 | 7.96086 | 1.145828 |
"set plot ylabel"
self.conf.relabel(ylabel=s, delay_draw=delay_draw) | def set_ylabel(self, s, delay_draw=False) | set plot ylabel | 9.256053 | 9.112117 | 1.015796 |
"set plot ylabel"
self.conf.relabel(y2label=s, delay_draw=delay_draw) | def set_y2label(self, s, delay_draw=False) | set plot ylabel | 9.341858 | 7.904941 | 1.181775 |
file_choices = "PNG (*.png)|*.png|SVG (*.svg)|*.svg|PDF (*.pdf)|*.pdf"
try:
ofile = self.conf.title.strip()
except:
ofile = 'Image'
if len(ofile) > 64:
ofile = ofile[:63].strip()
if len(ofile) < 1:
ofile = 'plot'
f... | def save_figure(self, event=None, transparent=False, dpi=600) | save figure image to file | 2.730788 | 2.714144 | 1.006133 |
if event is None:
return
self.cursor_mode_action('leftdown', event=event)
self.ForwardEvent(event=event.guiEvent) | def onLeftDown(self, event=None) | left button down: report x,y coords, start zooming mode | 12.711001 | 11.410999 | 1.113925 |
if event is None:
return
self.cursor_mode_action('leftup', event=event)
self.canvas.draw_idle()
self.canvas.draw()
self.ForwardEvent(event=event.guiEvent) | def onLeftUp(self, event=None) | left button up | 9.287139 | 8.970805 | 1.035263 |
if event is not None:
event.Skip()
if self.HasCapture():
try:
self.ReleaseMouse()
except:
pass | def ForwardEvent(self, event=None) | finish wx event, forward it to other wx objects | 3.800605 | 3.249137 | 1.169727 |
if event is None:
return
# note that the matplotlib event location have to be converted
if event.inaxes is not None and self.popup_menu is not None:
pos = event.guiEvent.GetPosition()
wx.CallAfter(self.PopupMenu, self.popup_menu, pos)
self.cur... | def onRightDown(self, event=None) | right button down: show pop-up | 7.648662 | 7.230249 | 1.05787 |
if event is None:
return
self.cursor_mode_action('rightup', event=event)
self.ForwardEvent(event=event.guiEvent) | def onRightUp(self, event=None) | right button up: put back to cursor mode | 13.791974 | 10.933382 | 1.261455 |
if x < 1: x = 1
span = self.axes.xaxis.get_view_interval()
tmin = max(1.0, span[0])
tmax = max(2.0, span[1])
tmin = time.mktime(dates.num2date(tmin).timetuple())
tmax = time.mktime(dates.num2date(tmax).timetuple())
nhours = (tmax - tmin)/3600.0
... | def __date_format(self, x) | formatter for date x-data. primitive, and probably needs
improvement, following matplotlib's date methods. | 2.707201 | 2.632641 | 1.028322 |
" x-axis formatter "
if self.use_dates:
return self.__date_format(x)
else:
return self.__format(x, type='x') | def xformatter(self, x, pos) | x-axis formatter | 7.489113 | 7.975428 | 0.939023 |
fmt, v = '%1.5g','%1.5g'
if type == 'y':
ax = self.axes.yaxis
elif type == 'y2' and len(self.fig.get_axes()) > 1:
ax = self.fig.get_axes()[1].yaxis
else:
ax = self.axes.xaxis
try:
dtick = 0.1 * ax.get_view_interval().span... | def __format(self, x, type='x') | home built tick formatter to use with FuncFormatter():
x value to be formatted
type 'x' or 'y' or 'y2' to set which list of ticks to get
also sets self._yfmt/self._xfmt for statusbar | 2.279459 | 2.178515 | 1.046336 |
if event is None:
return
key = event.guiEvent.GetKeyCode()
if (key < wx.WXK_SPACE or key > 255):
return
ckey = chr(key)
mod = event.guiEvent.ControlDown()
if self.is_macosx:
mod = event.guiEvent.MetaDown()
if mod:
... | def __onKeyEvent(self, event=None) | handles key events on canvas | 3.480159 | 3.346347 | 1.039987 |
if event is None:
return
button = event.button or 1
handlers = {(1, 'button_press_event'): self.onLeftDown,
(1, 'button_release_event'): self.onLeftUp,
(3, 'button_press_event'): self.onRightDown,
}
# (... | def __onMouseButtonEvent(self, event=None) | general mouse press/release events. Here, event is
a MplEvent from matplotlib. This routine just dispatches
to the appropriate onLeftDown, onLeftUp, onRightDown, onRightUp....
methods. | 3.475746 | 2.808653 | 1.237513 |
try:
x, y = event.x, event.y
except:
return
self.report_motion(event=event)
if self.zoom_ini is None:
return
ini_x, ini_y, ini_xd, ini_yd = self.zoom_ini
if event.xdata is not None:
self.x_lastmove = event.xdata
... | def zoom_motion(self, event=None) | motion event handler for zoom mode | 2.677032 | 2.658558 | 1.006949 |
self.x_lastmove, self.y_lastmove = None, None
self.zoom_ini = (event.x, event.y, event.xdata, event.ydata)
self.report_leftdown(event=event) | def zoom_leftdown(self, event=None) | leftdown event handler for zoom mode | 4.591669 | 4.324643 | 1.061745 |
try:
self.report_leftdown(event=event)
except:
return
if event.inaxes:
# set lasso color
color='goldenrod'
cmap = getattr(self.conf, 'cmap', None)
if isinstance(cmap, dict):
cmap = cmap['int']
... | def lasso_leftdown(self, event=None) | leftdown event handler for lasso mode | 3.751162 | 3.747659 | 1.000935 |
headers = self.headers
endpoint = 'https://outlook.office.com/api/v2.0/me/MailFolders/' + self.id
payload = '{ "DisplayName": "' + new_folder_name + '"}'
r = requests.patch(endpoint, headers=headers, data=payload)
if check_response(r):
return_folder = r.jso... | def rename(self, new_folder_name) | Renames the Folder to the provided name.
Args:
new_folder_name: A string of the replacement name.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
Returns:
A new Folder representing the folder with ... | 3.607548 | 3.318521 | 1.087095 |
headers = self.headers
endpoint = 'https://outlook.office.com/api/v2.0/me/MailFolders/' + self.id + '/childfolders'
r = requests.get(endpoint, headers=headers)
if check_response(r):
return self._json_to_folders(self.account, r.json()) | def get_subfolders(self) | Retrieve all child Folders inside of this Folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
Returns:
List[:class:`Folder <pyOutlook.core.folder.Folder>`] | 4.469796 | 3.890285 | 1.148964 |
headers = self.headers
endpoint = 'https://outlook.office.com/api/v2.0/me/MailFolders/' + self.id
r = requests.delete(endpoint, headers=headers)
check_response(r) | def delete(self) | Deletes this Folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token. | 4.262779 | 4.121201 | 1.034354 |
# type: (Folder) -> None
headers = self.headers
endpoint = 'https://outlook.office.com/api/v2.0/me/MailFolders/' + self.id + '/move'
payload = '{ "DestinationId": "' + destination_folder.id + '"}'
r = requests.post(endpoint, headers=headers, data=payload)
if ch... | def move_into(self, destination_folder) | Move the Folder into a different folder.
This makes the Folder provided a child folder of the destination_folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
Args:
destination_folder: A :class:`Folder <pyO... | 3.686178 | 3.549472 | 1.038514 |
headers = self.headers
endpoint = 'https://outlook.office.com/api/v2.0/me/MailFolders/' + self.id + '/childfolders'
payload = '{ "DisplayName": "' + folder_name + '"}'
r = requests.post(endpoint, headers=headers, data=payload)
if check_response(r):
return_f... | def create_child_folder(self, folder_name) | Creates a child folder within the Folder it is called from and returns the new Folder object.
Args:
folder_name: The name of the folder to create
Returns: :class:`Folder <pyOutlook.core.folder.Folder>` | 3.554092 | 3.346599 | 1.062001 |
headers = self.headers
r = requests.get('https://outlook.office.com/api/v2.0/me/MailFolders/' + self.id + '/messages', headers=headers)
check_response(r)
return Message._json_to_messages(self.account, r.json()) | def messages(self) | Retrieves the messages in this Folder,
returning a list of :class:`Messages <pyOutlook.core.message.Message>`. | 4.268981 | 3.281588 | 1.300889 |
try:
expon = int(log10(abs(val)))
except (OverflowError, ValueError):
expon = 0
length = max(length, 7)
form = 'e'
prec = length - 7
if abs(expon) > 99:
prec -= 1
elif ((expon > 0 and expon < (prec+4)) or
(expon <= 0 and -expon < (prec-1))):
for... | def gformat(val, length=11) | Format a number with '%g'-like format, except that
a) the length of the output string will be the requested length.
b) positive numbers will have a leading blank.
b) the precision will be as high as possible.
c) trailing zeros will not be trimmed.
The precision will typically be le... | 3.322123 | 3.304046 | 1.005471 |
"simple wxPython pack function"
tsize = window.GetSize()
msize = window.GetMinSize()
window.SetSizer(sizer)
sizer.Fit(window)
nsize = (10*int(expand*(max(msize[0], tsize[0])/10)),
10*int(expand*(max(msize[1], tsize[1])/10.)))
window.SetSize(nsize) | def pack(window, sizer, expand=1.1) | simple wxPython pack function | 4.164464 | 3.607117 | 1.154513 |
item = menu.Append(-1, label, longtext, **kws)
kind = item.GetKind()
if kind == wx.ITEM_CHECK:
item.Check(default)
if callable(action):
parent.Bind(wx.EVT_MENU, action, item)
return item | def MenuItem(parent, menu, label='', longtext='', action=None, default=True,
**kws) | Add Item to a Menu, with action
m = Menu(parent, menu, label, longtext, action=None) | 2.229065 | 2.312645 | 0.96386 |
if hasattr(self, 'printerData'):
data = wx.PageSetupDialogData()
data.SetPrintData(self.printerData)
else:
data = wx.PageSetupDialogData()
data.SetMarginTopLeft( (15, 15) )
data.SetMarginBottomRight( (15, 15) )
dlg = wx.PageSetupDial... | def Setup(self, event=None) | set up figure for printing. Using the standard wx Printer
Setup Dialog. | 2.607411 | 2.393692 | 1.089285 |
if title is None:
title = self.title
if self.canvas is None:
self.canvas = self.parent.canvas
po1 = PrintoutWx(self.parent.canvas, title=title,
width=self.pwidth, margin=self.pmargin)
po2 = PrintoutWx(self.parent.canvas, tit... | def Preview(self, title=None, event=None) | generate Print Preview with wx Print mechanism | 3.634776 | 3.564185 | 1.019806 |
pdd = wx.PrintDialogData()
pdd.SetPrintData(self.printerData)
pdd.SetToPage(1)
printer = wx.Printer(pdd)
if title is None:
title = self.title
printout = PrintoutWx(self.parent.canvas, title=title,
width=self.pwidth, mar... | def Print(self, title=None, event=None) | Print figure using wx Print mechanism | 4.955167 | 4.804077 | 1.031451 |
out = None
if not val in (None, ''):
try:
out = float(val)
except ValueError:
return None
if numpy.isnan(out):
out = default
return out | def set_float(val) | utility to set a floating value,
useful for converting from strings | 4.610078 | 4.752718 | 0.969988 |
"set callback action"
if hasattr(action,'__call__'):
self.__action = Closure(action, **kws) | def SetAction(self, action, **kws) | set callback action | 10.137441 | 8.990112 | 1.127621 |
" keep track of cursor position within text"
try:
self.__mark = min(wx.TextCtrl.GetSelection(self)[0],
len(wx.TextCtrl.GetValue(self).strip()))
except:
self.__mark = 0 | def __GetMark(self) | keep track of cursor position within text | 7.619182 | 5.332025 | 1.428947 |
"set mark for later"
if mark is None:
mark = self.__mark
self.SetSelection(mark, mark) | def __SetMark(self, mark=None) | set mark for later | 8.730151 | 6.062863 | 1.439939 |
" main method to set value "
if value is None:
value = wx.TextCtrl.GetValue(self).strip()
self.__CheckValid(value)
self.__GetMark()
if value is not None:
wx.TextCtrl.SetValue(self, self.format % set_float(value))
if self.is_valid and hasattr(self.... | def SetValue(self, value=None, act=True) | main method to set value | 5.638183 | 5.434566 | 1.037467 |
key = event.GetKeyCode()
entry = wx.TextCtrl.GetValue(self).strip()
pos = wx.TextCtrl.GetSelection(self)
# really, the order here is important:
# 1. return sends to ValidateEntry
if key == wx.WXK_RETURN:
if not self.is_valid:
wx.Te... | def OnChar(self, event) | on Character event | 5.917199 | 5.989677 | 0.987899 |
"text event"
try:
if event.GetString() != '':
self.__CheckValid(event.GetString())
except:
pass
event.Skip() | def OnText(self, event=None) | text event | 7.19352 | 6.522757 | 1.102834 |
"check for validity of value"
val = self.__val
self.is_valid = True
try:
val = set_float(value)
if self.__min is not None and (val < self.__min):
self.is_valid = False
val = self.__min
if self.__max is not None and (val ... | def __CheckValid(self, value) | check for validity of value | 2.526177 | 2.469311 | 1.023029 |
allaxes = self.fig.get_axes()
if len(allaxes) > 1:
for ax in allaxes[1:]:
if ax in self.data_range:
self.data_range.pop(ax)
self.fig.delaxes(ax)
self.data_range = {}
self.conf.zoom_lims = []
self.conf.axes_... | def plot(self, xdata, ydata, side='left', title=None,
xlabel=None, ylabel=None, y2label=None,
use_dates=False, **kws) | plot (that is, create a new plot: clear, then oplot) | 2.720945 | 2.641685 | 1.030004 |
def unpack_tracedata(tdat, **kws):
if (isinstance(tdat, dict) and
'xdata' in tdat and 'ydata' in tdat):
xdata = tdat.pop('xdata')
ydata = tdat.pop('ydata')
out = kws
out.update(tdat)
elif isinstance(... | def plot_many(self, datalist, side='left', title=None,
xlabel=None, ylabel=None, **kws) | plot many traces at once, taking a list of (x, y) pairs | 2.636606 | 2.62647 | 1.003859 |
axes = self.axes
if side == 'right':
axes = self.get_right_axes()
dynamic_size = False
if size is None:
size = self.conf.legendfont.get_size()
dynamic_size = True
t = axes.text(x, y, text, ha=ha, va=va, size=size,
... | def add_text(self, text, x, y, side='left', size=None,
rotation=None, ha='left', va='center',
family=None, **kws) | add text at supplied x, y position | 3.014443 | 2.997591 | 1.005622 |
dx, dy = x2-x1, y2-y1
axes = self.axes
if side == 'right':
axes = self.get_right_axes()
axes.arrow(x1, y1, dx, dy, shape=shape,
length_includes_head=True,
fc=color, edgecolor=color,
width=width, head_width=hea... | def add_arrow(self, x1, y1, x2, y2, side='left',
shape='full', color='black',
width=0.01, head_width=0.03, overhang=0, **kws) | add arrow supplied x, y position | 2.220058 | 2.29103 | 0.969022 |
"set user-defined limits and apply them"
if axes is None:
axes = self.axes
if side == 'right':
axes = self.get_right_axes()
self.conf.user_limits[axes] = limits
self.unzoom_all() | def set_xylims(self, limits, axes=None, side='left') | set user-defined limits and apply them | 5.894786 | 4.613784 | 1.277647 |
for ax in self.fig.get_axes():
ax.cla()
self.conf.ntrace = 0
self.conf.xlabel = ''
self.conf.ylabel = ''
self.conf.y2label = ''
self.conf.title = ''
self.conf.data_save = {} | def clear(self) | clear plot | 4.129948 | 3.623677 | 1.139712 |
"toggle derivative of data"
if value is None:
self.conf.data_deriv = not self.conf.data_deriv
expr = self.conf.data_expr or ''
if self.conf.data_deriv:
expr = "deriv(%s)" % expr
self.write_message("plotting %s" % expr, panel=0)
... | def toggle_deriv(self, evt=None, value=None) | toggle derivative of data | 5.183593 | 4.870207 | 1.064348 |
"set log or linear scale for x, y axis"
self.conf.set_logscale(xscale=xscale, yscale=yscale,
delay_draw=delay_draw) | def set_logscale(self, event=None, xscale='linear', yscale='linear',
delay_draw=False) | set log or linear scale for x, y axis | 3.678279 | 3.035141 | 1.211897 |
"toggle legend display"
if show is None:
show = not self.conf.show_legend
self.conf.show_legend = show
self.conf.draw_legend() | def toggle_legend(self, evt=None, show=None) | toggle legend display | 4.60339 | 4.441504 | 1.036449 |
"toggle grid display"
if show is None:
show = not self.conf.show_grid
self.conf.enable_grid(show) | def toggle_grid(self, evt=None, show=None) | toggle grid display | 5.498709 | 5.241864 | 1.048999 |
if self.win_config is not None:
try:
self.win_config.Raise()
except:
self.win_config = None
if self.win_config is None:
self.win_config = PlotConfigFrame(parent=self,
config=self.c... | def configure(self, event=None) | show configuration frame | 3.572205 | 3.025264 | 1.180791 |
self.fig = Figure(self.figsize, dpi=self.dpi)
# 1 axes for now
self.gridspec = GridSpec(1,1)
kwargs = {'facecolor': self.conf.bgcolor}
if matplotlib.__version__ < "2.0":
kwargs = {'axisbg': self.conf.bgcolor}
self.axes = self.fig.add_subplot(self.... | def BuildPanel(self) | builds basic GUI panel and popup menu | 3.323213 | 3.316006 | 1.002173 |
fn = self.canvas.draw
def draw2(*a,**k):
self._updateGridSpec()
return fn(*a,**k)
self.canvas.draw = draw2 | def _updateCanvasDraw(self) | Overload of the draw function that update
axes position before each draw | 5.557442 | 5.086132 | 1.092666 |
trans = self.fig.transFigure.inverted().transform
# Static margins
l, t, r, b = self.axesmargins
(l, b), (r, t) = trans(((l, b), (r, t)))
# Extent
dl, dt, dr, db = 0, 0, 0, 0
for i, ax in enumerate(self.fig.get_axes()):
(x0, y0),(x1, y1) = a... | def get_default_margins(self) | get default margins | 2.384331 | 2.35208 | 1.013712 |
if not self.conf.auto_margins:
return
# coordinates in px -> [0,1] in figure coordinates
trans = self.fig.transFigure.inverted().transform
# Static margins
if not self.use_dates:
self.conf.margins = l, t, r, b = self.get_default_margins()
... | def autoset_margins(self) | auto-set margins left, bottom, right, top
according to the specified margins (in pixels)
and axes extent (taking into account labels,
title, axis) | 5.780288 | 5.647174 | 1.023572 |
x = self.conf.get_mpl_line(trace)
x.set_data(xdata, ydata)
datarange = [xdata.min(), xdata.max(), ydata.min(), ydata.max()]
self.conf.set_trace_datarange(datarange, trace=trace)
axes = self.axes
if side == 'right':
axes = self.get_right_axes()
... | def update_line(self, trace, xdata, ydata, side='left', draw=False,
update_limits=True) | update a single trace, for faster redraw | 3.247832 | 3.427358 | 0.94762 |
legline = event.artist
trace = self.conf.legend_map.get(legline, None)
visible = True
if trace is not None and self.conf.hidewith_legend:
line, legline, legtext = trace
visible = not line.get_visible()
line.set_visible(visible)
if ... | def __onPickEvent(self, event=None) | pick events | 3.051321 | 3.004837 | 1.01547 |
''' get userid by email '''
response, status_code = self.__pod__.Users.get_v2_user(
sessionToken=self.__session__,
email=email
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def get_userid_by_email(self, email) | get userid by email | 6.603081 | 6.859004 | 0.962688 |
''' get user id by username '''
response, status_code = self.__pod__.Users.get_v2_user(
sessionToken=self.__session__,
username=username
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def get_user_id_by_user(self, username) | get user id by username | 6.308347 | 6.65032 | 0.948578 |
''' get user by user id '''
response, status_code = self.__pod__.Users.get_v2_user(
sessionToken=self.__session__,
uid=userid
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def get_user_by_userid(self, userid) | get user by user id | 6.68439 | 6.839571 | 0.977311 |
''' check on presence of a user '''
response, status_code = self.__pod__.Presence.get_v2_user_uid_presence(
sessionToken=self.__session__,
uid=userid
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def get_user_presence(self, userid) | check on presence of a user | 7.6849 | 7.077198 | 1.085868 |
''' set presence of user '''
response, status_code = self.__pod__.Presence.post_v2_user_uid_presence(
sessionToken=self.__session__,
uid=userid,
presence=presence
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_co... | def set_user_presence(self, userid, presence) | set presence of user | 6.724019 | 6.974169 | 0.964132 |
''' add a user to a stream '''
response, status_code = self.__pod__.Users.post_v1_user_search(
sessionToken=self.__session__,
searchRequest={'query': search_str,
'filters': search_filter}
).result()
self.logger.debug('%s: %s' % (status_c... | def search_user(self, search_str, search_filter, local) | add a user to a stream | 6.687407 | 5.997439 | 1.115044 |
''' parse p12 cert and get the cert / priv key for requests module '''
# open it, using password. Supply/read your own from stdin.
p12 = crypto.load_pkcs12(open(self.p12, 'rb').read(), self.pwd)
# grab the certs / keys
p12cert = p12.get_certificate() # (signed) certificate ob... | def p12parse(self) | parse p12 cert and get the cert / priv key for requests module | 4.45786 | 3.687996 | 1.208749 |
# Check python version
if sys.version_info < (3, 0, 0):
sys.stderr.write(
'You need python 3.0 or later to run this script!' + os.linesep
)
exit(1)
# Generate requires
if platform.system() == 'Windows':
requirements_file = 'windows.txt'
else:
... | def main() | App entry point | 1.946079 | 1.934534 | 1.005968 |
''' list features the pod supports '''
response, status_code = self.__pod__.System.get_v1_admin_system_features_list(
sessionToken=self.__session__
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def list_features(self) | list features the pod supports | 9.026273 | 7.215907 | 1.250885 |
''' update features by user id '''
response, status_code = self.__pod__.User.post_v1_admin_user_uid_features_update(
sessionToken=self.__session__,
uid=userid,
payload=payload
).result()
self.logger.debug('%s: %s' % (status_code, response))
ret... | def user_feature_update(self, userid, payload) | update features by user id | 6.170598 | 6.025973 | 1.024 |
''' get avatar by user id '''
response, status_code = self.__pod__.User.get_v1_admin_user_uid_avatar(
sessionToken=self.__session,
uid=userid
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def get_user_avatar(self, userid) | get avatar by user id | 6.96279 | 6.760393 | 1.029939 |
''' updated avatar by userid '''
response, status_code = self.__pod__.User.post_v1_admin_user_uid_avatar_update(
sessionToken=self.__session,
uid=userid,
payload=payload
).result()
self.logger.debug('%s: %s' % (status_code, response))
return st... | def user_avatar_update(self, userid, payload) | updated avatar by userid | 6.472935 | 6.260029 | 1.03401 |
''' list apps '''
response, status_code = self.__pod__.AppEntitlement.get_v1_admin_app_entitlement_list(
sessionToken=self.__session__
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def list_apps(self) | list apps | 8.217553 | 8.315123 | 0.988266 |
''' get stream members '''
response, status_code = self.__pod__.Streams.get_v1_admin_stream_id_membership_list(
sessionToken=self.__session__,
id=stream_id
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def stream_members(self, stream_id) | get stream members | 6.63975 | 6.630883 | 1.001337 |
''' session info '''
response, status_code = self.__pod__.Session.get_v2_sessioninfo(
sessionToken=self.__session__
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def sessioninfo(self) | session info | 8.030864 | 8.457099 | 0.9496 |
''' list connections '''
if status is None:
status = 'ALL'
response, status_code = self.__pod__.Connection.get_v1_connection_list(
sessionToken=self.__session__,
status=status
).result()
self.logger.debug('%s: %s' % (status_code, response))
... | def list_connections(self, status=None) | list connections | 5.720924 | 5.632788 | 1.015647 |
''' get connection status '''
response, status_code = self.__pod__.Connection.get_v1_connection_user_userId_info(
sessionToken=self.__session__,
userId=userid
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def connection_status(self, userid) | get connection status | 7.271154 | 7.608356 | 0.95568 |
''' create connection '''
req_hook = 'pod/v1/connection/create'
req_args = '{ "userId": %s }' % userid
status_code, response = self.__rest__.POST_query(req_hook, req_args)
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def create_connection(self, userid) | create connection | 5.909883 | 6.2018 | 0.95293 |
''' Generic GET query method '''
# GET request methods only require sessionTokens
headers = {'content-type': 'application/json',
'sessionToken': self.__session__}
# HTTP GET query method using requests module
try:
if req_args is None:
... | def PKCS_GET_query(self, req_hook, req_args) | Generic GET query method | 3.408905 | 3.356262 | 1.015685 |
''' Generic POST query method '''
# HTTP POST queries require keyManagerTokens and sessionTokens
headers = {'Content-Type': 'application/json',
'sessionToken': self.__session__,
'keyManagerToken': self.__keymngr__}
# HTTP POST query to keymanager au... | def PKCS_POST_query(self, req_hook, req_args) | Generic POST query method | 3.619819 | 3.597959 | 1.006076 |
''' ib group member list '''
req_hook = 'pod/v1/admin/group/' + group_id + '/membership/list'
req_args = None
status_code, response = self.__rest__.GET_query(req_hook, req_args)
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def ib_group_member_list(self, group_id) | ib group member list | 5.646473 | 5.812911 | 0.971368 |
''' ib group member add '''
req_hook = 'pod/v1/admin/group/' + group_id + '/membership/add'
req_args = {'usersListId': userids}
req_args = json.dumps(req_args)
status_code, response = self.__rest__.POST_query(req_hook, req_args)
self.logger.debug('%s: %s' % (status_code, ... | def ib_group_member_add(self, group_id, userids) | ib group member add | 5.016827 | 5.074472 | 0.98864 |
''' ib group policy list '''
req_hook = 'pod/v1/admin/policy/list'
req_args = None
status_code, response = self.__rest__.GET_query(req_hook, req_args)
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def ib_group_policy_list(self) | ib group policy list | 6.357903 | 6.464926 | 0.983446 |
if self.__monitoring is False:
self.__monitoring = True
self.__monitoring_action() | def start_monitoring(self) | Enable periodically monitoring. | 7.992647 | 5.948095 | 1.343732 |
''' Generic GET query method '''
# GET request methods only require sessionTokens
headers = {'content-type': 'application/json',
'sessionToken': self.__session__}
# HTTP GET query method using requests module
try:
if req_args is None:
... | def GET_query(self, req_hook, req_args) | Generic GET query method | 4.044016 | 4.031989 | 1.002983 |
''' Generic POST query method '''
# HTTP POST queries require keyManagerTokens and sessionTokens
headers = {'Content-Type': 'application/json',
'sessionToken': self.__session__,
'keyManagerToken': self.__keymngr__}
# HTTP POST query to keymanager au... | def POST_query(self, req_hook, req_args) | Generic POST query method | 4.446239 | 4.421362 | 1.005627 |
''' instantiate objects / parse config file '''
# open config file for parsing
try:
settings = configparser.ConfigParser()
settings._interpolation = configparser.ExtendedInterpolation()
except Exception as err:
self.logger.error("Failed to instantiate ... | def connect(self) | instantiate objects / parse config file | 2.393443 | 2.308934 | 1.036601 |
''' parse the MML structure '''
hashes_c = []
mentions_c = []
soup = BeautifulSoup(mml, "lxml")
hashes = soup.find_all('hash', {"tag": True})
for hashe in hashes:
hashes_c.append(hashe['tag'])
mentions = soup.find_all('mention', {"uid": True})
... | def parse_MML(self, mml) | parse the MML structure | 3.531642 | 3.525739 | 1.001674 |
''' parse messages '''
message_parsed = []
for message in datafeed:
mid = message['id']
streamId = message['streamId']
mstring = message['message']
fromuser = message['fromUserId']
timestamp = message['timestamp']
timestamp_... | def parse_msg(self, datafeed) | parse messages | 3.624473 | 3.5292 | 1.026996 |
''' add a user to a stream '''
req_hook = 'pod/v1/room/' + str(stream_id) + '/membership/add'
req_args = '{ "id": %s }' % user_id
status_code, response = self.__rest__.POST_query(req_hook, req_args)
self.logger.debug('%s: %s' % (status_code, response))
return status_code,... | def member_add(self, stream_id, user_id) | add a user to a stream | 4.840933 | 5.162672 | 0.93768 |
''' create a stream in a non-inclusive manner '''
response, status_code = self.__pod__.Streams.post_v2_room_create(
# V2RoomAttributes
payload=payload
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def create_room(self, payload) | create a stream in a non-inclusive manner | 10.988441 | 7.590523 | 1.447653 |
''' get stream info '''
response, status_code = self.__pod__.Streams.get_v2_room_id_info(
sessionToken=self.__session__,
id=stream_id
).result()
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def stream_info(self, stream_id) | get stream info | 7.562036 | 7.806046 | 0.968741 |
''' create a stream '''
req_hook = 'pod/v1/im/create'
req_args = json.dumps(uidList)
status_code, response = self.__rest__.POST_query(req_hook, req_args)
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def create_stream(self, uidList=[]) | create a stream | 6.208386 | 6.57965 | 0.943574 |
''' update a room definition '''
req_hook = 'pod/v2/room/' + str(stream_id) + '/update'
req_args = json.dumps(room_definition)
status_code, response = self.__rest__.POST_query(req_hook, req_args)
self.logger.debug('%s: %s' % (status_code, response))
return status_code, re... | def update_room(self, stream_id, room_definition) | update a room definition | 4.682423 | 4.814714 | 0.972524 |
''' de/reactivate a stream '''
req_hook = 'pod/v1/room/' + str(stream_id) + '/setActive?active=' + self.__rest__.bool2str(status)
req_args = None
status_code, response = self.__rest__.POST_query(req_hook, req_args)
self.logger.debug('%s: %s' % (status_code, response))
ret... | def activate_stream(self, stream_id, status) | de/reactivate a stream | 6.891197 | 6.214269 | 1.108931 |
''' get list of room members '''
req_hook = 'pod/v2/room/' + str(stream_id) + '/membership/list'
req_args = None
status_code, response = self.__rest__.GET_query(req_hook, req_args)
self.logger.debug('%s: %s' % (status_code, response))
return status_code, response | def room_members(self, stream_id) | get list of room members | 5.113371 | 4.974562 | 1.027904 |
''' promote user to owner in stream '''
req_hook = 'pod/v1/room/' + stream_id + '/membership/promoteOwner'
req_args = '{ "id": %s }' % user_id
status_code, response = self.__rest__.POST_query(req_hook, req_args)
self.logger.debug('%s: %s' % (status_code, response))
return... | def promote_owner(self, stream_id, user_id) | promote user to owner in stream | 5.475583 | 5.854424 | 0.93529 |
''' search rooms '''
req_hook = 'pod/v2/room/search?skip=' + str(skip) + '&limit=' + str(limit)
json_query = {
"query": query,
"labels": labels,
"active": active,
"creator": creator
}... | def search_rooms(self, query, labels=None, active=True, creator=None, skip=0, limit=25) | search rooms | 3.771292 | 3.885872 | 0.970514 |
''' list user streams '''
req_hook = 'pod/v1/streams/list'
json_query = {
"streamTypes": types,
"includeInactiveStreams": inactive
}
req_args = json.dumps(json_query)
status_code, response = self.__rest__.POST_que... | def list_streams(self, types=[], inactive=False) | list user streams | 5.074619 | 4.847334 | 1.046889 |
try:
claims = jws.get_unverified_claims(token)
except:
raise JWTError('Error decoding token claims.')
try:
claims = json.loads(claims.decode('utf-8'))
except ValueError as e:
raise JWTError('Invalid claims string: %s' % e)
if not isinstance(claims, Mapping):
... | def get_unverified_claims(token) | Returns the decoded claims without verification of any kind.
Args:
token (str): A signed JWT to decode the headers from.
Returns:
dict: The dict representation of the token claims.
Raises:
JWTError: If there is an exception decoding the token. | 3.008549 | 3.030179 | 0.992862 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.