nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ufal/neuralmonkey | 8b1465270f6bb28d5417a85cec492f7179036ede | neuralmonkey/decoders/decoder.py | python | Decoder.input_plus_attention | (self, *args) | return dropout(
tf.layers.dense(emb_with_ctx, self.embedding_size),
self.dropout_keep_prob, self.train_mode) | Merge input and previous attentions.
Input and previous attentions are merged into a single vector
of the size fo embedding. | Merge input and previous attentions. | [
"Merge",
"input",
"and",
"previous",
"attentions",
"."
] | def input_plus_attention(self, *args) -> tf.Tensor:
"""Merge input and previous attentions.
Input and previous attentions are merged into a single vector
of the size fo embedding.
"""
loop_state = LoopState(*args)
feedables = loop_state.feedables
emb_with_ctx = t... | [
"def",
"input_plus_attention",
"(",
"self",
",",
"*",
"args",
")",
"->",
"tf",
".",
"Tensor",
":",
"loop_state",
"=",
"LoopState",
"(",
"*",
"args",
")",
"feedables",
"=",
"loop_state",
".",
"feedables",
"emb_with_ctx",
"=",
"tf",
".",
"concat",
"(",
"["... | https://github.com/ufal/neuralmonkey/blob/8b1465270f6bb28d5417a85cec492f7179036ede/neuralmonkey/decoders/decoder.py#L264-L277 | |
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/addons/importer.py | python | Importer.import_shape_files | (self, fonts: Set[str]) | Import shape file table entries from the source document into the
target document.
Shape file entries are stored in the styles table but without a name. | Import shape file table entries from the source document into the
target document.
Shape file entries are stored in the styles table but without a name. | [
"Import",
"shape",
"file",
"table",
"entries",
"from",
"the",
"source",
"document",
"into",
"the",
"target",
"document",
".",
"Shape",
"file",
"entries",
"are",
"stored",
"in",
"the",
"styles",
"table",
"but",
"without",
"a",
"name",
"."
] | def import_shape_files(self, fonts: Set[str]) -> None:
"""Import shape file table entries from the source document into the
target document.
Shape file entries are stored in the styles table but without a name.
"""
for font in fonts:
table_entry = self.source.styles.... | [
"def",
"import_shape_files",
"(",
"self",
",",
"fonts",
":",
"Set",
"[",
"str",
"]",
")",
"->",
"None",
":",
"for",
"font",
"in",
"fonts",
":",
"table_entry",
"=",
"self",
".",
"source",
".",
"styles",
".",
"find_shx",
"(",
"font",
")",
"# copy is not ... | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/addons/importer.py#L229-L245 | ||
pik-copan/pyunicorn | b18316fc08ef34b434a1a4d69dfe3e57e24435ee | pyunicorn/core/grid.py | python | Grid.node_coordinates | (self, index) | return tuple(self._grid["space"][:, index]) | Return the position of node ``index``.
**Example:**
>>> Grid.SmallTestGrid().node_coordinates(3)
[15.0, 10.0]
:type index: number (int)
:arg index: The node index as used in node sequences.
:rtype: tuple of number (float)
:return: the node's coordinates. | Return the position of node ``index``. | [
"Return",
"the",
"position",
"of",
"node",
"index",
"."
] | def node_coordinates(self, index):
"""
Return the position of node ``index``.
**Example:**
>>> Grid.SmallTestGrid().node_coordinates(3)
[15.0, 10.0]
:type index: number (int)
:arg index: The node index as used in node sequences.
:rtype: tuple of number... | [
"def",
"node_coordinates",
"(",
"self",
",",
"index",
")",
":",
"return",
"tuple",
"(",
"self",
".",
"_grid",
"[",
"\"space\"",
"]",
"[",
":",
",",
"index",
"]",
")"
] | https://github.com/pik-copan/pyunicorn/blob/b18316fc08ef34b434a1a4d69dfe3e57e24435ee/pyunicorn/core/grid.py#L275-L290 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py | python | session | () | return Session() | Returns a :class:`Session` for context-management.
:rtype: Session | Returns a :class:`Session` for context-management. | [
"Returns",
"a",
":",
"class",
":",
"Session",
"for",
"context",
"-",
"management",
"."
] | def session():
"""
Returns a :class:`Session` for context-management.
:rtype: Session
"""
return Session() | [
"def",
"session",
"(",
")",
":",
"return",
"Session",
"(",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py#L734-L741 | |
mikedh/trimesh | 6b1e05616b44e6dd708d9bc748b211656ebb27ec | trimesh/voxel/morphology.py | python | fill_holes | (encoding, **kwargs) | return enc.DenseEncoding(
_m.binary_fill_holes(_dense(encoding, rank=3), **kwargs)) | Encoding wrapper around scipy.ndimage.morphology.binary_fill_holes.
https://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.ndimage.morphology.binary_fill_holes.html#scipy.ndimage.morphology.binary_fill_holes
Parameters
--------------
encoding: Encoding object or dense rank-3 array.
**kw... | Encoding wrapper around scipy.ndimage.morphology.binary_fill_holes. | [
"Encoding",
"wrapper",
"around",
"scipy",
".",
"ndimage",
".",
"morphology",
".",
"binary_fill_holes",
"."
] | def fill_holes(encoding, **kwargs):
"""
Encoding wrapper around scipy.ndimage.morphology.binary_fill_holes.
https://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.ndimage.morphology.binary_fill_holes.html#scipy.ndimage.morphology.binary_fill_holes
Parameters
--------------
encoding:... | [
"def",
"fill_holes",
"(",
"encoding",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"enc",
".",
"DenseEncoding",
"(",
"_m",
".",
"binary_fill_holes",
"(",
"_dense",
"(",
"encoding",
",",
"rank",
"=",
"3",
")",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/mikedh/trimesh/blob/6b1e05616b44e6dd708d9bc748b211656ebb27ec/trimesh/voxel/morphology.py#L100-L116 | |
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/voiper/sulley/impacket/dcerpc/svcctl.py | python | SVCCTLOpenSCManagerHeader.get_header_size | (self) | return SVCCTLOpenSCManagerHeader.__SIZE | [] | def get_header_size(self):
return SVCCTLOpenSCManagerHeader.__SIZE | [
"def",
"get_header_size",
"(",
"self",
")",
":",
"return",
"SVCCTLOpenSCManagerHeader",
".",
"__SIZE"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/voiper/sulley/impacket/dcerpc/svcctl.py#L68-L69 | |||
PaddlePaddle/PaddleDetection | 635e3e0a80f3d05751cdcfca8af04ee17c601a92 | ppdet/metrics/munkres.py | python | Munkres.compute | (self, cost_matrix) | return results | Compute the indexes for the lowest-cost pairings between rows and
columns in the database. Returns a list of (row, column) tuples
that can be used to traverse the matrix.
:Parameters:
cost_matrix : list of lists
The cost matrix. If this cost matrix is not square, it
... | Compute the indexes for the lowest-cost pairings between rows and
columns in the database. Returns a list of (row, column) tuples
that can be used to traverse the matrix. | [
"Compute",
"the",
"indexes",
"for",
"the",
"lowest",
"-",
"cost",
"pairings",
"between",
"rows",
"and",
"columns",
"in",
"the",
"database",
".",
"Returns",
"a",
"list",
"of",
"(",
"row",
"column",
")",
"tuples",
"that",
"can",
"be",
"used",
"to",
"traver... | def compute(self, cost_matrix):
"""
Compute the indexes for the lowest-cost pairings between rows and
columns in the database. Returns a list of (row, column) tuples
that can be used to traverse the matrix.
:Parameters:
cost_matrix : list of lists
The... | [
"def",
"compute",
"(",
"self",
",",
"cost_matrix",
")",
":",
"self",
".",
"C",
"=",
"self",
".",
"pad_matrix",
"(",
"cost_matrix",
")",
"self",
".",
"n",
"=",
"len",
"(",
"self",
".",
"C",
")",
"self",
".",
"original_length",
"=",
"len",
"(",
"cost... | https://github.com/PaddlePaddle/PaddleDetection/blob/635e3e0a80f3d05751cdcfca8af04ee17c601a92/ppdet/metrics/munkres.py#L87-L145 | |
nltk/nltk | 3f74ac55681667d7ef78b664557487145f51eb02 | nltk/sem/logic.py | python | Expression.constants | (self) | return self.visit(
lambda e: e.constants(), lambda parts: reduce(operator.or_, parts, set())
) | Return a set of individual constants (non-predicates).
:return: set of ``Variable`` objects | Return a set of individual constants (non-predicates).
:return: set of ``Variable`` objects | [
"Return",
"a",
"set",
"of",
"individual",
"constants",
"(",
"non",
"-",
"predicates",
")",
".",
":",
"return",
":",
"set",
"of",
"Variable",
"objects"
] | def constants(self):
"""
Return a set of individual constants (non-predicates).
:return: set of ``Variable`` objects
"""
return self.visit(
lambda e: e.constants(), lambda parts: reduce(operator.or_, parts, set())
) | [
"def",
"constants",
"(",
"self",
")",
":",
"return",
"self",
".",
"visit",
"(",
"lambda",
"e",
":",
"e",
".",
"constants",
"(",
")",
",",
"lambda",
"parts",
":",
"reduce",
"(",
"operator",
".",
"or_",
",",
"parts",
",",
"set",
"(",
")",
")",
")"
... | https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/sem/logic.py#L1181-L1188 | |
tsudoko/anki-sync-server | 41205c0b92290bc3dc6e50d401dc9dbf33bdd52c | ankisyncd/thread.py | python | ThreadingCollectionWrapper.close | (self) | Closes the underlying collection without stopping the thread. | Closes the underlying collection without stopping the thread. | [
"Closes",
"the",
"underlying",
"collection",
"without",
"stopping",
"the",
"thread",
"."
] | def close(self):
"""Closes the underlying collection without stopping the thread."""
def _close(col):
self.wrapper.close()
self.execute(_close, waitForReturn=False) | [
"def",
"close",
"(",
"self",
")",
":",
"def",
"_close",
"(",
"col",
")",
":",
"self",
".",
"wrapper",
".",
"close",
"(",
")",
"self",
".",
"execute",
"(",
"_close",
",",
"waitForReturn",
"=",
"False",
")"
] | https://github.com/tsudoko/anki-sync-server/blob/41205c0b92290bc3dc6e50d401dc9dbf33bdd52c/ankisyncd/thread.py#L144-L149 | ||
axcore/tartube | 36dd493642923fe8b9190a41db596c30c043ae90 | tartube/utils.py | python | add_links_to_textview | (app_obj, link_list, textbuffer, mark_start=None,
mark_end=None, drag_drop_text=None) | Called by mainwin.AddVideoDialogue.__init__(),
.on_window_drag_data_received() and .clipboard_timer_callback().
Also called by utils.add_links_to_textview_from_clipboard().
Function to add valid URLs from the clipboard to a Gtk.TextView, ignoring
anything that is not a valid URL, and ignoring duplicat... | Called by mainwin.AddVideoDialogue.__init__(),
.on_window_drag_data_received() and .clipboard_timer_callback(). | [
"Called",
"by",
"mainwin",
".",
"AddVideoDialogue",
".",
"__init__",
"()",
".",
"on_window_drag_data_received",
"()",
"and",
".",
"clipboard_timer_callback",
"()",
"."
] | def add_links_to_textview(app_obj, link_list, textbuffer, mark_start=None,
mark_end=None, drag_drop_text=None):
"""Called by mainwin.AddVideoDialogue.__init__(),
.on_window_drag_data_received() and .clipboard_timer_callback().
Also called by utils.add_links_to_textview_from_clipboard().
Function to a... | [
"def",
"add_links_to_textview",
"(",
"app_obj",
",",
"link_list",
",",
"textbuffer",
",",
"mark_start",
"=",
"None",
",",
"mark_end",
"=",
"None",
",",
"drag_drop_text",
"=",
"None",
")",
":",
"# Eliminate empty lines and any lines that are not valid URLs (we assume",
"... | https://github.com/axcore/tartube/blob/36dd493642923fe8b9190a41db596c30c043ae90/tartube/utils.py#L124-L203 | ||
bfontaine/term2048 | 6f2d7fce0bbbf00a217a907dd72db3f95d54c6b3 | term2048/game.py | python | Game.getCellStr | (self, x, y) | return self.__colors.get(c, Fore.RESET) + s + Style.RESET_ALL | return a string representation of the cell located at x,y. | return a string representation of the cell located at x,y. | [
"return",
"a",
"string",
"representation",
"of",
"the",
"cell",
"located",
"at",
"x",
"y",
"."
] | def getCellStr(self, x, y): # TODO: refactor regarding issue #11
"""
return a string representation of the cell located at x,y.
"""
c = self.board.getCell(x, y)
if c == 0:
return '.' if self.__azmode else ' .'
elif self.__azmode:
az = {}
... | [
"def",
"getCellStr",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"# TODO: refactor regarding issue #11",
"c",
"=",
"self",
".",
"board",
".",
"getCell",
"(",
"x",
",",
"y",
")",
"if",
"c",
"==",
"0",
":",
"return",
"'.'",
"if",
"self",
".",
"__azmode"... | https://github.com/bfontaine/term2048/blob/6f2d7fce0bbbf00a217a907dd72db3f95d54c6b3/term2048/game.py#L255-L279 | |
GoSecure/pyrdp | abd8b8762b6d7fd0e49d4a927b529f892b412743 | pyrdp/layer/rdp/virtual_channel/virtual_channel.py | python | VirtualChannelLayer.shouldForward | (self, pdu: PDU) | return True | [] | def shouldForward(self, pdu: PDU) -> bool:
return True | [
"def",
"shouldForward",
"(",
"self",
",",
"pdu",
":",
"PDU",
")",
"->",
"bool",
":",
"return",
"True"
] | https://github.com/GoSecure/pyrdp/blob/abd8b8762b6d7fd0e49d4a927b529f892b412743/pyrdp/layer/rdp/virtual_channel/virtual_channel.py#L61-L62 | |||
svenkreiss/pysparkling | f0e8e8d039f3313c2693b7c7576cb1b7ba5a6d78 | pysparkling/streaming/context.py | python | StreamingContext.sparkContext | (self) | return self._context | Return context of this StreamingContext. | Return context of this StreamingContext. | [
"Return",
"context",
"of",
"this",
"StreamingContext",
"."
] | def sparkContext(self):
"""Return context of this StreamingContext."""
return self._context | [
"def",
"sparkContext",
"(",
"self",
")",
":",
"return",
"self",
".",
"_context"
] | https://github.com/svenkreiss/pysparkling/blob/f0e8e8d039f3313c2693b7c7576cb1b7ba5a6d78/pysparkling/streaming/context.py#L48-L50 | |
dot-osk/monitor_ctrl | 5e5a6d151478e5dd5b0361ff401a96b609b98c84 | vcp.py | python | PhyMonitor.color_preset | (self) | return '' | 当前的color preset
:return: | 当前的color preset
:return: | [
"当前的color",
"preset",
":",
"return",
":"
] | def color_preset(self) -> str:
"""
当前的color preset
:return:
"""
preset = self.get_vcp_value_by_name('Select Color Preset')[0]
for i in list(vcp_code.COLOR_PRESET_CODE.keys()):
if vcp_code.COLOR_PRESET_CODE[i] == preset:
return i
return ... | [
"def",
"color_preset",
"(",
"self",
")",
"->",
"str",
":",
"preset",
"=",
"self",
".",
"get_vcp_value_by_name",
"(",
"'Select Color Preset'",
")",
"[",
"0",
"]",
"for",
"i",
"in",
"list",
"(",
"vcp_code",
".",
"COLOR_PRESET_CODE",
".",
"keys",
"(",
")",
... | https://github.com/dot-osk/monitor_ctrl/blob/5e5a6d151478e5dd5b0361ff401a96b609b98c84/vcp.py#L378-L387 | |
ClusterLabs/pcs | 1f225199e02c8d20456bb386f4c913c3ff21ac78 | pcs/alert.py | python | print_alert_config | (lib, argv, modifiers) | Options:
* -f - CIB file (in lib wrapper) | Options:
* -f - CIB file (in lib wrapper) | [
"Options",
":",
"*",
"-",
"f",
"-",
"CIB",
"file",
"(",
"in",
"lib",
"wrapper",
")"
] | def print_alert_config(lib, argv, modifiers):
"""
Options:
* -f - CIB file (in lib wrapper)
"""
modifiers.ensure_only_supported("-f")
if argv:
raise CmdLineInputError()
print("\n".join(alert_config_lines(lib))) | [
"def",
"print_alert_config",
"(",
"lib",
",",
"argv",
",",
"modifiers",
")",
":",
"modifiers",
".",
"ensure_only_supported",
"(",
"\"-f\"",
")",
"if",
"argv",
":",
"raise",
"CmdLineInputError",
"(",
")",
"print",
"(",
"\"\\n\"",
".",
"join",
"(",
"alert_conf... | https://github.com/ClusterLabs/pcs/blob/1f225199e02c8d20456bb386f4c913c3ff21ac78/pcs/alert.py#L210-L218 | ||
tobgu/pyrsistent | d039676c8736f6c0566ce6dcc571888ece10e3a7 | pyrsistent/_plist.py | python | _PListBase.split | (self, index) | return lb.build(), right_list | Spilt the list at position specified by index. Returns a tuple containing the
list up until index and the list after the index. Runs in O(index).
>>> plist([1, 2, 3, 4]).split(2)
(plist([1, 2]), plist([3, 4])) | Spilt the list at position specified by index. Returns a tuple containing the
list up until index and the list after the index. Runs in O(index). | [
"Spilt",
"the",
"list",
"at",
"position",
"specified",
"by",
"index",
".",
"Returns",
"a",
"tuple",
"containing",
"the",
"list",
"up",
"until",
"index",
"and",
"the",
"list",
"after",
"the",
"index",
".",
"Runs",
"in",
"O",
"(",
"index",
")",
"."
] | def split(self, index):
"""
Spilt the list at position specified by index. Returns a tuple containing the
list up until index and the list after the index. Runs in O(index).
>>> plist([1, 2, 3, 4]).split(2)
(plist([1, 2]), plist([3, 4]))
"""
lb = _PListBuilder()
... | [
"def",
"split",
"(",
"self",
",",
"index",
")",
":",
"lb",
"=",
"_PListBuilder",
"(",
")",
"right_list",
"=",
"self",
"i",
"=",
"0",
"while",
"right_list",
"and",
"i",
"<",
"index",
":",
"lb",
".",
"append_elem",
"(",
"right_list",
".",
"first",
")",... | https://github.com/tobgu/pyrsistent/blob/d039676c8736f6c0566ce6dcc571888ece10e3a7/pyrsistent/_plist.py#L109-L129 | |
kivy/kivy-designer | 20343184a28c2851faf0c1ab451d0286d147a441 | designer/components/playground.py | python | Playground.do_select_all | (self) | Select All widgets which basically means selecting root widget | Select All widgets which basically means selecting root widget | [
"Select",
"All",
"widgets",
"which",
"basically",
"means",
"selecting",
"root",
"widget"
] | def do_select_all(self):
'''Select All widgets which basically means selecting root widget
'''
self.selected_widget = self.root
App.get_running_app().focus_widget(self.root) | [
"def",
"do_select_all",
"(",
"self",
")",
":",
"self",
".",
"selected_widget",
"=",
"self",
".",
"root",
"App",
".",
"get_running_app",
"(",
")",
".",
"focus_widget",
"(",
"self",
".",
"root",
")"
] | https://github.com/kivy/kivy-designer/blob/20343184a28c2851faf0c1ab451d0286d147a441/designer/components/playground.py#L1149-L1153 | ||
googlefonts/fontmake | d09c860a0093392c4960c9a97d18cddb87fdcc83 | Lib/fontmake/font_project.py | python | FontProject.build_variable_font | (
self,
designspace,
output_path=None,
output_dir=None,
ttf=True,
optimize_gvar=True,
optimize_cff=CFFOptimization.SPECIALIZE,
use_production_names=None,
reverse_direction=True,
conversion_error=None,
feature_writers=None,
c... | Build OpenType variable font from masters in a designspace. | Build OpenType variable font from masters in a designspace. | [
"Build",
"OpenType",
"variable",
"font",
"from",
"masters",
"in",
"a",
"designspace",
"."
] | def build_variable_font(
self,
designspace,
output_path=None,
output_dir=None,
ttf=True,
optimize_gvar=True,
optimize_cff=CFFOptimization.SPECIALIZE,
use_production_names=None,
reverse_direction=True,
conversion_error=None,
feature_... | [
"def",
"build_variable_font",
"(",
"self",
",",
"designspace",
",",
"output_path",
"=",
"None",
",",
"output_dir",
"=",
"None",
",",
"ttf",
"=",
"True",
",",
"optimize_gvar",
"=",
"True",
",",
"optimize_cff",
"=",
"CFFOptimization",
".",
"SPECIALIZE",
",",
"... | https://github.com/googlefonts/fontmake/blob/d09c860a0093392c4960c9a97d18cddb87fdcc83/Lib/fontmake/font_project.py#L305-L362 | ||
pyg-team/pytorch_geometric | b920e9a3a64e22c8356be55301c88444ff051cae | torch_geometric/nn/dense/dense_graph_conv.py | python | DenseGraphConv.forward | (self, x, adj, mask=None) | return out | r"""
Args:
x (Tensor): Node feature tensor :math:`\mathbf{X} \in \mathbb{R}^{B
\times N \times F}`, with batch-size :math:`B`, (maximum)
number of nodes :math:`N` for each graph, and feature
dimension :math:`F`.
adj (Tensor): Adjacency tens... | r"""
Args:
x (Tensor): Node feature tensor :math:`\mathbf{X} \in \mathbb{R}^{B
\times N \times F}`, with batch-size :math:`B`, (maximum)
number of nodes :math:`N` for each graph, and feature
dimension :math:`F`.
adj (Tensor): Adjacency tens... | [
"r",
"Args",
":",
"x",
"(",
"Tensor",
")",
":",
"Node",
"feature",
"tensor",
":",
"math",
":",
"\\",
"mathbf",
"{",
"X",
"}",
"\\",
"in",
"\\",
"mathbb",
"{",
"R",
"}",
"^",
"{",
"B",
"\\",
"times",
"N",
"\\",
"times",
"F",
"}",
"with",
"batc... | def forward(self, x, adj, mask=None):
r"""
Args:
x (Tensor): Node feature tensor :math:`\mathbf{X} \in \mathbb{R}^{B
\times N \times F}`, with batch-size :math:`B`, (maximum)
number of nodes :math:`N` for each graph, and feature
dimension :math... | [
"def",
"forward",
"(",
"self",
",",
"x",
",",
"adj",
",",
"mask",
"=",
"None",
")",
":",
"x",
"=",
"x",
".",
"unsqueeze",
"(",
"0",
")",
"if",
"x",
".",
"dim",
"(",
")",
"==",
"2",
"else",
"x",
"adj",
"=",
"adj",
".",
"unsqueeze",
"(",
"0",... | https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/torch_geometric/nn/dense/dense_graph_conv.py#L25-L61 | |
dbcli/mssql-cli | 6509aa2fc226dde8ce6bab7af9cbb5f03717b936 | mssqlcli/mssqlcompleter.py | python | generate_alias | (tbl) | return ''.join([l for l in tbl if l.isupper()] or
[l for l, prev in zip(tbl, '_' + tbl) if prev == '_' and l != '_']) | Generate a table alias, consisting of all upper-case letters in
the table name, or, if there are no upper-case letters, the first letter +
all letters preceded by _
param tbl - unescaped name of the table to alias | Generate a table alias, consisting of all upper-case letters in
the table name, or, if there are no upper-case letters, the first letter +
all letters preceded by _
param tbl - unescaped name of the table to alias | [
"Generate",
"a",
"table",
"alias",
"consisting",
"of",
"all",
"upper",
"-",
"case",
"letters",
"in",
"the",
"table",
"name",
"or",
"if",
"there",
"are",
"no",
"upper",
"-",
"case",
"letters",
"the",
"first",
"letter",
"+",
"all",
"letters",
"preceded",
"... | def generate_alias(tbl):
""" Generate a table alias, consisting of all upper-case letters in
the table name, or, if there are no upper-case letters, the first letter +
all letters preceded by _
param tbl - unescaped name of the table to alias
"""
return ''.join([l for l in tbl if l.isupper()] or... | [
"def",
"generate_alias",
"(",
"tbl",
")",
":",
"return",
"''",
".",
"join",
"(",
"[",
"l",
"for",
"l",
"in",
"tbl",
"if",
"l",
".",
"isupper",
"(",
")",
"]",
"or",
"[",
"l",
"for",
"l",
",",
"prev",
"in",
"zip",
"(",
"tbl",
",",
"'_'",
"+",
... | https://github.com/dbcli/mssql-cli/blob/6509aa2fc226dde8ce6bab7af9cbb5f03717b936/mssqlcli/mssqlcompleter.py#L61-L68 | |
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/sound/backend_pysound.py | python | _PySoundCallbackClass.eos | (self, log=True) | This is potentially given directly to the paStream but we don't use
it. Instead we're calling our own Sound.eos() from within the
fillBuffer callback | This is potentially given directly to the paStream but we don't use
it. Instead we're calling our own Sound.eos() from within the
fillBuffer callback | [
"This",
"is",
"potentially",
"given",
"directly",
"to",
"the",
"paStream",
"but",
"we",
"don",
"t",
"use",
"it",
".",
"Instead",
"we",
"re",
"calling",
"our",
"own",
"Sound",
".",
"eos",
"()",
"from",
"within",
"the",
"fillBuffer",
"callback"
] | def eos(self, log=True):
"""This is potentially given directly to the paStream but we don't use
it. Instead we're calling our own Sound.eos() from within the
fillBuffer callback
"""
self.sndInstance()._onEOS() | [
"def",
"eos",
"(",
"self",
",",
"log",
"=",
"True",
")",
":",
"self",
".",
"sndInstance",
"(",
")",
".",
"_onEOS",
"(",
")"
] | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/sound/backend_pysound.py#L107-L112 | ||
kobayashi/s3monkey | cd59e6328fef94cac14f255a9755e2dd456ac302 | s3monkey/pyfakefs/fake_filesystem.py | python | FakeIoModule.__init__ | (self, filesystem) | Args:
filesystem: FakeFilesystem used to provide file system information. | Args:
filesystem: FakeFilesystem used to provide file system information. | [
"Args",
":",
"filesystem",
":",
"FakeFilesystem",
"used",
"to",
"provide",
"file",
"system",
"information",
"."
] | def __init__(self, filesystem):
"""
Args:
filesystem: FakeFilesystem used to provide file system information.
"""
self.filesystem = filesystem
self._io_module = io | [
"def",
"__init__",
"(",
"self",
",",
"filesystem",
")",
":",
"self",
".",
"filesystem",
"=",
"filesystem",
"self",
".",
"_io_module",
"=",
"io"
] | https://github.com/kobayashi/s3monkey/blob/cd59e6328fef94cac14f255a9755e2dd456ac302/s3monkey/pyfakefs/fake_filesystem.py#L3978-L3984 | ||
fhamborg/news-please | 3c2562470601f060828e9d0ad05ebdbb5907641f | newsplease/crawler/commoncrawl_crawler.py | python | __get_list_of_fully_extracted_warc_urls | () | return list_warcs | Reads in the log file that contains a list of all previously, fully extracted WARC urls
:return: | Reads in the log file that contains a list of all previously, fully extracted WARC urls
:return: | [
"Reads",
"in",
"the",
"log",
"file",
"that",
"contains",
"a",
"list",
"of",
"all",
"previously",
"fully",
"extracted",
"WARC",
"urls",
":",
"return",
":"
] | def __get_list_of_fully_extracted_warc_urls():
"""
Reads in the log file that contains a list of all previously, fully extracted WARC urls
:return:
"""
if not os.path.isfile(__log_pathname_fully_extracted_warcs):
return []
with open(__log_pathname_fully_extracted_warcs) as log_file:
... | [
"def",
"__get_list_of_fully_extracted_warc_urls",
"(",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"__log_pathname_fully_extracted_warcs",
")",
":",
"return",
"[",
"]",
"with",
"open",
"(",
"__log_pathname_fully_extracted_warcs",
")",
"as",
"log_fi... | https://github.com/fhamborg/news-please/blob/3c2562470601f060828e9d0ad05ebdbb5907641f/newsplease/crawler/commoncrawl_crawler.py#L191-L204 | |
sabri-zaki/EasY_HaCk | 2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9 | .modules/.sqlmap/thirdparty/odict/odict.py | python | _OrderedDict.__ge__ | (self, other) | return (self.items() >= other.items()) | >>> d = OrderedDict(((1, 3), (3, 2), (2, 1)))
>>> c = OrderedDict(((0, 3), (3, 2), (2, 1)))
>>> e = OrderedDict(d)
>>> c >= d
False
>>> d >= c
True
>>> d >= dict(c)
Traceback (most recent call last):
TypeError: Can only compare with other OrderedDi... | >>> d = OrderedDict(((1, 3), (3, 2), (2, 1)))
>>> c = OrderedDict(((0, 3), (3, 2), (2, 1)))
>>> e = OrderedDict(d)
>>> c >= d
False
>>> d >= c
True
>>> d >= dict(c)
Traceback (most recent call last):
TypeError: Can only compare with other OrderedDi... | [
">>>",
"d",
"=",
"OrderedDict",
"(((",
"1",
"3",
")",
"(",
"3",
"2",
")",
"(",
"2",
"1",
")))",
">>>",
"c",
"=",
"OrderedDict",
"(((",
"0",
"3",
")",
"(",
"3",
"2",
")",
"(",
"2",
"1",
")))",
">>>",
"e",
"=",
"OrderedDict",
"(",
"d",
")",
... | def __ge__(self, other):
"""
>>> d = OrderedDict(((1, 3), (3, 2), (2, 1)))
>>> c = OrderedDict(((0, 3), (3, 2), (2, 1)))
>>> e = OrderedDict(d)
>>> c >= d
False
>>> d >= c
True
>>> d >= dict(c)
Traceback (most recent call last):
Typ... | [
"def",
"__ge__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"OrderedDict",
")",
":",
"raise",
"TypeError",
"(",
"'Can only compare with other OrderedDicts'",
")",
"# FIXME: efficiency?",
"# Generate both item lists for each comp... | https://github.com/sabri-zaki/EasY_HaCk/blob/2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9/.modules/.sqlmap/thirdparty/odict/odict.py#L259-L278 | |
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/lib2to3/main.py | python | diff_texts | (a, b, filename) | return difflib.unified_diff(a, b, filename, filename,
"(original)", "(refactored)",
lineterm="") | Return a unified diff of two strings. | Return a unified diff of two strings. | [
"Return",
"a",
"unified",
"diff",
"of",
"two",
"strings",
"."
] | def diff_texts(a, b, filename):
"""Return a unified diff of two strings."""
a = a.splitlines()
b = b.splitlines()
return difflib.unified_diff(a, b, filename, filename,
"(original)", "(refactored)",
lineterm="") | [
"def",
"diff_texts",
"(",
"a",
",",
"b",
",",
"filename",
")",
":",
"a",
"=",
"a",
".",
"splitlines",
"(",
")",
"b",
"=",
"b",
".",
"splitlines",
"(",
")",
"return",
"difflib",
".",
"unified_diff",
"(",
"a",
",",
"b",
",",
"filename",
",",
"filen... | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/lib2to3/main.py#L17-L23 | |
facelessuser/HexViewer | 126fd7a691c475f42b37683a19f80ba3b14f28cf | hex_checksum.py | python | SSlAlgorithm.algorithm | (self, name, digest_size, arg) | The main algorithm. | The main algorithm. | [
"The",
"main",
"algorithm",
"."
] | def algorithm(self, name, digest_size, arg):
"""The main algorithm."""
self.__algorithm = hashlib.new(name)
self.__name = name
self.__digest_size = digest_size
self.update(arg) | [
"def",
"algorithm",
"(",
"self",
",",
"name",
",",
"digest_size",
",",
"arg",
")",
":",
"self",
".",
"__algorithm",
"=",
"hashlib",
".",
"new",
"(",
"name",
")",
"self",
".",
"__name",
"=",
"name",
"self",
".",
"__digest_size",
"=",
"digest_size",
"sel... | https://github.com/facelessuser/HexViewer/blob/126fd7a691c475f42b37683a19f80ba3b14f28cf/hex_checksum.py#L78-L83 | ||
napari/napari | dbf4158e801fa7a429de8ef1cdee73bf6d64c61e | napari/utils/colormaps/vendored/colors.py | python | ListedColormap.reversed | (self, name=None) | return ListedColormap(colors_r, name=name, N=self.N) | Make a reversed instance of the Colormap.
Parameters
----------
name : str, optional
The name for the reversed colormap. If it's None the
name will be the name of the parent colormap + "_r".
Returns
-------
ListedColormap
A reversed i... | Make a reversed instance of the Colormap. | [
"Make",
"a",
"reversed",
"instance",
"of",
"the",
"Colormap",
"."
] | def reversed(self, name=None):
"""
Make a reversed instance of the Colormap.
Parameters
----------
name : str, optional
The name for the reversed colormap. If it's None the
name will be the name of the parent colormap + "_r".
Returns
----... | [
"def",
"reversed",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"self",
".",
"name",
"+",
"\"_r\"",
"colors_r",
"=",
"list",
"(",
"reversed",
"(",
"self",
".",
"colors",
")",
")",
"return",
"ListedC... | https://github.com/napari/napari/blob/dbf4158e801fa7a429de8ef1cdee73bf6d64c61e/napari/utils/colormaps/vendored/colors.py#L760-L779 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/decimal.py | python | Context.__repr__ | (self) | return ', '.join(s) + ')' | Show the current context. | Show the current context. | [
"Show",
"the",
"current",
"context",
"."
] | def __repr__(self):
"""Show the current context."""
s = []
s.append('Context(prec=%(prec)d, rounding=%(rounding)s, '
'Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d'
% vars(self))
names = [f.__name__ for f, v in self.flags.items() if v]
s.ap... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"s",
"=",
"[",
"]",
"s",
".",
"append",
"(",
"'Context(prec=%(prec)d, rounding=%(rounding)s, '",
"'Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d'",
"%",
"vars",
"(",
"self",
")",
")",
"names",
"=",
"[",
"f",
".",
"... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/decimal.py#L3798-L3808 | |
NVIDIA/apex | b88c507edb0d067d5570f7a8efe03a90664a3d16 | apex/transformer/parallel_state.py | python | get_pipeline_model_parallel_group | () | return _PIPELINE_MODEL_PARALLEL_GROUP | Get the pipeline model parallel group the caller rank belongs to. | Get the pipeline model parallel group the caller rank belongs to. | [
"Get",
"the",
"pipeline",
"model",
"parallel",
"group",
"the",
"caller",
"rank",
"belongs",
"to",
"."
] | def get_pipeline_model_parallel_group():
"""Get the pipeline model parallel group the caller rank belongs to."""
assert _PIPELINE_MODEL_PARALLEL_GROUP is not None, "pipeline_model parallel group is not initialized"
return _PIPELINE_MODEL_PARALLEL_GROUP | [
"def",
"get_pipeline_model_parallel_group",
"(",
")",
":",
"assert",
"_PIPELINE_MODEL_PARALLEL_GROUP",
"is",
"not",
"None",
",",
"\"pipeline_model parallel group is not initialized\"",
"return",
"_PIPELINE_MODEL_PARALLEL_GROUP"
] | https://github.com/NVIDIA/apex/blob/b88c507edb0d067d5570f7a8efe03a90664a3d16/apex/transformer/parallel_state.py#L208-L211 | |
mahmoud/boltons | 270e974975984f662f998c8f6eb0ebebd964de82 | boltons/setutils.py | python | _ComplementSet.__ge__ | (self, other) | [] | def __ge__(self, other):
inc, exc = _norm_args_notimplemented(other)
if inc is NotImplemented:
return NotImplemented
if self._included is None:
if exc is None: # - +
return not self._excluded.intersection(inc)
else: # - -
retu... | [
"def",
"__ge__",
"(",
"self",
",",
"other",
")",
":",
"inc",
",",
"exc",
"=",
"_norm_args_notimplemented",
"(",
"other",
")",
"if",
"inc",
"is",
"NotImplemented",
":",
"return",
"NotImplemented",
"if",
"self",
".",
"_included",
"is",
"None",
":",
"if",
"... | https://github.com/mahmoud/boltons/blob/270e974975984f662f998c8f6eb0ebebd964de82/boltons/setutils.py#L860-L873 | ||||
Dan-in-CA/SIP | 7d08d807d7730bff2b5eaaa57e743665c8b143a6 | web/application.py | python | application.add_processor | (self, processor) | Adds a processor to the application.
>>> urls = ("/(.*)", "echo")
>>> app = application(urls, globals())
>>> class echo:
... def GET(self, name): return name
...
>>>
>>> def hello(handler): return "hello, " + handler()
... | Adds a processor to the application. | [
"Adds",
"a",
"processor",
"to",
"the",
"application",
"."
] | def add_processor(self, processor):
"""
Adds a processor to the application.
>>> urls = ("/(.*)", "echo")
>>> app = application(urls, globals())
>>> class echo:
... def GET(self, name): return name
...
>>>
>>> def h... | [
"def",
"add_processor",
"(",
"self",
",",
"processor",
")",
":",
"# PY3DOCTEST: b'hello, web.py'",
"self",
".",
"processors",
".",
"append",
"(",
"processor",
")"
] | https://github.com/Dan-in-CA/SIP/blob/7d08d807d7730bff2b5eaaa57e743665c8b143a6/web/application.py#L143-L160 | ||
Rapptz/discord.py | 45d498c1b76deaf3b394d17ccf56112fa691d160 | discord/opus.py | python | Decoder.set_gain | (self, dB: float) | return self._set_gain(dB_Q8) | Sets the decoder gain in dB, from -128 to 128. | Sets the decoder gain in dB, from -128 to 128. | [
"Sets",
"the",
"decoder",
"gain",
"in",
"dB",
"from",
"-",
"128",
"to",
"128",
"."
] | def set_gain(self, dB: float) -> int:
"""Sets the decoder gain in dB, from -128 to 128."""
dB_Q8 = max(-32768, min(32767, round(dB * 256))) # dB * 2^n where n is 8 (Q8)
return self._set_gain(dB_Q8) | [
"def",
"set_gain",
"(",
"self",
",",
"dB",
":",
"float",
")",
"->",
"int",
":",
"dB_Q8",
"=",
"max",
"(",
"-",
"32768",
",",
"min",
"(",
"32767",
",",
"round",
"(",
"dB",
"*",
"256",
")",
")",
")",
"# dB * 2^n where n is 8 (Q8)",
"return",
"self",
... | https://github.com/Rapptz/discord.py/blob/45d498c1b76deaf3b394d17ccf56112fa691d160/discord/opus.py#L411-L415 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/template/loader.py | python | get_template_from_string | (source, origin=None, name=None) | return Template(source, origin, name) | Returns a compiled Template object for the given template code,
handling template inheritance recursively. | Returns a compiled Template object for the given template code,
handling template inheritance recursively. | [
"Returns",
"a",
"compiled",
"Template",
"object",
"for",
"the",
"given",
"template",
"code",
"handling",
"template",
"inheritance",
"recursively",
"."
] | def get_template_from_string(source, origin=None, name=None):
"""
Returns a compiled Template object for the given template code,
handling template inheritance recursively.
"""
return Template(source, origin, name) | [
"def",
"get_template_from_string",
"(",
"source",
",",
"origin",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"return",
"Template",
"(",
"source",
",",
"origin",
",",
"name",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/template/loader.py#L151-L156 | |
eshapard/AnkiHabitica | b0ac7375ab0b2542b72dda801f84b49bd1e61ad2 | AnkiHabitica/logging/__init__.py | python | StreamHandler.setStream | (self, stream) | return result | Sets the StreamHandler's stream to the specified value,
if it is different.
Returns the old stream, if the stream was changed, or None
if it wasn't. | Sets the StreamHandler's stream to the specified value,
if it is different. | [
"Sets",
"the",
"StreamHandler",
"s",
"stream",
"to",
"the",
"specified",
"value",
"if",
"it",
"is",
"different",
"."
] | def setStream(self, stream):
"""
Sets the StreamHandler's stream to the specified value,
if it is different.
Returns the old stream, if the stream was changed, or None
if it wasn't.
"""
if stream is self.stream:
result = None
else:
... | [
"def",
"setStream",
"(",
"self",
",",
"stream",
")",
":",
"if",
"stream",
"is",
"self",
".",
"stream",
":",
"result",
"=",
"None",
"else",
":",
"result",
"=",
"self",
".",
"stream",
"self",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"flush"... | https://github.com/eshapard/AnkiHabitica/blob/b0ac7375ab0b2542b72dda801f84b49bd1e61ad2/AnkiHabitica/logging/__init__.py#L1042-L1060 | |
CSAILVision/gandissect | f55fc5683bebe2bd6c598d703efa6f4e6fb488bf | netdissect/proggan.py | python | ProgressiveGenerator.__init__ | (self, resolution=None, sizes=None, modify_sequence=None,
output_tanh=False) | A pytorch progessive GAN generator that can be converted directly
from either a tensorflow model or a theano model. It consists of
a sequence of convolutional layers, organized in pairs, with an
upsampling and reduction of channels at every other layer; and
then finally followed by an o... | A pytorch progessive GAN generator that can be converted directly
from either a tensorflow model or a theano model. It consists of
a sequence of convolutional layers, organized in pairs, with an
upsampling and reduction of channels at every other layer; and
then finally followed by an o... | [
"A",
"pytorch",
"progessive",
"GAN",
"generator",
"that",
"can",
"be",
"converted",
"directly",
"from",
"either",
"a",
"tensorflow",
"model",
"or",
"a",
"theano",
"model",
".",
"It",
"consists",
"of",
"a",
"sequence",
"of",
"convolutional",
"layers",
"organize... | def __init__(self, resolution=None, sizes=None, modify_sequence=None,
output_tanh=False):
'''
A pytorch progessive GAN generator that can be converted directly
from either a tensorflow model or a theano model. It consists of
a sequence of convolutional layers, organized in p... | [
"def",
"__init__",
"(",
"self",
",",
"resolution",
"=",
"None",
",",
"sizes",
"=",
"None",
",",
"modify_sequence",
"=",
"None",
",",
"output_tanh",
"=",
"False",
")",
":",
"assert",
"(",
"resolution",
"is",
"None",
")",
"!=",
"(",
"sizes",
"is",
"None"... | https://github.com/CSAILVision/gandissect/blob/f55fc5683bebe2bd6c598d703efa6f4e6fb488bf/netdissect/proggan.py#L35-L91 | ||
CuriousAI/mean-teacher | 546348ff863c998c26be4339021425df973b4a36 | tensorflow/datasets/preprocess_cifar10.py | python | global_contrast_normalize | (X, scale=55., min_divisor=1e-8) | return X | [] | def global_contrast_normalize(X, scale=55., min_divisor=1e-8):
X = X - X.mean(axis=1)[:, np.newaxis]
normalizers = np.sqrt((X ** 2).sum(axis=1)) / scale
normalizers[normalizers < min_divisor] = 1.
X /= normalizers[:, np.newaxis]
return X | [
"def",
"global_contrast_normalize",
"(",
"X",
",",
"scale",
"=",
"55.",
",",
"min_divisor",
"=",
"1e-8",
")",
":",
"X",
"=",
"X",
"-",
"X",
".",
"mean",
"(",
"axis",
"=",
"1",
")",
"[",
":",
",",
"np",
".",
"newaxis",
"]",
"normalizers",
"=",
"np... | https://github.com/CuriousAI/mean-teacher/blob/546348ff863c998c26be4339021425df973b4a36/tensorflow/datasets/preprocess_cifar10.py#L52-L60 | |||
sassoftware/python-dlpy | 6082b1eeaab7406cce22715a35a1f4308943d522 | dlpy/blocks.py | python | ResBlock.compile | (self, src_layer, block_num=None) | return options | Convert the block structure into DLPy layer definitions.
Parameters
----------
src_layer : Layer
The source layer for the whole block.
block_num : int, optional
The label of the block. (used to name the layers)
Returns
-------
list
... | Convert the block structure into DLPy layer definitions. | [
"Convert",
"the",
"block",
"structure",
"into",
"DLPy",
"layer",
"definitions",
"."
] | def compile(self, src_layer, block_num=None):
'''
Convert the block structure into DLPy layer definitions.
Parameters
----------
src_layer : Layer
The source layer for the whole block.
block_num : int, optional
The label of the block. (used to nam... | [
"def",
"compile",
"(",
"self",
",",
"src_layer",
",",
"block_num",
"=",
"None",
")",
":",
"if",
"block_num",
"is",
"None",
":",
"block_num",
"=",
"self",
".",
"get_number_of_instances",
"(",
")",
"options",
"=",
"[",
"]",
"conv_num",
"=",
"1",
"input_lay... | https://github.com/sassoftware/python-dlpy/blob/6082b1eeaab7406cce22715a35a1f4308943d522/dlpy/blocks.py#L109-L144 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/dbm/__init__.py | python | open | (file, flag='r', mode=0o666) | return mod.open(file, flag, mode) | Open or create database at path given by *file*.
Optional argument *flag* can be 'r' (default) for read-only access, 'w'
for read-write access of an existing database, 'c' for read-write access
to a new or existing database, and 'n' for read-write access to a new
database.
Note: 'r' and 'w' fail i... | Open or create database at path given by *file*. | [
"Open",
"or",
"create",
"database",
"at",
"path",
"given",
"by",
"*",
"file",
"*",
"."
] | def open(file, flag='r', mode=0o666):
"""Open or create database at path given by *file*.
Optional argument *flag* can be 'r' (default) for read-only access, 'w'
for read-write access of an existing database, 'c' for read-write access
to a new or existing database, and 'n' for read-write access to a ne... | [
"def",
"open",
"(",
"file",
",",
"flag",
"=",
"'r'",
",",
"mode",
"=",
"0o666",
")",
":",
"global",
"_defaultmod",
"if",
"_defaultmod",
"is",
"None",
":",
"for",
"name",
"in",
"_names",
":",
"try",
":",
"mod",
"=",
"__import__",
"(",
"name",
",",
"... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/dbm/__init__.py#L53-L95 | |
OpenCobolIDE/OpenCobolIDE | c78d0d335378e5fe0a5e74f53c19b68b55e85388 | open_cobol_ide/extlibs/pyqode/core/panels/search_and_replace.py | python | SearchAndReplacePanel._show_error | (self, error) | [] | def _show_error(self, error):
if error:
self._set_widget_background_color(
self.lineEditSearch, QtGui.QColor('#FFCCCC'))
self.lineEditSearch.setToolTip(str(error))
else:
self._set_widget_background_color(
self.lineEditSearch, self.palet... | [
"def",
"_show_error",
"(",
"self",
",",
"error",
")",
":",
"if",
"error",
":",
"self",
".",
"_set_widget_background_color",
"(",
"self",
".",
"lineEditSearch",
",",
"QtGui",
".",
"QColor",
"(",
"'#FFCCCC'",
")",
")",
"self",
".",
"lineEditSearch",
".",
"se... | https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/pyqode/core/panels/search_and_replace.py#L346-L355 | ||||
awslabs/aws-lambda-powertools-python | 0c6ac0fe183476140ee1df55fe9fa1cc20925577 | aws_lambda_powertools/event_handler/api_gateway.py | python | ResponseBuilder._route | (self, event: BaseProxyEvent, cors: Optional[CORSConfig]) | Optionally handle any of the route's configure response handling | Optionally handle any of the route's configure response handling | [
"Optionally",
"handle",
"any",
"of",
"the",
"route",
"s",
"configure",
"response",
"handling"
] | def _route(self, event: BaseProxyEvent, cors: Optional[CORSConfig]):
"""Optionally handle any of the route's configure response handling"""
if self.route is None:
return
if self.route.cors:
self._add_cors(cors or CORSConfig())
if self.route.cache_control:
... | [
"def",
"_route",
"(",
"self",
",",
"event",
":",
"BaseProxyEvent",
",",
"cors",
":",
"Optional",
"[",
"CORSConfig",
"]",
")",
":",
"if",
"self",
".",
"route",
"is",
"None",
":",
"return",
"if",
"self",
".",
"route",
".",
"cors",
":",
"self",
".",
"... | https://github.com/awslabs/aws-lambda-powertools-python/blob/0c6ac0fe183476140ee1df55fe9fa1cc20925577/aws_lambda_powertools/event_handler/api_gateway.py#L204-L213 | ||
bup/bup | ffa1a813b41d59cb3bdcd96429b9cbb3535e2d88 | lib/bup/git.py | python | update_ref | (refname, newval, oldval, repo_dir=None) | Update a repository reference. | Update a repository reference. | [
"Update",
"a",
"repository",
"reference",
"."
] | def update_ref(refname, newval, oldval, repo_dir=None):
"""Update a repository reference."""
if not oldval:
oldval = b''
assert refname.startswith(b'refs/heads/') \
or refname.startswith(b'refs/tags/')
p = subprocess.Popen([b'git', b'update-ref', refname,
hexlif... | [
"def",
"update_ref",
"(",
"refname",
",",
"newval",
",",
"oldval",
",",
"repo_dir",
"=",
"None",
")",
":",
"if",
"not",
"oldval",
":",
"oldval",
"=",
"b''",
"assert",
"refname",
".",
"startswith",
"(",
"b'refs/heads/'",
")",
"or",
"refname",
".",
"starts... | https://github.com/bup/bup/blob/ffa1a813b41d59cb3bdcd96429b9cbb3535e2d88/lib/bup/git.py#L1160-L1170 | ||
wangheda/youtube-8m | 07e54b387ee027cb58b0c14f5eb7c88cfa516d58 | youtube-8m-zhangteng/frame_level_models.py | python | LstmDivideModel.create_model | (self, model_input, vocab_size, num_frames, **unused_params) | return result | Creates a model which uses a stack of LSTMs to represent the video.
Args:
model_input: A 'batch_size' x 'max_frames' x 'num_features' matrix of
input features.
vocab_size: The number of classes in the dataset.
num_frames: A vector of length 'batch' which ind... | Creates a model which uses a stack of LSTMs to represent the video. | [
"Creates",
"a",
"model",
"which",
"uses",
"a",
"stack",
"of",
"LSTMs",
"to",
"represent",
"the",
"video",
"."
] | def create_model(self, model_input, vocab_size, num_frames, **unused_params):
"""Creates a model which uses a stack of LSTMs to represent the video.
Args:
model_input: A 'batch_size' x 'max_frames' x 'num_features' matrix of
input features.
vocab_size: The num... | [
"def",
"create_model",
"(",
"self",
",",
"model_input",
",",
"vocab_size",
",",
"num_frames",
",",
"*",
"*",
"unused_params",
")",
":",
"lstm_size",
"=",
"FLAGS",
".",
"lstm_cells",
"number_of_layers",
"=",
"FLAGS",
".",
"lstm_layers",
"num_extend",
"=",
"FLAG... | https://github.com/wangheda/youtube-8m/blob/07e54b387ee027cb58b0c14f5eb7c88cfa516d58/youtube-8m-zhangteng/frame_level_models.py#L3687-L3754 | |
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/exprs/world.py | python | World._C__sorted_objects | (self) | return res | compute private self._sorted_objects (a list, ordered by something not yet decided,
probably creation time; probably should be the same order used by list_all_objects_of_type) | compute private self._sorted_objects (a list, ordered by something not yet decided,
probably creation time; probably should be the same order used by list_all_objects_of_type) | [
"compute",
"private",
"self",
".",
"_sorted_objects",
"(",
"a",
"list",
"ordered",
"by",
"something",
"not",
"yet",
"decided",
"probably",
"creation",
"time",
";",
"probably",
"should",
"be",
"the",
"same",
"order",
"used",
"by",
"list_all_objects_of_type",
")"
... | def _C__sorted_objects(self):
"""compute private self._sorted_objects (a list, ordered by something not yet decided,
probably creation time; probably should be the same order used by list_all_objects_of_type)
"""
res = self._nodeset.values()
res = sorted_by( res, lambda obj: obj... | [
"def",
"_C__sorted_objects",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"_nodeset",
".",
"values",
"(",
")",
"res",
"=",
"sorted_by",
"(",
"res",
",",
"lambda",
"obj",
":",
"obj",
".",
"_e_serno",
")",
"###KLUGE: use _e_serno in place of .creation_order, ... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/exprs/world.py#L182-L191 | |
uber-archive/focuson | 6035be631853df16f434372194f5619c9c4e5322 | focuson.py | python | Engine.get_pri_sinks | (self, fti) | return L | Return any dangerous sinks in the body of a function.
pri = primary aka originate from here instead of transitive. | Return any dangerous sinks in the body of a function.
pri = primary aka originate from here instead of transitive. | [
"Return",
"any",
"dangerous",
"sinks",
"in",
"the",
"body",
"of",
"a",
"function",
".",
"pri",
"=",
"primary",
"aka",
"originate",
"from",
"here",
"instead",
"of",
"transitive",
"."
] | def get_pri_sinks(self, fti):
"""
Return any dangerous sinks in the body of a function.
pri = primary aka originate from here instead of transitive.
"""
L = []
for n in ast.walk(fti.ast):
if isinstance(n, ast.Call):
if isinstance(n.func, ast.N... | [
"def",
"get_pri_sinks",
"(",
"self",
",",
"fti",
")",
":",
"L",
"=",
"[",
"]",
"for",
"n",
"in",
"ast",
".",
"walk",
"(",
"fti",
".",
"ast",
")",
":",
"if",
"isinstance",
"(",
"n",
",",
"ast",
".",
"Call",
")",
":",
"if",
"isinstance",
"(",
"... | https://github.com/uber-archive/focuson/blob/6035be631853df16f434372194f5619c9c4e5322/focuson.py#L1074-L1101 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/utils/parsers/robots/data_structures.py | python | Joint.axis | (self, axis) | Set the joint axis. | Set the joint axis. | [
"Set",
"the",
"joint",
"axis",
"."
] | def axis(self, axis):
"""Set the joint axis."""
if axis is not None:
if isinstance(axis, str):
axis = [float(ax) for ax in axis.split()]
axis = tuple(axis)
if len(axis) != 3:
raise ValueError("Expecting the joint axis to be defined usin... | [
"def",
"axis",
"(",
"self",
",",
"axis",
")",
":",
"if",
"axis",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"axis",
",",
"str",
")",
":",
"axis",
"=",
"[",
"float",
"(",
"ax",
")",
"for",
"ax",
"in",
"axis",
".",
"split",
"(",
")",
"]... | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/utils/parsers/robots/data_structures.py#L1703-L1711 | ||
byt3bl33d3r/pth-toolkit | 3641cdc76c0f52275315c9b18bf08b22521bd4d7 | lib/python2.7/site-packages/samba/provision/backend.py | python | BackendResult.report_logger | (self, logger) | Rerport this result to a particular logger. | Rerport this result to a particular logger. | [
"Rerport",
"this",
"result",
"to",
"a",
"particular",
"logger",
"."
] | def report_logger(self, logger):
"""Rerport this result to a particular logger.
"""
raise NotImplementedError(self.report_logger) | [
"def",
"report_logger",
"(",
"self",
",",
"logger",
")",
":",
"raise",
"NotImplementedError",
"(",
"self",
".",
"report_logger",
")"
] | https://github.com/byt3bl33d3r/pth-toolkit/blob/3641cdc76c0f52275315c9b18bf08b22521bd4d7/lib/python2.7/site-packages/samba/provision/backend.py#L57-L61 | ||
Epistimio/orion | 732e739d99561020dbe620760acf062ade746006 | src/orion/core/io/database/mongodb.py | python | MongoDB._convert_index_keys | (self, keys) | return converted_keys | Convert index keys to MongoDB ones. | Convert index keys to MongoDB ones. | [
"Convert",
"index",
"keys",
"to",
"MongoDB",
"ones",
"."
] | def _convert_index_keys(self, keys):
"""Convert index keys to MongoDB ones."""
if not isinstance(keys, (list, tuple)):
keys = [(keys, self.ASCENDING)]
converted_keys = []
for key, sort_order in keys:
converted_keys.append((key, self._convert_sort_order(sort_order... | [
"def",
"_convert_index_keys",
"(",
"self",
",",
"keys",
")",
":",
"if",
"not",
"isinstance",
"(",
"keys",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"keys",
"=",
"[",
"(",
"keys",
",",
"self",
".",
"ASCENDING",
")",
"]",
"converted_keys",
"=",
... | https://github.com/Epistimio/orion/blob/732e739d99561020dbe620760acf062ade746006/src/orion/core/io/database/mongodb.py#L216-L225 | |
ros/ros_comm | 52b0556dadf3ec0c0bc72df4fc202153a53b539e | tools/roslaunch/src/roslaunch/remoteprocess.py | python | SSHChildROSLaunchProcess.stop | (self, errors=None) | Terminate this process, including the SSH connection. | Terminate this process, including the SSH connection. | [
"Terminate",
"this",
"process",
"including",
"the",
"SSH",
"connection",
"."
] | def stop(self, errors=None):
"""
Terminate this process, including the SSH connection.
"""
if errors is None:
errors = []
with self.lock:
if not self.ssh:
return
# call the shutdown API first as closing the SSH connection
... | [
"def",
"stop",
"(",
"self",
",",
"errors",
"=",
"None",
")",
":",
"if",
"errors",
"is",
"None",
":",
"errors",
"=",
"[",
"]",
"with",
"self",
".",
"lock",
":",
"if",
"not",
"self",
".",
"ssh",
":",
"return",
"# call the shutdown API first as closing the ... | https://github.com/ros/ros_comm/blob/52b0556dadf3ec0c0bc72df4fc202153a53b539e/tools/roslaunch/src/roslaunch/remoteprocess.py#L298-L337 | ||
pm4py/pm4py-core | 7807b09a088b02199cd0149d724d0e28793971bf | pm4py/streaming/algo/conformance/footprints/variants/classic.py | python | FootprintsStreamingConformance.verify_footprints | (self, case, activity) | Verify the event according to the footprints
(assuming it has a case and an activity)
Parameters
----------------
case
Case ID
activity
Activity | Verify the event according to the footprints
(assuming it has a case and an activity) | [
"Verify",
"the",
"event",
"according",
"to",
"the",
"footprints",
"(",
"assuming",
"it",
"has",
"a",
"case",
"and",
"an",
"activity",
")"
] | def verify_footprints(self, case, activity):
"""
Verify the event according to the footprints
(assuming it has a case and an activity)
Parameters
----------------
case
Case ID
activity
Activity
"""
if case not in self.case_... | [
"def",
"verify_footprints",
"(",
"self",
",",
"case",
",",
"activity",
")",
":",
"if",
"case",
"not",
"in",
"self",
".",
"case_dict",
".",
"keys",
"(",
")",
":",
"self",
".",
"dev_dict",
"[",
"case",
"]",
"=",
"0",
"if",
"activity",
"in",
"self",
"... | https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/streaming/algo/conformance/footprints/variants/classic.py#L108-L130 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/josepy-1.1.0/src/josepy/jwk.py | python | JWK.load | (cls, data, password=None, backend=None) | Load serialized key as JWK.
:param str data: Public or private key serialized as PEM or DER.
:param str password: Optional password.
:param backend: A `.PEMSerializationBackend` and
`.DERSerializationBackend` provider.
:raises errors.Error: if unable to deserialize, or unsu... | Load serialized key as JWK. | [
"Load",
"serialized",
"key",
"as",
"JWK",
"."
] | def load(cls, data, password=None, backend=None):
"""Load serialized key as JWK.
:param str data: Public or private key serialized as PEM or DER.
:param str password: Optional password.
:param backend: A `.PEMSerializationBackend` and
`.DERSerializationBackend` provider.
... | [
"def",
"load",
"(",
"cls",
",",
"data",
",",
"password",
"=",
"None",
",",
"backend",
"=",
"None",
")",
":",
"try",
":",
"key",
"=",
"cls",
".",
"_load_cryptography_key",
"(",
"data",
",",
"password",
",",
"backend",
")",
"except",
"errors",
".",
"Er... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/josepy-1.1.0/src/josepy/jwk.py#L92-L120 | ||
deepgully/me | f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0 | libs/werkzeug/security.py | python | gen_salt | (length) | return ''.join(_sys_rng.choice(SALT_CHARS) for _ in xrange(length)) | Generate a random string of SALT_CHARS with specified ``length``. | Generate a random string of SALT_CHARS with specified ``length``. | [
"Generate",
"a",
"random",
"string",
"of",
"SALT_CHARS",
"with",
"specified",
"length",
"."
] | def gen_salt(length):
"""Generate a random string of SALT_CHARS with specified ``length``."""
if length <= 0:
raise ValueError('requested salt of length <= 0')
return ''.join(_sys_rng.choice(SALT_CHARS) for _ in xrange(length)) | [
"def",
"gen_salt",
"(",
"length",
")",
":",
"if",
"length",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"'requested salt of length <= 0'",
")",
"return",
"''",
".",
"join",
"(",
"_sys_rng",
".",
"choice",
"(",
"SALT_CHARS",
")",
"for",
"_",
"in",
"xrange",... | https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/werkzeug/security.py#L56-L60 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/common/lib/python2.7/site-packages/libxml2.py | python | xmlDoc.newReference | (self, name) | return __tmp | Creation of a new reference node. | Creation of a new reference node. | [
"Creation",
"of",
"a",
"new",
"reference",
"node",
"."
] | def newReference(self, name):
"""Creation of a new reference node. """
ret = libxml2mod.xmlNewReference(self._o, name)
if ret is None:raise treeError('xmlNewReference() failed')
__tmp = xmlNode(_obj=ret)
return __tmp | [
"def",
"newReference",
"(",
"self",
",",
"name",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlNewReference",
"(",
"self",
".",
"_o",
",",
"name",
")",
"if",
"ret",
"is",
"None",
":",
"raise",
"treeError",
"(",
"'xmlNewReference() failed'",
")",
"__tmp",
... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/common/lib/python2.7/site-packages/libxml2.py#L4344-L4349 | |
learningequality/ka-lite | 571918ea668013dcf022286ea85eff1c5333fb8b | kalite/packages/bundled/fle_utils/internet/webcache.py | python | calc_last_modified | (request, *args, **kwargs) | return last_modified | Returns the file's modified time as the last-modified date | Returns the file's modified time as the last-modified date | [
"Returns",
"the",
"file",
"s",
"modified",
"time",
"as",
"the",
"last",
"-",
"modified",
"date"
] | def calc_last_modified(request, *args, **kwargs):
"""
Returns the file's modified time as the last-modified date
"""
assert "cache_name" in kwargs, "Must specify cache_name as a keyword arg."
try:
cache = get_cache(kwargs["cache_name"])
assert isinstance(cache, FileBasedCache) or is... | [
"def",
"calc_last_modified",
"(",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"\"cache_name\"",
"in",
"kwargs",
",",
"\"Must specify cache_name as a keyword arg.\"",
"try",
":",
"cache",
"=",
"get_cache",
"(",
"kwargs",
"[",
"\"cach... | https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/fle_utils/internet/webcache.py#L23-L52 | |
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py/gluon/contrib/gateways/fcgi.py | python | Connection._do_stdin | (self, inrec) | Handle the FCGI_STDIN stream. | Handle the FCGI_STDIN stream. | [
"Handle",
"the",
"FCGI_STDIN",
"stream",
"."
] | def _do_stdin(self, inrec):
"""Handle the FCGI_STDIN stream."""
req = self._requests.get(inrec.requestId)
if req is not None:
req.stdin.add_data(inrec.contentData) | [
"def",
"_do_stdin",
"(",
"self",
",",
"inrec",
")",
":",
"req",
"=",
"self",
".",
"_requests",
".",
"get",
"(",
"inrec",
".",
"requestId",
")",
"if",
"req",
"is",
"not",
"None",
":",
"req",
".",
"stdin",
".",
"add_data",
"(",
"inrec",
".",
"content... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/gluon/contrib/gateways/fcgi.py#L801-L805 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/accounting/forms.py | python | BulkUpgradeToLatestVersionForm.__init__ | (self, old_plan_version, web_user, *args, **kwargs) | [] | def __init__(self, old_plan_version, web_user, *args, **kwargs):
self.old_plan_version = old_plan_version
self.web_user = web_user
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_class = "form-horizontal"
self.helper.label_class = 'col-sm-3 ... | [
"def",
"__init__",
"(",
"self",
",",
"old_plan_version",
",",
"web_user",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"old_plan_version",
"=",
"old_plan_version",
"self",
".",
"web_user",
"=",
"web_user",
"super",
"(",
")",
".",
"__... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/accounting/forms.py#L930-L951 | ||||
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbWuDaoKou.alibaba_wdk_hrworkbench_cdpemps_query | (
self,
page_size,
biz_key,
biz_code,
current_page
) | return self._top_request(
"alibaba.wdk.hrworkbench.cdpemps.query",
{
"page_size": page_size,
"biz_key": biz_key,
"biz_code": biz_code,
"current_page": current_page
}
) | homs员工信息核对查询服务
给盒马可靠软件服务商Cdp系统,做非阿里编员工数据一致性核对检查
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=41373
:param page_size: 页面大小
:param biz_key: 业务授权key
:param biz_code: 业务授权code
:param current_page: 起始页 | homs员工信息核对查询服务
给盒马可靠软件服务商Cdp系统,做非阿里编员工数据一致性核对检查
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=41373 | [
"homs员工信息核对查询服务",
"给盒马可靠软件服务商Cdp系统,做非阿里编员工数据一致性核对检查",
"文档地址:https",
":",
"//",
"open",
"-",
"doc",
".",
"dingtalk",
".",
"com",
"/",
"docs",
"/",
"api",
".",
"htm?apiId",
"=",
"41373"
] | def alibaba_wdk_hrworkbench_cdpemps_query(
self,
page_size,
biz_key,
biz_code,
current_page
):
"""
homs员工信息核对查询服务
给盒马可靠软件服务商Cdp系统,做非阿里编员工数据一致性核对检查
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=41373
:param p... | [
"def",
"alibaba_wdk_hrworkbench_cdpemps_query",
"(",
"self",
",",
"page_size",
",",
"biz_key",
",",
"biz_code",
",",
"current_page",
")",
":",
"return",
"self",
".",
"_top_request",
"(",
"\"alibaba.wdk.hrworkbench.cdpemps.query\"",
",",
"{",
"\"page_size\"",
":",
"pag... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L64858-L64883 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/common/lib/python2.7/site-packages/libxml2.py | python | parserCtxt.ctxtReset | (self) | Reset a parser context | Reset a parser context | [
"Reset",
"a",
"parser",
"context"
] | def ctxtReset(self):
"""Reset a parser context """
libxml2mod.xmlCtxtReset(self._o) | [
"def",
"ctxtReset",
"(",
"self",
")",
":",
"libxml2mod",
".",
"xmlCtxtReset",
"(",
"self",
".",
"_o",
")"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/common/lib/python2.7/site-packages/libxml2.py#L5009-L5011 | ||
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/treeview/faces.py | python | TextFace._width | (self) | return self.get_bounding_rect().width() | [] | def _width(self):
return self.get_bounding_rect().width() | [
"def",
"_width",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_bounding_rect",
"(",
")",
".",
"width",
"(",
")"
] | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/treeview/faces.py#L331-L332 | |||
mlberkeley/Creative-Adversarial-Networks | fea29d4348a650a40322fc4da645395d3d0f089c | slim/nets/dcgan.py | python | discriminator | (inputs,
depth=64,
is_training=True,
reuse=None,
scope='Discriminator',
fused_batch_norm=False) | Discriminator network for DCGAN.
Construct discriminator network from inputs to the final endpoint.
Args:
inputs: A tensor of size [batch_size, height, width, channels]. Must be
floating point.
depth: Number of channels in first convolution layer.
is_training: Whether the network is for training... | Discriminator network for DCGAN. | [
"Discriminator",
"network",
"for",
"DCGAN",
"."
] | def discriminator(inputs,
depth=64,
is_training=True,
reuse=None,
scope='Discriminator',
fused_batch_norm=False):
"""Discriminator network for DCGAN.
Construct discriminator network from inputs to the final endpoint.
Args:... | [
"def",
"discriminator",
"(",
"inputs",
",",
"depth",
"=",
"64",
",",
"is_training",
"=",
"True",
",",
"reuse",
"=",
"None",
",",
"scope",
"=",
"'Discriminator'",
",",
"fused_batch_norm",
"=",
"False",
")",
":",
"normalizer_fn",
"=",
"slim",
".",
"batch_nor... | https://github.com/mlberkeley/Creative-Adversarial-Networks/blob/fea29d4348a650a40322fc4da645395d3d0f089c/slim/nets/dcgan.py#L39-L102 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/export/models/new.py | python | _meta_property | (name) | return property(fget) | [] | def _meta_property(name):
def fget(self):
return getattr(self._meta, name)
return property(fget) | [
"def",
"_meta_property",
"(",
"name",
")",
":",
"def",
"fget",
"(",
"self",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"_meta",
",",
"name",
")",
"return",
"property",
"(",
"fget",
")"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/export/models/new.py#L2743-L2746 | |||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_edit.py | python | Yedit.add_entry | (data, key, item=None, sep='.') | return data | Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a#b
return c | Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a#b
return c | [
"Get",
"an",
"item",
"from",
"a",
"dictionary",
"with",
"key",
"notation",
"a",
".",
"b",
".",
"c",
"d",
"=",
"{",
"a",
":",
"{",
"b",
":",
"c",
"}}}",
"key",
"=",
"a#b",
"return",
"c"
] | def add_entry(data, key, item=None, sep='.'):
''' Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a#b
return c
'''
if key == '':
pass
elif (not (key and Yedit.valid_key(key, sep)) and
isinsta... | [
"def",
"add_entry",
"(",
"data",
",",
"key",
",",
"item",
"=",
"None",
",",
"sep",
"=",
"'.'",
")",
":",
"if",
"key",
"==",
"''",
":",
"pass",
"elif",
"(",
"not",
"(",
"key",
"and",
"Yedit",
".",
"valid_key",
"(",
"key",
",",
"sep",
")",
")",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_edit.py#L305-L355 | |
Octavian-ai/clevr-graph | a7d5be1da0c0c1e1e0a4b3c95f7e793b0de31b50 | gqa/types.py | python | GraphSpec.__setstate__ | (self, state) | [] | def __setstate__(self, state):
self.id = state["id"]
self.edges = state["edges"]
# print([i.__dict__ for i in state["nodes"]])
self.nodes = {i["id"]:i for i in state["nodes"]}
self.lines = {i["id"]:i for i in state["lines"]}
self.gen_gnx() | [
"def",
"__setstate__",
"(",
"self",
",",
"state",
")",
":",
"self",
".",
"id",
"=",
"state",
"[",
"\"id\"",
"]",
"self",
".",
"edges",
"=",
"state",
"[",
"\"edges\"",
"]",
"# print([i.__dict__ for i in state[\"nodes\"]])",
"self",
".",
"nodes",
"=",
"{",
"... | https://github.com/Octavian-ai/clevr-graph/blob/a7d5be1da0c0c1e1e0a4b3c95f7e793b0de31b50/gqa/types.py#L123-L129 | ||||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/foundation/undo_manager.py | python | AssyUndoManager.make_manual_checkpoint | (self) | return | #doc; called from editMakeCheckpoint, presumably only when autocheckpointing is disabled | #doc; called from editMakeCheckpoint, presumably only when autocheckpointing is disabled | [
"#doc",
";",
"called",
"from",
"editMakeCheckpoint",
"presumably",
"only",
"when",
"autocheckpointing",
"is",
"disabled"
] | def make_manual_checkpoint(self): #060312
"""
#doc; called from editMakeCheckpoint, presumably only when autocheckpointing is disabled
"""
self.checkpoint( cptype = 'manual', merge_with_future = False )
# temporary comment 060312: this might be enough, once it sets up for rem... | [
"def",
"make_manual_checkpoint",
"(",
"self",
")",
":",
"#060312",
"self",
".",
"checkpoint",
"(",
"cptype",
"=",
"'manual'",
",",
"merge_with_future",
"=",
"False",
")",
"# temporary comment 060312: this might be enough, once it sets up for remake_UI_menuitems",
"return"
] | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/foundation/undo_manager.py#L185-L191 | |
mediadrop/mediadrop | 59b477398fe306932cd93fc6bddb37fd45327373 | mediadrop/forms/admin/storage/ftp.py | python | FTPStorageForm.display | (self, value, engine, **kwargs) | return StorageForm.display(self, value, engine, **kwargs) | Display the form with default values from the given StorageEngine.
If the value dict is not fully populated, populate any missing entries
with the values from the given StorageEngine's
:attr:`_data <mediadrop.lib.storage.StorageEngine._data>` dict.
:param value: A (sparse) dict of valu... | Display the form with default values from the given StorageEngine. | [
"Display",
"the",
"form",
"with",
"default",
"values",
"from",
"the",
"given",
"StorageEngine",
"."
] | def display(self, value, engine, **kwargs):
"""Display the form with default values from the given StorageEngine.
If the value dict is not fully populated, populate any missing entries
with the values from the given StorageEngine's
:attr:`_data <mediadrop.lib.storage.StorageEngine._data... | [
"def",
"display",
"(",
"self",
",",
"value",
",",
"engine",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"engine",
".",
"_data",
"ftp",
"=",
"value",
".",
"setdefault",
"(",
"'ftp'",
",",
"{",
"}",
")",
"ftp",
".",
"setdefault",
"(",
"'server'",... | https://github.com/mediadrop/mediadrop/blob/59b477398fe306932cd93fc6bddb37fd45327373/mediadrop/forms/admin/storage/ftp.py#L38-L60 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/turtle.py | python | TurtleScreenBase.numinput | (self, title, prompt, default=None, minval=None, maxval=None) | return simpledialog.askfloat(title, prompt, initialvalue=default,
minvalue=minval, maxvalue=maxval,
parent=self.cv) | Pop up a dialog window for input of a number.
Arguments: title is the title of the dialog window,
prompt is a text mostly describing what numerical information to input.
default: default value
minval: minimum value for input
maxval: maximum value for input
The number in... | Pop up a dialog window for input of a number. | [
"Pop",
"up",
"a",
"dialog",
"window",
"for",
"input",
"of",
"a",
"number",
"."
] | def numinput(self, title, prompt, default=None, minval=None, maxval=None):
"""Pop up a dialog window for input of a number.
Arguments: title is the title of the dialog window,
prompt is a text mostly describing what numerical information to input.
default: default value
minval: ... | [
"def",
"numinput",
"(",
"self",
",",
"title",
",",
"prompt",
",",
"default",
"=",
"None",
",",
"minval",
"=",
"None",
",",
"maxval",
"=",
"None",
")",
":",
"return",
"simpledialog",
".",
"askfloat",
"(",
"title",
",",
"prompt",
",",
"initialvalue",
"="... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/turtle.py#L829-L849 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_configmap.py | python | Yedit.append | (self, path, value) | return (True, self.yaml_dict) | append value to a list | append value to a list | [
"append",
"value",
"to",
"a",
"list"
] | def append(self, path, value):
'''append value to a list'''
try:
entry = Yedit.get_entry(self.yaml_dict, path, self.separator)
except KeyError:
entry = None
if entry is None:
self.put(path, [])
entry = Yedit.get_entry(self.yaml_dict, path,... | [
"def",
"append",
"(",
"self",
",",
"path",
",",
"value",
")",
":",
"try",
":",
"entry",
"=",
"Yedit",
".",
"get_entry",
"(",
"self",
".",
"yaml_dict",
",",
"path",
",",
"self",
".",
"separator",
")",
"except",
"KeyError",
":",
"entry",
"=",
"None",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_configmap.py#L518-L535 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/dns/rdtypes/IN/SRV.py | python | SRV.from_text | (cls, rdclass, rdtype, tok, origin=None, relativize=True,
relativize_to=None) | return cls(rdclass, rdtype, priority, weight, port, target) | [] | def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True,
relativize_to=None):
priority = tok.get_uint16()
weight = tok.get_uint16()
port = tok.get_uint16()
target = tok.get_name(origin, relativize, relativize_to)
tok.get_eol()
return cls(rd... | [
"def",
"from_text",
"(",
"cls",
",",
"rdclass",
",",
"rdtype",
",",
"tok",
",",
"origin",
"=",
"None",
",",
"relativize",
"=",
"True",
",",
"relativize_to",
"=",
"None",
")",
":",
"priority",
"=",
"tok",
".",
"get_uint16",
"(",
")",
"weight",
"=",
"t... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/dns/rdtypes/IN/SRV.py#L46-L53 | |||
beetbox/beets | 2fea53c34dd505ba391cb345424e0613901c8025 | beetsplug/bpsync.py | python | BPSyncPlugin.func | (self, lib, opts, args) | Command handler for the bpsync function. | Command handler for the bpsync function. | [
"Command",
"handler",
"for",
"the",
"bpsync",
"function",
"."
] | def func(self, lib, opts, args):
"""Command handler for the bpsync function.
"""
move = ui.should_move(opts.move)
pretend = opts.pretend
write = ui.should_write(opts.write)
query = ui.decargs(args)
self.singletons(lib, query, move, pretend, write)
self.al... | [
"def",
"func",
"(",
"self",
",",
"lib",
",",
"opts",
",",
"args",
")",
":",
"move",
"=",
"ui",
".",
"should_move",
"(",
"opts",
".",
"move",
")",
"pretend",
"=",
"opts",
".",
"pretend",
"write",
"=",
"ui",
".",
"should_write",
"(",
"opts",
".",
"... | https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/beetsplug/bpsync.py#L64-L73 | ||
learningequality/kolibri | d056dbc477aaf651ab843caa141a6a1e0a491046 | kolibri/core/auth/management/utils.py | python | MorangoSyncCommand._session_tracker_adapter | (self, signal_group, noninteractive) | Attaches a signal handler to session creation signals
:type signal_group: morango.sync.syncsession.SyncSignalGroup
:type noninteractive: bool | Attaches a signal handler to session creation signals | [
"Attaches",
"a",
"signal",
"handler",
"to",
"session",
"creation",
"signals"
] | def _session_tracker_adapter(self, signal_group, noninteractive):
"""
Attaches a signal handler to session creation signals
:type signal_group: morango.sync.syncsession.SyncSignalGroup
:type noninteractive: bool
"""
@run_once
def session_creation(transfer_sessio... | [
"def",
"_session_tracker_adapter",
"(",
"self",
",",
"signal_group",
",",
"noninteractive",
")",
":",
"@",
"run_once",
"def",
"session_creation",
"(",
"transfer_session",
")",
":",
"\"\"\"\n A session is created individually for pushing and pulling\n \"\"\""... | https://github.com/learningequality/kolibri/blob/d056dbc477aaf651ab843caa141a6a1e0a491046/kolibri/core/auth/management/utils.py#L604-L626 | ||
robinhood/faust | 01b4c0ad8390221db71751d80001b0fd879291e2 | faust/types/settings/settings.py | python | Settings.reply_expires | (self) | RPC reply expiry time in seconds.
The expiry time (in seconds :class:`float`,
or :class:`~datetime.timedelta`), for how long replies will stay
in the instances local reply topic before being removed. | RPC reply expiry time in seconds. | [
"RPC",
"reply",
"expiry",
"time",
"in",
"seconds",
"."
] | def reply_expires(self) -> float:
"""RPC reply expiry time in seconds.
The expiry time (in seconds :class:`float`,
or :class:`~datetime.timedelta`), for how long replies will stay
in the instances local reply topic before being removed.
""" | [
"def",
"reply_expires",
"(",
"self",
")",
"->",
"float",
":"
] | https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/types/settings/settings.py#L1353-L1359 | ||
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/dispatch.py | python | SOAPRequestHandler.do_POST | (self) | The POST command. | The POST command. | [
"The",
"POST",
"command",
"."
] | def do_POST(self):
'''The POST command.
'''
try:
ct = self.headers['content-type']
if ct.startswith('multipart/'):
cid = resolvers.MIMEResolver(ct, self.rfile)
xml = cid.GetSOAPPart()
ps = ParsedSoap(xml, resolver=cid.Resolv... | [
"def",
"do_POST",
"(",
"self",
")",
":",
"try",
":",
"ct",
"=",
"self",
".",
"headers",
"[",
"'content-type'",
"]",
"if",
"ct",
".",
"startswith",
"(",
"'multipart/'",
")",
":",
"cid",
"=",
"resolvers",
".",
"MIMEResolver",
"(",
"ct",
",",
"self",
".... | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/dispatch.py#L213-L235 | ||
h5py/h5py | aa31f03bef99e5807d1d6381e36233325d944279 | h5py/_hl/selections.py | python | Selection.nselect | (self) | return self._id.get_select_npoints() | Number of elements currently selected | Number of elements currently selected | [
"Number",
"of",
"elements",
"currently",
"selected"
] | def nselect(self):
""" Number of elements currently selected """
return self._id.get_select_npoints() | [
"def",
"nselect",
"(",
"self",
")",
":",
"return",
"self",
".",
"_id",
".",
"get_select_npoints",
"(",
")"
] | https://github.com/h5py/h5py/blob/aa31f03bef99e5807d1d6381e36233325d944279/h5py/_hl/selections.py#L134-L136 | |
realsirjoe/instagram-scraper | 0b71972eecb239724c8dbe23e35b9c366b889619 | igramscraper/instagram.py | python | Instagram.block | (self, user_id) | return False | :param user_id: user id
:return: bool | :param user_id: user id
:return: bool | [
":",
"param",
"user_id",
":",
"user",
"id",
":",
"return",
":",
"bool"
] | def block(self, user_id):
"""
:param user_id: user id
:return: bool
"""
if self.is_logged_in(self.user_session):
user_id_number=self.get_account(user_id).identifier
url_block = endpoints.get_block_url(user_id_number)
try:
bloc... | [
"def",
"block",
"(",
"self",
",",
"user_id",
")",
":",
"if",
"self",
".",
"is_logged_in",
"(",
"self",
".",
"user_session",
")",
":",
"user_id_number",
"=",
"self",
".",
"get_account",
"(",
"user_id",
")",
".",
"identifier",
"url_block",
"=",
"endpoints",
... | https://github.com/realsirjoe/instagram-scraper/blob/0b71972eecb239724c8dbe23e35b9c366b889619/igramscraper/instagram.py#L1748-L1766 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | couchbase/datadog_checks/couchbase/couchbase.py | python | Couchbase._get_query_monitoring_data | (self) | return query_data | [] | def _get_query_monitoring_data(self):
query_data = None
query_monitoring_url = self.instance.get('query_monitoring_url')
if query_monitoring_url:
url = '{}{}'.format(query_monitoring_url, COUCHBASE_VITALS_PATH)
try:
query_data = self._get_stats(url)
... | [
"def",
"_get_query_monitoring_data",
"(",
"self",
")",
":",
"query_data",
"=",
"None",
"query_monitoring_url",
"=",
"self",
".",
"instance",
".",
"get",
"(",
"'query_monitoring_url'",
")",
"if",
"query_monitoring_url",
":",
"url",
"=",
"'{}{}'",
".",
"format",
"... | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/couchbase/datadog_checks/couchbase/couchbase.py#L313-L327 | |||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/mail/smtp.py | python | ESMTPClient.registerAuthenticator | (self, auth) | Registers an Authenticator with the ESMTPClient. The ESMTPClient
will attempt to login to the SMTP Server in the order the
Authenticators are registered. The most secure Authentication
mechanism should be registered first.
@param auth: The Authentication mechanism to registe... | Registers an Authenticator with the ESMTPClient. The ESMTPClient
will attempt to login to the SMTP Server in the order the
Authenticators are registered. The most secure Authentication
mechanism should be registered first. | [
"Registers",
"an",
"Authenticator",
"with",
"the",
"ESMTPClient",
".",
"The",
"ESMTPClient",
"will",
"attempt",
"to",
"login",
"to",
"the",
"SMTP",
"Server",
"in",
"the",
"order",
"the",
"Authenticators",
"are",
"registered",
".",
"The",
"most",
"secure",
"Aut... | def registerAuthenticator(self, auth):
"""Registers an Authenticator with the ESMTPClient. The ESMTPClient
will attempt to login to the SMTP Server in the order the
Authenticators are registered. The most secure Authentication
mechanism should be registered first.
@p... | [
"def",
"registerAuthenticator",
"(",
"self",
",",
"auth",
")",
":",
"self",
".",
"authenticators",
".",
"append",
"(",
"auth",
")"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/mail/smtp.py#L1283-L1293 | ||
bk1285/rpi_wordclock | 5f1cef3bb58a904c4fda17dba9945174d15a6ab2 | wordclock_plugins/ip_address/plugin.py | python | plugin.run | (self, wcd, wci) | return | Show ip of the wordclock | Show ip of the wordclock | [
"Show",
"ip",
"of",
"the",
"wordclock"
] | def run(self, wcd, wci):
"""
Show ip of the wordclock
"""
try:
ip = netifaces.ifaddresses(self.interface)[2][0]['addr']
wcd.showText(ip)
except:
wcd.showText('No ip.')
return | [
"def",
"run",
"(",
"self",
",",
"wcd",
",",
"wci",
")",
":",
"try",
":",
"ip",
"=",
"netifaces",
".",
"ifaddresses",
"(",
"self",
".",
"interface",
")",
"[",
"2",
"]",
"[",
"0",
"]",
"[",
"'addr'",
"]",
"wcd",
".",
"showText",
"(",
"ip",
")",
... | https://github.com/bk1285/rpi_wordclock/blob/5f1cef3bb58a904c4fda17dba9945174d15a6ab2/wordclock_plugins/ip_address/plugin.py#L20-L29 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/saved_reports/models.py | python | ReportConfig.to_complete_json | (self, lang=None) | return result | [] | def to_complete_json(self, lang=None):
result = super(ReportConfig, self).to_json()
result.update({
'url': self.url,
'report_name': self.report_name,
'date_description': self.date_description,
'datespan_filters': self.datespan_filter_choices(
... | [
"def",
"to_complete_json",
"(",
"self",
",",
"lang",
"=",
"None",
")",
":",
"result",
"=",
"super",
"(",
"ReportConfig",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'url'",
":",
"self",
".",
"url",
",",
"'report_na... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/saved_reports/models.py#L154-L166 | |||
conda/constructor | 63b45930bfd296b5e735f03d533670487d626778 | versioneer.py | python | do_vcs_install | (manifest_in, versionfile_source, ipy) | Git-specific installation logic for Versioneer.
For Git, this means creating/changing .gitattributes to mark _version.py
for export-subst keyword substitution. | Git-specific installation logic for Versioneer. | [
"Git",
"-",
"specific",
"installation",
"logic",
"for",
"Versioneer",
"."
] | def do_vcs_install(manifest_in, versionfile_source, ipy):
"""Git-specific installation logic for Versioneer.
For Git, this means creating/changing .gitattributes to mark _version.py
for export-subst keyword substitution.
"""
GITS = ["git"]
if sys.platform == "win32":
GITS = ["git.cmd", ... | [
"def",
"do_vcs_install",
"(",
"manifest_in",
",",
"versionfile_source",
",",
"ipy",
")",
":",
"GITS",
"=",
"[",
"\"git\"",
"]",
"if",
"sys",
".",
"platform",
"==",
"\"win32\"",
":",
"GITS",
"=",
"[",
"\"git.cmd\"",
",",
"\"git.exe\"",
"]",
"files",
"=",
... | https://github.com/conda/constructor/blob/63b45930bfd296b5e735f03d533670487d626778/versioneer.py#L1120-L1155 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/GoogleChronicleBackstory/Integrations/GoogleChronicleBackstory/GoogleChronicleBackstory.py | python | is_severity_suspicious | (severity, reputation_params) | return severity and severity.lower() in reputation_params['override_severity_suspicious'] | determine if severity is suspicious in reputation_params | determine if severity is suspicious in reputation_params | [
"determine",
"if",
"severity",
"is",
"suspicious",
"in",
"reputation_params"
] | def is_severity_suspicious(severity, reputation_params):
"""
determine if severity is suspicious in reputation_params
"""
return severity and severity.lower() in reputation_params['override_severity_suspicious'] | [
"def",
"is_severity_suspicious",
"(",
"severity",
",",
"reputation_params",
")",
":",
"return",
"severity",
"and",
"severity",
".",
"lower",
"(",
")",
"in",
"reputation_params",
"[",
"'override_severity_suspicious'",
"]"
] | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/GoogleChronicleBackstory/Integrations/GoogleChronicleBackstory/GoogleChronicleBackstory.py#L710-L714 | |
dry-python/returns | dfc1613f22ef6cbc5d1c48e086affe16c1bd33bb | returns/maybe.py | python | Maybe.from_value | (
cls, inner_value: _NewValueType,
) | return Some(inner_value) | Creates new instance of ``Maybe`` container based on a value.
.. code:: python
>>> from returns.maybe import Maybe, Some
>>> assert Maybe.from_value(1) == Some(1)
>>> assert Maybe.from_value(None) == Some(None) | Creates new instance of ``Maybe`` container based on a value. | [
"Creates",
"new",
"instance",
"of",
"Maybe",
"container",
"based",
"on",
"a",
"value",
"."
] | def from_value(
cls, inner_value: _NewValueType,
) -> 'Maybe[_NewValueType]':
"""
Creates new instance of ``Maybe`` container based on a value.
.. code:: python
>>> from returns.maybe import Maybe, Some
>>> assert Maybe.from_value(1) == Some(1)
>>> ass... | [
"def",
"from_value",
"(",
"cls",
",",
"inner_value",
":",
"_NewValueType",
",",
")",
"->",
"'Maybe[_NewValueType]'",
":",
"return",
"Some",
"(",
"inner_value",
")"
] | https://github.com/dry-python/returns/blob/dfc1613f22ef6cbc5d1c48e086affe16c1bd33bb/returns/maybe.py#L251-L264 | |
datacenter/acitoolkit | 629b84887dd0f0183b81efc8adb16817f985541a | applications/snapback/aciconfigdb.py | python | ConfigDB.get_latest_file_version | (self, filename) | return latest_version[1] | Get the latest version identifier of a given filename
:param filename: string containing the file name
:returns: string containing the latest version identifier for the
specified file | Get the latest version identifier of a given filename | [
"Get",
"the",
"latest",
"version",
"identifier",
"of",
"a",
"given",
"filename"
] | def get_latest_file_version(self, filename):
"""
Get the latest version identifier of a given filename
:param filename: string containing the file name
:returns: string containing the latest version identifier for the
specified file
"""
try:
... | [
"def",
"get_latest_file_version",
"(",
"self",
",",
"filename",
")",
":",
"try",
":",
"versions",
"=",
"str",
"(",
"self",
".",
"repo",
".",
"git",
".",
"show",
"(",
"'--tags'",
",",
"'--name-only'",
",",
"'--oneline'",
",",
"filename",
")",
")",
"except... | https://github.com/datacenter/acitoolkit/blob/629b84887dd0f0183b81efc8adb16817f985541a/applications/snapback/aciconfigdb.py#L497-L518 | |
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/metadata.py | python | LegacyMetadata.is_field | (self, name) | return name in _ALL_FIELDS | return True if name is a valid metadata key | return True if name is a valid metadata key | [
"return",
"True",
"if",
"name",
"is",
"a",
"valid",
"metadata",
"key"
] | def is_field(self, name):
"""return True if name is a valid metadata key"""
name = self._convert_name(name)
return name in _ALL_FIELDS | [
"def",
"is_field",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"self",
".",
"_convert_name",
"(",
"name",
")",
"return",
"name",
"in",
"_ALL_FIELDS"
] | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/metadata.py#L321-L324 | |
microsoftgraph/python-sample-auth | 78827b41b86405ac95e03e53491e4f8db175a35c | sample_requests.py | python | authorized | () | return bottle.redirect('/graphcall') | Handler for the application's Redirect Uri. | Handler for the application's Redirect Uri. | [
"Handler",
"for",
"the",
"application",
"s",
"Redirect",
"Uri",
"."
] | def authorized():
"""Handler for the application's Redirect Uri."""
if bottle.request.query.state != MSGRAPH.auth_state:
raise Exception('state returned to redirect URL does not match!')
MSGRAPH.fetch_token(config.AUTHORITY_URL + config.TOKEN_ENDPOINT,
client_secret=config.CL... | [
"def",
"authorized",
"(",
")",
":",
"if",
"bottle",
".",
"request",
".",
"query",
".",
"state",
"!=",
"MSGRAPH",
".",
"auth_state",
":",
"raise",
"Exception",
"(",
"'state returned to redirect URL does not match!'",
")",
"MSGRAPH",
".",
"fetch_token",
"(",
"conf... | https://github.com/microsoftgraph/python-sample-auth/blob/78827b41b86405ac95e03e53491e4f8db175a35c/sample_requests.py#L40-L47 | |
kislyuk/ensure | ffa68ef7ae18cbcdda1ec35a70a270af6f793703 | ensure/main.py | python | Ensure.is_not_a | (self, prototype) | return ChainInspector(self._subject) | Ensures :attr:`subject` is not an object of class *prototype*. | Ensures :attr:`subject` is not an object of class *prototype*. | [
"Ensures",
":",
"attr",
":",
"subject",
"is",
"not",
"an",
"object",
"of",
"class",
"*",
"prototype",
"*",
"."
] | def is_not_a(self, prototype):
"""
Ensures :attr:`subject` is not an object of class *prototype*.
"""
self._run(unittest_case.assertNotIsInstance, (self._subject, prototype))
return ChainInspector(self._subject) | [
"def",
"is_not_a",
"(",
"self",
",",
"prototype",
")",
":",
"self",
".",
"_run",
"(",
"unittest_case",
".",
"assertNotIsInstance",
",",
"(",
"self",
".",
"_subject",
",",
"prototype",
")",
")",
"return",
"ChainInspector",
"(",
"self",
".",
"_subject",
")"
... | https://github.com/kislyuk/ensure/blob/ffa68ef7ae18cbcdda1ec35a70a270af6f793703/ensure/main.py#L474-L479 | |
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gen/plug/_plugin.py | python | Plugin.get_module_name | (self) | return self.__mod_name | Get the name of the module that this plugin lives in.
:return: a string representing the name of the module for this plugin | Get the name of the module that this plugin lives in. | [
"Get",
"the",
"name",
"of",
"the",
"module",
"that",
"this",
"plugin",
"lives",
"in",
"."
] | def get_module_name(self):
"""
Get the name of the module that this plugin lives in.
:return: a string representing the name of the module for this plugin
"""
return self.__mod_name | [
"def",
"get_module_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"__mod_name"
] | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/plug/_plugin.py#L64-L70 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/ldap3/operation/extended.py | python | extended_response_to_dict | (response) | return {'result': int(response['resultCode']),
'dn': str(response['matchedDN']),
'message': str(response['diagnosticMessage']),
'description': ResultCode().getNamedValues().getName(response['resultCode']),
'referrals': referrals_to_list(response['referral']),
... | [] | def extended_response_to_dict(response):
return {'result': int(response['resultCode']),
'dn': str(response['matchedDN']),
'message': str(response['diagnosticMessage']),
'description': ResultCode().getNamedValues().getName(response['resultCode']),
'referrals': referral... | [
"def",
"extended_response_to_dict",
"(",
"response",
")",
":",
"return",
"{",
"'result'",
":",
"int",
"(",
"response",
"[",
"'resultCode'",
"]",
")",
",",
"'dn'",
":",
"str",
"(",
"response",
"[",
"'matchedDN'",
"]",
")",
",",
"'message'",
":",
"str",
"(... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/ldap3/operation/extended.py#L63-L70 | |||
googleapis/python-dialogflow | e48ea001b7c8a4a5c1fe4b162bad49ea397458e9 | google/cloud/dialogflow_v2/services/knowledge_bases/async_client.py | python | KnowledgeBasesAsyncClient.update_knowledge_base | (
self,
request: Union[gcd_knowledge_base.UpdateKnowledgeBaseRequest, dict] = None,
*,
knowledge_base: gcd_knowledge_base.KnowledgeBase = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
... | return response | r"""Updates the specified knowledge base.
Args:
request (Union[google.cloud.dialogflow_v2.types.UpdateKnowledgeBaseRequest, dict]):
The request object. Request message for
[KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeB... | r"""Updates the specified knowledge base. | [
"r",
"Updates",
"the",
"specified",
"knowledge",
"base",
"."
] | async def update_knowledge_base(
self,
request: Union[gcd_knowledge_base.UpdateKnowledgeBaseRequest, dict] = None,
*,
knowledge_base: gcd_knowledge_base.KnowledgeBase = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
... | [
"async",
"def",
"update_knowledge_base",
"(",
"self",
",",
"request",
":",
"Union",
"[",
"gcd_knowledge_base",
".",
"UpdateKnowledgeBaseRequest",
",",
"dict",
"]",
"=",
"None",
",",
"*",
",",
"knowledge_base",
":",
"gcd_knowledge_base",
".",
"KnowledgeBase",
"=",
... | https://github.com/googleapis/python-dialogflow/blob/e48ea001b7c8a4a5c1fe4b162bad49ea397458e9/google/cloud/dialogflow_v2/services/knowledge_bases/async_client.py#L496-L588 | |
faucetsdn/ryu | 537f35f4b2bc634ef05e3f28373eb5e24609f989 | ryu/lib/ovs/bridge.py | python | OVSBridge.delete_port | (self, port_name) | Deletes a port on the OVS instance.
This method is corresponding to the following ovs-vsctl command::
$ ovs-vsctl --if-exists del-port <bridge> <port> | Deletes a port on the OVS instance. | [
"Deletes",
"a",
"port",
"on",
"the",
"OVS",
"instance",
"."
] | def delete_port(self, port_name):
"""
Deletes a port on the OVS instance.
This method is corresponding to the following ovs-vsctl command::
$ ovs-vsctl --if-exists del-port <bridge> <port>
"""
command = ovs_vsctl.VSCtlCommand(
'del-port', (self.br_name, ... | [
"def",
"delete_port",
"(",
"self",
",",
"port_name",
")",
":",
"command",
"=",
"ovs_vsctl",
".",
"VSCtlCommand",
"(",
"'del-port'",
",",
"(",
"self",
".",
"br_name",
",",
"port_name",
")",
",",
"'--if-exists'",
")",
"self",
".",
"run_command",
"(",
"[",
... | https://github.com/faucetsdn/ryu/blob/537f35f4b2bc634ef05e3f28373eb5e24609f989/ryu/lib/ovs/bridge.py#L340-L350 | ||
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/cpython/heapq.py | python | hq_heappop | (heap) | return hq_heappop_impl | [] | def hq_heappop(heap):
assert_heap_type(heap)
def hq_heappop_impl(heap):
lastelt = heap.pop()
if heap:
returnitem = heap[0]
heap[0] = lastelt
_siftup(heap, 0)
return returnitem
return lastelt
return hq_heappop_impl | [
"def",
"hq_heappop",
"(",
"heap",
")",
":",
"assert_heap_type",
"(",
"heap",
")",
"def",
"hq_heappop_impl",
"(",
"heap",
")",
":",
"lastelt",
"=",
"heap",
".",
"pop",
"(",
")",
"if",
"heap",
":",
"returnitem",
"=",
"heap",
"[",
"0",
"]",
"heap",
"[",... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cpython/heapq.py#L135-L147 | |||
colinskow/move37 | f57afca9d15ce0233b27b2b0d6508b99b46d4c7f | ppo/lib/multiprocessing_env.py | python | CloudpickleWrapper.__init__ | (self, x) | [] | def __init__(self, x):
self.x = x | [
"def",
"__init__",
"(",
"self",
",",
"x",
")",
":",
"self",
".",
"x",
"=",
"x"
] | https://github.com/colinskow/move37/blob/f57afca9d15ce0233b27b2b0d6508b99b46d4c7f/ppo/lib/multiprocessing_env.py#L87-L88 | ||||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_internal/commands/configuration.py | python | ConfigurationCommand._save_configuration | (self) | [] | def _save_configuration(self) -> None:
# We successfully ran a modifying command. Need to save the
# configuration.
try:
self.configuration.save()
except Exception:
logger.exception(
"Unable to save configuration. Please report this as a bug."
... | [
"def",
"_save_configuration",
"(",
"self",
")",
"->",
"None",
":",
"# We successfully ran a modifying command. Need to save the",
"# configuration.",
"try",
":",
"self",
".",
"configuration",
".",
"save",
"(",
")",
"except",
"Exception",
":",
"logger",
".",
"exception... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_internal/commands/configuration.py#L247-L256 | ||||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gui/views/treemodels/treebasemodel.py | python | TreeBaseModel.rebuild_data | (self, data_filter=None, data_filter2=None, skip=[]) | Rebuild the data map.
When called externally (from listview), data_filter and data_filter2
should be None; set_search will already have been called to establish
the filter functions. When called internally (from __init__) both
data_filter and data_filter2 will have been set from set_sea... | Rebuild the data map. | [
"Rebuild",
"the",
"data",
"map",
"."
] | def rebuild_data(self, data_filter=None, data_filter2=None, skip=[]):
"""
Rebuild the data map.
When called externally (from listview), data_filter and data_filter2
should be None; set_search will already have been called to establish
the filter functions. When called internally... | [
"def",
"rebuild_data",
"(",
"self",
",",
"data_filter",
"=",
"None",
",",
"data_filter2",
"=",
"None",
",",
"skip",
"=",
"[",
"]",
")",
":",
"cput",
"=",
"perf_counter",
"(",
")",
"self",
".",
"clear_cache",
"(",
")",
"self",
".",
"_in_build",
"=",
"... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/views/treemodels/treebasemodel.py#L479-L508 | ||
MDAnalysis/mdanalysis | 3488df3cdb0c29ed41c4fb94efe334b541e31b21 | benchmarks/benchmarks/traj_reader.py | python | TrajReaderCreation.time_reads | (self, traj_format) | Simple benchmark for reading traj file formats
from our standard test files. | Simple benchmark for reading traj file formats
from our standard test files. | [
"Simple",
"benchmark",
"for",
"reading",
"traj",
"file",
"formats",
"from",
"our",
"standard",
"test",
"files",
"."
] | def time_reads(self, traj_format):
"""Simple benchmark for reading traj file formats
from our standard test files.
"""
self.traj_reader(self.traj_file) | [
"def",
"time_reads",
"(",
"self",
",",
"traj_format",
")",
":",
"self",
".",
"traj_reader",
"(",
"self",
".",
"traj_file",
")"
] | https://github.com/MDAnalysis/mdanalysis/blob/3488df3cdb0c29ed41c4fb94efe334b541e31b21/benchmarks/benchmarks/traj_reader.py#L40-L44 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/dns/wire.py | python | Parser.seek | (self, where) | [] | def seek(self, where):
# Note that seeking to the end is OK! (If you try to read
# after such a seek, you'll get an exception as expected.)
if where < 0 or where > self.end:
raise dns.exception.FormError
self.current = where | [
"def",
"seek",
"(",
"self",
",",
"where",
")",
":",
"# Note that seeking to the end is OK! (If you try to read",
"# after such a seek, you'll get an exception as expected.)",
"if",
"where",
"<",
"0",
"or",
"where",
">",
"self",
".",
"end",
":",
"raise",
"dns",
".",
"... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/dns/wire.py#L54-L59 | ||||
pndurette/gTTS | a67962cde02b605f89404bdc04ccb2e0af8fd340 | gtts/lang.py | python | _extra_langs | () | return {
# Chinese
'zh-TW': 'Chinese (Mandarin/Taiwan)',
'zh': 'Chinese (Mandarin)'
} | Define extra languages.
Returns:
dict: A dictionnary of extra languages manually defined.
Variations of the ones generated in `_main_langs`,
observed to provide different dialects or accents or
just simply accepted by the Google Translate Text-to-Speech API. | Define extra languages. | [
"Define",
"extra",
"languages",
"."
] | def _extra_langs():
"""Define extra languages.
Returns:
dict: A dictionnary of extra languages manually defined.
Variations of the ones generated in `_main_langs`,
observed to provide different dialects or accents or
just simply accepted by the Google Translate Text... | [
"def",
"_extra_langs",
"(",
")",
":",
"return",
"{",
"# Chinese",
"'zh-TW'",
":",
"'Chinese (Mandarin/Taiwan)'",
",",
"'zh'",
":",
"'Chinese (Mandarin)'",
"}"
] | https://github.com/pndurette/gTTS/blob/a67962cde02b605f89404bdc04ccb2e0af8fd340/gtts/lang.py#L37-L52 | |
psd-tools/psd-tools | 00241f3aed2ca52a8012e198a0f390ff7d8edca9 | src/psd_tools/api/layers.py | python | Layer.tagged_blocks | (self) | return self._record.tagged_blocks | Layer tagged blocks that is a dict-like container of settings.
See :py:class:`psd_tools.constants.Tag` for available
keys.
:return: :py:class:`~psd_tools.psd.tagged_blocks.TaggedBlocks` or
`None`.
Example::
from psd_tools.constants import Tag
metad... | Layer tagged blocks that is a dict-like container of settings. | [
"Layer",
"tagged",
"blocks",
"that",
"is",
"a",
"dict",
"-",
"like",
"container",
"of",
"settings",
"."
] | def tagged_blocks(self):
"""
Layer tagged blocks that is a dict-like container of settings.
See :py:class:`psd_tools.constants.Tag` for available
keys.
:return: :py:class:`~psd_tools.psd.tagged_blocks.TaggedBlocks` or
`None`.
Example::
from psd... | [
"def",
"tagged_blocks",
"(",
"self",
")",
":",
"return",
"self",
".",
"_record",
".",
"tagged_blocks"
] | https://github.com/psd-tools/psd-tools/blob/00241f3aed2ca52a8012e198a0f390ff7d8edca9/src/psd_tools/api/layers.py#L468-L483 | |
lulz3xploit/LittleBrother | 338cf821c3e051deedef1cbcf5f516dfef385a84 | lib/Url.py | python | Url.__init__ | (self, url) | [] | def __init__(self, url):
self.url = url
self.encodeDic = {
"%21": "!",
"%23": "#",
"%24": "$",
"%26": "&",
"%27": "'",
"%28": "(",
"%29": ")",
"%2A": "*",
"%2B": "+",
"%2C": ",",
"%2F": "/",
"%3A": ":",
"%3B": ";",
"%3D": "=",
"%3F": "?",
"%40": "@",
"%5B": "[",
"%5D": "]",
"%... | [
"def",
"__init__",
"(",
"self",
",",
"url",
")",
":",
"self",
".",
"url",
"=",
"url",
"self",
".",
"encodeDic",
"=",
"{",
"\"%21\"",
":",
"\"!\"",
",",
"\"%23\"",
":",
"\"#\"",
",",
"\"%24\"",
":",
"\"$\"",
",",
"\"%26\"",
":",
"\"&\"",
",",
"\"%27... | https://github.com/lulz3xploit/LittleBrother/blob/338cf821c3e051deedef1cbcf5f516dfef385a84/lib/Url.py#L5-L41 | ||||
jet-admin/jet-django | 9bd4536e02d581d39890d56190e8cc966e2714a4 | jet_django/deps/rest_framework/utils/html.py | python | parse_html_list | (dictionary, prefix='') | return [ret[item] for item in sorted(ret)] | Used to support list values in HTML forms.
Supports lists of primitives and/or dictionaries.
* List of primitives.
{
'[0]': 'abc',
'[1]': 'def',
'[2]': 'hij'
}
-->
[
'abc',
'def',
'hij'
]
* List of dictionaries.
{
'[0]fo... | Used to support list values in HTML forms.
Supports lists of primitives and/or dictionaries. | [
"Used",
"to",
"support",
"list",
"values",
"in",
"HTML",
"forms",
".",
"Supports",
"lists",
"of",
"primitives",
"and",
"/",
"or",
"dictionaries",
"."
] | def parse_html_list(dictionary, prefix=''):
"""
Used to support list values in HTML forms.
Supports lists of primitives and/or dictionaries.
* List of primitives.
{
'[0]': 'abc',
'[1]': 'def',
'[2]': 'hij'
}
-->
[
'abc',
'def',
'hij'
... | [
"def",
"parse_html_list",
"(",
"dictionary",
",",
"prefix",
"=",
"''",
")",
":",
"ret",
"=",
"{",
"}",
"regex",
"=",
"re",
".",
"compile",
"(",
"r'^%s\\[([0-9]+)\\](.*)$'",
"%",
"re",
".",
"escape",
"(",
"prefix",
")",
")",
"for",
"field",
",",
"value"... | https://github.com/jet-admin/jet-django/blob/9bd4536e02d581d39890d56190e8cc966e2714a4/jet_django/deps/rest_framework/utils/html.py#L15-L62 | |
SALib/SALib | b6b6b5cab3388f3b80590c98d66aca7dc784d894 | src/SALib/analyze/delta.py | python | calc_delta | (Y, Ygrid, X, m) | return d_hat | Plischke et al. (2013) delta index estimator (eqn 26) for d_hat. | Plischke et al. (2013) delta index estimator (eqn 26) for d_hat. | [
"Plischke",
"et",
"al",
".",
"(",
"2013",
")",
"delta",
"index",
"estimator",
"(",
"eqn",
"26",
")",
"for",
"d_hat",
"."
] | def calc_delta(Y, Ygrid, X, m):
"""Plischke et al. (2013) delta index estimator (eqn 26) for d_hat."""
N = len(Y)
fy = gaussian_kde(Y, bw_method='silverman')(Ygrid)
abs_fy = np.abs(fy)
xr = rankdata(X, method='ordinal')
d_hat = 0
for j in range(len(m) - 1):
ix = np.where((xr > m[j])... | [
"def",
"calc_delta",
"(",
"Y",
",",
"Ygrid",
",",
"X",
",",
"m",
")",
":",
"N",
"=",
"len",
"(",
"Y",
")",
"fy",
"=",
"gaussian_kde",
"(",
"Y",
",",
"bw_method",
"=",
"'silverman'",
")",
"(",
"Ygrid",
")",
"abs_fy",
"=",
"np",
".",
"abs",
"(",
... | https://github.com/SALib/SALib/blob/b6b6b5cab3388f3b80590c98d66aca7dc784d894/src/SALib/analyze/delta.py#L100-L121 | |
networkx/networkx | 1620568e36702b1cfeaf1c0277b167b6cb93e48d | networkx/algorithms/isomorphism/ismags.py | python | ISMAGS._process_ordered_pair_partitions | (
self,
graph,
top_partitions,
bottom_partitions,
edge_colors,
orbits=None,
cosets=None,
) | return permutations, cosets | Processes ordered pair partitions as per the reference paper. Finds and
returns all permutations and cosets that leave the graph unchanged. | Processes ordered pair partitions as per the reference paper. Finds and
returns all permutations and cosets that leave the graph unchanged. | [
"Processes",
"ordered",
"pair",
"partitions",
"as",
"per",
"the",
"reference",
"paper",
".",
"Finds",
"and",
"returns",
"all",
"permutations",
"and",
"cosets",
"that",
"leave",
"the",
"graph",
"unchanged",
"."
] | def _process_ordered_pair_partitions(
self,
graph,
top_partitions,
bottom_partitions,
edge_colors,
orbits=None,
cosets=None,
):
"""
Processes ordered pair partitions as per the reference paper. Finds and
returns all permutations and cos... | [
"def",
"_process_ordered_pair_partitions",
"(",
"self",
",",
"graph",
",",
"top_partitions",
",",
"bottom_partitions",
",",
"edge_colors",
",",
"orbits",
"=",
"None",
",",
"cosets",
"=",
"None",
",",
")",
":",
"if",
"orbits",
"is",
"None",
":",
"orbits",
"="... | https://github.com/networkx/networkx/blob/1620568e36702b1cfeaf1c0277b167b6cb93e48d/networkx/algorithms/isomorphism/ismags.py#L1055-L1153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.