repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens listlengths 20 707 | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value | idx int64 0 252k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
newville/wxmplot | examples/floatcontrol.py | FloatCtrl.SetAction | def SetAction(self, action, **kws):
"set callback action"
if hasattr(action,'__call__'):
self.__action = Closure(action, **kws) | python | def SetAction(self, action, **kws):
"set callback action"
if hasattr(action,'__call__'):
self.__action = Closure(action, **kws) | [
"def",
"SetAction",
"(",
"self",
",",
"action",
",",
"*",
"*",
"kws",
")",
":",
"if",
"hasattr",
"(",
"action",
",",
"'__call__'",
")",
":",
"self",
".",
"__action",
"=",
"Closure",
"(",
"action",
",",
"*",
"*",
"kws",
")"
] | set callback action | [
"set",
"callback",
"action"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/floatcontrol.py#L111-L114 | train | 61,200 |
newville/wxmplot | examples/floatcontrol.py | FloatCtrl.__GetMark | def __GetMark(self):
" 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 | python | def __GetMark(self):
" 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",
")",
":",
"try",
":",
"self",
".",
"__mark",
"=",
"min",
"(",
"wx",
".",
"TextCtrl",
".",
"GetSelection",
"(",
"self",
")",
"[",
"0",
"]",
",",
"len",
"(",
"wx",
".",
"TextCtrl",
".",
"GetValue",
"(",
"self",
")",... | keep track of cursor position within text | [
"keep",
"track",
"of",
"cursor",
"position",
"within",
"text"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/floatcontrol.py#L121-L127 | train | 61,201 |
newville/wxmplot | examples/floatcontrol.py | FloatCtrl.__SetMark | def __SetMark(self, mark=None):
"set mark for later"
if mark is None:
mark = self.__mark
self.SetSelection(mark, mark) | python | def __SetMark(self, mark=None):
"set mark for later"
if mark is None:
mark = self.__mark
self.SetSelection(mark, mark) | [
"def",
"__SetMark",
"(",
"self",
",",
"mark",
"=",
"None",
")",
":",
"if",
"mark",
"is",
"None",
":",
"mark",
"=",
"self",
".",
"__mark",
"self",
".",
"SetSelection",
"(",
"mark",
",",
"mark",
")"
] | set mark for later | [
"set",
"mark",
"for",
"later"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/floatcontrol.py#L129-L133 | train | 61,202 |
newville/wxmplot | examples/floatcontrol.py | FloatCtrl.SetValue | def SetValue(self, value=None, act=True):
" 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))
... | python | def SetValue(self, value=None, act=True):
" 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))
... | [
"def",
"SetValue",
"(",
"self",
",",
"value",
"=",
"None",
",",
"act",
"=",
"True",
")",
":",
"if",
"value",
"is",
"None",
":",
"value",
"=",
"wx",
".",
"TextCtrl",
".",
"GetValue",
"(",
"self",
")",
".",
"strip",
"(",
")",
"self",
".",
"__CheckV... | main method to set value | [
"main",
"method",
"to",
"set",
"value"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/floatcontrol.py#L135-L149 | train | 61,203 |
newville/wxmplot | examples/floatcontrol.py | FloatCtrl.OnChar | def OnChar(self, event):
""" on Character event"""
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:
... | python | def OnChar(self, event):
""" on Character event"""
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:
... | [
"def",
"OnChar",
"(",
"self",
",",
"event",
")",
":",
"key",
"=",
"event",
".",
"GetKeyCode",
"(",
")",
"entry",
"=",
"wx",
".",
"TextCtrl",
".",
"GetValue",
"(",
"self",
")",
".",
"strip",
"(",
")",
"pos",
"=",
"wx",
".",
"TextCtrl",
".",
"GetSe... | on Character event | [
"on",
"Character",
"event"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/floatcontrol.py#L161-L191 | train | 61,204 |
newville/wxmplot | examples/floatcontrol.py | FloatCtrl.__CheckValid | def __CheckValid(self, value):
"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 s... | python | def __CheckValid(self, value):
"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 s... | [
"def",
"__CheckValid",
"(",
"self",
",",
"value",
")",
":",
"val",
"=",
"self",
".",
"__val",
"self",
".",
"is_valid",
"=",
"True",
"try",
":",
"val",
"=",
"set_float",
"(",
"value",
")",
"if",
"self",
".",
"__min",
"is",
"not",
"None",
"and",
"(",... | check for validity of value | [
"check",
"for",
"validity",
"of",
"value"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/floatcontrol.py#L226-L247 | train | 61,205 |
newville/wxmplot | wxmplot/plotpanel.py | PlotPanel.add_text | 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"""
axes = self.axes
if side == 'right':
axes = self.get_right_axes()
dynamic_size = False... | python | 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"""
axes = self.axes
if side == 'right':
axes = self.get_right_axes()
dynamic_size = False... | [
"def",
"add_text",
"(",
"self",
",",
"text",
",",
"x",
",",
"y",
",",
"side",
"=",
"'left'",
",",
"size",
"=",
"None",
",",
"rotation",
"=",
"None",
",",
"ha",
"=",
"'left'",
",",
"va",
"=",
"'center'",
",",
"family",
"=",
"None",
",",
"*",
"*"... | add text at supplied x, y position | [
"add",
"text",
"at",
"supplied",
"x",
"y",
"position"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotpanel.py#L323-L337 | train | 61,206 |
newville/wxmplot | wxmplot/plotpanel.py | PlotPanel.add_arrow | 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"""
dx, dy = x2-x1, y2-y1
axes = self.axes
if side == 'right':
axes = self.g... | python | 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"""
dx, dy = x2-x1, y2-y1
axes = self.axes
if side == 'right':
axes = self.g... | [
"def",
"add_arrow",
"(",
"self",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"side",
"=",
"'left'",
",",
"shape",
"=",
"'full'",
",",
"color",
"=",
"'black'",
",",
"width",
"=",
"0.01",
",",
"head_width",
"=",
"0.03",
",",
"overhang",
"=",
"... | add arrow supplied x, y position | [
"add",
"arrow",
"supplied",
"x",
"y",
"position"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotpanel.py#L339-L353 | train | 61,207 |
newville/wxmplot | wxmplot/plotpanel.py | PlotPanel.set_xylims | def set_xylims(self, limits, axes=None, side='left'):
"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() | python | def set_xylims(self, limits, axes=None, side='left'):
"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'",
")",
":",
"if",
"axes",
"is",
"None",
":",
"axes",
"=",
"self",
".",
"axes",
"if",
"side",
"==",
"'right'",
":",
"axes",
"=",
"self",
".",
"get... | set user-defined limits and apply them | [
"set",
"user",
"-",
"defined",
"limits",
"and",
"apply",
"them"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotpanel.py#L459-L466 | train | 61,208 |
newville/wxmplot | wxmplot/plotpanel.py | PlotPanel.toggle_deriv | def toggle_deriv(self, evt=None, value=None):
"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_mess... | python | def toggle_deriv(self, evt=None, value=None):
"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_mess... | [
"def",
"toggle_deriv",
"(",
"self",
",",
"evt",
"=",
"None",
",",
"value",
"=",
"None",
")",
":",
"if",
"value",
"is",
"None",
":",
"self",
".",
"conf",
".",
"data_deriv",
"=",
"not",
"self",
".",
"conf",
".",
"data_deriv",
"expr",
"=",
"self",
"."... | toggle derivative of data | [
"toggle",
"derivative",
"of",
"data"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotpanel.py#L517-L527 | train | 61,209 |
newville/wxmplot | wxmplot/plotpanel.py | PlotPanel.toggle_legend | def toggle_legend(self, evt=None, show=None):
"toggle legend display"
if show is None:
show = not self.conf.show_legend
self.conf.show_legend = show
self.conf.draw_legend() | python | def toggle_legend(self, evt=None, show=None):
"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",
")",
":",
"if",
"show",
"is",
"None",
":",
"show",
"=",
"not",
"self",
".",
"conf",
".",
"show_legend",
"self",
".",
"conf",
".",
"show_legend",
"=",
"show",
"s... | toggle legend display | [
"toggle",
"legend",
"display"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotpanel.py#L535-L540 | train | 61,210 |
newville/wxmplot | wxmplot/plotpanel.py | PlotPanel.toggle_grid | def toggle_grid(self, evt=None, show=None):
"toggle grid display"
if show is None:
show = not self.conf.show_grid
self.conf.enable_grid(show) | python | def toggle_grid(self, evt=None, show=None):
"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",
")",
":",
"if",
"show",
"is",
"None",
":",
"show",
"=",
"not",
"self",
".",
"conf",
".",
"show_grid",
"self",
".",
"conf",
".",
"enable_grid",
"(",
"show",
")"
] | toggle grid display | [
"toggle",
"grid",
"display"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotpanel.py#L542-L546 | train | 61,211 |
newville/wxmplot | wxmplot/plotpanel.py | PlotPanel.configure | def configure(self, event=None):
"""show configuration frame"""
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=se... | python | def configure(self, event=None):
"""show configuration frame"""
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=se... | [
"def",
"configure",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"if",
"self",
".",
"win_config",
"is",
"not",
"None",
":",
"try",
":",
"self",
".",
"win_config",
".",
"Raise",
"(",
")",
"except",
":",
"self",
".",
"win_config",
"=",
"None",
"... | show configuration frame | [
"show",
"configuration",
"frame"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotpanel.py#L548-L560 | train | 61,212 |
newville/wxmplot | wxmplot/plotpanel.py | PlotPanel._updateCanvasDraw | def _updateCanvasDraw(self):
""" Overload of the draw function that update
axes position before each draw"""
fn = self.canvas.draw
def draw2(*a,**k):
self._updateGridSpec()
return fn(*a,**k)
self.canvas.draw = draw2 | python | def _updateCanvasDraw(self):
""" Overload of the draw function that update
axes position before each draw"""
fn = self.canvas.draw
def draw2(*a,**k):
self._updateGridSpec()
return fn(*a,**k)
self.canvas.draw = draw2 | [
"def",
"_updateCanvasDraw",
"(",
"self",
")",
":",
"fn",
"=",
"self",
".",
"canvas",
".",
"draw",
"def",
"draw2",
"(",
"*",
"a",
",",
"*",
"*",
"k",
")",
":",
"self",
".",
"_updateGridSpec",
"(",
")",
"return",
"fn",
"(",
"*",
"a",
",",
"*",
"*... | Overload of the draw function that update
axes position before each draw | [
"Overload",
"of",
"the",
"draw",
"function",
"that",
"update",
"axes",
"position",
"before",
"each",
"draw"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotpanel.py#L603-L610 | train | 61,213 |
newville/wxmplot | wxmplot/plotpanel.py | PlotPanel.get_default_margins | def get_default_margins(self):
"""get default margins"""
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... | python | def get_default_margins(self):
"""get default margins"""
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... | [
"def",
"get_default_margins",
"(",
"self",
")",
":",
"trans",
"=",
"self",
".",
"fig",
".",
"transFigure",
".",
"inverted",
"(",
")",
".",
"transform",
"# Static margins",
"l",
",",
"t",
",",
"r",
",",
"b",
"=",
"self",
".",
"axesmargins",
"(",
"l",
... | get default margins | [
"get",
"default",
"margins"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotpanel.py#L612-L634 | train | 61,214 |
newville/wxmplot | wxmplot/plotpanel.py | PlotPanel.update_line | def update_line(self, trace, xdata, ydata, side='left', draw=False,
update_limits=True):
""" update a single trace, for faster redraw """
x = self.conf.get_mpl_line(trace)
x.set_data(xdata, ydata)
datarange = [xdata.min(), xdata.max(), ydata.min(), ydata.max()]
... | python | def update_line(self, trace, xdata, ydata, side='left', draw=False,
update_limits=True):
""" update a single trace, for faster redraw """
x = self.conf.get_mpl_line(trace)
x.set_data(xdata, ydata)
datarange = [xdata.min(), xdata.max(), ydata.min(), ydata.max()]
... | [
"def",
"update_line",
"(",
"self",
",",
"trace",
",",
"xdata",
",",
"ydata",
",",
"side",
"=",
"'left'",
",",
"draw",
"=",
"False",
",",
"update_limits",
"=",
"True",
")",
":",
"x",
"=",
"self",
".",
"conf",
".",
"get_mpl_line",
"(",
"trace",
")",
... | update a single trace, for faster redraw | [
"update",
"a",
"single",
"trace",
"for",
"faster",
"redraw"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotpanel.py#L662-L677 | train | 61,215 |
symphonyoss/python-symphony | symphony/Pod/users.py | Users.get_userid_by_email | def get_userid_by_email(self, email):
''' 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, respon... | python | def get_userid_by_email(self, email):
''' 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, respon... | [
"def",
"get_userid_by_email",
"(",
"self",
",",
"email",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"Users",
".",
"get_v2_user",
"(",
"sessionToken",
"=",
"self",
".",
"__session__",
",",
"email",
"=",
"email",
")",
".",
... | get userid by email | [
"get",
"userid",
"by",
"email"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/users.py#L19-L26 | train | 61,216 |
symphonyoss/python-symphony | symphony/Pod/users.py | Users.get_user_id_by_user | def get_user_id_by_user(self, username):
''' 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... | python | def get_user_id_by_user(self, username):
''' 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... | [
"def",
"get_user_id_by_user",
"(",
"self",
",",
"username",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"Users",
".",
"get_v2_user",
"(",
"sessionToken",
"=",
"self",
".",
"__session__",
",",
"username",
"=",
"username",
")",
... | get user id by username | [
"get",
"user",
"id",
"by",
"username"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/users.py#L28-L35 | train | 61,217 |
symphonyoss/python-symphony | symphony/Pod/users.py | Users.get_user_by_userid | def get_user_by_userid(self, userid):
''' 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, respons... | python | def get_user_by_userid(self, userid):
''' 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, respons... | [
"def",
"get_user_by_userid",
"(",
"self",
",",
"userid",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"Users",
".",
"get_v2_user",
"(",
"sessionToken",
"=",
"self",
".",
"__session__",
",",
"uid",
"=",
"userid",
")",
".",
"... | get user by user id | [
"get",
"user",
"by",
"user",
"id"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/users.py#L37-L44 | train | 61,218 |
symphonyoss/python-symphony | symphony/Pod/users.py | Users.get_user_presence | def get_user_presence(self, userid):
''' 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))
retu... | python | def get_user_presence(self, userid):
''' 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))
retu... | [
"def",
"get_user_presence",
"(",
"self",
",",
"userid",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"Presence",
".",
"get_v2_user_uid_presence",
"(",
"sessionToken",
"=",
"self",
".",
"__session__",
",",
"uid",
"=",
"userid",
... | check on presence of a user | [
"check",
"on",
"presence",
"of",
"a",
"user"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/users.py#L46-L53 | train | 61,219 |
symphonyoss/python-symphony | symphony/Pod/users.py | Users.set_user_presence | def set_user_presence(self, userid, presence):
''' 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' % (s... | python | def set_user_presence(self, userid, presence):
''' 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' % (s... | [
"def",
"set_user_presence",
"(",
"self",
",",
"userid",
",",
"presence",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"Presence",
".",
"post_v2_user_uid_presence",
"(",
"sessionToken",
"=",
"self",
".",
"__session__",
",",
"uid",... | set presence of user | [
"set",
"presence",
"of",
"user"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/users.py#L55-L63 | train | 61,220 |
symphonyoss/python-symphony | symphony/Pod/admin.py | Admin.list_features | def list_features(self):
''' 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 | python | def list_features(self):
''' 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",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"System",
".",
"get_v1_admin_system_features_list",
"(",
"sessionToken",
"=",
"self",
".",
"__session__",
")",
".",
"result",
"(",
")",
"self",
"... | list features the pod supports | [
"list",
"features",
"the",
"pod",
"supports"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/admin.py#L19-L25 | train | 61,221 |
symphonyoss/python-symphony | symphony/Pod/admin.py | Admin.user_feature_update | def user_feature_update(self, userid, payload):
''' 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... | python | def user_feature_update(self, userid, payload):
''' 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... | [
"def",
"user_feature_update",
"(",
"self",
",",
"userid",
",",
"payload",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"User",
".",
"post_v1_admin_user_uid_features_update",
"(",
"sessionToken",
"=",
"self",
".",
"__session__",
","... | update features by user id | [
"update",
"features",
"by",
"user",
"id"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/admin.py#L27-L35 | train | 61,222 |
symphonyoss/python-symphony | symphony/Pod/admin.py | Admin.get_user_avatar | def get_user_avatar(self, userid):
''' 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_... | python | def get_user_avatar(self, userid):
''' 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_... | [
"def",
"get_user_avatar",
"(",
"self",
",",
"userid",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"User",
".",
"get_v1_admin_user_uid_avatar",
"(",
"sessionToken",
"=",
"self",
".",
"__session",
",",
"uid",
"=",
"userid",
")",... | get avatar by user id | [
"get",
"avatar",
"by",
"user",
"id"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/admin.py#L37-L44 | train | 61,223 |
symphonyoss/python-symphony | symphony/Pod/admin.py | Admin.user_avatar_update | def user_avatar_update(self, userid, payload):
''' 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: %... | python | def user_avatar_update(self, userid, payload):
''' 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: %... | [
"def",
"user_avatar_update",
"(",
"self",
",",
"userid",
",",
"payload",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"User",
".",
"post_v1_admin_user_uid_avatar_update",
"(",
"sessionToken",
"=",
"self",
".",
"__session",
",",
"... | updated avatar by userid | [
"updated",
"avatar",
"by",
"userid"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/admin.py#L46-L54 | train | 61,224 |
symphonyoss/python-symphony | symphony/Pod/admin.py | Admin.stream_members | def stream_members(self, stream_id):
''' 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))
... | python | def stream_members(self, stream_id):
''' 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))
... | [
"def",
"stream_members",
"(",
"self",
",",
"stream_id",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"Streams",
".",
"get_v1_admin_stream_id_membership_list",
"(",
"sessionToken",
"=",
"self",
".",
"__session__",
",",
"id",
"=",
... | get stream members | [
"get",
"stream",
"members"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/admin.py#L64-L71 | train | 61,225 |
symphonyoss/python-symphony | symphony/Pod/connections.py | Connections.connection_status | def connection_status(self, userid):
''' 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))
... | python | def connection_status(self, userid):
''' 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))
... | [
"def",
"connection_status",
"(",
"self",
",",
"userid",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"Connection",
".",
"get_v1_connection_user_userId_info",
"(",
"sessionToken",
"=",
"self",
".",
"__session__",
",",
"userId",
"=",... | get connection status | [
"get",
"connection",
"status"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/connections.py#L38-L45 | train | 61,226 |
symphonyoss/python-symphony | symphony/Pod/groups.py | Groups.ib_group_member_list | def ib_group_member_list(self, group_id):
''' 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))
... | python | def ib_group_member_list(self, group_id):
''' 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))
... | [
"def",
"ib_group_member_list",
"(",
"self",
",",
"group_id",
")",
":",
"req_hook",
"=",
"'pod/v1/admin/group/'",
"+",
"group_id",
"+",
"'/membership/list'",
"req_args",
"=",
"None",
"status_code",
",",
"response",
"=",
"self",
".",
"__rest__",
".",
"GET_query",
... | ib group member list | [
"ib",
"group",
"member",
"list"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/groups.py#L29-L35 | train | 61,227 |
symphonyoss/python-symphony | symphony/Pod/groups.py | Groups.ib_group_member_add | def ib_group_member_add(self, group_id, userids):
''' 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)
... | python | def ib_group_member_add(self, group_id, userids):
''' 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)
... | [
"def",
"ib_group_member_add",
"(",
"self",
",",
"group_id",
",",
"userids",
")",
":",
"req_hook",
"=",
"'pod/v1/admin/group/'",
"+",
"group_id",
"+",
"'/membership/add'",
"req_args",
"=",
"{",
"'usersListId'",
":",
"userids",
"}",
"req_args",
"=",
"json",
".",
... | ib group member add | [
"ib",
"group",
"member",
"add"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/groups.py#L37-L44 | train | 61,228 |
symphonyoss/python-symphony | symphony/Pod/groups.py | Groups.ib_group_policy_list | def ib_group_policy_list(self):
''' 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 | python | def ib_group_policy_list(self):
''' 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",
")",
":",
"req_hook",
"=",
"'pod/v1/admin/policy/list'",
"req_args",
"=",
"None",
"status_code",
",",
"response",
"=",
"self",
".",
"__rest__",
".",
"GET_query",
"(",
"req_hook",
",",
"req_args",
")",
"self",
".",
"l... | ib group policy list | [
"ib",
"group",
"policy",
"list"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/groups.py#L46-L52 | train | 61,229 |
it-geeks-club/pyspectator | pyspectator/monitoring.py | AbcMonitor.start_monitoring | def start_monitoring(self):
"""Enable periodically monitoring.
"""
if self.__monitoring is False:
self.__monitoring = True
self.__monitoring_action() | python | def start_monitoring(self):
"""Enable periodically monitoring.
"""
if self.__monitoring is False:
self.__monitoring = True
self.__monitoring_action() | [
"def",
"start_monitoring",
"(",
"self",
")",
":",
"if",
"self",
".",
"__monitoring",
"is",
"False",
":",
"self",
".",
"__monitoring",
"=",
"True",
"self",
".",
"__monitoring_action",
"(",
")"
] | Enable periodically monitoring. | [
"Enable",
"periodically",
"monitoring",
"."
] | 356a808b1b29575fd47a85a2611fe50f1afeea8a | https://github.com/it-geeks-club/pyspectator/blob/356a808b1b29575fd47a85a2611fe50f1afeea8a/pyspectator/monitoring.py#L31-L36 | train | 61,230 |
symphonyoss/python-symphony | symphony/Mml/__init__.py | Mml.parse_MML | def parse_MML(self, mml):
''' 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... | python | def parse_MML(self, mml):
''' 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... | [
"def",
"parse_MML",
"(",
"self",
",",
"mml",
")",
":",
"hashes_c",
"=",
"[",
"]",
"mentions_c",
"=",
"[",
"]",
"soup",
"=",
"BeautifulSoup",
"(",
"mml",
",",
"\"lxml\"",
")",
"hashes",
"=",
"soup",
".",
"find_all",
"(",
"'hash'",
",",
"{",
"\"tag\"",... | parse the MML structure | [
"parse",
"the",
"MML",
"structure"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Mml/__init__.py#L23-L36 | train | 61,231 |
symphonyoss/python-symphony | symphony/Pod/streams.py | Streams.create_room | def create_room(self, payload):
''' 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 s... | python | def create_room(self, payload):
''' 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 s... | [
"def",
"create_room",
"(",
"self",
",",
"payload",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"Streams",
".",
"post_v2_room_create",
"(",
"# V2RoomAttributes",
"payload",
"=",
"payload",
")",
".",
"result",
"(",
")",
"self",
... | create a stream in a non-inclusive manner | [
"create",
"a",
"stream",
"in",
"a",
"non",
"-",
"inclusive",
"manner"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/streams.py#L37-L44 | train | 61,232 |
symphonyoss/python-symphony | symphony/Pod/streams.py | Streams.stream_info | def stream_info(self, stream_id):
''' 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, res... | python | def stream_info(self, stream_id):
''' 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, res... | [
"def",
"stream_info",
"(",
"self",
",",
"stream_id",
")",
":",
"response",
",",
"status_code",
"=",
"self",
".",
"__pod__",
".",
"Streams",
".",
"get_v2_room_id_info",
"(",
"sessionToken",
"=",
"self",
".",
"__session__",
",",
"id",
"=",
"stream_id",
")",
... | get stream info | [
"get",
"stream",
"info"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/streams.py#L46-L53 | train | 61,233 |
symphonyoss/python-symphony | symphony/Pod/streams.py | Streams.create_stream | def create_stream(self, uidList=[]):
''' 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, respons... | python | def create_stream(self, uidList=[]):
''' 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, respons... | [
"def",
"create_stream",
"(",
"self",
",",
"uidList",
"=",
"[",
"]",
")",
":",
"req_hook",
"=",
"'pod/v1/im/create'",
"req_args",
"=",
"json",
".",
"dumps",
"(",
"uidList",
")",
"status_code",
",",
"response",
"=",
"self",
".",
"__rest__",
".",
"POST_query"... | create a stream | [
"create",
"a",
"stream"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/streams.py#L55-L61 | train | 61,234 |
symphonyoss/python-symphony | symphony/Pod/streams.py | Streams.update_room | def update_room(self, stream_id, room_definition):
''' 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' % (sta... | python | def update_room(self, stream_id, room_definition):
''' 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' % (sta... | [
"def",
"update_room",
"(",
"self",
",",
"stream_id",
",",
"room_definition",
")",
":",
"req_hook",
"=",
"'pod/v2/room/'",
"+",
"str",
"(",
"stream_id",
")",
"+",
"'/update'",
"req_args",
"=",
"json",
".",
"dumps",
"(",
"room_definition",
")",
"status_code",
... | update a room definition | [
"update",
"a",
"room",
"definition"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/streams.py#L63-L69 | train | 61,235 |
symphonyoss/python-symphony | symphony/Pod/streams.py | Streams.room_members | def room_members(self, stream_id):
''' 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))
re... | python | def room_members(self, stream_id):
''' 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))
re... | [
"def",
"room_members",
"(",
"self",
",",
"stream_id",
")",
":",
"req_hook",
"=",
"'pod/v2/room/'",
"+",
"str",
"(",
"stream_id",
")",
"+",
"'/membership/list'",
"req_args",
"=",
"None",
"status_code",
",",
"response",
"=",
"self",
".",
"__rest__",
".",
"GET_... | get list of room members | [
"get",
"list",
"of",
"room",
"members"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/streams.py#L79-L85 | train | 61,236 |
symphonyoss/python-symphony | symphony/Pod/streams.py | Streams.promote_owner | def promote_owner(self, stream_id, user_id):
''' 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: ... | python | def promote_owner(self, stream_id, user_id):
''' 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: ... | [
"def",
"promote_owner",
"(",
"self",
",",
"stream_id",
",",
"user_id",
")",
":",
"req_hook",
"=",
"'pod/v1/room/'",
"+",
"stream_id",
"+",
"'/membership/promoteOwner'",
"req_args",
"=",
"'{ \"id\": %s }'",
"%",
"user_id",
"status_code",
",",
"response",
"=",
"self... | promote user to owner in stream | [
"promote",
"user",
"to",
"owner",
"in",
"stream"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/streams.py#L87-L93 | train | 61,237 |
symphonyoss/python-symphony | symphony/Pod/streams.py | Streams.list_streams | def list_streams(self, types=[], inactive=False):
''' list user streams '''
req_hook = 'pod/v1/streams/list'
json_query = {
"streamTypes": types,
"includeInactiveStreams": inactive
}
req_args = json.dumps(json_query)
... | python | def list_streams(self, types=[], inactive=False):
''' list user streams '''
req_hook = 'pod/v1/streams/list'
json_query = {
"streamTypes": types,
"includeInactiveStreams": inactive
}
req_args = json.dumps(json_query)
... | [
"def",
"list_streams",
"(",
"self",
",",
"types",
"=",
"[",
"]",
",",
"inactive",
"=",
"False",
")",
":",
"req_hook",
"=",
"'pod/v1/streams/list'",
"json_query",
"=",
"{",
"\"streamTypes\"",
":",
"types",
",",
"\"includeInactiveStreams\"",
":",
"inactive",
"}"... | list user streams | [
"list",
"user",
"streams"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/streams.py#L117-L127 | train | 61,238 |
capless/python-jose-cryptodome | jose/jwt.py | get_unverified_claims | 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 tok... | python | 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 tok... | [
"def",
"get_unverified_claims",
"(",
"token",
")",
":",
"try",
":",
"claims",
"=",
"jws",
".",
"get_unverified_claims",
"(",
"token",
")",
"except",
":",
"raise",
"JWTError",
"(",
"'Error decoding token claims.'",
")",
"try",
":",
"claims",
"=",
"json",
".",
... | 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. | [
"Returns",
"the",
"decoded",
"claims",
"without",
"verification",
"of",
"any",
"kind",
"."
] | a169236e2380cff7f1380bbe8eba70cda7393e28 | https://github.com/capless/python-jose-cryptodome/blob/a169236e2380cff7f1380bbe8eba70cda7393e28/jose/jwt.py#L193-L218 | train | 61,239 |
capless/python-jose-cryptodome | jose/jwt.py | _validate_at_hash | def _validate_at_hash(claims, access_token, algorithm):
"""
Validates that the 'at_hash' parameter included in the claims matches
with the access_token returned alongside the id token as part of
the authorization_code flow.
Args:
claims (dict): The claims dictionary to validate.
acc... | python | def _validate_at_hash(claims, access_token, algorithm):
"""
Validates that the 'at_hash' parameter included in the claims matches
with the access_token returned alongside the id token as part of
the authorization_code flow.
Args:
claims (dict): The claims dictionary to validate.
acc... | [
"def",
"_validate_at_hash",
"(",
"claims",
",",
"access_token",
",",
"algorithm",
")",
":",
"if",
"'at_hash'",
"not",
"in",
"claims",
"and",
"not",
"access_token",
":",
"return",
"elif",
"'at_hash'",
"in",
"claims",
"and",
"not",
"access_token",
":",
"msg",
... | Validates that the 'at_hash' parameter included in the claims matches
with the access_token returned alongside the id token as part of
the authorization_code flow.
Args:
claims (dict): The claims dictionary to validate.
access_token (str): The access token returned by the OpenID Provider.
... | [
"Validates",
"that",
"the",
"at_hash",
"parameter",
"included",
"in",
"the",
"claims",
"matches",
"with",
"the",
"access_token",
"returned",
"alongside",
"the",
"id",
"token",
"as",
"part",
"of",
"the",
"authorization_code",
"flow",
"."
] | a169236e2380cff7f1380bbe8eba70cda7393e28 | https://github.com/capless/python-jose-cryptodome/blob/a169236e2380cff7f1380bbe8eba70cda7393e28/jose/jwt.py#L407-L436 | train | 61,240 |
symphonyoss/python-symphony | symphony/Auth/__init__.py | Auth.get_session_token | def get_session_token(self):
''' get session token '''
# HTTP POST query to session authenticate API
try:
response = requests.post(self.__session_url__ + 'sessionauth/v1/authenticate',
cert=(self.__crt__, self.__key__), verify=True)
except... | python | def get_session_token(self):
''' get session token '''
# HTTP POST query to session authenticate API
try:
response = requests.post(self.__session_url__ + 'sessionauth/v1/authenticate',
cert=(self.__crt__, self.__key__), verify=True)
except... | [
"def",
"get_session_token",
"(",
"self",
")",
":",
"# HTTP POST query to session authenticate API",
"try",
":",
"response",
"=",
"requests",
".",
"post",
"(",
"self",
".",
"__session_url__",
"+",
"'sessionauth/v1/authenticate'",
",",
"cert",
"=",
"(",
"self",
".",
... | get session token | [
"get",
"session",
"token"
] | b939f35fbda461183ec0c01790c754f89a295be0 | https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Auth/__init__.py#L27-L46 | train | 61,241 |
CalebBell/ht | ht/radiation.py | solar_spectrum | def solar_spectrum(model='SOLAR-ISS'):
r'''Returns the solar spectrum of the sun according to the specified model.
Only the 'SOLAR-ISS' model is supported.
Parameters
----------
model : str, optional
The model to use; 'SOLAR-ISS' is the only model available, [-]
Returns
-------
... | python | def solar_spectrum(model='SOLAR-ISS'):
r'''Returns the solar spectrum of the sun according to the specified model.
Only the 'SOLAR-ISS' model is supported.
Parameters
----------
model : str, optional
The model to use; 'SOLAR-ISS' is the only model available, [-]
Returns
-------
... | [
"def",
"solar_spectrum",
"(",
"model",
"=",
"'SOLAR-ISS'",
")",
":",
"if",
"model",
"==",
"'SOLAR-ISS'",
":",
"pth",
"=",
"os",
".",
"path",
".",
"join",
"(",
"folder",
",",
"'solar_iss_2018_spectrum.dat'",
")",
"data",
"=",
"np",
".",
"loadtxt",
"(",
"p... | r'''Returns the solar spectrum of the sun according to the specified model.
Only the 'SOLAR-ISS' model is supported.
Parameters
----------
model : str, optional
The model to use; 'SOLAR-ISS' is the only model available, [-]
Returns
-------
wavelengths : ndarray
The waveleng... | [
"r",
"Returns",
"the",
"solar",
"spectrum",
"of",
"the",
"sun",
"according",
"to",
"the",
"specified",
"model",
".",
"Only",
"the",
"SOLAR",
"-",
"ISS",
"model",
"is",
"supported",
"."
] | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/radiation.py#L183-L258 | train | 61,242 |
CalebBell/ht | ht/boiling_nucleic.py | qmax_boiling | def qmax_boiling(rhol=None, rhog=None, sigma=None, Hvap=None, D=None, P=None,
Pc=None, Method=None, AvailableMethods=False):
r'''This function handles the calculation of nucleate boiling critical
heat flux and chooses the best method for performing the calculation.
Preferred methods a... | python | def qmax_boiling(rhol=None, rhog=None, sigma=None, Hvap=None, D=None, P=None,
Pc=None, Method=None, AvailableMethods=False):
r'''This function handles the calculation of nucleate boiling critical
heat flux and chooses the best method for performing the calculation.
Preferred methods a... | [
"def",
"qmax_boiling",
"(",
"rhol",
"=",
"None",
",",
"rhog",
"=",
"None",
",",
"sigma",
"=",
"None",
",",
"Hvap",
"=",
"None",
",",
"D",
"=",
"None",
",",
"P",
"=",
"None",
",",
"Pc",
"=",
"None",
",",
"Method",
"=",
"None",
",",
"AvailableMetho... | r'''This function handles the calculation of nucleate boiling critical
heat flux and chooses the best method for performing the calculation.
Preferred methods are 'Serth-HEDH' when a tube diameter is specified,
and 'Zuber' otherwise.
Parameters
----------
rhol : float, optional
Den... | [
"r",
"This",
"function",
"handles",
"the",
"calculation",
"of",
"nucleate",
"boiling",
"critical",
"heat",
"flux",
"and",
"chooses",
"the",
"best",
"method",
"for",
"performing",
"the",
"calculation",
".",
"Preferred",
"methods",
"are",
"Serth",
"-",
"HEDH",
"... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/boiling_nucleic.py#L1165-L1238 | train | 61,243 |
CalebBell/ht | ht/conv_free_immersed.py | Nu_vertical_cylinder | def Nu_vertical_cylinder(Pr, Gr, L=None, D=None, Method=None,
AvailableMethods=False):
r'''This function handles choosing which vertical cylinder free convection
correlation is used. Generally this is used by a helper class, but can be
used directly. Will automatically select the co... | python | def Nu_vertical_cylinder(Pr, Gr, L=None, D=None, Method=None,
AvailableMethods=False):
r'''This function handles choosing which vertical cylinder free convection
correlation is used. Generally this is used by a helper class, but can be
used directly. Will automatically select the co... | [
"def",
"Nu_vertical_cylinder",
"(",
"Pr",
",",
"Gr",
",",
"L",
"=",
"None",
",",
"D",
"=",
"None",
",",
"Method",
"=",
"None",
",",
"AvailableMethods",
"=",
"False",
")",
":",
"def",
"list_methods",
"(",
")",
":",
"methods",
"=",
"[",
"]",
"for",
"... | r'''This function handles choosing which vertical cylinder free convection
correlation is used. Generally this is used by a helper class, but can be
used directly. Will automatically select the correlation to use if none is
provided; returns None if insufficient information is provided.
Preferred funct... | [
"r",
"This",
"function",
"handles",
"choosing",
"which",
"vertical",
"cylinder",
"free",
"convection",
"correlation",
"is",
"used",
".",
"Generally",
"this",
"is",
"used",
"by",
"a",
"helper",
"class",
"but",
"can",
"be",
"used",
"directly",
".",
"Will",
"au... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/conv_free_immersed.py#L774-L841 | train | 61,244 |
CalebBell/ht | ht/conv_free_immersed.py | Nu_horizontal_cylinder | def Nu_horizontal_cylinder(Pr, Gr, Method=None, AvailableMethods=False):
r'''This function handles choosing which horizontal cylinder free convection
correlation is used. Generally this is used by a helper class, but can be
used directly. Will automatically select the correlation to use if none is
provi... | python | def Nu_horizontal_cylinder(Pr, Gr, Method=None, AvailableMethods=False):
r'''This function handles choosing which horizontal cylinder free convection
correlation is used. Generally this is used by a helper class, but can be
used directly. Will automatically select the correlation to use if none is
provi... | [
"def",
"Nu_horizontal_cylinder",
"(",
"Pr",
",",
"Gr",
",",
"Method",
"=",
"None",
",",
"AvailableMethods",
"=",
"False",
")",
":",
"def",
"list_methods",
"(",
")",
":",
"methods",
"=",
"[",
"]",
"for",
"key",
",",
"values",
"in",
"horizontal_cylinder_corr... | r'''This function handles choosing which horizontal cylinder free convection
correlation is used. Generally this is used by a helper class, but can be
used directly. Will automatically select the correlation to use if none is
provided; returns None if insufficient information is provided.
Prefered func... | [
"r",
"This",
"function",
"handles",
"choosing",
"which",
"horizontal",
"cylinder",
"free",
"convection",
"correlation",
"is",
"used",
".",
"Generally",
"this",
"is",
"used",
"by",
"a",
"helper",
"class",
"but",
"can",
"be",
"used",
"directly",
".",
"Will",
"... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/conv_free_immersed.py#L1035-L1090 | train | 61,245 |
CalebBell/ht | ht/hx.py | calc_Cmin | def calc_Cmin(mh, mc, Cph, Cpc):
r'''Returns the heat capacity rate for the minimum stream
having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`.
.. math::
C_c = m_cC_{p,c}
C_h = m_h C_{p,h}
C_{min} = \min(C_c, C_h)
Parameters
----------
mh : float... | python | def calc_Cmin(mh, mc, Cph, Cpc):
r'''Returns the heat capacity rate for the minimum stream
having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`.
.. math::
C_c = m_cC_{p,c}
C_h = m_h C_{p,h}
C_{min} = \min(C_c, C_h)
Parameters
----------
mh : float... | [
"def",
"calc_Cmin",
"(",
"mh",
",",
"mc",
",",
"Cph",
",",
"Cpc",
")",
":",
"Ch",
"=",
"mh",
"*",
"Cph",
"Cc",
"=",
"mc",
"*",
"Cpc",
"return",
"min",
"(",
"Ch",
",",
"Cc",
")"
] | r'''Returns the heat capacity rate for the minimum stream
having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`.
.. math::
C_c = m_cC_{p,c}
C_h = m_h C_{p,h}
C_{min} = \min(C_c, C_h)
Parameters
----------
mh : float
Mass flow rate of hot stream... | [
"r",
"Returns",
"the",
"heat",
"capacity",
"rate",
"for",
"the",
"minimum",
"stream",
"having",
"flows",
"mh",
"and",
"mc",
"with",
"averaged",
"heat",
"capacities",
"Cph",
"and",
"Cpc",
"."
] | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/hx.py#L557-L604 | train | 61,246 |
CalebBell/ht | ht/hx.py | calc_Cmax | def calc_Cmax(mh, mc, Cph, Cpc):
r'''Returns the heat capacity rate for the maximum stream
having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`.
.. math::
C_c = m_cC_{p,c}
C_h = m_h C_{p,h}
C_{max} = \max(C_c, C_h)
Parameters
----------
mh : float... | python | def calc_Cmax(mh, mc, Cph, Cpc):
r'''Returns the heat capacity rate for the maximum stream
having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`.
.. math::
C_c = m_cC_{p,c}
C_h = m_h C_{p,h}
C_{max} = \max(C_c, C_h)
Parameters
----------
mh : float... | [
"def",
"calc_Cmax",
"(",
"mh",
",",
"mc",
",",
"Cph",
",",
"Cpc",
")",
":",
"Ch",
"=",
"mh",
"*",
"Cph",
"Cc",
"=",
"mc",
"*",
"Cpc",
"return",
"max",
"(",
"Ch",
",",
"Cc",
")"
] | r'''Returns the heat capacity rate for the maximum stream
having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`.
.. math::
C_c = m_cC_{p,c}
C_h = m_h C_{p,h}
C_{max} = \max(C_c, C_h)
Parameters
----------
mh : float
Mass flow rate of hot stream... | [
"r",
"Returns",
"the",
"heat",
"capacity",
"rate",
"for",
"the",
"maximum",
"stream",
"having",
"flows",
"mh",
"and",
"mc",
"with",
"averaged",
"heat",
"capacities",
"Cph",
"and",
"Cpc",
"."
] | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/hx.py#L607-L654 | train | 61,247 |
CalebBell/ht | ht/hx.py | calc_Cr | def calc_Cr(mh, mc, Cph, Cpc):
r'''Returns the heat capacity rate ratio for a heat exchanger
having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`.
.. math::
C_r=C^*=\frac{C_{min}}{C_{max}}
Parameters
----------
mh : float
Mass flow rate of hot stream, [kg/s... | python | def calc_Cr(mh, mc, Cph, Cpc):
r'''Returns the heat capacity rate ratio for a heat exchanger
having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`.
.. math::
C_r=C^*=\frac{C_{min}}{C_{max}}
Parameters
----------
mh : float
Mass flow rate of hot stream, [kg/s... | [
"def",
"calc_Cr",
"(",
"mh",
",",
"mc",
",",
"Cph",
",",
"Cpc",
")",
":",
"Ch",
"=",
"mh",
"*",
"Cph",
"Cc",
"=",
"mc",
"*",
"Cpc",
"Cmin",
"=",
"min",
"(",
"Ch",
",",
"Cc",
")",
"Cmax",
"=",
"max",
"(",
"Ch",
",",
"Cc",
")",
"return",
"C... | r'''Returns the heat capacity rate ratio for a heat exchanger
having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`.
.. math::
C_r=C^*=\frac{C_{min}}{C_{max}}
Parameters
----------
mh : float
Mass flow rate of hot stream, [kg/s]
mc : float
Mass flow ... | [
"r",
"Returns",
"the",
"heat",
"capacity",
"rate",
"ratio",
"for",
"a",
"heat",
"exchanger",
"having",
"flows",
"mh",
"and",
"mc",
"with",
"averaged",
"heat",
"capacities",
"Cph",
"and",
"Cpc",
"."
] | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/hx.py#L657-L703 | train | 61,248 |
CalebBell/ht | ht/hx.py | Pc | def Pc(x, y):
r'''Basic helper calculator which accepts a transformed R1 and NTU1 as
inputs for a common term used in the calculation of the P-NTU method for
plate exchangers.
Returns a value which is normally used in other calculations before the
actual P1 is calculated. Nominally used in c... | python | def Pc(x, y):
r'''Basic helper calculator which accepts a transformed R1 and NTU1 as
inputs for a common term used in the calculation of the P-NTU method for
plate exchangers.
Returns a value which is normally used in other calculations before the
actual P1 is calculated. Nominally used in c... | [
"def",
"Pc",
"(",
"x",
",",
"y",
")",
":",
"try",
":",
"term",
"=",
"exp",
"(",
"-",
"x",
"*",
"(",
"1.",
"-",
"y",
")",
")",
"return",
"(",
"1.",
"-",
"term",
")",
"/",
"(",
"1.",
"-",
"y",
"*",
"term",
")",
"except",
"ZeroDivisionError",
... | r'''Basic helper calculator which accepts a transformed R1 and NTU1 as
inputs for a common term used in the calculation of the P-NTU method for
plate exchangers.
Returns a value which is normally used in other calculations before the
actual P1 is calculated. Nominally used in counterflow calcula... | [
"r",
"Basic",
"helper",
"calculator",
"which",
"accepts",
"a",
"transformed",
"R1",
"and",
"NTU1",
"as",
"inputs",
"for",
"a",
"common",
"term",
"used",
"in",
"the",
"calculation",
"of",
"the",
"P",
"-",
"NTU",
"method",
"for",
"plate",
"exchangers",
".",
... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/hx.py#L827-L872 | train | 61,249 |
CalebBell/ht | ht/hx.py | _NTU_from_P_solver | def _NTU_from_P_solver(P1, R1, NTU_min, NTU_max, function, **kwargs):
'''Private function to solve the P-NTU method backwards, given the
function to use, the upper and lower NTU bounds for consideration,
and the desired P1 and R1 values.
'''
P1_max = _NTU_from_P_objective(NTU_max, R1, 0, function, *... | python | def _NTU_from_P_solver(P1, R1, NTU_min, NTU_max, function, **kwargs):
'''Private function to solve the P-NTU method backwards, given the
function to use, the upper and lower NTU bounds for consideration,
and the desired P1 and R1 values.
'''
P1_max = _NTU_from_P_objective(NTU_max, R1, 0, function, *... | [
"def",
"_NTU_from_P_solver",
"(",
"P1",
",",
"R1",
",",
"NTU_min",
",",
"NTU_max",
",",
"function",
",",
"*",
"*",
"kwargs",
")",
":",
"P1_max",
"=",
"_NTU_from_P_objective",
"(",
"NTU_max",
",",
"R1",
",",
"0",
",",
"function",
",",
"*",
"*",
"kwargs"... | Private function to solve the P-NTU method backwards, given the
function to use, the upper and lower NTU bounds for consideration,
and the desired P1 and R1 values. | [
"Private",
"function",
"to",
"solve",
"the",
"P",
"-",
"NTU",
"method",
"backwards",
"given",
"the",
"function",
"to",
"use",
"the",
"upper",
"and",
"lower",
"NTU",
"bounds",
"for",
"consideration",
"and",
"the",
"desired",
"P1",
"and",
"R1",
"values",
"."... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/hx.py#L2964-L2977 | train | 61,250 |
CalebBell/ht | ht/hx.py | _NTU_max_for_P_solver | def _NTU_max_for_P_solver(data, R1):
'''Private function to calculate the upper bound on the NTU1 value in the
P-NTU method. This value is calculated via a pade approximation obtained
on the result of a global minimizer which calculated the maximum P1
at a given R1 from ~1E-7 to approximately 100. This ... | python | def _NTU_max_for_P_solver(data, R1):
'''Private function to calculate the upper bound on the NTU1 value in the
P-NTU method. This value is calculated via a pade approximation obtained
on the result of a global minimizer which calculated the maximum P1
at a given R1 from ~1E-7 to approximately 100. This ... | [
"def",
"_NTU_max_for_P_solver",
"(",
"data",
",",
"R1",
")",
":",
"offset_max",
"=",
"data",
"[",
"'offset'",
"]",
"[",
"-",
"1",
"]",
"for",
"offset",
",",
"p",
",",
"q",
"in",
"zip",
"(",
"data",
"[",
"'offset'",
"]",
",",
"data",
"[",
"'p'",
"... | Private function to calculate the upper bound on the NTU1 value in the
P-NTU method. This value is calculated via a pade approximation obtained
on the result of a global minimizer which calculated the maximum P1
at a given R1 from ~1E-7 to approximately 100. This should suffice for
engineering applicat... | [
"Private",
"function",
"to",
"calculate",
"the",
"upper",
"bound",
"on",
"the",
"NTU1",
"value",
"in",
"the",
"P",
"-",
"NTU",
"method",
".",
"This",
"value",
"is",
"calculated",
"via",
"a",
"pade",
"approximation",
"obtained",
"on",
"the",
"result",
"of",... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/hx.py#L2980-L2991 | train | 61,251 |
CalebBell/ht | ht/hx.py | Ntubes_VDI | def Ntubes_VDI(DBundle=None, Ntp=None, Do=None, pitch=None, angle=30.):
r'''A rough equation presented in the VDI Heat Atlas for estimating
the number of tubes in a tube bundle of differing geometries and tube
sizes. No accuracy estimation given.
Parameters
----------
DBundle : float
Ou... | python | def Ntubes_VDI(DBundle=None, Ntp=None, Do=None, pitch=None, angle=30.):
r'''A rough equation presented in the VDI Heat Atlas for estimating
the number of tubes in a tube bundle of differing geometries and tube
sizes. No accuracy estimation given.
Parameters
----------
DBundle : float
Ou... | [
"def",
"Ntubes_VDI",
"(",
"DBundle",
"=",
"None",
",",
"Ntp",
"=",
"None",
",",
"Do",
"=",
"None",
",",
"pitch",
"=",
"None",
",",
"angle",
"=",
"30.",
")",
":",
"if",
"Ntp",
"==",
"1",
":",
"f2",
"=",
"0.",
"elif",
"Ntp",
"==",
"2",
":",
"f2... | r'''A rough equation presented in the VDI Heat Atlas for estimating
the number of tubes in a tube bundle of differing geometries and tube
sizes. No accuracy estimation given.
Parameters
----------
DBundle : float
Outer diameter of tube bundle, [m]
Ntp : float
Number of tube pass... | [
"r",
"A",
"rough",
"equation",
"presented",
"in",
"the",
"VDI",
"Heat",
"Atlas",
"for",
"estimating",
"the",
"number",
"of",
"tubes",
"in",
"a",
"tube",
"bundle",
"of",
"differing",
"geometries",
"and",
"tube",
"sizes",
".",
"No",
"accuracy",
"estimation",
... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/hx.py#L6001-L6064 | train | 61,252 |
CalebBell/ht | ht/hx.py | D_for_Ntubes_VDI | def D_for_Ntubes_VDI(N, Ntp, Do, pitch, angle=30):
r'''A rough equation presented in the VDI Heat Atlas for estimating
the size of a tube bundle from a given number of tubes, number of tube
passes, outer tube diameter, pitch, and arrangement.
No accuracy estimation given.
.. math::
OTL = \s... | python | def D_for_Ntubes_VDI(N, Ntp, Do, pitch, angle=30):
r'''A rough equation presented in the VDI Heat Atlas for estimating
the size of a tube bundle from a given number of tubes, number of tube
passes, outer tube diameter, pitch, and arrangement.
No accuracy estimation given.
.. math::
OTL = \s... | [
"def",
"D_for_Ntubes_VDI",
"(",
"N",
",",
"Ntp",
",",
"Do",
",",
"pitch",
",",
"angle",
"=",
"30",
")",
":",
"if",
"Ntp",
"==",
"1",
":",
"f2",
"=",
"0.",
"elif",
"Ntp",
"==",
"2",
":",
"f2",
"=",
"22.",
"elif",
"Ntp",
"==",
"4",
":",
"f2",
... | r'''A rough equation presented in the VDI Heat Atlas for estimating
the size of a tube bundle from a given number of tubes, number of tube
passes, outer tube diameter, pitch, and arrangement.
No accuracy estimation given.
.. math::
OTL = \sqrt{f_1 z t^2 + f_2 t \sqrt{z} - d_o}
Parameters
... | [
"r",
"A",
"rough",
"equation",
"presented",
"in",
"the",
"VDI",
"Heat",
"Atlas",
"for",
"estimating",
"the",
"size",
"of",
"a",
"tube",
"bundle",
"from",
"a",
"given",
"number",
"of",
"tubes",
"number",
"of",
"tube",
"passes",
"outer",
"tube",
"diameter",
... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/hx.py#L6067-L6132 | train | 61,253 |
CalebBell/ht | ht/hx.py | Ntubes_HEDH | def Ntubes_HEDH(DBundle=None, Do=None, pitch=None, angle=30):
r'''A rough equation presented in the HEDH for estimating
the number of tubes in a tube bundle of differing geometries and tube
sizes. No accuracy estimation given. Only 1 pass is supported.
.. math::
N = \frac{0.78(D_{bundle} - D_o)... | python | def Ntubes_HEDH(DBundle=None, Do=None, pitch=None, angle=30):
r'''A rough equation presented in the HEDH for estimating
the number of tubes in a tube bundle of differing geometries and tube
sizes. No accuracy estimation given. Only 1 pass is supported.
.. math::
N = \frac{0.78(D_{bundle} - D_o)... | [
"def",
"Ntubes_HEDH",
"(",
"DBundle",
"=",
"None",
",",
"Do",
"=",
"None",
",",
"pitch",
"=",
"None",
",",
"angle",
"=",
"30",
")",
":",
"if",
"angle",
"==",
"30",
"or",
"angle",
"==",
"60",
":",
"C1",
"=",
"13",
"/",
"15.",
"elif",
"angle",
"=... | r'''A rough equation presented in the HEDH for estimating
the number of tubes in a tube bundle of differing geometries and tube
sizes. No accuracy estimation given. Only 1 pass is supported.
.. math::
N = \frac{0.78(D_{bundle} - D_o)^2}{C_1(\text{pitch})^2}
C1 = 0.866 for 30° and 60° l... | [
"r",
"A",
"rough",
"equation",
"presented",
"in",
"the",
"HEDH",
"for",
"estimating",
"the",
"number",
"of",
"tubes",
"in",
"a",
"tube",
"bundle",
"of",
"differing",
"geometries",
"and",
"tube",
"sizes",
".",
"No",
"accuracy",
"estimation",
"given",
".",
"... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/hx.py#L6135-L6184 | train | 61,254 |
CalebBell/ht | ht/hx.py | DBundle_for_Ntubes_HEDH | def DBundle_for_Ntubes_HEDH(N, Do, pitch, angle=30):
r'''A rough equation presented in the HEDH for estimating the tube bundle
diameter necessary to fit a given number of tubes.
No accuracy estimation given. Only 1 pass is supported.
.. math::
D_{bundle} = (D_o + (\text{pitch})\sqrt{\frac{1}{0... | python | def DBundle_for_Ntubes_HEDH(N, Do, pitch, angle=30):
r'''A rough equation presented in the HEDH for estimating the tube bundle
diameter necessary to fit a given number of tubes.
No accuracy estimation given. Only 1 pass is supported.
.. math::
D_{bundle} = (D_o + (\text{pitch})\sqrt{\frac{1}{0... | [
"def",
"DBundle_for_Ntubes_HEDH",
"(",
"N",
",",
"Do",
",",
"pitch",
",",
"angle",
"=",
"30",
")",
":",
"if",
"angle",
"==",
"30",
"or",
"angle",
"==",
"60",
":",
"C1",
"=",
"13",
"/",
"15.",
"elif",
"angle",
"==",
"45",
"or",
"angle",
"==",
"90"... | r'''A rough equation presented in the HEDH for estimating the tube bundle
diameter necessary to fit a given number of tubes.
No accuracy estimation given. Only 1 pass is supported.
.. math::
D_{bundle} = (D_o + (\text{pitch})\sqrt{\frac{1}{0.78}}\cdot
\sqrt{C_1\cdot N})
C1 = 0.866 fo... | [
"r",
"A",
"rough",
"equation",
"presented",
"in",
"the",
"HEDH",
"for",
"estimating",
"the",
"tube",
"bundle",
"diameter",
"necessary",
"to",
"fit",
"a",
"given",
"number",
"of",
"tubes",
".",
"No",
"accuracy",
"estimation",
"given",
".",
"Only",
"1",
"pas... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/hx.py#L6187-L6236 | train | 61,255 |
timkpaine/perspective-python | perspective/base.py | PerspectiveBaseMixin.setup | def setup(self,
data,
view='hypergrid',
schema=None,
columns=None,
rowpivots=None,
columnpivots=None,
aggregates=None,
sort=None,
index='',
limit=-1,
computedcolumns=... | python | def setup(self,
data,
view='hypergrid',
schema=None,
columns=None,
rowpivots=None,
columnpivots=None,
aggregates=None,
sort=None,
index='',
limit=-1,
computedcolumns=... | [
"def",
"setup",
"(",
"self",
",",
"data",
",",
"view",
"=",
"'hypergrid'",
",",
"schema",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"rowpivots",
"=",
"None",
",",
"columnpivots",
"=",
"None",
",",
"aggregates",
"=",
"None",
",",
"sort",
"=",
"No... | Setup perspective base class
Arguments:
data : dataframe/list/dict
The static or live datasource
Keyword Arguments:
view : str or View
what view to use. available in the enum View (default: {'hypergrid'})
columns : list of str
... | [
"Setup",
"perspective",
"base",
"class"
] | 34cc59811909bc74d11e3de80010a3066ba9a8be | https://github.com/timkpaine/perspective-python/blob/34cc59811909bc74d11e3de80010a3066ba9a8be/perspective/base.py#L139-L202 | train | 61,256 |
CalebBell/ht | ht/conduction.py | R_cylinder | def R_cylinder(Di, Do, k, L):
r'''Returns the thermal resistance `R` of a cylinder of constant thermal
conductivity `k`, of inner and outer diameter `Di` and `Do`, and with a
length `L`.
.. math::
(hA)_{\text{cylinder}}=\frac{k}{\ln(D_o/D_i)} \cdot 2\pi L\\
R_{\text{cylinder}}=\frac{1}{... | python | def R_cylinder(Di, Do, k, L):
r'''Returns the thermal resistance `R` of a cylinder of constant thermal
conductivity `k`, of inner and outer diameter `Di` and `Do`, and with a
length `L`.
.. math::
(hA)_{\text{cylinder}}=\frac{k}{\ln(D_o/D_i)} \cdot 2\pi L\\
R_{\text{cylinder}}=\frac{1}{... | [
"def",
"R_cylinder",
"(",
"Di",
",",
"Do",
",",
"k",
",",
"L",
")",
":",
"hA",
"=",
"k",
"*",
"2",
"*",
"pi",
"*",
"L",
"/",
"log",
"(",
"Do",
"/",
"Di",
")",
"return",
"1.",
"/",
"hA"
] | r'''Returns the thermal resistance `R` of a cylinder of constant thermal
conductivity `k`, of inner and outer diameter `Di` and `Do`, and with a
length `L`.
.. math::
(hA)_{\text{cylinder}}=\frac{k}{\ln(D_o/D_i)} \cdot 2\pi L\\
R_{\text{cylinder}}=\frac{1}{(hA)_{\text{cylinder}}}=
\... | [
"r",
"Returns",
"the",
"thermal",
"resistance",
"R",
"of",
"a",
"cylinder",
"of",
"constant",
"thermal",
"conductivity",
"k",
"of",
"inner",
"and",
"outer",
"diameter",
"Di",
"and",
"Do",
"and",
"with",
"a",
"length",
"L",
"."
] | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/conduction.py#L272-L310 | train | 61,257 |
CalebBell/ht | ht/conduction.py | S_isothermal_pipe_to_isothermal_pipe | def S_isothermal_pipe_to_isothermal_pipe(D1, D2, W, L=1.):
r'''Returns the Shape factor `S` of a pipe of constant outer temperature
and of outer diameter `D1` which is `w` distance from another infinite
pipe of outer diameter`D2`. Length `L` must be provided, but can be set to
1 to obtain a dimensionles... | python | def S_isothermal_pipe_to_isothermal_pipe(D1, D2, W, L=1.):
r'''Returns the Shape factor `S` of a pipe of constant outer temperature
and of outer diameter `D1` which is `w` distance from another infinite
pipe of outer diameter`D2`. Length `L` must be provided, but can be set to
1 to obtain a dimensionles... | [
"def",
"S_isothermal_pipe_to_isothermal_pipe",
"(",
"D1",
",",
"D2",
",",
"W",
",",
"L",
"=",
"1.",
")",
":",
"return",
"2.",
"*",
"pi",
"*",
"L",
"/",
"acosh",
"(",
"(",
"4",
"*",
"W",
"**",
"2",
"-",
"D1",
"**",
"2",
"-",
"D2",
"**",
"2",
"... | r'''Returns the Shape factor `S` of a pipe of constant outer temperature
and of outer diameter `D1` which is `w` distance from another infinite
pipe of outer diameter`D2`. Length `L` must be provided, but can be set to
1 to obtain a dimensionless shape factor used in some sources.
.. math::
S =... | [
"r",
"Returns",
"the",
"Shape",
"factor",
"S",
"of",
"a",
"pipe",
"of",
"constant",
"outer",
"temperature",
"and",
"of",
"outer",
"diameter",
"D1",
"which",
"is",
"w",
"distance",
"from",
"another",
"infinite",
"pipe",
"of",
"outer",
"diameter",
"D2",
".",... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/conduction.py#L445-L490 | train | 61,258 |
CalebBell/ht | ht/conduction.py | S_isothermal_pipe_to_two_planes | def S_isothermal_pipe_to_two_planes(D, Z, L=1.):
r'''Returns the Shape factor `S` of a pipe of constant outer temperature
and of outer diameter `D` which is `Z` distance from two infinite
isothermal planes of equal temperatures, parallel to each other and
enclosing the pipe. Length `L` must be provided,... | python | def S_isothermal_pipe_to_two_planes(D, Z, L=1.):
r'''Returns the Shape factor `S` of a pipe of constant outer temperature
and of outer diameter `D` which is `Z` distance from two infinite
isothermal planes of equal temperatures, parallel to each other and
enclosing the pipe. Length `L` must be provided,... | [
"def",
"S_isothermal_pipe_to_two_planes",
"(",
"D",
",",
"Z",
",",
"L",
"=",
"1.",
")",
":",
"return",
"2.",
"*",
"pi",
"*",
"L",
"/",
"log",
"(",
"8.",
"*",
"Z",
"/",
"(",
"pi",
"*",
"D",
")",
")"
] | r'''Returns the Shape factor `S` of a pipe of constant outer temperature
and of outer diameter `D` which is `Z` distance from two infinite
isothermal planes of equal temperatures, parallel to each other and
enclosing the pipe. Length `L` must be provided, but can be set to
1 to obtain a dimensionless sh... | [
"r",
"Returns",
"the",
"Shape",
"factor",
"S",
"of",
"a",
"pipe",
"of",
"constant",
"outer",
"temperature",
"and",
"of",
"outer",
"diameter",
"D",
"which",
"is",
"Z",
"distance",
"from",
"two",
"infinite",
"isothermal",
"planes",
"of",
"equal",
"temperatures... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/conduction.py#L493-L538 | train | 61,259 |
CalebBell/ht | ht/conduction.py | S_isothermal_pipe_eccentric_to_isothermal_pipe | def S_isothermal_pipe_eccentric_to_isothermal_pipe(D1, D2, Z, L=1.):
r'''Returns the Shape factor `S` of a pipe of constant outer temperature
and of outer diameter `D1` which is `Z` distance from the center of another
pipe of outer diameter`D2`. Length `L` must be provided, but can be set to
1 to obtain... | python | def S_isothermal_pipe_eccentric_to_isothermal_pipe(D1, D2, Z, L=1.):
r'''Returns the Shape factor `S` of a pipe of constant outer temperature
and of outer diameter `D1` which is `Z` distance from the center of another
pipe of outer diameter`D2`. Length `L` must be provided, but can be set to
1 to obtain... | [
"def",
"S_isothermal_pipe_eccentric_to_isothermal_pipe",
"(",
"D1",
",",
"D2",
",",
"Z",
",",
"L",
"=",
"1.",
")",
":",
"return",
"2.",
"*",
"pi",
"*",
"L",
"/",
"acosh",
"(",
"(",
"D2",
"**",
"2",
"+",
"D1",
"**",
"2",
"-",
"4.",
"*",
"Z",
"**",... | r'''Returns the Shape factor `S` of a pipe of constant outer temperature
and of outer diameter `D1` which is `Z` distance from the center of another
pipe of outer diameter`D2`. Length `L` must be provided, but can be set to
1 to obtain a dimensionless shape factor used in some sources.
.. math::
... | [
"r",
"Returns",
"the",
"Shape",
"factor",
"S",
"of",
"a",
"pipe",
"of",
"constant",
"outer",
"temperature",
"and",
"of",
"outer",
"diameter",
"D1",
"which",
"is",
"Z",
"distance",
"from",
"the",
"center",
"of",
"another",
"pipe",
"of",
"outer",
"diameter",... | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/conduction.py#L541-L587 | train | 61,260 |
CalebBell/ht | ht/core.py | LMTD | def LMTD(Thi, Tho, Tci, Tco, counterflow=True):
r'''Returns the log-mean temperature difference of an ideal counterflow
or co-current heat exchanger.
.. math::
\Delta T_{LMTD}=\frac{\Delta T_1-\Delta T_2}{\ln(\Delta T_1/\Delta T_2)}
\text{For countercurrent: } \\
\Delta T_1=T_... | python | def LMTD(Thi, Tho, Tci, Tco, counterflow=True):
r'''Returns the log-mean temperature difference of an ideal counterflow
or co-current heat exchanger.
.. math::
\Delta T_{LMTD}=\frac{\Delta T_1-\Delta T_2}{\ln(\Delta T_1/\Delta T_2)}
\text{For countercurrent: } \\
\Delta T_1=T_... | [
"def",
"LMTD",
"(",
"Thi",
",",
"Tho",
",",
"Tci",
",",
"Tco",
",",
"counterflow",
"=",
"True",
")",
":",
"if",
"counterflow",
":",
"dTF1",
"=",
"Thi",
"-",
"Tco",
"dTF2",
"=",
"Tho",
"-",
"Tci",
"else",
":",
"dTF1",
"=",
"Thi",
"-",
"Tci",
"dT... | r'''Returns the log-mean temperature difference of an ideal counterflow
or co-current heat exchanger.
.. math::
\Delta T_{LMTD}=\frac{\Delta T_1-\Delta T_2}{\ln(\Delta T_1/\Delta T_2)}
\text{For countercurrent: } \\
\Delta T_1=T_{h,i}-T_{c,o}\\
\Delta T_2=T_{h,o}-T_{c,i}
... | [
"r",
"Returns",
"the",
"log",
"-",
"mean",
"temperature",
"difference",
"of",
"an",
"ideal",
"counterflow",
"or",
"co",
"-",
"current",
"heat",
"exchanger",
"."
] | 3097ef9524c4cf0068ad453c17b10ec9ce551eee | https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/core.py#L37-L95 | train | 61,261 |
mrcagney/kml2geojson | kml2geojson/cli.py | k2g | def k2g(kml_path, output_dir, separate_folders, style_type,
style_filename):
"""
Given a path to a KML file, convert it to a a GeoJSON FeatureCollection file and save it to the given output directory.
If ``--separate_folders``, then create several GeoJSON files, one for each folder in the KML file that ... | python | def k2g(kml_path, output_dir, separate_folders, style_type,
style_filename):
"""
Given a path to a KML file, convert it to a a GeoJSON FeatureCollection file and save it to the given output directory.
If ``--separate_folders``, then create several GeoJSON files, one for each folder in the KML file that ... | [
"def",
"k2g",
"(",
"kml_path",
",",
"output_dir",
",",
"separate_folders",
",",
"style_type",
",",
"style_filename",
")",
":",
"m",
".",
"convert",
"(",
"kml_path",
",",
"output_dir",
",",
"separate_folders",
",",
"style_type",
",",
"style_filename",
")"
] | Given a path to a KML file, convert it to a a GeoJSON FeatureCollection file and save it to the given output directory.
If ``--separate_folders``, then create several GeoJSON files, one for each folder in the KML file that contains geodata or that has a descendant node that contains geodata.
Warning: this can ... | [
"Given",
"a",
"path",
"to",
"a",
"KML",
"file",
"convert",
"it",
"to",
"a",
"a",
"GeoJSON",
"FeatureCollection",
"file",
"and",
"save",
"it",
"to",
"the",
"given",
"output",
"directory",
"."
] | 6c4720f2b1327d636e15ce397dd808c9df8580a5 | https://github.com/mrcagney/kml2geojson/blob/6c4720f2b1327d636e15ce397dd808c9df8580a5/kml2geojson/cli.py#L15-L25 | train | 61,262 |
mrcagney/kml2geojson | kml2geojson/main.py | disambiguate | def disambiguate(names, mark='1'):
"""
Given a list of strings ``names``, return a new list of names where repeated names have been disambiguated by repeatedly appending the given mark.
EXAMPLE::
>>> disambiguate(['sing', 'song', 'sing', 'sing'])
['sing', 'song', 'sing1', 'sing11']
""... | python | def disambiguate(names, mark='1'):
"""
Given a list of strings ``names``, return a new list of names where repeated names have been disambiguated by repeatedly appending the given mark.
EXAMPLE::
>>> disambiguate(['sing', 'song', 'sing', 'sing'])
['sing', 'song', 'sing1', 'sing11']
""... | [
"def",
"disambiguate",
"(",
"names",
",",
"mark",
"=",
"'1'",
")",
":",
"names_seen",
"=",
"set",
"(",
")",
"new_names",
"=",
"[",
"]",
"for",
"name",
"in",
"names",
":",
"new_name",
"=",
"name",
"while",
"new_name",
"in",
"names_seen",
":",
"new_name"... | Given a list of strings ``names``, return a new list of names where repeated names have been disambiguated by repeatedly appending the given mark.
EXAMPLE::
>>> disambiguate(['sing', 'song', 'sing', 'sing'])
['sing', 'song', 'sing1', 'sing11'] | [
"Given",
"a",
"list",
"of",
"strings",
"names",
"return",
"a",
"new",
"list",
"of",
"names",
"where",
"repeated",
"names",
"have",
"been",
"disambiguated",
"by",
"repeatedly",
"appending",
"the",
"given",
"mark",
"."
] | 6c4720f2b1327d636e15ce397dd808c9df8580a5 | https://github.com/mrcagney/kml2geojson/blob/6c4720f2b1327d636e15ce397dd808c9df8580a5/kml2geojson/main.py#L151-L170 | train | 61,263 |
mrcagney/kml2geojson | kml2geojson/main.py | build_rgb_and_opacity | def build_rgb_and_opacity(s):
"""
Given a KML color string, return an equivalent RGB hex color string and an opacity float rounded to 2 decimal places.
EXAMPLE::
>>> build_rgb_and_opacity('ee001122')
('#221100', 0.93)
"""
# Set defaults
color = '000000'
opacity = 1
if... | python | def build_rgb_and_opacity(s):
"""
Given a KML color string, return an equivalent RGB hex color string and an opacity float rounded to 2 decimal places.
EXAMPLE::
>>> build_rgb_and_opacity('ee001122')
('#221100', 0.93)
"""
# Set defaults
color = '000000'
opacity = 1
if... | [
"def",
"build_rgb_and_opacity",
"(",
"s",
")",
":",
"# Set defaults",
"color",
"=",
"'000000'",
"opacity",
"=",
"1",
"if",
"s",
".",
"startswith",
"(",
"'#'",
")",
":",
"s",
"=",
"s",
"[",
"1",
":",
"]",
"if",
"len",
"(",
"s",
")",
"==",
"8",
":"... | Given a KML color string, return an equivalent RGB hex color string and an opacity float rounded to 2 decimal places.
EXAMPLE::
>>> build_rgb_and_opacity('ee001122')
('#221100', 0.93) | [
"Given",
"a",
"KML",
"color",
"string",
"return",
"an",
"equivalent",
"RGB",
"hex",
"color",
"string",
"and",
"an",
"opacity",
"float",
"rounded",
"to",
"2",
"decimal",
"places",
"."
] | 6c4720f2b1327d636e15ce397dd808c9df8580a5 | https://github.com/mrcagney/kml2geojson/blob/6c4720f2b1327d636e15ce397dd808c9df8580a5/kml2geojson/main.py#L191-L215 | train | 61,264 |
mrcagney/kml2geojson | kml2geojson/main.py | build_svg_style | def build_svg_style(node):
"""
Given a DOM node, grab its top-level Style nodes, convert every one into a SVG style dictionary, put them in a master dictionary of the form
#style ID -> SVG style dictionary,
and return the result.
The possible keys and values of each SVG style dictionary, the ... | python | def build_svg_style(node):
"""
Given a DOM node, grab its top-level Style nodes, convert every one into a SVG style dictionary, put them in a master dictionary of the form
#style ID -> SVG style dictionary,
and return the result.
The possible keys and values of each SVG style dictionary, the ... | [
"def",
"build_svg_style",
"(",
"node",
")",
":",
"d",
"=",
"{",
"}",
"for",
"item",
"in",
"get",
"(",
"node",
",",
"'Style'",
")",
":",
"style_id",
"=",
"'#'",
"+",
"attr",
"(",
"item",
",",
"'id'",
")",
"# Create style properties",
"props",
"=",
"{"... | Given a DOM node, grab its top-level Style nodes, convert every one into a SVG style dictionary, put them in a master dictionary of the form
#style ID -> SVG style dictionary,
and return the result.
The possible keys and values of each SVG style dictionary, the style options, are
- ``iconUrl``: ... | [
"Given",
"a",
"DOM",
"node",
"grab",
"its",
"top",
"-",
"level",
"Style",
"nodes",
"convert",
"every",
"one",
"into",
"a",
"SVG",
"style",
"dictionary",
"put",
"them",
"in",
"a",
"master",
"dictionary",
"of",
"the",
"form"
] | 6c4720f2b1327d636e15ce397dd808c9df8580a5 | https://github.com/mrcagney/kml2geojson/blob/6c4720f2b1327d636e15ce397dd808c9df8580a5/kml2geojson/main.py#L217-L278 | train | 61,265 |
Element-34/py.saunter | saunter/po/webdriver/page.py | Page.wait_for_available | def wait_for_available(self, locator):
"""
Synchronization to deal with elements that are present, and are visible
:raises: ElementVisiblityTimeout
"""
for i in range(timeout_seconds):
try:
if self.is_element_available(locator):
br... | python | def wait_for_available(self, locator):
"""
Synchronization to deal with elements that are present, and are visible
:raises: ElementVisiblityTimeout
"""
for i in range(timeout_seconds):
try:
if self.is_element_available(locator):
br... | [
"def",
"wait_for_available",
"(",
"self",
",",
"locator",
")",
":",
"for",
"i",
"in",
"range",
"(",
"timeout_seconds",
")",
":",
"try",
":",
"if",
"self",
".",
"is_element_available",
"(",
"locator",
")",
":",
"break",
"except",
":",
"pass",
"time",
".",... | Synchronization to deal with elements that are present, and are visible
:raises: ElementVisiblityTimeout | [
"Synchronization",
"to",
"deal",
"with",
"elements",
"that",
"are",
"present",
"and",
"are",
"visible"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/po/webdriver/page.py#L58-L73 | train | 61,266 |
Element-34/py.saunter | saunter/po/webdriver/page.py | Page.wait_for_visible | def wait_for_visible(self, locator):
"""
Synchronization to deal with elements that are present, but are disabled until some action
triggers their visibility.
:raises: ElementVisiblityTimeout
"""
for i in range(timeout_seconds):
try:
if self.d... | python | def wait_for_visible(self, locator):
"""
Synchronization to deal with elements that are present, but are disabled until some action
triggers their visibility.
:raises: ElementVisiblityTimeout
"""
for i in range(timeout_seconds):
try:
if self.d... | [
"def",
"wait_for_visible",
"(",
"self",
",",
"locator",
")",
":",
"for",
"i",
"in",
"range",
"(",
"timeout_seconds",
")",
":",
"try",
":",
"if",
"self",
".",
"driver",
".",
"is_visible",
"(",
"locator",
")",
":",
"break",
"except",
":",
"pass",
"time",... | Synchronization to deal with elements that are present, but are disabled until some action
triggers their visibility.
:raises: ElementVisiblityTimeout | [
"Synchronization",
"to",
"deal",
"with",
"elements",
"that",
"are",
"present",
"but",
"are",
"disabled",
"until",
"some",
"action",
"triggers",
"their",
"visibility",
"."
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/po/webdriver/page.py#L75-L91 | train | 61,267 |
Element-34/py.saunter | saunter/po/webdriver/page.py | Page.wait_for_text | def wait_for_text(self, locator, text):
"""
Synchronization on some text being displayed in a particular element.
:raises: ElementVisiblityTimeout
"""
for i in range(timeout_seconds):
try:
e = self.driver.find_element_by_locator(locator)
... | python | def wait_for_text(self, locator, text):
"""
Synchronization on some text being displayed in a particular element.
:raises: ElementVisiblityTimeout
"""
for i in range(timeout_seconds):
try:
e = self.driver.find_element_by_locator(locator)
... | [
"def",
"wait_for_text",
"(",
"self",
",",
"locator",
",",
"text",
")",
":",
"for",
"i",
"in",
"range",
"(",
"timeout_seconds",
")",
":",
"try",
":",
"e",
"=",
"self",
".",
"driver",
".",
"find_element_by_locator",
"(",
"locator",
")",
"if",
"e",
".",
... | Synchronization on some text being displayed in a particular element.
:raises: ElementVisiblityTimeout | [
"Synchronization",
"on",
"some",
"text",
"being",
"displayed",
"in",
"a",
"particular",
"element",
"."
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/po/webdriver/page.py#L109-L125 | train | 61,268 |
Element-34/py.saunter | saunter/po/webdriver/page.py | Page.wait_for_element_not_present | def wait_for_element_not_present(self, locator):
"""
Synchronization helper to wait until some element is removed from the page
:raises: ElementVisiblityTimeout
"""
for i in range(timeout_seconds):
if self.driver.is_element_present(locator):
time.slee... | python | def wait_for_element_not_present(self, locator):
"""
Synchronization helper to wait until some element is removed from the page
:raises: ElementVisiblityTimeout
"""
for i in range(timeout_seconds):
if self.driver.is_element_present(locator):
time.slee... | [
"def",
"wait_for_element_not_present",
"(",
"self",
",",
"locator",
")",
":",
"for",
"i",
"in",
"range",
"(",
"timeout_seconds",
")",
":",
"if",
"self",
".",
"driver",
".",
"is_element_present",
"(",
"locator",
")",
":",
"time",
".",
"sleep",
"(",
"1",
"... | Synchronization helper to wait until some element is removed from the page
:raises: ElementVisiblityTimeout | [
"Synchronization",
"helper",
"to",
"wait",
"until",
"some",
"element",
"is",
"removed",
"from",
"the",
"page"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/po/webdriver/page.py#L159-L172 | train | 61,269 |
praekelt/django-object-tools | object_tools/validation.py | validate | def validate(tool_class, model_class):
"""
Does basic ObjectTool option validation.
"""
if not hasattr(tool_class, 'name'):
raise ImproperlyConfigured("No 'name' attribute found for tool %s." % (
tool_class.__name__
))
if not hasattr(tool_class, 'label'):
raise I... | python | def validate(tool_class, model_class):
"""
Does basic ObjectTool option validation.
"""
if not hasattr(tool_class, 'name'):
raise ImproperlyConfigured("No 'name' attribute found for tool %s." % (
tool_class.__name__
))
if not hasattr(tool_class, 'label'):
raise I... | [
"def",
"validate",
"(",
"tool_class",
",",
"model_class",
")",
":",
"if",
"not",
"hasattr",
"(",
"tool_class",
",",
"'name'",
")",
":",
"raise",
"ImproperlyConfigured",
"(",
"\"No 'name' attribute found for tool %s.\"",
"%",
"(",
"tool_class",
".",
"__name__",
")"... | Does basic ObjectTool option validation. | [
"Does",
"basic",
"ObjectTool",
"option",
"validation",
"."
] | 5923c1ec315edb96bb377762f28efc83ddf121d4 | https://github.com/praekelt/django-object-tools/blob/5923c1ec315edb96bb377762f28efc83ddf121d4/object_tools/validation.py#L8-L25 | train | 61,270 |
praekelt/django-object-tools | object_tools/options.py | ObjectTool.construct_form | def construct_form(self, request):
"""
Constructs form from POST method using self.form_class.
"""
if not hasattr(self, 'form_class'):
return None
if request.method == 'POST':
form = self.form_class(self.model, request.POST, request.FILES)
else:
... | python | def construct_form(self, request):
"""
Constructs form from POST method using self.form_class.
"""
if not hasattr(self, 'form_class'):
return None
if request.method == 'POST':
form = self.form_class(self.model, request.POST, request.FILES)
else:
... | [
"def",
"construct_form",
"(",
"self",
",",
"request",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'form_class'",
")",
":",
"return",
"None",
"if",
"request",
".",
"method",
"==",
"'POST'",
":",
"form",
"=",
"self",
".",
"form_class",
"(",
"sel... | Constructs form from POST method using self.form_class. | [
"Constructs",
"form",
"from",
"POST",
"method",
"using",
"self",
".",
"form_class",
"."
] | 5923c1ec315edb96bb377762f28efc83ddf121d4 | https://github.com/praekelt/django-object-tools/blob/5923c1ec315edb96bb377762f28efc83ddf121d4/object_tools/options.py#L44-L55 | train | 61,271 |
praekelt/django-object-tools | object_tools/options.py | ObjectTool.has_permission | def has_permission(self, user):
"""
Returns True if the given request has permission to use the tool.
Can be overriden by the user in subclasses.
"""
return user.has_perm(
self.model._meta.app_label + '.' + self.get_permission()
) | python | def has_permission(self, user):
"""
Returns True if the given request has permission to use the tool.
Can be overriden by the user in subclasses.
"""
return user.has_perm(
self.model._meta.app_label + '.' + self.get_permission()
) | [
"def",
"has_permission",
"(",
"self",
",",
"user",
")",
":",
"return",
"user",
".",
"has_perm",
"(",
"self",
".",
"model",
".",
"_meta",
".",
"app_label",
"+",
"'.'",
"+",
"self",
".",
"get_permission",
"(",
")",
")"
] | Returns True if the given request has permission to use the tool.
Can be overriden by the user in subclasses. | [
"Returns",
"True",
"if",
"the",
"given",
"request",
"has",
"permission",
"to",
"use",
"the",
"tool",
".",
"Can",
"be",
"overriden",
"by",
"the",
"user",
"in",
"subclasses",
"."
] | 5923c1ec315edb96bb377762f28efc83ddf121d4 | https://github.com/praekelt/django-object-tools/blob/5923c1ec315edb96bb377762f28efc83ddf121d4/object_tools/options.py#L60-L67 | train | 61,272 |
praekelt/django-object-tools | object_tools/options.py | ObjectTool.media | def media(self, form):
"""
Collects admin and form media.
"""
js = ['admin/js/core.js', 'admin/js/admin/RelatedObjectLookups.js',
'admin/js/jquery.min.js', 'admin/js/jquery.init.js']
media = forms.Media(
js=['%s%s' % (settings.STATIC_URL, u) for u in js... | python | def media(self, form):
"""
Collects admin and form media.
"""
js = ['admin/js/core.js', 'admin/js/admin/RelatedObjectLookups.js',
'admin/js/jquery.min.js', 'admin/js/jquery.init.js']
media = forms.Media(
js=['%s%s' % (settings.STATIC_URL, u) for u in js... | [
"def",
"media",
"(",
"self",
",",
"form",
")",
":",
"js",
"=",
"[",
"'admin/js/core.js'",
",",
"'admin/js/admin/RelatedObjectLookups.js'",
",",
"'admin/js/jquery.min.js'",
",",
"'admin/js/jquery.init.js'",
"]",
"media",
"=",
"forms",
".",
"Media",
"(",
"js",
"=",
... | Collects admin and form media. | [
"Collects",
"admin",
"and",
"form",
"media",
"."
] | 5923c1ec315edb96bb377762f28efc83ddf121d4 | https://github.com/praekelt/django-object-tools/blob/5923c1ec315edb96bb377762f28efc83ddf121d4/object_tools/options.py#L69-L84 | train | 61,273 |
praekelt/django-object-tools | object_tools/options.py | ObjectTool._urls | def _urls(self):
"""
URL patterns for tool linked to _view method.
"""
info = (
self.model._meta.app_label, self.model._meta.model_name,
self.name,
)
urlpatterns = [
url(r'^%s/$' % self.name, self._view, name='%s_%s_%s' % info)
... | python | def _urls(self):
"""
URL patterns for tool linked to _view method.
"""
info = (
self.model._meta.app_label, self.model._meta.model_name,
self.name,
)
urlpatterns = [
url(r'^%s/$' % self.name, self._view, name='%s_%s_%s' % info)
... | [
"def",
"_urls",
"(",
"self",
")",
":",
"info",
"=",
"(",
"self",
".",
"model",
".",
"_meta",
".",
"app_label",
",",
"self",
".",
"model",
".",
"_meta",
".",
"model_name",
",",
"self",
".",
"name",
",",
")",
"urlpatterns",
"=",
"[",
"url",
"(",
"r... | URL patterns for tool linked to _view method. | [
"URL",
"patterns",
"for",
"tool",
"linked",
"to",
"_view",
"method",
"."
] | 5923c1ec315edb96bb377762f28efc83ddf121d4 | https://github.com/praekelt/django-object-tools/blob/5923c1ec315edb96bb377762f28efc83ddf121d4/object_tools/options.py#L96-L107 | train | 61,274 |
praekelt/django-object-tools | object_tools/options.py | ObjectTool.construct_context | def construct_context(self, request):
"""
Builds context with various required variables.
"""
opts = self.model._meta
app_label = opts.app_label
object_name = opts.object_name.lower()
form = self.construct_form(request)
media = self.media(form)
co... | python | def construct_context(self, request):
"""
Builds context with various required variables.
"""
opts = self.model._meta
app_label = opts.app_label
object_name = opts.object_name.lower()
form = self.construct_form(request)
media = self.media(form)
co... | [
"def",
"construct_context",
"(",
"self",
",",
"request",
")",
":",
"opts",
"=",
"self",
".",
"model",
".",
"_meta",
"app_label",
"=",
"opts",
".",
"app_label",
"object_name",
"=",
"opts",
".",
"object_name",
".",
"lower",
"(",
")",
"form",
"=",
"self",
... | Builds context with various required variables. | [
"Builds",
"context",
"with",
"various",
"required",
"variables",
"."
] | 5923c1ec315edb96bb377762f28efc83ddf121d4 | https://github.com/praekelt/django-object-tools/blob/5923c1ec315edb96bb377762f28efc83ddf121d4/object_tools/options.py#L110-L138 | train | 61,275 |
praekelt/django-object-tools | object_tools/options.py | ObjectTool._view | def _view(self, request, extra_context=None):
"""
View wrapper taking care of houskeeping for painless form rendering.
"""
if not self.has_permission(request.user):
raise PermissionDenied
return self.view(request, self.construct_context(request)) | python | def _view(self, request, extra_context=None):
"""
View wrapper taking care of houskeeping for painless form rendering.
"""
if not self.has_permission(request.user):
raise PermissionDenied
return self.view(request, self.construct_context(request)) | [
"def",
"_view",
"(",
"self",
",",
"request",
",",
"extra_context",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"has_permission",
"(",
"request",
".",
"user",
")",
":",
"raise",
"PermissionDenied",
"return",
"self",
".",
"view",
"(",
"request",
",",
... | View wrapper taking care of houskeeping for painless form rendering. | [
"View",
"wrapper",
"taking",
"care",
"of",
"houskeeping",
"for",
"painless",
"form",
"rendering",
"."
] | 5923c1ec315edb96bb377762f28efc83ddf121d4 | https://github.com/praekelt/django-object-tools/blob/5923c1ec315edb96bb377762f28efc83ddf121d4/object_tools/options.py#L141-L148 | train | 61,276 |
Element-34/py.saunter | saunter/providers/csv_provider.py | CSVProvider.randomRow | def randomRow(self):
"""
Gets a random row from the provider
:returns: List
"""
l = []
for row in self.data:
l.append(row)
return random.choice(l) | python | def randomRow(self):
"""
Gets a random row from the provider
:returns: List
"""
l = []
for row in self.data:
l.append(row)
return random.choice(l) | [
"def",
"randomRow",
"(",
"self",
")",
":",
"l",
"=",
"[",
"]",
"for",
"row",
"in",
"self",
".",
"data",
":",
"l",
".",
"append",
"(",
"row",
")",
"return",
"random",
".",
"choice",
"(",
"l",
")"
] | Gets a random row from the provider
:returns: List | [
"Gets",
"a",
"random",
"row",
"from",
"the",
"provider"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/providers/csv_provider.py#L37-L46 | train | 61,277 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_equal | def verify_equal(self, first, second, msg=""):
"""
Soft assert for equality
:params want: the value to compare against
:params second: the value to compare with
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_equal(first, se... | python | def verify_equal(self, first, second, msg=""):
"""
Soft assert for equality
:params want: the value to compare against
:params second: the value to compare with
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_equal(first, se... | [
"def",
"verify_equal",
"(",
"self",
",",
"first",
",",
"second",
",",
"msg",
"=",
"\"\"",
")",
":",
"try",
":",
"self",
".",
"assert_equal",
"(",
"first",
",",
"second",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",
":",
... | Soft assert for equality
:params want: the value to compare against
:params second: the value to compare with
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"equality"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L22-L37 | train | 61,278 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_not_equal | def verify_not_equal(self, first, second, msg=""):
"""
Soft assert for inequality
:params want: the value to compare against
:params second: the value to compare with
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_not_equal... | python | def verify_not_equal(self, first, second, msg=""):
"""
Soft assert for inequality
:params want: the value to compare against
:params second: the value to compare with
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_not_equal... | [
"def",
"verify_not_equal",
"(",
"self",
",",
"first",
",",
"second",
",",
"msg",
"=",
"\"\"",
")",
":",
"try",
":",
"self",
".",
"assert_not_equal",
"(",
"first",
",",
"second",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",
... | Soft assert for inequality
:params want: the value to compare against
:params second: the value to compare with
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"inequality"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L49-L64 | train | 61,279 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_true | def verify_true(self, expr, msg=None):
"""
Soft assert for whether the condition is true
:params expr: the statement to evaluate
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_true(expr, msg)
except AssertionError, e:
... | python | def verify_true(self, expr, msg=None):
"""
Soft assert for whether the condition is true
:params expr: the statement to evaluate
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_true(expr, msg)
except AssertionError, e:
... | [
"def",
"verify_true",
"(",
"self",
",",
"expr",
",",
"msg",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"assert_true",
"(",
"expr",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",
":",
"m",
"=",
"\"%s:\\n%s\"",
"%",
"("... | Soft assert for whether the condition is true
:params expr: the statement to evaluate
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"whether",
"the",
"condition",
"is",
"true"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L75-L89 | train | 61,280 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_false | def verify_false(self, expr, msg=None):
"""
Soft assert for whether the condition is false
:params expr: the statement to evaluate
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_false(expr, msg)
except AssertionError, e:
... | python | def verify_false(self, expr, msg=None):
"""
Soft assert for whether the condition is false
:params expr: the statement to evaluate
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_false(expr, msg)
except AssertionError, e:
... | [
"def",
"verify_false",
"(",
"self",
",",
"expr",
",",
"msg",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"assert_false",
"(",
"expr",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",
":",
"m",
"=",
"\"%s:\\n%s\"",
"%",
"... | Soft assert for whether the condition is false
:params expr: the statement to evaluate
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"whether",
"the",
"condition",
"is",
"false"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L100-L114 | train | 61,281 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_is | def verify_is(self, first, second, msg=None):
"""
Soft assert for whether the parameters evaluate to the same object
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference
"""
t... | python | def verify_is(self, first, second, msg=None):
"""
Soft assert for whether the parameters evaluate to the same object
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference
"""
t... | [
"def",
"verify_is",
"(",
"self",
",",
"first",
",",
"second",
",",
"msg",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"assert_is",
"(",
"first",
",",
"second",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",
":",
"m",
... | Soft assert for whether the parameters evaluate to the same object
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"whether",
"the",
"parameters",
"evaluate",
"to",
"the",
"same",
"object"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L126-L141 | train | 61,282 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_is_not | def verify_is_not(self, first, second, msg=None):
"""
Soft assert for whether the parameters do not evaluate to the same object
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference
""... | python | def verify_is_not(self, first, second, msg=None):
"""
Soft assert for whether the parameters do not evaluate to the same object
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference
""... | [
"def",
"verify_is_not",
"(",
"self",
",",
"first",
",",
"second",
",",
"msg",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"assert_is_not",
"(",
"first",
",",
"second",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",
":",
... | Soft assert for whether the parameters do not evaluate to the same object
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"whether",
"the",
"parameters",
"do",
"not",
"evaluate",
"to",
"the",
"same",
"object"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L153-L168 | train | 61,283 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_is_none | def verify_is_none(self, expr, msg=None):
"""
Soft assert for whether the expr is None
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_is... | python | def verify_is_none(self, expr, msg=None):
"""
Soft assert for whether the expr is None
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_is... | [
"def",
"verify_is_none",
"(",
"self",
",",
"expr",
",",
"msg",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"assert_is_none",
"(",
"expr",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",
":",
"m",
"=",
"\"%s:\\n%s\"",
"%",... | Soft assert for whether the expr is None
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"whether",
"the",
"expr",
"is",
"None"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L179-L194 | train | 61,284 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_is_not_none | def verify_is_not_none(self, expr, msg=None):
"""
Soft assert for whether the expr is not None
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference
"""
try:
self.a... | python | def verify_is_not_none(self, expr, msg=None):
"""
Soft assert for whether the expr is not None
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference
"""
try:
self.a... | [
"def",
"verify_is_not_none",
"(",
"self",
",",
"expr",
",",
"msg",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"assert_is_not_none",
"(",
"expr",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",
":",
"m",
"=",
"\"%s:\\n%s\""... | Soft assert for whether the expr is not None
:params want: the object to compare against
:params second: the object to compare with
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"whether",
"the",
"expr",
"is",
"not",
"None"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L205-L220 | train | 61,285 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_in | def verify_in(self, first, second, msg=""):
"""
Soft assert for whether the first is in second
:params first: the value to check
:params second: the container to check in
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_in(fi... | python | def verify_in(self, first, second, msg=""):
"""
Soft assert for whether the first is in second
:params first: the value to check
:params second: the container to check in
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert_in(fi... | [
"def",
"verify_in",
"(",
"self",
",",
"first",
",",
"second",
",",
"msg",
"=",
"\"\"",
")",
":",
"try",
":",
"self",
".",
"assert_in",
"(",
"first",
",",
"second",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",
":",
"m",
... | Soft assert for whether the first is in second
:params first: the value to check
:params second: the container to check in
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"whether",
"the",
"first",
"is",
"in",
"second"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L232-L247 | train | 61,286 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_not_in | def verify_not_in(self, first, second, msg=""):
"""
Soft assert for whether the first is not in second
:params first: the value to check
:params second: the container to check in
:params msg: (Optional) msg explaining the difference
"""
try:
self.asse... | python | def verify_not_in(self, first, second, msg=""):
"""
Soft assert for whether the first is not in second
:params first: the value to check
:params second: the container to check in
:params msg: (Optional) msg explaining the difference
"""
try:
self.asse... | [
"def",
"verify_not_in",
"(",
"self",
",",
"first",
",",
"second",
",",
"msg",
"=",
"\"\"",
")",
":",
"try",
":",
"self",
".",
"assert_not_in",
"(",
"first",
",",
"second",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",
":",
... | Soft assert for whether the first is not in second
:params first: the value to check
:params second: the container to check in
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"whether",
"the",
"first",
"is",
"not",
"in",
"second"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L259-L274 | train | 61,287 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_is_instance | def verify_is_instance(self, obj, cls, msg=""):
"""
Soft assert for whether the is an instance of cls
:params obj: the object instance
:params cls: the class to compare against
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert... | python | def verify_is_instance(self, obj, cls, msg=""):
"""
Soft assert for whether the is an instance of cls
:params obj: the object instance
:params cls: the class to compare against
:params msg: (Optional) msg explaining the difference
"""
try:
self.assert... | [
"def",
"verify_is_instance",
"(",
"self",
",",
"obj",
",",
"cls",
",",
"msg",
"=",
"\"\"",
")",
":",
"try",
":",
"self",
".",
"assert_is_instance",
"(",
"obj",
",",
"cls",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",
":",
... | Soft assert for whether the is an instance of cls
:params obj: the object instance
:params cls: the class to compare against
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"whether",
"the",
"is",
"an",
"instance",
"of",
"cls"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L286-L301 | train | 61,288 |
Element-34/py.saunter | saunter/matchers.py | Matchers.verify_is_not_instance | def verify_is_not_instance(self, obj, cls, msg=""):
"""
Soft assert for whether the is not an instance of cls
:params obj: the object instance
:params cls: the class to compare against
:params msg: (Optional) msg explaining the difference
"""
try:
sel... | python | def verify_is_not_instance(self, obj, cls, msg=""):
"""
Soft assert for whether the is not an instance of cls
:params obj: the object instance
:params cls: the class to compare against
:params msg: (Optional) msg explaining the difference
"""
try:
sel... | [
"def",
"verify_is_not_instance",
"(",
"self",
",",
"obj",
",",
"cls",
",",
"msg",
"=",
"\"\"",
")",
":",
"try",
":",
"self",
".",
"assert_is_not_instance",
"(",
"obj",
",",
"cls",
",",
"msg",
")",
"except",
"AssertionError",
",",
"e",
":",
"if",
"msg",... | Soft assert for whether the is not an instance of cls
:params obj: the object instance
:params cls: the class to compare against
:params msg: (Optional) msg explaining the difference | [
"Soft",
"assert",
"for",
"whether",
"the",
"is",
"not",
"an",
"instance",
"of",
"cls"
] | bdc8480b1453e082872c80d3382d42565b8ed9c0 | https://github.com/Element-34/py.saunter/blob/bdc8480b1453e082872c80d3382d42565b8ed9c0/saunter/matchers.py#L313-L328 | train | 61,289 |
serkanyersen/underscore.py | src/underscore.py | underscore.obj | def obj(self):
"""
Returns passed object but if chain method is used
returns the last processed result
"""
if self._wrapped is not self.Null:
return self._wrapped
else:
return self.object | python | def obj(self):
"""
Returns passed object but if chain method is used
returns the last processed result
"""
if self._wrapped is not self.Null:
return self._wrapped
else:
return self.object | [
"def",
"obj",
"(",
"self",
")",
":",
"if",
"self",
".",
"_wrapped",
"is",
"not",
"self",
".",
"Null",
":",
"return",
"self",
".",
"_wrapped",
"else",
":",
"return",
"self",
".",
"object"
] | Returns passed object but if chain method is used
returns the last processed result | [
"Returns",
"passed",
"object",
"but",
"if",
"chain",
"method",
"is",
"used",
"returns",
"the",
"last",
"processed",
"result"
] | 07c25c3f0f789536e4ad47aa315faccc0da9602f | https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L115-L123 | train | 61,290 |
serkanyersen/underscore.py | src/underscore.py | underscore._wrap | def _wrap(self, ret):
"""
Returns result but ig chain method is used
returns the object itself so we can chain
"""
if self.chained:
self._wrapped = ret
return self
else:
return ret | python | def _wrap(self, ret):
"""
Returns result but ig chain method is used
returns the object itself so we can chain
"""
if self.chained:
self._wrapped = ret
return self
else:
return ret | [
"def",
"_wrap",
"(",
"self",
",",
"ret",
")",
":",
"if",
"self",
".",
"chained",
":",
"self",
".",
"_wrapped",
"=",
"ret",
"return",
"self",
"else",
":",
"return",
"ret"
] | Returns result but ig chain method is used
returns the object itself so we can chain | [
"Returns",
"result",
"but",
"ig",
"chain",
"method",
"is",
"used",
"returns",
"the",
"object",
"itself",
"so",
"we",
"can",
"chain"
] | 07c25c3f0f789536e4ad47aa315faccc0da9602f | https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L132-L141 | train | 61,291 |
serkanyersen/underscore.py | src/underscore.py | underscore._toOriginal | def _toOriginal(self, val):
""" Pitty attempt to convert itertools result into a real object
"""
if self._clean.isTuple():
return tuple(val)
elif self._clean.isList():
return list(val)
elif self._clean.isDict():
return dict(val)
else:
... | python | def _toOriginal(self, val):
""" Pitty attempt to convert itertools result into a real object
"""
if self._clean.isTuple():
return tuple(val)
elif self._clean.isList():
return list(val)
elif self._clean.isDict():
return dict(val)
else:
... | [
"def",
"_toOriginal",
"(",
"self",
",",
"val",
")",
":",
"if",
"self",
".",
"_clean",
".",
"isTuple",
"(",
")",
":",
"return",
"tuple",
"(",
"val",
")",
"elif",
"self",
".",
"_clean",
".",
"isList",
"(",
")",
":",
"return",
"list",
"(",
"val",
")... | Pitty attempt to convert itertools result into a real object | [
"Pitty",
"attempt",
"to",
"convert",
"itertools",
"result",
"into",
"a",
"real",
"object"
] | 07c25c3f0f789536e4ad47aa315faccc0da9602f | https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L151-L161 | train | 61,292 |
serkanyersen/underscore.py | src/underscore.py | underscore.map | def map(self, func):
""" Return the results of applying the iterator to each element.
"""
ns = self.Namespace()
ns.results = []
def by(value, index, list, *args):
ns.results.append(func(value, index, list))
_(self.obj).each(by)
return self._wrap(ns.r... | python | def map(self, func):
""" Return the results of applying the iterator to each element.
"""
ns = self.Namespace()
ns.results = []
def by(value, index, list, *args):
ns.results.append(func(value, index, list))
_(self.obj).each(by)
return self._wrap(ns.r... | [
"def",
"map",
"(",
"self",
",",
"func",
")",
":",
"ns",
"=",
"self",
".",
"Namespace",
"(",
")",
"ns",
".",
"results",
"=",
"[",
"]",
"def",
"by",
"(",
"value",
",",
"index",
",",
"list",
",",
"*",
"args",
")",
":",
"ns",
".",
"results",
".",... | Return the results of applying the iterator to each element. | [
"Return",
"the",
"results",
"of",
"applying",
"the",
"iterator",
"to",
"each",
"element",
"."
] | 07c25c3f0f789536e4ad47aa315faccc0da9602f | https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L185-L195 | train | 61,293 |
serkanyersen/underscore.py | src/underscore.py | underscore.reduceRight | def reduceRight(self, func):
""" The right-associative version of reduce, also known as `foldr`.
"""
#foldr = lambda f, i: lambda s: reduce(f, s, i)
x = self.obj[:]
x.reverse()
return self._wrap(functools.reduce(func, x)) | python | def reduceRight(self, func):
""" The right-associative version of reduce, also known as `foldr`.
"""
#foldr = lambda f, i: lambda s: reduce(f, s, i)
x = self.obj[:]
x.reverse()
return self._wrap(functools.reduce(func, x)) | [
"def",
"reduceRight",
"(",
"self",
",",
"func",
")",
":",
"#foldr = lambda f, i: lambda s: reduce(f, s, i)",
"x",
"=",
"self",
".",
"obj",
"[",
":",
"]",
"x",
".",
"reverse",
"(",
")",
"return",
"self",
".",
"_wrap",
"(",
"functools",
".",
"reduce",
"(",
... | The right-associative version of reduce, also known as `foldr`. | [
"The",
"right",
"-",
"associative",
"version",
"of",
"reduce",
"also",
"known",
"as",
"foldr",
"."
] | 07c25c3f0f789536e4ad47aa315faccc0da9602f | https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L221-L227 | train | 61,294 |
serkanyersen/underscore.py | src/underscore.py | underscore.find | def find(self, func):
"""
Return the first value which passes a truth test.
Aliased as `detect`.
"""
self.ftmp = None
def test(value, index, list):
if func(value, index, list) is True:
self.ftmp = value
return True
self... | python | def find(self, func):
"""
Return the first value which passes a truth test.
Aliased as `detect`.
"""
self.ftmp = None
def test(value, index, list):
if func(value, index, list) is True:
self.ftmp = value
return True
self... | [
"def",
"find",
"(",
"self",
",",
"func",
")",
":",
"self",
".",
"ftmp",
"=",
"None",
"def",
"test",
"(",
"value",
",",
"index",
",",
"list",
")",
":",
"if",
"func",
"(",
"value",
",",
"index",
",",
"list",
")",
"is",
"True",
":",
"self",
".",
... | Return the first value which passes a truth test.
Aliased as `detect`. | [
"Return",
"the",
"first",
"value",
"which",
"passes",
"a",
"truth",
"test",
".",
"Aliased",
"as",
"detect",
"."
] | 07c25c3f0f789536e4ad47aa315faccc0da9602f | https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L230-L242 | train | 61,295 |
serkanyersen/underscore.py | src/underscore.py | underscore.filter | def filter(self, func):
""" Return all the elements that pass a truth test.
"""
return self._wrap(list(filter(func, self.obj))) | python | def filter(self, func):
""" Return all the elements that pass a truth test.
"""
return self._wrap(list(filter(func, self.obj))) | [
"def",
"filter",
"(",
"self",
",",
"func",
")",
":",
"return",
"self",
".",
"_wrap",
"(",
"list",
"(",
"filter",
"(",
"func",
",",
"self",
".",
"obj",
")",
")",
")"
] | Return all the elements that pass a truth test. | [
"Return",
"all",
"the",
"elements",
"that",
"pass",
"a",
"truth",
"test",
"."
] | 07c25c3f0f789536e4ad47aa315faccc0da9602f | https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L245-L248 | train | 61,296 |
serkanyersen/underscore.py | src/underscore.py | underscore.reject | def reject(self, func):
""" Return all the elements for which a truth test fails.
"""
return self._wrap(list(filter(lambda val: not func(val), self.obj))) | python | def reject(self, func):
""" Return all the elements for which a truth test fails.
"""
return self._wrap(list(filter(lambda val: not func(val), self.obj))) | [
"def",
"reject",
"(",
"self",
",",
"func",
")",
":",
"return",
"self",
".",
"_wrap",
"(",
"list",
"(",
"filter",
"(",
"lambda",
"val",
":",
"not",
"func",
"(",
"val",
")",
",",
"self",
".",
"obj",
")",
")",
")"
] | Return all the elements for which a truth test fails. | [
"Return",
"all",
"the",
"elements",
"for",
"which",
"a",
"truth",
"test",
"fails",
"."
] | 07c25c3f0f789536e4ad47aa315faccc0da9602f | https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L251-L254 | train | 61,297 |
serkanyersen/underscore.py | src/underscore.py | underscore.all | def all(self, func=None):
""" Determine whether all of the elements match a truth test.
"""
if func is None:
func = lambda x, *args: x
self.altmp = True
def testEach(value, index, *args):
if func(value, index, *args) is False:
self.altmp =... | python | def all(self, func=None):
""" Determine whether all of the elements match a truth test.
"""
if func is None:
func = lambda x, *args: x
self.altmp = True
def testEach(value, index, *args):
if func(value, index, *args) is False:
self.altmp =... | [
"def",
"all",
"(",
"self",
",",
"func",
"=",
"None",
")",
":",
"if",
"func",
"is",
"None",
":",
"func",
"=",
"lambda",
"x",
",",
"*",
"args",
":",
"x",
"self",
".",
"altmp",
"=",
"True",
"def",
"testEach",
"(",
"value",
",",
"index",
",",
"*",
... | Determine whether all of the elements match a truth test. | [
"Determine",
"whether",
"all",
"of",
"the",
"elements",
"match",
"a",
"truth",
"test",
"."
] | 07c25c3f0f789536e4ad47aa315faccc0da9602f | https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L256-L268 | train | 61,298 |
serkanyersen/underscore.py | src/underscore.py | underscore.any | def any(self, func=None):
"""
Determine if at least one element in the object
matches a truth test.
"""
if func is None:
func = lambda x, *args: x
self.antmp = False
def testEach(value, index, *args):
if func(value, index, *args) is True:
... | python | def any(self, func=None):
"""
Determine if at least one element in the object
matches a truth test.
"""
if func is None:
func = lambda x, *args: x
self.antmp = False
def testEach(value, index, *args):
if func(value, index, *args) is True:
... | [
"def",
"any",
"(",
"self",
",",
"func",
"=",
"None",
")",
":",
"if",
"func",
"is",
"None",
":",
"func",
"=",
"lambda",
"x",
",",
"*",
"args",
":",
"x",
"self",
".",
"antmp",
"=",
"False",
"def",
"testEach",
"(",
"value",
",",
"index",
",",
"*",... | Determine if at least one element in the object
matches a truth test. | [
"Determine",
"if",
"at",
"least",
"one",
"element",
"in",
"the",
"object",
"matches",
"a",
"truth",
"test",
"."
] | 07c25c3f0f789536e4ad47aa315faccc0da9602f | https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L271-L286 | train | 61,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.