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
x0rz/EQGRP_Lost_in_Translation
6692b1486f562f027567a49523b8c151a4050988
windows/fuzzbunch/pyreadline/console/ironpython_console.py
python
Console.__del__
(self)
Cleanup the console when finished.
Cleanup the console when finished.
[ "Cleanup", "the", "console", "when", "finished", "." ]
def __del__(self): '''Cleanup the console when finished.''' # I don't think this ever gets called pass
[ "def", "__del__", "(", "self", ")", ":", "# I don't think this ever gets called", "pass" ]
https://github.com/x0rz/EQGRP_Lost_in_Translation/blob/6692b1486f562f027567a49523b8c151a4050988/windows/fuzzbunch/pyreadline/console/ironpython_console.py#L100-L103
etetoolkit/ete
2b207357dc2a40ccad7bfd8f54964472c72e4726
ete3/nexml/_nexml.py
python
ContinuousSeqMatrix.exportLiteral
(self, outfile, level, name_='ContinuousSeqMatrix')
[]
def exportLiteral(self, outfile, level, name_='ContinuousSeqMatrix'): level += 1 self.exportLiteralAttributes(outfile, level, [], name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_)
[ "def", "exportLiteral", "(", "self", ",", "outfile", ",", "level", ",", "name_", "=", "'ContinuousSeqMatrix'", ")", ":", "level", "+=", "1", "self", ".", "exportLiteralAttributes", "(", "outfile", ",", "level", ",", "[", "]", ",", "name_", ")", "if", "se...
https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/nexml/_nexml.py#L2053-L2057
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/lib-tk/Tkinter.py
python
Listbox.delete
(self, first, last=None)
Delete items from FIRST to LAST (not included).
Delete items from FIRST to LAST (not included).
[ "Delete", "items", "from", "FIRST", "to", "LAST", "(", "not", "included", ")", "." ]
def delete(self, first, last=None): """Delete items from FIRST to LAST (not included).""" self.tk.call(self._w, 'delete', first, last)
[ "def", "delete", "(", "self", ",", "first", ",", "last", "=", "None", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'delete'", ",", "first", ",", "last", ")" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/lib-tk/Tkinter.py#L2501-L2503
Ultimaker/Uranium
66da853cd9a04edd3a8a03526fac81e83c03f5aa
plugins/Tools/ScaleTool/ScaleTool.py
python
ScaleTool.getScaleSnap
(self)
return self._snap_scale
Get snap scaling flag :return: snap type(boolean)
Get snap scaling flag
[ "Get", "snap", "scaling", "flag" ]
def getScaleSnap(self): """Get snap scaling flag :return: snap type(boolean) """ return self._snap_scale
[ "def", "getScaleSnap", "(", "self", ")", ":", "return", "self", ".", "_snap_scale" ]
https://github.com/Ultimaker/Uranium/blob/66da853cd9a04edd3a8a03526fac81e83c03f5aa/plugins/Tools/ScaleTool/ScaleTool.py#L230-L236
shiyanhui/Compiler
32f4dce37e14cc873100ad9f1d61eaaa5b8cd946
compiler.py
python
Assembler._function_statement
(self, node=None)
[]
def _function_statement(self, node=None): # 第一个儿子 current_node = node.first_son while current_node: if current_node.value == 'FunctionName': if current_node.first_son.value != 'main': print 'other function statement except for main is not supported...
[ "def", "_function_statement", "(", "self", ",", "node", "=", "None", ")", ":", "# 第一个儿子", "current_node", "=", "node", ".", "first_son", "while", "current_node", ":", "if", "current_node", ".", "value", "==", "'FunctionName'", ":", "if", "current_node", ".", ...
https://github.com/shiyanhui/Compiler/blob/32f4dce37e14cc873100ad9f1d61eaaa5b8cd946/compiler.py#L939-L953
awslabs/gluon-ts
066ec3b7f47aa4ee4c061a28f35db7edbad05a98
src/gluonts/torch/distributions/isqf.py
python
ISQF.crps
(self, z: torch.Tensor)
return crps_lt + crps_rt + self.crps_spline(z)
r""" Compute CRPS in analytical form Parameters ---------- z Observation to evaluate. Shape = (*batch_shape,) Returns ------- Tensor Tensor containing the CRPS, of the same shape as z
r""" Compute CRPS in analytical form Parameters ---------- z Observation to evaluate. Shape = (*batch_shape,) Returns ------- Tensor Tensor containing the CRPS, of the same shape as z
[ "r", "Compute", "CRPS", "in", "analytical", "form", "Parameters", "----------", "z", "Observation", "to", "evaluate", ".", "Shape", "=", "(", "*", "batch_shape", ")", "Returns", "-------", "Tensor", "Tensor", "containing", "the", "CRPS", "of", "the", "same", ...
def crps(self, z: torch.Tensor) -> torch.Tensor: r""" Compute CRPS in analytical form Parameters ---------- z Observation to evaluate. Shape = (*batch_shape,) Returns ------- Tensor Tensor containing the CRPS, of the same shape as z...
[ "def", "crps", "(", "self", ",", "z", ":", "torch", ".", "Tensor", ")", "->", "torch", ".", "Tensor", ":", "crps_lt", "=", "self", ".", "crps_tail", "(", "z", ",", "left_tail", "=", "True", ")", "crps_rt", "=", "self", ".", "crps_tail", "(", "z", ...
https://github.com/awslabs/gluon-ts/blob/066ec3b7f47aa4ee4c061a28f35db7edbad05a98/src/gluonts/torch/distributions/isqf.py#L613-L629
deepgram/kur
fd0c120e50815c1e5be64e5dde964dcd47234556
kur/sources/chunk.py
python
ChunkSource.set_chunk_size
(self, chunk_size)
Modifies the chunk size.
Modifies the chunk size.
[ "Modifies", "the", "chunk", "size", "." ]
def set_chunk_size(self, chunk_size): """ Modifies the chunk size. """ self.chunk_size = chunk_size or self.default_chunk_size()
[ "def", "set_chunk_size", "(", "self", ",", "chunk_size", ")", ":", "self", ".", "chunk_size", "=", "chunk_size", "or", "self", ".", "default_chunk_size", "(", ")" ]
https://github.com/deepgram/kur/blob/fd0c120e50815c1e5be64e5dde964dcd47234556/kur/sources/chunk.py#L45-L48
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/cherrypy/process/plugins.py
python
Autoreloader.sysfiles
(self)
return files
Return a Set of sys.modules filenames to monitor.
Return a Set of sys.modules filenames to monitor.
[ "Return", "a", "Set", "of", "sys", ".", "modules", "filenames", "to", "monitor", "." ]
def sysfiles(self): """Return a Set of sys.modules filenames to monitor.""" files = set() for k, m in list(sys.modules.items()): if re.match(self.match, k): if ( hasattr(m, '__loader__') and hasattr(m.__loader__, 'archive') ...
[ "def", "sysfiles", "(", "self", ")", ":", "files", "=", "set", "(", ")", "for", "k", ",", "m", "in", "list", "(", "sys", ".", "modules", ".", "items", "(", ")", ")", ":", "if", "re", ".", "match", "(", "self", ".", "match", ",", "k", ")", "...
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/cherrypy/process/plugins.py#L610-L628
pytroll/satpy
09e51f932048f98cce7919a4ff8bd2ec01e1ae98
satpy/enhancements/__init__.py
python
palettize
(img, **kwargs)
Palettize the given image (no color interpolation).
Palettize the given image (no color interpolation).
[ "Palettize", "the", "given", "image", "(", "no", "color", "interpolation", ")", "." ]
def palettize(img, **kwargs): """Palettize the given image (no color interpolation).""" full_cmap = _merge_colormaps(kwargs) img.palettize(full_cmap)
[ "def", "palettize", "(", "img", ",", "*", "*", "kwargs", ")", ":", "full_cmap", "=", "_merge_colormaps", "(", "kwargs", ")", "img", ".", "palettize", "(", "full_cmap", ")" ]
https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/enhancements/__init__.py#L325-L328
mlbvn/d2l-vn
5a2e43ca27b6df15879e71e289692fc33bfd093f
d2l/mxnet.py
python
train_ch3
(net, train_iter, test_iter, loss, num_epochs, updater)
Train a model (defined in Chapter 3).
Train a model (defined in Chapter 3).
[ "Train", "a", "model", "(", "defined", "in", "Chapter", "3", ")", "." ]
def train_ch3(net, train_iter, test_iter, loss, num_epochs, updater): #@save """Train a model (defined in Chapter 3).""" animator = Animator(xlabel='epoch', xlim=[1, num_epochs], ylim=[0.3, 0.9], legend=['train loss', 'train acc', 'test acc']) for epoch in range(num_epochs): ...
[ "def", "train_ch3", "(", "net", ",", "train_iter", ",", "test_iter", ",", "loss", ",", "num_epochs", ",", "updater", ")", ":", "#@save", "animator", "=", "Animator", "(", "xlabel", "=", "'epoch'", ",", "xlim", "=", "[", "1", ",", "num_epochs", "]", ","...
https://github.com/mlbvn/d2l-vn/blob/5a2e43ca27b6df15879e71e289692fc33bfd093f/d2l/mxnet.py#L304-L315
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/scipy/stats/_multivariate.py
python
multivariate_normal_gen.pdf
(self, x, mean, cov)
return _squeeze_output(out)
Multivariate normal probability density function. Parameters ---------- x : array_like Quantiles, with the last axis of `x` denoting the components. %(_doc_default_callparams)s Notes ----- %(_doc_callparams_note)s Returns ------- ...
Multivariate normal probability density function.
[ "Multivariate", "normal", "probability", "density", "function", "." ]
def pdf(self, x, mean, cov): """ Multivariate normal probability density function. Parameters ---------- x : array_like Quantiles, with the last axis of `x` denoting the components. %(_doc_default_callparams)s Notes ----- %(_doc_callp...
[ "def", "pdf", "(", "self", ",", "x", ",", "mean", ",", "cov", ")", ":", "dim", ",", "mean", ",", "cov", "=", "_process_parameters", "(", "None", ",", "mean", ",", "cov", ")", "x", "=", "_process_quantiles", "(", "x", ",", "dim", ")", "prec_U", ",...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/scipy/stats/_multivariate.py#L358-L382
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/idlelib/config.py
python
IdleConf.default_keys
()
[]
def default_keys(): if sys.platform[:3] == 'win': return 'IDLE Classic Windows' elif sys.platform == 'darwin': return 'IDLE Classic OSX' else: return 'IDLE Modern Unix'
[ "def", "default_keys", "(", ")", ":", "if", "sys", ".", "platform", "[", ":", "3", "]", "==", "'win'", ":", "return", "'IDLE Classic Windows'", "elif", "sys", ".", "platform", "==", "'darwin'", ":", "return", "'IDLE Classic OSX'", "else", ":", "return", "'...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/idlelib/config.py#L404-L410
KhronosGroup/glTF-Blender-Exporter
dd7a3dbd8f43a79d572e7c45f4215f770bb92a37
scripts/addons/io_scene_gltf2/gltf2_debug.py
python
print_console
(level, output)
Prints to Blender console with a given header and output.
Prints to Blender console with a given header and output.
[ "Prints", "to", "Blender", "console", "with", "a", "given", "header", "and", "output", "." ]
def print_console(level, output): """ Prints to Blender console with a given header and output. """ global g_output_levels global g_current_output_level if g_output_levels.index(level) > g_output_levels.index(g_current_output_level): return print(lev...
[ "def", "print_console", "(", "level", ",", "output", ")", ":", "global", "g_output_levels", "global", "g_current_output_level", "if", "g_output_levels", ".", "index", "(", "level", ")", ">", "g_output_levels", ".", "index", "(", "g_current_output_level", ")", ":",...
https://github.com/KhronosGroup/glTF-Blender-Exporter/blob/dd7a3dbd8f43a79d572e7c45f4215f770bb92a37/scripts/addons/io_scene_gltf2/gltf2_debug.py#L50-L62
ladybug-tools/honeybee-legacy
bd62af4862fe022801fb87dbc8794fdf1dff73a9
src/Honeybee_Honeybee.py
python
hb_WriteRAD.RADSurface
(self, surface)
[]
def RADSurface(self, surface): fullStr = [] # base surface coordinates coordinatesList = surface.extractPoints(1, True) if coordinatesList: if type(coordinatesList[0])is not list and type(coordinatesList[0]) is not tuple: coordinatesList = [coordinate...
[ "def", "RADSurface", "(", "self", ",", "surface", ")", ":", "fullStr", "=", "[", "]", "# base surface coordinates", "coordinatesList", "=", "surface", ".", "extractPoints", "(", "1", ",", "True", ")", "if", "coordinatesList", ":", "if", "type", "(", "coordin...
https://github.com/ladybug-tools/honeybee-legacy/blob/bd62af4862fe022801fb87dbc8794fdf1dff73a9/src/Honeybee_Honeybee.py#L2533-L2562
ganeti/ganeti
d340a9ddd12f501bef57da421b5f9b969a4ba905
lib/server/noded.py
python
NodeRequestHandler.perspective_x509_cert_remove
(params)
return backend.RemoveX509Certificate(name)
Removes a X509 certificate.
Removes a X509 certificate.
[ "Removes", "a", "X509", "certificate", "." ]
def perspective_x509_cert_remove(params): """Removes a X509 certificate. """ (name, ) = params return backend.RemoveX509Certificate(name)
[ "def", "perspective_x509_cert_remove", "(", "params", ")", ":", "(", "name", ",", ")", "=", "params", "return", "backend", ".", "RemoveX509Certificate", "(", "name", ")" ]
https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/lib/server/noded.py#L1221-L1226
AGProjects/python-sipsimple
a644f25948de1f9b190844d04384159f20738c1e
sipsimple/lookup.py
python
domain_iterator
(domain)
A generator which returns the domain and its parent domains.
A generator which returns the domain and its parent domains.
[ "A", "generator", "which", "returns", "the", "domain", "and", "its", "parent", "domains", "." ]
def domain_iterator(domain): """ A generator which returns the domain and its parent domains. """ while domain not in ('.', ''): yield domain domain = (domain.split('.', 1)+[''])[1]
[ "def", "domain_iterator", "(", "domain", ")", ":", "while", "domain", "not", "in", "(", "'.'", ",", "''", ")", ":", "yield", "domain", "domain", "=", "(", "domain", ".", "split", "(", "'.'", ",", "1", ")", "+", "[", "''", "]", ")", "[", "1", "]...
https://github.com/AGProjects/python-sipsimple/blob/a644f25948de1f9b190844d04384159f20738c1e/sipsimple/lookup.py#L57-L63
fortharris/Pcode
147962d160a834c219e12cb456abc130826468e4
Extensions/Projects/ProjectManager/ProjectManager.py
python
ProjectManager.configureProject
(self)
[]
def configureProject(self): self.configDialog.exec_()
[ "def", "configureProject", "(", "self", ")", ":", "self", ".", "configDialog", ".", "exec_", "(", ")" ]
https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/Extensions/Projects/ProjectManager/ProjectManager.py#L65-L66
abr/abr_control
a248ec56166f01791857a766ac58ee0920c0861c
abr_control/controllers/path_planners/second_order_dmp.py
python
SecondOrderDMP._step
(self, error=None)
return position, velocity
Steps through the dmp, returning the next position and velocity along the path planner.
Steps through the dmp, returning the next position and velocity along the path planner.
[ "Steps", "through", "the", "dmp", "returning", "the", "next", "position", "and", "velocity", "along", "the", "path", "planner", "." ]
def _step(self, error=None): """ Steps through the dmp, returning the next position and velocity along the path planner. """ if error is None: error = 0 # get the next point in the target trajectory from the dmp position, velocity, _ = self.dmps.step(e...
[ "def", "_step", "(", "self", ",", "error", "=", "None", ")", ":", "if", "error", "is", "None", ":", "error", "=", "0", "# get the next point in the target trajectory from the dmp", "position", ",", "velocity", ",", "_", "=", "self", ".", "dmps", ".", "step",...
https://github.com/abr/abr_control/blob/a248ec56166f01791857a766ac58ee0920c0861c/abr_control/controllers/path_planners/second_order_dmp.py#L117-L129
styxit/HTPC-Manager
490697460b4fa1797106aece27d873bc256b2ff1
libs/cherrypy/lib/sessions.py
python
PostgresqlSession.release_lock
(self)
Release the lock on the currently-loaded session data.
Release the lock on the currently-loaded session data.
[ "Release", "the", "lock", "on", "the", "currently", "-", "loaded", "session", "data", "." ]
def release_lock(self): """Release the lock on the currently-loaded session data.""" # We just close the cursor and that will remove the lock # introduced by the "for update" clause self.cursor.close() self.locked = False
[ "def", "release_lock", "(", "self", ")", ":", "# We just close the cursor and that will remove the lock", "# introduced by the \"for update\" clause", "self", ".", "cursor", ".", "close", "(", ")", "self", ".", "locked", "=", "False" ]
https://github.com/styxit/HTPC-Manager/blob/490697460b4fa1797106aece27d873bc256b2ff1/libs/cherrypy/lib/sessions.py#L582-L587
Zhenye-Na/reinforcement-learning-stanford
51440cc8228c2061ce87795a7e9a838a9c385a71
assignment2/assignment2/core/q_learning.py
python
QN.update_target_params
(self)
Update params of Q' with params of Q
Update params of Q' with params of Q
[ "Update", "params", "of", "Q", "with", "params", "of", "Q" ]
def update_target_params(self): """ Update params of Q' with params of Q """ pass
[ "def", "update_target_params", "(", "self", ")", ":", "pass" ]
https://github.com/Zhenye-Na/reinforcement-learning-stanford/blob/51440cc8228c2061ce87795a7e9a838a9c385a71/assignment2/assignment2/core/q_learning.py#L94-L98
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/pymysql/__init__.py
python
Connect
(*args, **kwargs)
return Connection(*args, **kwargs)
Connect to the database; see connections.Connection.__init__() for more information.
Connect to the database; see connections.Connection.__init__() for more information.
[ "Connect", "to", "the", "database", ";", "see", "connections", ".", "Connection", ".", "__init__", "()", "for", "more", "information", "." ]
def Connect(*args, **kwargs): """ Connect to the database; see connections.Connection.__init__() for more information. """ from .connections import Connection return Connection(*args, **kwargs)
[ "def", "Connect", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", "connections", "import", "Connection", "return", "Connection", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/pymysql/__init__.py#L88-L94
ucfopen/canvasapi
3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36
canvasapi/canvas.py
python
Canvas.conversations_unread_count
(self, **kwargs)
return response.json()
Get the number of unread conversations for the current user :calls: `GET /api/v1/conversations/unread_count \ <https://canvas.instructure.com/doc/api/conversations.html#method.conversations.unread_count>`_ :returns: simple object with unread_count, example: {'unread_count': '7'} :rtype...
Get the number of unread conversations for the current user
[ "Get", "the", "number", "of", "unread", "conversations", "for", "the", "current", "user" ]
def conversations_unread_count(self, **kwargs): """ Get the number of unread conversations for the current user :calls: `GET /api/v1/conversations/unread_count \ <https://canvas.instructure.com/doc/api/conversations.html#method.conversations.unread_count>`_ :returns: simple obj...
[ "def", "conversations_unread_count", "(", "self", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "__requester", ".", "request", "(", "\"GET\"", ",", "\"conversations/unread_count\"", ",", "_kwargs", "=", "combine_kwargs", "(", "*", "*", "kwar...
https://github.com/ucfopen/canvasapi/blob/3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36/canvasapi/canvas.py#L165-L179
pychess/pychess
e3f9b12947e429993edcc2b9288f79bc181e6500
lib/pychess/System/repeat.py
python
repeat
(func, *args, **kwargs)
Repeats a function in a new thread until it returns False
Repeats a function in a new thread until it returns False
[ "Repeats", "a", "function", "in", "a", "new", "thread", "until", "it", "returns", "False" ]
def repeat(func, *args, **kwargs): """ Repeats a function in a new thread until it returns False """ def run(): while func(*args, **kwargs): pass thread = Thread(target=run, name=fident(func)) thread.daemon = True thread.start()
[ "def", "repeat", "(", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "run", "(", ")", ":", "while", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "pass", "thread", "=", "Thread", "(", "target", "=", "run", ...
https://github.com/pychess/pychess/blob/e3f9b12947e429993edcc2b9288f79bc181e6500/lib/pychess/System/repeat.py#L8-L17
kbandla/ImmunityDebugger
2abc03fb15c8f3ed0914e1175c4d8933977c73e3
1.83/Libs/immlib.py
python
Debugger.getXrefFrom
(self, address)
return []
Get X Reference from a given address @type Address: DWORD @param Address: Address @rtype: LIST @return: List of X reference from the given address
Get X Reference from a given address
[ "Get", "X", "Reference", "from", "a", "given", "address" ]
def getXrefFrom(self, address): """ Get X Reference from a given address @type Address: DWORD @param Address: Address @rtype: LIST @return: List of X reference from the given address """ for mod in self.getAllModules(): ...
[ "def", "getXrefFrom", "(", "self", ",", "address", ")", ":", "for", "mod", "in", "self", ".", "getAllModules", "(", ")", ":", "xref", "=", "mod", ".", "getXrefFrom", "(", "address", ")", "if", "xref", ":", "return", "xref", "return", "[", "]" ]
https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.83/Libs/immlib.py#L959-L973
HonglinChu/SiamTrackers
8471660b14f970578a43f077b28207d44a27e867
SiamFCpp/SiamFCpp-video_analyst/siamfcpp/data/transformer/transformer_base.py
python
TransformerBase.set_hps
(self, hps: Dict)
r""" Set hyper-parameters Arguments --------- hps: Dict Dict of hyper-parameters, the keys must in self.__hyper_params__
r""" Set hyper-parameters
[ "r", "Set", "hyper", "-", "parameters" ]
def set_hps(self, hps: Dict) -> None: r""" Set hyper-parameters Arguments --------- hps: Dict Dict of hyper-parameters, the keys must in self.__hyper_params__ """ for key in hps: if key not in self._hyper_params: raise KeyE...
[ "def", "set_hps", "(", "self", ",", "hps", ":", "Dict", ")", "->", "None", ":", "for", "key", "in", "hps", ":", "if", "key", "not", "in", "self", ".", "_hyper_params", ":", "raise", "KeyError", "self", ".", "_hyper_params", "[", "key", "]", "=", "h...
https://github.com/HonglinChu/SiamTrackers/blob/8471660b14f970578a43f077b28207d44a27e867/SiamFCpp/SiamFCpp-video_analyst/siamfcpp/data/transformer/transformer_base.py#L57-L69
xtiankisutsa/MARA_Framework
ac4ac88bfd38f33ae8780a606ed09ab97177c562
tools/lobotomy/core/include/androguard/androguard/core/bytecodes/dvm.py
python
FieldIdItem.get_class_name
(self)
return self.class_idx_value
Return the class name of the field :rtype: string
Return the class name of the field
[ "Return", "the", "class", "name", "of", "the", "field" ]
def get_class_name(self) : """ Return the class name of the field :rtype: string """ return self.class_idx_value
[ "def", "get_class_name", "(", "self", ")", ":", "return", "self", ".", "class_idx_value" ]
https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/lobotomy/core/include/androguard/androguard/core/bytecodes/dvm.py#L2154-L2160
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/traitlets/traitlets.py
python
Tuple.__init__
(self, *traits, **kwargs)
Create a tuple from a list, set, or tuple. Create a fixed-type tuple with Traits: ``t = Tuple(Int(), Str(), CStr())`` would be length 3, with Int,Str,CStr for each element. If only one arg is given and it is not a Trait, it is taken as default_value: ``t = Tuple((1, ...
Create a tuple from a list, set, or tuple.
[ "Create", "a", "tuple", "from", "a", "list", "set", "or", "tuple", "." ]
def __init__(self, *traits, **kwargs): """Create a tuple from a list, set, or tuple. Create a fixed-type tuple with Traits: ``t = Tuple(Int(), Str(), CStr())`` would be length 3, with Int,Str,CStr for each element. If only one arg is given and it is not a Trait, it is taken a...
[ "def", "__init__", "(", "self", ",", "*", "traits", ",", "*", "*", "kwargs", ")", ":", "default_value", "=", "kwargs", ".", "pop", "(", "'default_value'", ",", "Undefined", ")", "# allow Tuple((values,)):", "if", "len", "(", "traits", ")", "==", "1", "an...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/traitlets/traitlets.py#L2375-L2430
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/ipython-4.0.0-py3.3.egg/IPython/extensions/autoreload.py
python
ModuleReloader.mark_module_skipped
(self, module_name)
Skip reloading the named module in the future
Skip reloading the named module in the future
[ "Skip", "reloading", "the", "named", "module", "in", "the", "future" ]
def mark_module_skipped(self, module_name): """Skip reloading the named module in the future""" try: del self.modules[module_name] except KeyError: pass self.skip_modules[module_name] = True
[ "def", "mark_module_skipped", "(", "self", ",", "module_name", ")", ":", "try", ":", "del", "self", ".", "modules", "[", "module_name", "]", "except", "KeyError", ":", "pass", "self", ".", "skip_modules", "[", "module_name", "]", "=", "True" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/ipython-4.0.0-py3.3.egg/IPython/extensions/autoreload.py#L151-L157
Fuyukai/Kyoukai
44d47f4b0ece1c509fc5116275982df63ca09438
kyoukai/blueprint.py
python
Blueprint.computed_prefix
(self)
return self._prefix
:return: The combined prefix (parent + ours) of this Blueprint. .. versionadded:: 2.2.0
:return: The combined prefix (parent + ours) of this Blueprint. .. versionadded:: 2.2.0
[ ":", "return", ":", "The", "combined", "prefix", "(", "parent", "+", "ours", ")", "of", "this", "Blueprint", ".", "..", "versionadded", "::", "2", ".", "2", ".", "0" ]
def computed_prefix(self) -> str: """ :return: The combined prefix (parent + ours) of this Blueprint. .. versionadded:: 2.2.0 """ if self._parent: return self._parent.computed_prefix + self._prefix return self._prefix
[ "def", "computed_prefix", "(", "self", ")", "->", "str", ":", "if", "self", ".", "_parent", ":", "return", "self", ".", "_parent", ".", "computed_prefix", "+", "self", ".", "_prefix", "return", "self", ".", "_prefix" ]
https://github.com/Fuyukai/Kyoukai/blob/44d47f4b0ece1c509fc5116275982df63ca09438/kyoukai/blueprint.py#L104-L113
mvantellingen/python-zeep
2f35b7d29355ba646f5e3c6e9925033d5d6df8bb
src/zeep/wsse/utils.py
python
ensure_id
(node)
return id_val
Ensure given node has a wsu:Id attribute; add unique one if not. Return found/created attribute value.
Ensure given node has a wsu:Id attribute; add unique one if not.
[ "Ensure", "given", "node", "has", "a", "wsu", ":", "Id", "attribute", ";", "add", "unique", "one", "if", "not", "." ]
def ensure_id(node): """Ensure given node has a wsu:Id attribute; add unique one if not. Return found/created attribute value. """ assert node is not None id_val = node.get(ID_ATTR) if not id_val: id_val = get_unique_id() node.set(ID_ATTR, id_val) return id_val
[ "def", "ensure_id", "(", "node", ")", ":", "assert", "node", "is", "not", "None", "id_val", "=", "node", ".", "get", "(", "ID_ATTR", ")", "if", "not", "id_val", ":", "id_val", "=", "get_unique_id", "(", ")", "node", ".", "set", "(", "ID_ATTR", ",", ...
https://github.com/mvantellingen/python-zeep/blob/2f35b7d29355ba646f5e3c6e9925033d5d6df8bb/src/zeep/wsse/utils.py#L43-L54
huggingface/datasets
249b4a38390bf1543f5b6e2f3dc208b5689c1c13
src/datasets/arrow_writer.py
python
BeamWriter.finalize
(self, metrics_query_result: dict)
return self._num_examples, self._num_bytes
Run after the pipeline has finished. It converts the resulting parquet files to arrow and it completes the info from the pipeline metrics. Args: metrics_query_result: `dict` obtained from pipeline_results.metrics().query(m_filter). Make sure that the filter keeps only the me...
Run after the pipeline has finished. It converts the resulting parquet files to arrow and it completes the info from the pipeline metrics.
[ "Run", "after", "the", "pipeline", "has", "finished", ".", "It", "converts", "the", "resulting", "parquet", "files", "to", "arrow", "and", "it", "completes", "the", "info", "from", "the", "pipeline", "metrics", "." ]
def finalize(self, metrics_query_result: dict): """ Run after the pipeline has finished. It converts the resulting parquet files to arrow and it completes the info from the pipeline metrics. Args: metrics_query_result: `dict` obtained from pipeline_results.metrics().query(m_...
[ "def", "finalize", "(", "self", ",", "metrics_query_result", ":", "dict", ")", ":", "import", "apache_beam", "as", "beam", "from", ".", "utils", "import", "beam_utils", "# Convert to arrow", "logger", ".", "info", "(", "f\"Converting parquet file {self._parquet_path} ...
https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/src/datasets/arrow_writer.py#L556-L599
DamnWidget/anaconda
a9998fb362320f907d5ccbc6fcf5b62baca677c0
anaconda_lib/autopep/autopep8_lib/lib2to3/fixer_util.py
python
in_special_context
(node)
return False
Returns true if node is in an environment where all that is required of it is being iterable (ie, it doesn't matter if it returns a list or an iterator). See test_map_nochange in test_fixers.py for some examples and tests.
Returns true if node is in an environment where all that is required of it is being iterable (ie, it doesn't matter if it returns a list or an iterator). See test_map_nochange in test_fixers.py for some examples and tests.
[ "Returns", "true", "if", "node", "is", "in", "an", "environment", "where", "all", "that", "is", "required", "of", "it", "is", "being", "iterable", "(", "ie", "it", "doesn", "t", "matter", "if", "it", "returns", "a", "list", "or", "an", "iterator", ")",...
def in_special_context(node): """ Returns true if node is in an environment where all that is required of it is being iterable (ie, it doesn't matter if it returns a list or an iterator). See test_map_nochange in test_fixers.py for some examples and tests. """ global p0, p1, p2, ...
[ "def", "in_special_context", "(", "node", ")", ":", "global", "p0", ",", "p1", ",", "p2", ",", "pats_built", "if", "not", "pats_built", ":", "p0", "=", "patcomp", ".", "compile_pattern", "(", "p0", ")", "p1", "=", "patcomp", ".", "compile_pattern", "(", ...
https://github.com/DamnWidget/anaconda/blob/a9998fb362320f907d5ccbc6fcf5b62baca677c0/anaconda_lib/autopep/autopep8_lib/lib2to3/fixer_util.py#L208-L225
Qirky/Troop
529c5eb14e456f683e6d23fd4adcddc8446aa115
src/utils.py
python
get_peer_char
(id_num)
return PEER_CHARS[id_num]
Returns the ID character to identify a peer
Returns the ID character to identify a peer
[ "Returns", "the", "ID", "character", "to", "identify", "a", "peer" ]
def get_peer_char(id_num): """ Returns the ID character to identify a peer """ return PEER_CHARS[id_num]
[ "def", "get_peer_char", "(", "id_num", ")", ":", "return", "PEER_CHARS", "[", "id_num", "]" ]
https://github.com/Qirky/Troop/blob/529c5eb14e456f683e6d23fd4adcddc8446aa115/src/utils.py#L108-L110
seppius-xbmc-repo/ru
d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2
script.module.elementtree/lib/elementtree/ElementIron.py
python
ParserAPI.fromstring
(self, source)
return self.parse(StringReader(source))
[]
def fromstring(self, source): return self.parse(StringReader(source))
[ "def", "fromstring", "(", "self", ",", "source", ")", ":", "return", "self", ".", "parse", "(", "StringReader", "(", "source", ")", ")" ]
https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/script.module.elementtree/lib/elementtree/ElementIron.py#L187-L188
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/server/grr_response_server/bigquery.py
python
BigQueryClient.__init__
(self, project_id=None, bq_service=None, dataset_id=None)
[]
def __init__(self, project_id=None, bq_service=None, dataset_id=None): self.tables = {} self.datasets = {} self.project_id = project_id self.service = bq_service self.dataset_id = dataset_id
[ "def", "__init__", "(", "self", ",", "project_id", "=", "None", ",", "bq_service", "=", "None", ",", "dataset_id", "=", "None", ")", ":", "self", ".", "tables", "=", "{", "}", "self", ".", "datasets", "=", "{", "}", "self", ".", "project_id", "=", ...
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/bigquery.py#L62-L67
YosaiProject/yosai
7f96aa6b837ceae9bf3d7387cd7e35f5ab032575
yosai/web/session/session.py
python
WebSessionManager._generate_csrf_token
(self)
return binascii.hexlify(os.urandom(20)).decode('utf-8')
[]
def _generate_csrf_token(self): return binascii.hexlify(os.urandom(20)).decode('utf-8')
[ "def", "_generate_csrf_token", "(", "self", ")", ":", "return", "binascii", ".", "hexlify", "(", "os", ".", "urandom", "(", "20", ")", ")", ".", "decode", "(", "'utf-8'", ")" ]
https://github.com/YosaiProject/yosai/blob/7f96aa6b837ceae9bf3d7387cd7e35f5ab032575/yosai/web/session/session.py#L219-L220
eirannejad/pyRevit
49c0b7eb54eb343458ce1365425e6552d0c47d44
site-packages/werkzeug/urls.py
python
url_decode
(s, charset='utf-8', decode_keys=False, include_empty=True, errors='replace', separator='&', cls=None)
return cls(_url_decode_impl(s.split(separator), charset, decode_keys, include_empty, errors))
Parse a querystring and return it as :class:`MultiDict`. There is a difference in key decoding on different Python versions. On Python 3 keys will always be fully decoded whereas on Python 2, keys will remain bytestrings if they fit into ASCII. On 2.x keys can be forced to be unicode by setting `deco...
Parse a querystring and return it as :class:`MultiDict`. There is a difference in key decoding on different Python versions. On Python 3 keys will always be fully decoded whereas on Python 2, keys will remain bytestrings if they fit into ASCII. On 2.x keys can be forced to be unicode by setting `deco...
[ "Parse", "a", "querystring", "and", "return", "it", "as", ":", "class", ":", "MultiDict", ".", "There", "is", "a", "difference", "in", "key", "decoding", "on", "different", "Python", "versions", ".", "On", "Python", "3", "keys", "will", "always", "be", "...
def url_decode(s, charset='utf-8', decode_keys=False, include_empty=True, errors='replace', separator='&', cls=None): """ Parse a querystring and return it as :class:`MultiDict`. There is a difference in key decoding on different Python versions. On Python 3 keys will always be fully de...
[ "def", "url_decode", "(", "s", ",", "charset", "=", "'utf-8'", ",", "decode_keys", "=", "False", ",", "include_empty", "=", "True", ",", "errors", "=", "'replace'", ",", "separator", "=", "'&'", ",", "cls", "=", "None", ")", ":", "if", "cls", "is", "...
https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/site-packages/werkzeug/urls.py#L684-L731
ilevkivskyi/typing_inspect
8f6aa2075ba448ab322def454137e7c59b9b302d
typing_inspect.py
python
_remove_dups_flatten
(parameters)
return tuple(t for t in params if t in all_params)
backport of _remove_dups_flatten
backport of _remove_dups_flatten
[ "backport", "of", "_remove_dups_flatten" ]
def _remove_dups_flatten(parameters): """backport of _remove_dups_flatten""" # Flatten out Union[Union[...], ...]. params = [] for p in parameters: if isinstance(p, _Union): # and p.__origin__ is Union: params.extend(p.__union_params__) # p.__args__) elif isinstance(p, tup...
[ "def", "_remove_dups_flatten", "(", "parameters", ")", ":", "# Flatten out Union[Union[...], ...].", "params", "=", "[", "]", "for", "p", "in", "parameters", ":", "if", "isinstance", "(", "p", ",", "_Union", ")", ":", "# and p.__origin__ is Union:", "params", ".",...
https://github.com/ilevkivskyi/typing_inspect/blob/8f6aa2075ba448ab322def454137e7c59b9b302d/typing_inspect.py#L655-L692
sherjilozair/dqn
ee621e10169b609a31a6e631a343a7783b91176e
util.py
python
MaxAndSkipEnv._reset
(self)
return obs
Clear past frame buffer and init. to first obs. from inner env.
Clear past frame buffer and init. to first obs. from inner env.
[ "Clear", "past", "frame", "buffer", "and", "init", ".", "to", "first", "obs", ".", "from", "inner", "env", "." ]
def _reset(self): """Clear past frame buffer and init. to first obs. from inner env.""" self._obs_buffer.clear() obs = self.env.reset() self._obs_buffer.append(obs) return obs
[ "def", "_reset", "(", "self", ")", ":", "self", ".", "_obs_buffer", ".", "clear", "(", ")", "obs", "=", "self", ".", "env", ".", "reset", "(", ")", "self", ".", "_obs_buffer", ".", "append", "(", "obs", ")", "return", "obs" ]
https://github.com/sherjilozair/dqn/blob/ee621e10169b609a31a6e631a343a7783b91176e/util.py#L108-L113
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/kerberos-1.3.0/pysrc/kerberos.py
python
authGSSClientClean
(context)
Destroys the context for GSSAPI client-side authentication. This function is provided for compatibility with earlier versions of PyKerberos but does nothing. The context object destroys itself when it is reclaimed. @param context: The context object returned from L{authGSSClientInit}. @return: A resul...
Destroys the context for GSSAPI client-side authentication. This function is provided for compatibility with earlier versions of PyKerberos but does nothing. The context object destroys itself when it is reclaimed.
[ "Destroys", "the", "context", "for", "GSSAPI", "client", "-", "side", "authentication", ".", "This", "function", "is", "provided", "for", "compatibility", "with", "earlier", "versions", "of", "PyKerberos", "but", "does", "nothing", ".", "The", "context", "object...
def authGSSClientClean(context): """ Destroys the context for GSSAPI client-side authentication. This function is provided for compatibility with earlier versions of PyKerberos but does nothing. The context object destroys itself when it is reclaimed. @param context: The context object returned fro...
[ "def", "authGSSClientClean", "(", "context", ")", ":" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/kerberos-1.3.0/pysrc/kerberos.py#L170-L179
baidu/CUP
79ab2f3ad6eaab1461aa3b4cca37d3262240194a
cup/util/context.py
python
ContextTracker4Thread.get_context
(self, key)
return self.current_context().get_context(key)
get the context by key
get the context by key
[ "get", "the", "context", "by", "key" ]
def get_context(self, key): """ get the context by key """ return self.current_context().get_context(key)
[ "def", "get_context", "(", "self", ",", "key", ")", ":", "return", "self", ".", "current_context", "(", ")", ".", "get_context", "(", "key", ")" ]
https://github.com/baidu/CUP/blob/79ab2f3ad6eaab1461aa3b4cca37d3262240194a/cup/util/context.py#L71-L75
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/distlib/manifest.py
python
Manifest.findall
(self)
Find all files under the base and set ``allfiles`` to the absolute pathnames of files found.
Find all files under the base and set ``allfiles`` to the absolute pathnames of files found.
[ "Find", "all", "files", "under", "the", "base", "and", "set", "allfiles", "to", "the", "absolute", "pathnames", "of", "files", "found", "." ]
def findall(self): """Find all files under the base and set ``allfiles`` to the absolute pathnames of files found. """ from stat import S_ISREG, S_ISDIR, S_ISLNK self.allfiles = allfiles = [] root = self.base stack = [root] pop = stack.pop push = ...
[ "def", "findall", "(", "self", ")", ":", "from", "stat", "import", "S_ISREG", ",", "S_ISDIR", ",", "S_ISLNK", "self", ".", "allfiles", "=", "allfiles", "=", "[", "]", "root", "=", "self", ".", "base", "stack", "=", "[", "root", "]", "pop", "=", "st...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/distlib/manifest.py#L57-L82
donnemartin/gitsome
d7c57abc7cb66e9c910a844f15d4536866da3310
xonsh/parsers/base.py
python
BaseParser.p_comma_expr_or_star_expr
(self, p)
comma_expr_or_star_expr : COMMA expr_or_star_expr
comma_expr_or_star_expr : COMMA expr_or_star_expr
[ "comma_expr_or_star_expr", ":", "COMMA", "expr_or_star_expr" ]
def p_comma_expr_or_star_expr(self, p): """comma_expr_or_star_expr : COMMA expr_or_star_expr""" p[0] = [p[2]]
[ "def", "p_comma_expr_or_star_expr", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "[", "p", "[", "2", "]", "]" ]
https://github.com/donnemartin/gitsome/blob/d7c57abc7cb66e9c910a844f15d4536866da3310/xonsh/parsers/base.py#L2676-L2678
iGio90/Dwarf
bb3011cdffd209c7e3f5febe558053bf649ca69c
dwarf_debugger/lib/session/session.py
python
Session.__init__
(self, parent=None, session_type='')
[]
def __init__(self, parent=None, session_type=''): super(Session, self).__init__(parent) self._app_window = parent self._dwarf = Dwarf(self, parent) self._session_type = session_type # main menu every session needs self._menu = [] if self._app_window.dwarf_args.a...
[ "def", "__init__", "(", "self", ",", "parent", "=", "None", ",", "session_type", "=", "''", ")", ":", "super", "(", "Session", ",", "self", ")", ".", "__init__", "(", "parent", ")", "self", ".", "_app_window", "=", "parent", "self", ".", "_dwarf", "=...
https://github.com/iGio90/Dwarf/blob/bb3011cdffd209c7e3f5febe558053bf649ca69c/dwarf_debugger/lib/session/session.py#L36-L46
clinton-hall/nzbToMedia
27669389216902d1085660167e7bda0bd8527ecf
libs/common/beets/dbcore/db.py
python
Model.items
(self)
Iterate over (key, value) pairs that this object contains. Computed fields are not included.
Iterate over (key, value) pairs that this object contains. Computed fields are not included.
[ "Iterate", "over", "(", "key", "value", ")", "pairs", "that", "this", "object", "contains", ".", "Computed", "fields", "are", "not", "included", "." ]
def items(self): """Iterate over (key, value) pairs that this object contains. Computed fields are not included. """ for key in self: yield key, self[key]
[ "def", "items", "(", "self", ")", ":", "for", "key", "in", "self", ":", "yield", "key", ",", "self", "[", "key", "]" ]
https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/beets/dbcore/db.py#L326-L331
cea-sec/miasm
09376c524aedc7920a7eda304d6095e12f6958f4
miasm/ir/symbexec.py
python
SymbolicExecutionEngine.mem_write
(self, dst, src)
[DEV]: Override to modify the effective memory writes Write symbolic value @src at ExprMem @dst @dst: destination ExprMem @src: source Expression
[DEV]: Override to modify the effective memory writes
[ "[", "DEV", "]", ":", "Override", "to", "modify", "the", "effective", "memory", "writes" ]
def mem_write(self, dst, src): """ [DEV]: Override to modify the effective memory writes Write symbolic value @src at ExprMem @dst @dst: destination ExprMem @src: source Expression """ self.symbols.write(dst, src)
[ "def", "mem_write", "(", "self", ",", "dst", ",", "src", ")", ":", "self", ".", "symbols", ".", "write", "(", "dst", ",", "src", ")" ]
https://github.com/cea-sec/miasm/blob/09376c524aedc7920a7eda304d6095e12f6958f4/miasm/ir/symbexec.py#L1124-L1132
angr/angr
4b04d56ace135018083d36d9083805be8146688b
angr/analyses/cfg/cfg_base.py
python
CFGBase._fast_memory_load_byte
(self, addr)
Perform a fast memory loading of a byte. :param int addr: Address to read from. :return: A char or None if the address does not exist. :rtype: int or None
Perform a fast memory loading of a byte.
[ "Perform", "a", "fast", "memory", "loading", "of", "a", "byte", "." ]
def _fast_memory_load_byte(self, addr): """ Perform a fast memory loading of a byte. :param int addr: Address to read from. :return: A char or None if the address does not exist. :rtype: int or None """ try: return self.project.loade...
[ "def", "_fast_memory_load_byte", "(", "self", ",", "addr", ")", ":", "try", ":", "return", "self", ".", "project", ".", "loader", ".", "memory", "[", "addr", "]", "except", "KeyError", ":", "return", "None" ]
https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/analyses/cfg/cfg_base.py#L696-L708
tanghaibao/goatools
647e9dd833695f688cd16c2f9ea18f1692e5c6bc
goatools/anno/init/reader_gaf.py
python
GafData.__init__
(self, ver, allow_missing_symbol=False)
[]
def __init__(self, ver, allow_missing_symbol=False): self.ver = ver self.is_long = self._init_is_long(ver) self.required_columns = self.gaf_required_columns[self.ver] self.flds = self.gaf_columns[self.ver] # pylint: disable=line-too-long self.req1 = self.spec_req1 if not ...
[ "def", "__init__", "(", "self", ",", "ver", ",", "allow_missing_symbol", "=", "False", ")", ":", "self", ".", "ver", "=", "ver", "self", ".", "is_long", "=", "self", ".", "_init_is_long", "(", "ver", ")", "self", ".", "required_columns", "=", "self", "...
https://github.com/tanghaibao/goatools/blob/647e9dd833695f688cd16c2f9ea18f1692e5c6bc/goatools/anno/init/reader_gaf.py#L182-L191
danpaquin/coinbasepro-python
5658b2212b0fe39dde18b792f34aeaf81dda6640
cbpro/authenticated_client.py
python
AuthenticatedClient.buy
(self, product_id, order_type, **kwargs)
return self.place_order(product_id, 'buy', order_type, **kwargs)
Place a buy order. This is included to maintain backwards compatibility with older versions of cbpro-Python. For maximum support from docstrings and function signatures see the order type-specific functions place_limit_order, place_market_order, and place_stop_order. Args: ...
Place a buy order.
[ "Place", "a", "buy", "order", "." ]
def buy(self, product_id, order_type, **kwargs): """Place a buy order. This is included to maintain backwards compatibility with older versions of cbpro-Python. For maximum support from docstrings and function signatures see the order type-specific functions place_limit_order, p...
[ "def", "buy", "(", "self", ",", "product_id", ",", "order_type", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "place_order", "(", "product_id", ",", "'buy'", ",", "order_type", ",", "*", "*", "kwargs", ")" ]
https://github.com/danpaquin/coinbasepro-python/blob/5658b2212b0fe39dde18b792f34aeaf81dda6640/cbpro/authenticated_client.py#L285-L303
erikdubois/Aureola
005fb14b3cab0ba1929ebf9ac3ac68d2c6e1c0ef
shailen/dropbox.py
python
status
(args)
u"""get current status of the dropboxd dropbox status Prints out the current status of the Dropbox daemon.
u"""get current status of the dropboxd dropbox status
[ "u", "get", "current", "status", "of", "the", "dropboxd", "dropbox", "status" ]
def status(args): u"""get current status of the dropboxd dropbox status Prints out the current status of the Dropbox daemon. """ if len(args) != 0: console_print(status.__doc__,linebreak=False) return try: with closing(DropboxCommand()) as dc: try: lines...
[ "def", "status", "(", "args", ")", ":", "if", "len", "(", "args", ")", "!=", "0", ":", "console_print", "(", "status", ".", "__doc__", ",", "linebreak", "=", "False", ")", "return", "try", ":", "with", "closing", "(", "DropboxCommand", "(", ")", ")",...
https://github.com/erikdubois/Aureola/blob/005fb14b3cab0ba1929ebf9ac3ac68d2c6e1c0ef/shailen/dropbox.py#L1169-L1197
jx-zhong-for-academic-purpose/GCN-Anomaly-Detection
798dadbf38518895d447699e005ae7504cf7d1f1
feature_extraction/extract_c3d/pyActionRecog/utils/io.py
python
rgb_to_parrots
(frame, oversample=True, mean_val=None, crop_size=None)
Pre-process the rgb frame for Parrots input
Pre-process the rgb frame for Parrots input
[ "Pre", "-", "process", "the", "rgb", "frame", "for", "Parrots", "input" ]
def rgb_to_parrots(frame, oversample=True, mean_val=None, crop_size=None): """ Pre-process the rgb frame for Parrots input """ if mean_val is None: mean_val = [104, 117, 123] if not oversample: ret_frame = (frame - mean_val).transpose((2, 0, 1)) return ret_frame[None, ...] ...
[ "def", "rgb_to_parrots", "(", "frame", ",", "oversample", "=", "True", ",", "mean_val", "=", "None", ",", "crop_size", "=", "None", ")", ":", "if", "mean_val", "is", "None", ":", "mean_val", "=", "[", "104", ",", "117", ",", "123", "]", "if", "not", ...
https://github.com/jx-zhong-for-academic-purpose/GCN-Anomaly-Detection/blob/798dadbf38518895d447699e005ae7504cf7d1f1/feature_extraction/extract_c3d/pyActionRecog/utils/io.py#L174-L186
lijx10/USIP
68d9b0b52de18d8caf58dd2bd49da03784747b49
models/layers.py
python
GeneralKNNFusionModule.forward
(self, query, database, x, K, epoch=None)
return feature
:param query: Bx3xM FloatTensor :param database: Bx3xN FloatTensor :param x: BxCxN FloatTensor :param K: K neighbors :return:
[]
def forward(self, query, database, x, K, epoch=None): ''' :param query: Bx3xM FloatTensor :param database: Bx3xN FloatTensor :param x: BxCxN FloatTensor :param K: K neighbors :return: ''' # 1. compute knn, query -> database # 2. for each query, no...
[ "def", "forward", "(", "self", ",", "query", ",", "database", ",", "x", ",", "K", ",", "epoch", "=", "None", ")", ":", "# 1. compute knn, query -> database", "# 2. for each query, normalize neighbors with its coordinate", "# 3. FC for these normalized points", "# 4. maxpool...
https://github.com/lijx10/USIP/blob/68d9b0b52de18d8caf58dd2bd49da03784747b49/models/layers.py#L401-L440
bshillingford/python-torchfile
fbd434a5b5562c88b91a95e6476e11dbb7735436
torchfile.py
python
TorchObject.__getitem__
(self, k)
[]
def __getitem__(self, k): if k in self._obj: return self._obj[k] if isinstance(k, (str, bytes)): return self._obj.get(k.encode('utf8'))
[ "def", "__getitem__", "(", "self", ",", "k", ")", ":", "if", "k", "in", "self", ".", "_obj", ":", "return", "self", ".", "_obj", "[", "k", "]", "if", "isinstance", "(", "k", ",", "(", "str", ",", "bytes", ")", ")", ":", "return", "self", ".", ...
https://github.com/bshillingford/python-torchfile/blob/fbd434a5b5562c88b91a95e6476e11dbb7735436/torchfile.py#L105-L109
STIXProject/python-stix
5ab382b1a3c19364fb8c3e5219addab9e3b64ee9
stix/core/stix_package.py
python
STIXPackage.add_indicator
(self, indicator)
Adds an :class:`.Indicator` object to the :attr:`indicators` collection.
Adds an :class:`.Indicator` object to the :attr:`indicators` collection.
[ "Adds", "an", ":", "class", ":", ".", "Indicator", "object", "to", "the", ":", "attr", ":", "indicators", "collection", "." ]
def add_indicator(self, indicator): """Adds an :class:`.Indicator` object to the :attr:`indicators` collection. """ if self.indicators is None: self.indicators = Indicators() self.indicators.append(indicator)
[ "def", "add_indicator", "(", "self", ",", "indicator", ")", ":", "if", "self", ".", "indicators", "is", "None", ":", "self", ".", "indicators", "=", "Indicators", "(", ")", "self", ".", "indicators", ".", "append", "(", "indicator", ")" ]
https://github.com/STIXProject/python-stix/blob/5ab382b1a3c19364fb8c3e5219addab9e3b64ee9/stix/core/stix_package.py#L112-L119
amimo/dcc
114326ab5a082a42c7728a375726489e4709ca29
androguard/core/bytecodes/dvm.py
python
EncodedCatchHandlerList.get_size
(self)
return self.size
Return the size of this list, in entries :rtype: int
Return the size of this list, in entries
[ "Return", "the", "size", "of", "this", "list", "in", "entries" ]
def get_size(self): """ Return the size of this list, in entries :rtype: int """ return self.size
[ "def", "get_size", "(", "self", ")", ":", "return", "self", ".", "size" ]
https://github.com/amimo/dcc/blob/114326ab5a082a42c7728a375726489e4709ca29/androguard/core/bytecodes/dvm.py#L3925-L3931
veusz/veusz
5a1e2af5f24df0eb2a2842be51f2997c4999c7fb
veusz/widgets/grid.py
python
_
(text, disambiguation=None, context='Grid')
return qt.QCoreApplication.translate(context, text, disambiguation)
Translate text.
Translate text.
[ "Translate", "text", "." ]
def _(text, disambiguation=None, context='Grid'): """Translate text.""" return qt.QCoreApplication.translate(context, text, disambiguation)
[ "def", "_", "(", "text", ",", "disambiguation", "=", "None", ",", "context", "=", "'Grid'", ")", ":", "return", "qt", ".", "QCoreApplication", ".", "translate", "(", "context", ",", "text", ",", "disambiguation", ")" ]
https://github.com/veusz/veusz/blob/5a1e2af5f24df0eb2a2842be51f2997c4999c7fb/veusz/widgets/grid.py#L31-L33
hamcrest/PyHamcrest
11aafabd688af2db23e8614f89da3015fd39f611
src/hamcrest/core/helpers/hasmethod.py
python
hasmethod
(obj: object, methodname: str)
return callable(method)
Does ``obj`` have a method named ``methodname``?
Does ``obj`` have a method named ``methodname``?
[ "Does", "obj", "have", "a", "method", "named", "methodname", "?" ]
def hasmethod(obj: object, methodname: str) -> bool: """Does ``obj`` have a method named ``methodname``?""" if not hasattr(obj, methodname): return False method = getattr(obj, methodname) return callable(method)
[ "def", "hasmethod", "(", "obj", ":", "object", ",", "methodname", ":", "str", ")", "->", "bool", ":", "if", "not", "hasattr", "(", "obj", ",", "methodname", ")", ":", "return", "False", "method", "=", "getattr", "(", "obj", ",", "methodname", ")", "r...
https://github.com/hamcrest/PyHamcrest/blob/11aafabd688af2db23e8614f89da3015fd39f611/src/hamcrest/core/helpers/hasmethod.py#L6-L12
trakt/Plex-Trakt-Scrobbler
aeb0bfbe62fad4b06c164f1b95581da7f35dce0b
Trakttv.bundle/Contents/Libraries/Shared/requests/models.py
python
PreparedRequest.prepare_body
(self, data, files, json=None)
Prepares the given HTTP body data.
Prepares the given HTTP body data.
[ "Prepares", "the", "given", "HTTP", "body", "data", "." ]
def prepare_body(self, data, files, json=None): """Prepares the given HTTP body data.""" # Check if file, fo, generator, iterator. # If not, run through normal process. # Nottin' on you. body = None content_type = None if not data and json is not None: ...
[ "def", "prepare_body", "(", "self", ",", "data", ",", "files", ",", "json", "=", "None", ")", ":", "# Check if file, fo, generator, iterator.", "# If not, run through normal process.", "# Nottin' on you.", "body", "=", "None", "content_type", "=", "None", "if", "not",...
https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/Shared/requests/models.py#L431-L498
edublancas/sklearn-evaluation
bdf721b20c42d8cfde0f8716ab1ed6ae1029a2ea
src/sklearn_evaluation/util.py
python
_group_by
(data, criteria)
return res
Group objects in data using a function or a key
Group objects in data using a function or a key
[ "Group", "objects", "in", "data", "using", "a", "function", "or", "a", "key" ]
def _group_by(data, criteria): """ Group objects in data using a function or a key """ if isinstance(criteria, str): criteria_str = criteria def criteria(x): return x[criteria_str] res = defaultdict(list) for element in data: key = criteria(element) ...
[ "def", "_group_by", "(", "data", ",", "criteria", ")", ":", "if", "isinstance", "(", "criteria", ",", "str", ")", ":", "criteria_str", "=", "criteria", "def", "criteria", "(", "x", ")", ":", "return", "x", "[", "criteria_str", "]", "res", "=", "default...
https://github.com/edublancas/sklearn-evaluation/blob/bdf721b20c42d8cfde0f8716ab1ed6ae1029a2ea/src/sklearn_evaluation/util.py#L46-L60
Azure/aztk
8f8e7b268bdbf82c3ae4ecdcd907077bd6fe69b6
aztk/spark/client/job/operations.py
python
JobOperations.get_application_log
(self, id, application_name)
return get_application_log.get_job_application_log(self._core_job_operations, self, id, application_name)
Get the log for a running or completed application Args: id (:obj:`str`): the id of the job the application was submitted to. application_name (:obj:`str`): the name of the application to get the log of Returns: :obj:`aztk.spark.models.ApplicationLog`: a model repre...
Get the log for a running or completed application
[ "Get", "the", "log", "for", "a", "running", "or", "completed", "application" ]
def get_application_log(self, id, application_name): """Get the log for a running or completed application Args: id (:obj:`str`): the id of the job the application was submitted to. application_name (:obj:`str`): the name of the application to get the log of Returns: ...
[ "def", "get_application_log", "(", "self", ",", "id", ",", "application_name", ")", ":", "return", "get_application_log", ".", "get_job_application_log", "(", "self", ".", "_core_job_operations", ",", "self", ",", "id", ",", "application_name", ")" ]
https://github.com/Azure/aztk/blob/8f8e7b268bdbf82c3ae4ecdcd907077bd6fe69b6/aztk/spark/client/job/operations.py#L63-L73
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/email/parser.py
python
Parser.parsestr
(self, text, headersonly=False)
return self.parse(StringIO(text), headersonly=headersonly)
Create a message structure from a string. Returns the root of the message structure. Optional headersonly is a flag specifying whether to stop parsing after reading the headers or not. The default is False, meaning it parses the entire contents of the file.
Create a message structure from a string.
[ "Create", "a", "message", "structure", "from", "a", "string", "." ]
def parsestr(self, text, headersonly=False): """Create a message structure from a string. Returns the root of the message structure. Optional headersonly is a flag specifying whether to stop parsing after reading the headers or not. The default is False, meaning it parses the entire c...
[ "def", "parsestr", "(", "self", ",", "text", ",", "headersonly", "=", "False", ")", ":", "return", "self", ".", "parse", "(", "StringIO", "(", "text", ")", ",", "headersonly", "=", "headersonly", ")" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/email/parser.py#L74-L82
baidu/Dialogue
2415430e1f3997806d059455a6e5b16a2d565d06
DGU/dgu/reader.py
python
convert_tokens
(tokens, sep_id, tokenizer)
return tokens_ids
Converts tokens to ids
Converts tokens to ids
[ "Converts", "tokens", "to", "ids" ]
def convert_tokens(tokens, sep_id, tokenizer): """Converts tokens to ids""" tokens_ids = [] if not tokens: return tokens_ids if isinstance(tokens, list): for text in tokens: tok_text = tokenizer.tokenize(text) ids = tokenizer.convert_tokens_to_ids(tok_text) ...
[ "def", "convert_tokens", "(", "tokens", ",", "sep_id", ",", "tokenizer", ")", ":", "tokens_ids", "=", "[", "]", "if", "not", "tokens", ":", "return", "tokens_ids", "if", "isinstance", "(", "tokens", ",", "list", ")", ":", "for", "text", "in", "tokens", ...
https://github.com/baidu/Dialogue/blob/2415430e1f3997806d059455a6e5b16a2d565d06/DGU/dgu/reader.py#L686-L701
menpo/menpofit
5f2f45bab26df206d43292fd32d19cd8f62f0443
menpofit/sdm/algorithm/base.py
python
features_per_image
(images, shapes, patch_shape, features_callable, prefix='', verbose=False)
return np.vstack(patch_features)
r""" Method that given multiple images with multiple shapes per image, it first extracts patches that correspond to the shapes and then features from these patches. Parameters ---------- images : `list` of `menpo.image.Image` or subclass The input images. shapes : `list` of `list` o...
r""" Method that given multiple images with multiple shapes per image, it first extracts patches that correspond to the shapes and then features from these patches.
[ "r", "Method", "that", "given", "multiple", "images", "with", "multiple", "shapes", "per", "image", "it", "first", "extracts", "patches", "that", "correspond", "to", "the", "shapes", "and", "then", "features", "from", "these", "patches", "." ]
def features_per_image(images, shapes, patch_shape, features_callable, prefix='', verbose=False): r""" Method that given multiple images with multiple shapes per image, it first extracts patches that correspond to the shapes and then features from these patches. Parameters ...
[ "def", "features_per_image", "(", "images", ",", "shapes", ",", "patch_shape", ",", "features_callable", ",", "prefix", "=", "''", ",", "verbose", "=", "False", ")", ":", "wrap", "=", "partial", "(", "print_progress", ",", "prefix", "=", "'{}Extracting patches...
https://github.com/menpo/menpofit/blob/5f2f45bab26df206d43292fd32d19cd8f62f0443/menpofit/sdm/algorithm/base.py#L218-L251
ansible/ansible-modules-extras
f216ba8e0616bc8ad8794c22d4b48e1ab18886cf
cloud/amazon/ec2_vpc_nat_gateway.py
python
release_address
(client, allocation_id, check_mode=False)
return ip_released, err_msg
Release an EIP from your EIP Pool Args: client (botocore.client.EC2): Boto3 client allocation_id (str): The eip Amazon identifier. Kwargs: check_mode (bool): if set to true, do not run anything and falsify the results. Basic Usage: >>> client = boto3.client('ec2...
Release an EIP from your EIP Pool Args: client (botocore.client.EC2): Boto3 client allocation_id (str): The eip Amazon identifier.
[ "Release", "an", "EIP", "from", "your", "EIP", "Pool", "Args", ":", "client", "(", "botocore", ".", "client", ".", "EC2", ")", ":", "Boto3", "client", "allocation_id", "(", "str", ")", ":", "The", "eip", "Amazon", "identifier", "." ]
def release_address(client, allocation_id, check_mode=False): """Release an EIP from your EIP Pool Args: client (botocore.client.EC2): Boto3 client allocation_id (str): The eip Amazon identifier. Kwargs: check_mode (bool): if set to true, do not run anything and falsify ...
[ "def", "release_address", "(", "client", ",", "allocation_id", ",", "check_mode", "=", "False", ")", ":", "err_msg", "=", "''", "if", "check_mode", ":", "return", "True", ",", "''", "ip_released", "=", "False", "params", "=", "{", "'AllocationId'", ":", "a...
https://github.com/ansible/ansible-modules-extras/blob/f216ba8e0616bc8ad8794c22d4b48e1ab18886cf/cloud/amazon/ec2_vpc_nat_gateway.py#L641-L674
robotframework/RIDE
6e8a50774ff33dead3a2757a11b0b4418ab205c0
src/robotide/lib/robot/running/arguments/argumentmapper.py
python
KeywordCallTemplate.__init__
(self, argspec)
:type argspec: :py:class:`robot.running.arguments.ArgumentSpec`
:type argspec: :py:class:`robot.running.arguments.ArgumentSpec`
[ ":", "type", "argspec", ":", ":", "py", ":", "class", ":", "robot", ".", "running", ".", "arguments", ".", "ArgumentSpec" ]
def __init__(self, argspec): """:type argspec: :py:class:`robot.running.arguments.ArgumentSpec`""" self._argspec = argspec self.args = [None if arg not in argspec.defaults else DefaultValue(argspec.defaults[arg]) for arg in argspec.positional] se...
[ "def", "__init__", "(", "self", ",", "argspec", ")", ":", "self", ".", "_argspec", "=", "argspec", "self", ".", "args", "=", "[", "None", "if", "arg", "not", "in", "argspec", ".", "defaults", "else", "DefaultValue", "(", "argspec", ".", "defaults", "["...
https://github.com/robotframework/RIDE/blob/6e8a50774ff33dead3a2757a11b0b4418ab205c0/src/robotide/lib/robot/running/arguments/argumentmapper.py#L36-L42
lixinsu/RCZoo
37fcb7962fbd4c751c561d4a0c84173881ea8339
reader/qanet/predictor.py
python
Predictor.__init__
(self, model=None, tokenizer=None, normalize=True, embedding_file=None, num_workers=None)
Args: model: path to saved model file. tokenizer: option string to select tokenizer class. normalize: squash output score to 0-1 probabilities with a softmax. embedding_file: if provided, will expand dictionary to use all available pretrained vectors in this...
Args: model: path to saved model file. tokenizer: option string to select tokenizer class. normalize: squash output score to 0-1 probabilities with a softmax. embedding_file: if provided, will expand dictionary to use all available pretrained vectors in this...
[ "Args", ":", "model", ":", "path", "to", "saved", "model", "file", ".", "tokenizer", ":", "option", "string", "to", "select", "tokenizer", "class", ".", "normalize", ":", "squash", "output", "score", "to", "0", "-", "1", "probabilities", "with", "a", "so...
def __init__(self, model=None, tokenizer=None, normalize=True, embedding_file=None, num_workers=None): """ Args: model: path to saved model file. tokenizer: option string to select tokenizer class. normalize: squash output score to 0-1 probabilities w...
[ "def", "__init__", "(", "self", ",", "model", "=", "None", ",", "tokenizer", "=", "None", ",", "normalize", "=", "True", ",", "embedding_file", "=", "None", ",", "num_workers", "=", "None", ")", ":", "logger", ".", "info", "(", "'Initializing model...'", ...
https://github.com/lixinsu/RCZoo/blob/37fcb7962fbd4c751c561d4a0c84173881ea8339/reader/qanet/predictor.py#L48-L84
pysmt/pysmt
ade4dc2a825727615033a96d31c71e9f53ce4764
pysmt/solvers/msat.py
python
MSatConverter.walk_bv_sle
(self, formula, args, **kwargs)
return mathsat.msat_make_bv_sleq(self.msat_env(), args[0], args[1])
[]
def walk_bv_sle(self, formula, args, **kwargs): return mathsat.msat_make_bv_sleq(self.msat_env(), args[0], args[1])
[ "def", "walk_bv_sle", "(", "self", ",", "formula", ",", "args", ",", "*", "*", "kwargs", ")", ":", "return", "mathsat", ".", "msat_make_bv_sleq", "(", "self", ".", "msat_env", "(", ")", ",", "args", "[", "0", "]", ",", "args", "[", "1", "]", ")" ]
https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/solvers/msat.py#L858-L860
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Ubuntu_12/MySQLdb/connections.py
python
numeric_part
(s)
return None
Returns the leading numeric part of a string. >>> numeric_part("20-alpha") 20 >>> numeric_part("foo") >>> numeric_part("16b") 16
Returns the leading numeric part of a string. >>> numeric_part("20-alpha") 20 >>> numeric_part("foo") >>> numeric_part("16b") 16
[ "Returns", "the", "leading", "numeric", "part", "of", "a", "string", ".", ">>>", "numeric_part", "(", "20", "-", "alpha", ")", "20", ">>>", "numeric_part", "(", "foo", ")", ">>>", "numeric_part", "(", "16b", ")", "16" ]
def numeric_part(s): """Returns the leading numeric part of a string. >>> numeric_part("20-alpha") 20 >>> numeric_part("foo") >>> numeric_part("16b") 16 """ m = re_numeric_part.match(s) if m: return int(m.group(1)) return None
[ "def", "numeric_part", "(", "s", ")", ":", "m", "=", "re_numeric_part", ".", "match", "(", "s", ")", "if", "m", ":", "return", "int", "(", "m", ".", "group", "(", "1", ")", ")", "return", "None" ]
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Ubuntu_12/MySQLdb/connections.py#L40-L53
qiufengyuyi/sequence_tagging
ad6b3299ebbe32837f3d6e20c2c9190d6a8c934a
bert/run_classifier.py
python
MrpcProcessor._create_examples
(self, lines, set_type)
return examples
Creates examples for the training and dev sets.
Creates examples for the training and dev sets.
[ "Creates", "examples", "for", "the", "training", "and", "dev", "sets", "." ]
def _create_examples(self, lines, set_type): """Creates examples for the training and dev sets.""" examples = [] for (i, line) in enumerate(lines): if i == 0: continue guid = "%s-%s" % (set_type, i) text_a = tokenization.convert_to_unicode(line...
[ "def", "_create_examples", "(", "self", ",", "lines", ",", "set_type", ")", ":", "examples", "=", "[", "]", "for", "(", "i", ",", "line", ")", "in", "enumerate", "(", "lines", ")", ":", "if", "i", "==", "0", ":", "continue", "guid", "=", "\"%s-%s\"...
https://github.com/qiufengyuyi/sequence_tagging/blob/ad6b3299ebbe32837f3d6e20c2c9190d6a8c934a/bert/run_classifier.py#L276-L288
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/tvdbapiv2/api_client.py
python
ApiClient.__deserialize_file
(self, response)
return path
Saves response body into a file in a temporary folder, using the filename from the `Content-Disposition` header if provided. :param response: RESTResponse. :return: file path.
Saves response body into a file in a temporary folder, using the filename from the `Content-Disposition` header if provided.
[ "Saves", "response", "body", "into", "a", "file", "in", "a", "temporary", "folder", "using", "the", "filename", "from", "the", "Content", "-", "Disposition", "header", "if", "provided", "." ]
def __deserialize_file(self, response): """ Saves response body into a file in a temporary folder, using the filename from the `Content-Disposition` header if provided. :param response: RESTResponse. :return: file path. """ config = Configuration() fd, ...
[ "def", "__deserialize_file", "(", "self", ",", "response", ")", ":", "config", "=", "Configuration", "(", ")", "fd", ",", "path", "=", "tempfile", ".", "mkstemp", "(", "dir", "=", "config", ".", "temp_folder_path", ")", "os", ".", "close", "(", "fd", "...
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/tvdbapiv2/api_client.py#L442-L466
maas/maas
db2f89970c640758a51247c59bf1ec6f60cf4ab5
src/maasserver/api/support.py
python
admin_method
(func)
return wrapper
Decorator to protect a method from non-admin users. If a non-admin tries to call a method decorated with this decorator, they will get an HTTP "forbidden" error and a message saying the operation is accessible only to administrators.
Decorator to protect a method from non-admin users.
[ "Decorator", "to", "protect", "a", "method", "from", "non", "-", "admin", "users", "." ]
def admin_method(func): """Decorator to protect a method from non-admin users. If a non-admin tries to call a method decorated with this decorator, they will get an HTTP "forbidden" error and a message saying the operation is accessible only to administrators. """ @wraps(func) def wrapper(...
[ "def", "admin_method", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "request", ".", "user", ".", "is_superuser", ":", "raise"...
https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/api/support.py#L145-L160
pageauc/pi-timolo
b146898190a5241788b3d7314bdf4d100a05f034
source/py3exiv2-arm/pyexiv2/utils.py
python
GPSCoordinate.__init__
(self, degrees, minutes, seconds, direction)
Instanciate a GPSCoordinate object. Args: degrees -- int(degrees) minutes -- int(minutes) seconds -- int(seconds) direction -- str('N', 'S', 'E' or 'W') Raise ValueError: if any of the parameter is not in the expected range of values
Instanciate a GPSCoordinate object.
[ "Instanciate", "a", "GPSCoordinate", "object", "." ]
def __init__(self, degrees, minutes, seconds, direction): """Instanciate a GPSCoordinate object. Args: degrees -- int(degrees) minutes -- int(minutes) seconds -- int(seconds) direction -- str('N', 'S', 'E' or 'W') Raise ValueError: if any of the parameter is not...
[ "def", "__init__", "(", "self", ",", "degrees", ",", "minutes", ",", "seconds", ",", "direction", ")", ":", "if", "direction", "not", "in", "(", "'N'", ",", "'S'", ",", "'E'", ",", "'W'", ")", ":", "raise", "ValueError", "(", "'Invalid direction: %s'", ...
https://github.com/pageauc/pi-timolo/blob/b146898190a5241788b3d7314bdf4d100a05f034/source/py3exiv2-arm/pyexiv2/utils.py#L338-L366
cloudera/impyla
0c736af4cad2bade9b8e313badc08ec50e81c948
impala/_thrift_gen/ImpalaService/ttypes.py
python
TGetRuntimeProfileResp.__repr__
(self)
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
[]
def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.items()] return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
[ "def", "__repr__", "(", "self", ")", ":", "L", "=", "[", "'%s=%r'", "%", "(", "key", ",", "value", ")", "for", "key", ",", "value", "in", "self", ".", "__dict__", ".", "items", "(", ")", "]", "return", "'%s(%s)'", "%", "(", "self", ".", "__class_...
https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/ImpalaService/ttypes.py#L774-L777
etetoolkit/ete
2b207357dc2a40ccad7bfd8f54964472c72e4726
ete3/nexml/_nexml.py
python
RNAMatrixObsRow.get_cell
(self)
return self.cell
[]
def get_cell(self): return self.cell
[ "def", "get_cell", "(", "self", ")", ":", "return", "self", ".", "cell" ]
https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/nexml/_nexml.py#L12333-L12333
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/events_v1_event.py
python
EventsV1Event.metadata
(self, metadata)
Sets the metadata of this EventsV1Event. :param metadata: The metadata of this EventsV1Event. # noqa: E501 :type: V1ObjectMeta
Sets the metadata of this EventsV1Event.
[ "Sets", "the", "metadata", "of", "this", "EventsV1Event", "." ]
def metadata(self, metadata): """Sets the metadata of this EventsV1Event. :param metadata: The metadata of this EventsV1Event. # noqa: E501 :type: V1ObjectMeta """ self._metadata = metadata
[ "def", "metadata", "(", "self", ",", "metadata", ")", ":", "self", ".", "_metadata", "=", "metadata" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/events_v1_event.py#L329-L337
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/ldap3/strategy/restartable.py
python
RestartableStrategy.__init__
(self, ldap_connection)
[]
def __init__(self, ldap_connection): SyncStrategy.__init__(self, ldap_connection) self.sync = True self.no_real_dsa = False self.pooled = False self.can_stream = False self.restartable_sleep_time = get_config_parameter('RESTARTABLE_SLEEPTIME') self.restartable_tri...
[ "def", "__init__", "(", "self", ",", "ldap_connection", ")", ":", "SyncStrategy", ".", "__init__", "(", "self", ",", "ldap_connection", ")", "self", ".", "sync", "=", "True", "self", ".", "no_real_dsa", "=", "False", "self", ".", "pooled", "=", "False", ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/ldap3/strategy/restartable.py#L37-L51
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/core/reshape/merge.py
python
_MergeOperation._get_join_indexers
(self)
return get_join_indexers( self.left_join_keys, self.right_join_keys, sort=self.sort, how=self.how )
return the join indexers
return the join indexers
[ "return", "the", "join", "indexers" ]
def _get_join_indexers(self) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: """return the join indexers""" return get_join_indexers( self.left_join_keys, self.right_join_keys, sort=self.sort, how=self.how )
[ "def", "_get_join_indexers", "(", "self", ")", "->", "tuple", "[", "npt", ".", "NDArray", "[", "np", ".", "intp", "]", ",", "npt", ".", "NDArray", "[", "np", ".", "intp", "]", "]", ":", "return", "get_join_indexers", "(", "self", ".", "left_join_keys",...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/reshape/merge.py#L939-L943
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/tcl/tkinter/ttk.py
python
LabeledScale._adjust
(self, *args)
Adjust the label position according to the scale.
Adjust the label position according to the scale.
[ "Adjust", "the", "label", "position", "according", "to", "the", "scale", "." ]
def _adjust(self, *args): """Adjust the label position according to the scale.""" def adjust_label(): self.update_idletasks() # "force" scale redraw x, y = self.scale.coords() if self._label_top: y = self.scale.winfo_y() - self.label.winfo_reqheight()...
[ "def", "_adjust", "(", "self", ",", "*", "args", ")", ":", "def", "adjust_label", "(", ")", ":", "self", ".", "update_idletasks", "(", ")", "# \"force\" scale redraw", "x", ",", "y", "=", "self", ".", "scale", ".", "coords", "(", ")", "if", "self", "...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/tcl/tkinter/ttk.py#L1561-L1586
PaddlePaddle/PaddleSlim
f895aebe441b2bef79ecc434626d3cac4b3cbd09
paddleslim/prune/unstructured_pruner.py
python
UnstructuredPruner.step
(self)
Update the threshold and masks.
Update the threshold and masks.
[ "Update", "the", "threshold", "and", "masks", "." ]
def step(self): """ Update the threshold and masks. """ if self.mode == 'threshold': pass elif self.mode == 'ratio': self.update_threshold() self._update_masks()
[ "def", "step", "(", "self", ")", ":", "if", "self", ".", "mode", "==", "'threshold'", ":", "pass", "elif", "self", ".", "mode", "==", "'ratio'", ":", "self", ".", "update_threshold", "(", ")", "self", ".", "_update_masks", "(", ")" ]
https://github.com/PaddlePaddle/PaddleSlim/blob/f895aebe441b2bef79ecc434626d3cac4b3cbd09/paddleslim/prune/unstructured_pruner.py#L209-L217
kiryha/Houdini
a9a45325042755295096d66c06c6728089600eec
Eve/tools/core/database/eve_data.py
python
EveData.add_project
(self, project)
[]
def add_project(self, project): connection = sqlite3.connect(self.SQL_FILE_PATH) cursor = connection.cursor() # Add project to DB cursor.execute("INSERT INTO projects VALUES (" ":id," ":name," ":houdini_build," ...
[ "def", "add_project", "(", "self", ",", "project", ")", ":", "connection", "=", "sqlite3", ".", "connect", "(", "self", ".", "SQL_FILE_PATH", ")", "cursor", "=", "connection", ".", "cursor", "(", ")", "# Add project to DB", "cursor", ".", "execute", "(", "...
https://github.com/kiryha/Houdini/blob/a9a45325042755295096d66c06c6728089600eec/Eve/tools/core/database/eve_data.py#L38-L64
TesterlifeRaymond/doraemon
d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333
venv/lib/python3.6/site-packages/pip/_vendor/requests/cookies.py
python
remove_cookie_by_name
(cookiejar, name, domain=None, path=None)
Unsets a cookie by name, by default over all domains and paths. Wraps CookieJar.clear(), is O(n).
Unsets a cookie by name, by default over all domains and paths.
[ "Unsets", "a", "cookie", "by", "name", "by", "default", "over", "all", "domains", "and", "paths", "." ]
def remove_cookie_by_name(cookiejar, name, domain=None, path=None): """Unsets a cookie by name, by default over all domains and paths. Wraps CookieJar.clear(), is O(n). """ clearables = [] for cookie in cookiejar: if cookie.name != name: continue if domain is not None an...
[ "def", "remove_cookie_by_name", "(", "cookiejar", ",", "name", ",", "domain", "=", "None", ",", "path", "=", "None", ")", ":", "clearables", "=", "[", "]", "for", "cookie", "in", "cookiejar", ":", "if", "cookie", ".", "name", "!=", "name", ":", "contin...
https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pip/_vendor/requests/cookies.py#L147-L163
missionpinball/mpf
8e6b74cff4ba06d2fec9445742559c1068b88582
mpf/platforms/p_roc_common.py
python
PDBConfig.__init__
(self, proc_platform, config, driver_count)
Set up PDB config. Will configure driver groups for matrixes, lamps and normal drivers. We always use polarity True in this method because it is only used for PDB machines.
Set up PDB config.
[ "Set", "up", "PDB", "config", "." ]
def __init__(self, proc_platform, config, driver_count): """Set up PDB config. Will configure driver groups for matrixes, lamps and normal drivers. We always use polarity True in this method because it is only used for PDB machines. """ self.log = logging.getLogger('PDBConfig') ...
[ "def", "__init__", "(", "self", ",", "proc_platform", ",", "config", ",", "driver_count", ")", ":", "self", ".", "log", "=", "logging", ".", "getLogger", "(", "'PDBConfig'", ")", "self", ".", "log", ".", "debug", "(", "\"Processing PDB Driver Board configurati...
https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/platforms/p_roc_common.py#L854-L1015
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/bleach/_vendor/html5lib/_tokenizer.py
python
HTMLTokenizer.entityDataState
(self)
return True
[]
def entityDataState(self): self.consumeEntity() self.state = self.dataState return True
[ "def", "entityDataState", "(", "self", ")", ":", "self", ".", "consumeEntity", "(", ")", "self", ".", "state", "=", "self", ".", "dataState", "return", "True" ]
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/bleach/_vendor/html5lib/_tokenizer.py#L285-L288
munificent/magpie
f5138e3d316ec1a664b5eadba1bcc8573d3faca3
dep/gyp/pylib/gyp/xcode_emulation.py
python
XcodeSettings.AdjustLibraries
(self, libraries)
return libraries
Transforms entries like 'Cocoa.framework' in libraries into entries like '-framework Cocoa', 'libcrypto.dylib' into '-lcrypto', etc.
Transforms entries like 'Cocoa.framework' in libraries into entries like '-framework Cocoa', 'libcrypto.dylib' into '-lcrypto', etc.
[ "Transforms", "entries", "like", "Cocoa", ".", "framework", "in", "libraries", "into", "entries", "like", "-", "framework", "Cocoa", "libcrypto", ".", "dylib", "into", "-", "lcrypto", "etc", "." ]
def AdjustLibraries(self, libraries): """Transforms entries like 'Cocoa.framework' in libraries into entries like '-framework Cocoa', 'libcrypto.dylib' into '-lcrypto', etc. """ libraries = [ self._AdjustLibrary(library) for library in libraries] return libraries
[ "def", "AdjustLibraries", "(", "self", ",", "libraries", ")", ":", "libraries", "=", "[", "self", ".", "_AdjustLibrary", "(", "library", ")", "for", "library", "in", "libraries", "]", "return", "libraries" ]
https://github.com/munificent/magpie/blob/f5138e3d316ec1a664b5eadba1bcc8573d3faca3/dep/gyp/pylib/gyp/xcode_emulation.py#L687-L692
wmayner/pyphi
299fccd4a8152dcfa4bb989d7d739e245343b0a5
pyphi/compute/network.py
python
condensed
(network, state)
return result
Return a list of maximal non-overlapping complexes. Args: network (Network): The |Network| of interest. state (tuple[int]): The state of the network (a binary tuple). Returns: list[SystemIrreducibilityAnalysis]: A list of |SIA| for non-overlapping complexes with maximal |big_ph...
Return a list of maximal non-overlapping complexes.
[ "Return", "a", "list", "of", "maximal", "non", "-", "overlapping", "complexes", "." ]
def condensed(network, state): """Return a list of maximal non-overlapping complexes. Args: network (Network): The |Network| of interest. state (tuple[int]): The state of the network (a binary tuple). Returns: list[SystemIrreducibilityAnalysis]: A list of |SIA| for non-overlapping ...
[ "def", "condensed", "(", "network", ",", "state", ")", ":", "result", "=", "[", "]", "covered_nodes", "=", "set", "(", ")", "for", "c", "in", "reversed", "(", "sorted", "(", "complexes", "(", "network", ",", "state", ")", ")", ")", ":", "if", "not"...
https://github.com/wmayner/pyphi/blob/299fccd4a8152dcfa4bb989d7d739e245343b0a5/pyphi/compute/network.py#L161-L180
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v7/services/services/keyword_plan_campaign_service/client.py
python
KeywordPlanCampaignServiceClient.parse_geo_target_constant_path
(path: str)
return m.groupdict() if m else {}
Parse a geo_target_constant path into its component segments.
Parse a geo_target_constant path into its component segments.
[ "Parse", "a", "geo_target_constant", "path", "into", "its", "component", "segments", "." ]
def parse_geo_target_constant_path(path: str) -> Dict[str, str]: """Parse a geo_target_constant path into its component segments.""" m = re.match(r"^geoTargetConstants/(?P<criterion_id>.+?)$", path) return m.groupdict() if m else {}
[ "def", "parse_geo_target_constant_path", "(", "path", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "m", "=", "re", ".", "match", "(", "r\"^geoTargetConstants/(?P<criterion_id>.+?)$\"", ",", "path", ")", "return", "m", ".", "groupdict", "(...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/keyword_plan_campaign_service/client.py#L172-L175
meraki/dashboard-api-python
aef5e6fe5d23a40d435d5c64ff30580a28af07f1
meraki_v0/api/bluetooth_settings.py
python
BluetoothSettings.updateDeviceWirelessBluetoothSettings
(self, serial: str, **kwargs)
return self._session.put(metadata, resource, payload)
**Update the bluetooth settings for a wireless device** https://developer.cisco.com/meraki/api/#!update-device-wireless-bluetooth-settings - serial (string) - uuid (string): Desired UUID of the beacon. If the value is set to null it will reset to Dashboard's automatically generated valu...
**Update the bluetooth settings for a wireless device** https://developer.cisco.com/meraki/api/#!update-device-wireless-bluetooth-settings - serial (string) - uuid (string): Desired UUID of the beacon. If the value is set to null it will reset to Dashboard's automatically generated valu...
[ "**", "Update", "the", "bluetooth", "settings", "for", "a", "wireless", "device", "**", "https", ":", "//", "developer", ".", "cisco", ".", "com", "/", "meraki", "/", "api", "/", "#!update", "-", "device", "-", "wireless", "-", "bluetooth", "-", "setting...
def updateDeviceWirelessBluetoothSettings(self, serial: str, **kwargs): """ **Update the bluetooth settings for a wireless device** https://developer.cisco.com/meraki/api/#!update-device-wireless-bluetooth-settings - serial (string) - uuid (string): Desired UUID of the b...
[ "def", "updateDeviceWirelessBluetoothSettings", "(", "self", ",", "serial", ":", "str", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update", "(", "locals", "(", ")", ")", "metadata", "=", "{", "'tags'", ":", "[", "'Bluetooth settings'", "]", ",", ...
https://github.com/meraki/dashboard-api-python/blob/aef5e6fe5d23a40d435d5c64ff30580a28af07f1/meraki_v0/api/bluetooth_settings.py#L22-L44
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/http/client.py
python
HTTPResponse.readinto
(self, b)
return n
Read up to len(b) bytes into bytearray b and return the number of bytes read.
Read up to len(b) bytes into bytearray b and return the number of bytes read.
[ "Read", "up", "to", "len", "(", "b", ")", "bytes", "into", "bytearray", "b", "and", "return", "the", "number", "of", "bytes", "read", "." ]
def readinto(self, b): """Read up to len(b) bytes into bytearray b and return the number of bytes read. """ if self.fp is None: return 0 if self._method == "HEAD": self._close_conn() return 0 if self.chunked: return self....
[ "def", "readinto", "(", "self", ",", "b", ")", ":", "if", "self", ".", "fp", "is", "None", ":", "return", "0", "if", "self", ".", "_method", "==", "\"HEAD\"", ":", "self", ".", "_close_conn", "(", ")", "return", "0", "if", "self", ".", "chunked", ...
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/http/client.py#L478-L510
EasyIME/PIME
0f1eee10169c1cb2eaa0b59a77fa6f931ecb33b3
python/python3/tornado/queues.py
python
Queue.maxsize
(self)
return self._maxsize
Number of items allowed in the queue.
Number of items allowed in the queue.
[ "Number", "of", "items", "allowed", "in", "the", "queue", "." ]
def maxsize(self) -> int: """Number of items allowed in the queue.""" return self._maxsize
[ "def", "maxsize", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_maxsize" ]
https://github.com/EasyIME/PIME/blob/0f1eee10169c1cb2eaa0b59a77fa6f931ecb33b3/python/python3/tornado/queues.py#L169-L171
pycrypto/pycrypto
7acba5f3a6ff10f1424c309d0d34d2b713233019
lib/Crypto/Protocol/KDF.py
python
_S2V.update
(self, item)
Pass the next component of the vector. The maximum number of components you can pass is equal to the block length of the cipher (in bits) minus 1. :Parameters: item : byte string The next component of the vector. :Raise TypeError: when the limit on the number of c...
Pass the next component of the vector.
[ "Pass", "the", "next", "component", "of", "the", "vector", "." ]
def update(self, item): """Pass the next component of the vector. The maximum number of components you can pass is equal to the block length of the cipher (in bits) minus 1. :Parameters: item : byte string The next component of the vector. :Raise TypeError...
[ "def", "update", "(", "self", ",", "item", ")", ":", "if", "not", "item", ":", "raise", "ValueError", "(", "\"A component cannot be empty\"", ")", "if", "self", ".", "_n_updates", "==", "0", ":", "raise", "TypeError", "(", "\"Too many components passed to S2V\""...
https://github.com/pycrypto/pycrypto/blob/7acba5f3a6ff10f1424c309d0d34d2b713233019/lib/Crypto/Protocol/KDF.py#L173-L195
sth2018/FastWordQuery
901ebe8fd5989d8861d20ee3fec3acd15b7f46a5
addons/fastwq/libs/mdict/readmdict.py
python
MDict.keys
(self)
return (key_value for key_id, key_value in self._key_list)
Return an iterator over dictionary keys.
Return an iterator over dictionary keys.
[ "Return", "an", "iterator", "over", "dictionary", "keys", "." ]
def keys(self): """ Return an iterator over dictionary keys. """ return (key_value for key_id, key_value in self._key_list)
[ "def", "keys", "(", "self", ")", ":", "return", "(", "key_value", "for", "key_id", ",", "key_value", "in", "self", ".", "_key_list", ")" ]
https://github.com/sth2018/FastWordQuery/blob/901ebe8fd5989d8861d20ee3fec3acd15b7f46a5/addons/fastwq/libs/mdict/readmdict.py#L113-L117
bmuller/twistar
1eb46ff2577473e0a26932ee57473e26203a3db2
twistar/relationships.py
python
HasMany.count
(self, **kwargs)
return self.otherklass.count(**kwargs)
Get the number of objects that caller has. @param kwargs: These could include C{limit}, C{orderby}, or any others included in C{DBObject.find}. If a C{where} parameter is included, the conditions will be added to the ones already imposed by default in this method. @return: A C{Deferre...
Get the number of objects that caller has.
[ "Get", "the", "number", "of", "objects", "that", "caller", "has", "." ]
def count(self, **kwargs): """ Get the number of objects that caller has. @param kwargs: These could include C{limit}, C{orderby}, or any others included in C{DBObject.find}. If a C{where} parameter is included, the conditions will be added to the ones already imposed by defaul...
[ "def", "count", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "self", ".", "_generateGetArgs", "(", "kwargs", ")", "return", "self", ".", "otherklass", ".", "count", "(", "*", "*", "kwargs", ")" ]
https://github.com/bmuller/twistar/blob/1eb46ff2577473e0a26932ee57473e26203a3db2/twistar/relationships.py#L122-L133
youknowone/ring
650df62b5f6336a6b1363f642e5fcfb0949e7df6
ring/func/base.py
python
coerce
(v, in_memory_storage)
Transform the given value to cache-friendly string data.
Transform the given value to cache-friendly string data.
[ "Transform", "the", "given", "value", "to", "cache", "-", "friendly", "string", "data", "." ]
def coerce(v, in_memory_storage): """Transform the given value to cache-friendly string data.""" type_coerce = coerce_function(type(v)) if type_coerce: return type_coerce(v) if hasattr(v, '__ring_key__'): return v.__ring_key__() if in_memory_storage and type(v).__hash__ != object....
[ "def", "coerce", "(", "v", ",", "in_memory_storage", ")", ":", "type_coerce", "=", "coerce_function", "(", "type", "(", "v", ")", ")", "if", "type_coerce", ":", "return", "type_coerce", "(", "v", ")", "if", "hasattr", "(", "v", ",", "'__ring_key__'", ")"...
https://github.com/youknowone/ring/blob/650df62b5f6336a6b1363f642e5fcfb0949e7df6/ring/func/base.py#L221-L243
pika/pika
12dcdf15d0932c388790e0fa990810bfd21b1a32
pika/adapters/utils/selector_ioloop_adapter.py
python
_AddressResolver.start
(self)
return _SelectorIOLoopIOHandle(self)
Start asynchronous DNS lookup. :rtype: nbio_interface.AbstractIOReference
Start asynchronous DNS lookup.
[ "Start", "asynchronous", "DNS", "lookup", "." ]
def start(self): """Start asynchronous DNS lookup. :rtype: nbio_interface.AbstractIOReference """ assert self._state == self.NOT_STARTED, self._state self._state = self.ACTIVE self._threading_timer = threading.Timer(0, self._resolve) self._threading_timer.start...
[ "def", "start", "(", "self", ")", ":", "assert", "self", ".", "_state", "==", "self", ".", "NOT_STARTED", ",", "self", ".", "_state", "self", ".", "_state", "=", "self", ".", "ACTIVE", "self", ".", "_threading_timer", "=", "threading", ".", "Timer", "(...
https://github.com/pika/pika/blob/12dcdf15d0932c388790e0fa990810bfd21b1a32/pika/adapters/utils/selector_ioloop_adapter.py#L518-L530
vita-epfl/openpifpaf
6eeffc864024f577542180a5eab3da9ef6482c1f
versioneer.py
python
versions_from_parentdir
(parentdir_prefix, root, verbose)
Try to determine the version from the parent directory name. Source tarballs conventionally unpack into a directory that includes both the project name and a version string. We will also support searching up two directory levels for an appropriately named parent directory
Try to determine the version from the parent directory name.
[ "Try", "to", "determine", "the", "version", "from", "the", "parent", "directory", "name", "." ]
def versions_from_parentdir(parentdir_prefix, root, verbose): """Try to determine the version from the parent directory name. Source tarballs conventionally unpack into a directory that includes both the project name and a version string. We will also support searching up two directory levels for an ap...
[ "def", "versions_from_parentdir", "(", "parentdir_prefix", ",", "root", ",", "verbose", ")", ":", "rootdirs", "=", "[", "]", "for", "i", "in", "range", "(", "3", ")", ":", "dirname", "=", "os", ".", "path", ".", "basename", "(", "root", ")", "if", "d...
https://github.com/vita-epfl/openpifpaf/blob/6eeffc864024f577542180a5eab3da9ef6482c1f/versioneer.py#L1159-L1181
tensorflow/addons
37a368adfea1d0ec4cb85998946f458e9d565818
tensorflow_addons/seq2seq/beam_search_decoder.py
python
_check_batch_beam
(t, batch_size, beam_width)
return tf.Assert(condition, [error_message])
Returns an Assert operation checking that the elements of the stacked TensorArray can be reshaped to [batch_size, beam_size, -1]. At this point, the TensorArray elements have a known rank of at least 1.
Returns an Assert operation checking that the elements of the stacked TensorArray can be reshaped to [batch_size, beam_size, -1].
[ "Returns", "an", "Assert", "operation", "checking", "that", "the", "elements", "of", "the", "stacked", "TensorArray", "can", "be", "reshaped", "to", "[", "batch_size", "beam_size", "-", "1", "]", "." ]
def _check_batch_beam(t, batch_size, beam_width): """Returns an Assert operation checking that the elements of the stacked TensorArray can be reshaped to [batch_size, beam_size, -1]. At this point, the TensorArray elements have a known rank of at least 1. """ error_message = ( "TensorAr...
[ "def", "_check_batch_beam", "(", "t", ",", "batch_size", ",", "beam_width", ")", ":", "error_message", "=", "(", "\"TensorArray reordering expects elements to be \"", "\"reshapable to [batch_size, beam_size, -1] which is \"", "\"incompatible with the dynamic shape of %s elements. \"", ...
https://github.com/tensorflow/addons/blob/37a368adfea1d0ec4cb85998946f458e9d565818/tensorflow_addons/seq2seq/beam_search_decoder.py#L330-L356
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/nsw_rural_fire_service_feed/geo_location.py
python
async_setup_platform
( hass: HomeAssistant, config: ConfigType, async_add_entities: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None, )
Set up the NSW Rural Fire Service Feed platform.
Set up the NSW Rural Fire Service Feed platform.
[ "Set", "up", "the", "NSW", "Rural", "Fire", "Service", "Feed", "platform", "." ]
async def async_setup_platform( hass: HomeAssistant, config: ConfigType, async_add_entities: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None, ) -> None: """Set up the NSW Rural Fire Service Feed platform.""" scan_interval = config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL) c...
[ "async", "def", "async_setup_platform", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", "discovery_info", ":", "DiscoveryInfoType", "|", "None", "=", "None", ",", ")", "->", "None", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/nsw_rural_fire_service_feed/geo_location.py#L69-L98
stanfordnlp/stanza
e44d1c88340e33bf9813e6f5a6bd24387eefc4b2
stanza/models/constituency/parse_tree.py
python
Tree.remap_words
(self, word_map)
return Tree(self.label, [child.remap_words(word_map) for child in self.children])
Copies the tree with some labels replaced. Labels in the map are replaced with the mapped value. Labels not in the map are unchanged.
Copies the tree with some labels replaced.
[ "Copies", "the", "tree", "with", "some", "labels", "replaced", "." ]
def remap_words(self, word_map): """ Copies the tree with some labels replaced. Labels in the map are replaced with the mapped value. Labels not in the map are unchanged. """ if self.is_leaf(): new_label = word_map.get(self.label, self.label) retu...
[ "def", "remap_words", "(", "self", ",", "word_map", ")", ":", "if", "self", ".", "is_leaf", "(", ")", ":", "new_label", "=", "word_map", ".", "get", "(", "self", ".", "label", ",", "self", ".", "label", ")", "return", "Tree", "(", "new_label", ")", ...
https://github.com/stanfordnlp/stanza/blob/e44d1c88340e33bf9813e6f5a6bd24387eefc4b2/stanza/models/constituency/parse_tree.py#L251-L263
reviewboard/reviewboard
7395902e4c181bcd1d633f61105012ffb1d18e1b
reviewboard/ssh/storage.py
python
SSHStorage.delete_user_key
(self, key)
Deletes a user key. The user key, if it exists, will be removed from storage. If no user key exists, this will do nothing.
Deletes a user key.
[ "Deletes", "a", "user", "key", "." ]
def delete_user_key(self, key): """Deletes a user key. The user key, if it exists, will be removed from storage. If no user key exists, this will do nothing. """ raise NotImplementedError
[ "def", "delete_user_key", "(", "self", ",", "key", ")", ":", "raise", "NotImplementedError" ]
https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/ssh/storage.py#L42-L49
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/core/groupby/groupby.py
python
BaseGroupBy.groups
(self)
return self.grouper.groups
Dict {group name -> group labels}.
Dict {group name -> group labels}.
[ "Dict", "{", "group", "name", "-", ">", "group", "labels", "}", "." ]
def groups(self) -> dict[Hashable, np.ndarray]: """ Dict {group name -> group labels}. """ return self.grouper.groups
[ "def", "groups", "(", "self", ")", "->", "dict", "[", "Hashable", ",", "np", ".", "ndarray", "]", ":", "return", "self", ".", "grouper", ".", "groups" ]
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/groupby/groupby.py#L598-L602