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
yt-project/yt
dc7b24f9b266703db4c843e329c6c8644d47b824
yt/visualization/volume_rendering/image_handling.py
python
export_rgba
( image, fn, h5=True, fits=False, )
This function accepts an *image*, of shape (N,M,4) corresponding to r,g,b,a, and saves to *fn*. If *h5* is True, then it will save in hdf5 format. If *fits* is True, it will save in fits format.
This function accepts an *image*, of shape (N,M,4) corresponding to r,g,b,a, and saves to *fn*. If *h5* is True, then it will save in hdf5 format. If *fits* is True, it will save in fits format.
[ "This", "function", "accepts", "an", "*", "image", "*", "of", "shape", "(", "N", "M", "4", ")", "corresponding", "to", "r", "g", "b", "a", "and", "saves", "to", "*", "fn", "*", ".", "If", "*", "h5", "*", "is", "True", "then", "it", "will", "sav...
def export_rgba( image, fn, h5=True, fits=False, ): """ This function accepts an *image*, of shape (N,M,4) corresponding to r,g,b,a, and saves to *fn*. If *h5* is True, then it will save in hdf5 format. If *fits* is True, it will save in fits format. """ if (not h5 and not fits...
[ "def", "export_rgba", "(", "image", ",", "fn", ",", "h5", "=", "True", ",", "fits", "=", "False", ",", ")", ":", "if", "(", "not", "h5", "and", "not", "fits", ")", "or", "(", "h5", "and", "fits", ")", ":", "raise", "ValueError", "(", "\"Choose ei...
https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/visualization/volume_rendering/image_handling.py#L7-L36
ydkhatri/mac_apt
729630c8bbe7a73cce3ca330305d3301a919cb07
plugins/netusage.py
python
Plugin_Start_Ios
(ios_info)
Entry point for ios_apt plugin
Entry point for ios_apt plugin
[ "Entry", "point", "for", "ios_apt", "plugin" ]
def Plugin_Start_Ios(ios_info): '''Entry point for ios_apt plugin''' netusage_items = [] netusage_path = '/private/var/networkd/netusage.sqlite' ProcessDbFromPath(ios_info, netusage_items, netusage_path) if len(netusage_items) > 0: PrintAll(netusage_items, ios_info.output_params) ...
[ "def", "Plugin_Start_Ios", "(", "ios_info", ")", ":", "netusage_items", "=", "[", "]", "netusage_path", "=", "'/private/var/networkd/netusage.sqlite'", "ProcessDbFromPath", "(", "ios_info", ",", "netusage_items", ",", "netusage_path", ")", "if", "len", "(", "netusage_...
https://github.com/ydkhatri/mac_apt/blob/729630c8bbe7a73cce3ca330305d3301a919cb07/plugins/netusage.py#L177-L187
compas-dev/compas
0b33f8786481f710115fb1ae5fe79abc2a9a5175
src/compas_rhino/conversions/_primitives.py
python
line_to_rhino
(line)
return RhinoLine(point_to_rhino(line[0]), point_to_rhino(line[1]))
Convert a COMPAS line to a Rhino line. Parameters ---------- line : :class:`compas.geometry.Line` Returns ------- :class:`Rhino.Geometry.Line`
Convert a COMPAS line to a Rhino line.
[ "Convert", "a", "COMPAS", "line", "to", "a", "Rhino", "line", "." ]
def line_to_rhino(line): """Convert a COMPAS line to a Rhino line. Parameters ---------- line : :class:`compas.geometry.Line` Returns ------- :class:`Rhino.Geometry.Line` """ return RhinoLine(point_to_rhino(line[0]), point_to_rhino(line[1]))
[ "def", "line_to_rhino", "(", "line", ")", ":", "return", "RhinoLine", "(", "point_to_rhino", "(", "line", "[", "0", "]", ")", ",", "point_to_rhino", "(", "line", "[", "1", "]", ")", ")" ]
https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas_rhino/conversions/_primitives.py#L95-L107
dragonfly/dragonfly
a579b5eadf452e23b07d4caf27b402703b0012b7
dragonfly/nn/nn_gp.py
python
NNGP._get_training_kernel_matrix
(self)
Compute the kernel matrix from distances if they are provided.
Compute the kernel matrix from distances if they are provided.
[ "Compute", "the", "kernel", "matrix", "from", "distances", "if", "they", "are", "provided", "." ]
def _get_training_kernel_matrix(self): """ Compute the kernel matrix from distances if they are provided. """ if self.list_of_dists is not None: return self.kernel.evaluate_from_dists(self.list_of_dists) else: return self.kernel(self.X, self.X)
[ "def", "_get_training_kernel_matrix", "(", "self", ")", ":", "if", "self", ".", "list_of_dists", "is", "not", "None", ":", "return", "self", ".", "kernel", ".", "evaluate_from_dists", "(", "self", ".", "list_of_dists", ")", "else", ":", "return", "self", "."...
https://github.com/dragonfly/dragonfly/blob/a579b5eadf452e23b07d4caf27b402703b0012b7/dragonfly/nn/nn_gp.py#L82-L87
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
twistedcaldav/memcachepool.py
python
PooledMemCacheProtocol.connectionMade
(self)
Notify our factory that we're ready to accept connections.
Notify our factory that we're ready to accept connections.
[ "Notify", "our", "factory", "that", "we", "re", "ready", "to", "accept", "connections", "." ]
def connectionMade(self): """ Notify our factory that we're ready to accept connections. """ MemCacheProtocol.connectionMade(self) if self.factory.deferred is not None: self.factory.deferred.callback(self) self.factory.deferred = None
[ "def", "connectionMade", "(", "self", ")", ":", "MemCacheProtocol", ".", "connectionMade", "(", "self", ")", "if", "self", ".", "factory", ".", "deferred", "is", "not", "None", ":", "self", ".", "factory", ".", "deferred", ".", "callback", "(", "self", "...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/twistedcaldav/memcachepool.py#L38-L46
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/cbook.py
python
wrap
(prefix, text, cols)
return ret
wrap *text* with *prefix* at length *cols*
wrap *text* with *prefix* at length *cols*
[ "wrap", "*", "text", "*", "with", "*", "prefix", "*", "at", "length", "*", "cols", "*" ]
def wrap(prefix, text, cols): 'wrap *text* with *prefix* at length *cols*' pad = ' ' * len(prefix.expandtabs()) available = cols - len(pad) seq = text.split(' ') Nseq = len(seq) ind = 0 lines = [] while ind < Nseq: lastInd = ind ind += get_split_ind(seq[ind:], available)...
[ "def", "wrap", "(", "prefix", ",", "text", ",", "cols", ")", ":", "pad", "=", "' '", "*", "len", "(", "prefix", ".", "expandtabs", "(", ")", ")", "available", "=", "cols", "-", "len", "(", "pad", ")", "seq", "=", "text", ".", "split", "(", "' '...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/cbook.py#L1051-L1069
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/live/v20180801/live_client.py
python
LiveClient.DescribeLiveCert
(self, request)
获取证书信息 :param request: Request instance for DescribeLiveCert. :type request: :class:`tencentcloud.live.v20180801.models.DescribeLiveCertRequest` :rtype: :class:`tencentcloud.live.v20180801.models.DescribeLiveCertResponse`
获取证书信息
[ "获取证书信息" ]
def DescribeLiveCert(self, request): """获取证书信息 :param request: Request instance for DescribeLiveCert. :type request: :class:`tencentcloud.live.v20180801.models.DescribeLiveCertRequest` :rtype: :class:`tencentcloud.live.v20180801.models.DescribeLiveCertResponse` """ try:...
[ "def", "DescribeLiveCert", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeLiveCert\"", ",", "params", ")", "response", "=", "json", ".", "loads",...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/live/v20180801/live_client.py#L1402-L1427
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/base/management/commands/convert_pg_timestamp_to_tz.py
python
Command.handle
(self, *args, **options)
[]
def handle(self, *args, **options): verbosity = int(options['verbosity']) if "postgresql" in settings.DATABASES['default']['ENGINE']: updated_field_count = 0 total_values_updated = 0 start_dt = datetime.now() print("START: %s" % start_dt) mo...
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "verbosity", "=", "int", "(", "options", "[", "'verbosity'", "]", ")", "if", "\"postgresql\"", "in", "settings", ".", "DATABASES", "[", "'default'", "]", "[", "'ENGINE'...
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/base/management/commands/convert_pg_timestamp_to_tz.py#L29-L110
crownpku/Information-Extraction-Chinese
c0f649b63a4f9070e25bff20ab43936c41cd9936
NER_IDCNN_CRF/data_utils.py
python
input_from_line
(line, char_to_id)
return inputs
Take sentence data and return an input for the training or the evaluation function.
Take sentence data and return an input for the training or the evaluation function.
[ "Take", "sentence", "data", "and", "return", "an", "input", "for", "the", "training", "or", "the", "evaluation", "function", "." ]
def input_from_line(line, char_to_id): """ Take sentence data and return an input for the training or the evaluation function. """ line = full_to_half(line) line = replace_html(line) inputs = list() inputs.append([line]) line.replace(" ", "$") inputs.append([[char_to_id[char] if ...
[ "def", "input_from_line", "(", "line", ",", "char_to_id", ")", ":", "line", "=", "full_to_half", "(", "line", ")", "line", "=", "replace_html", "(", "line", ")", "inputs", "=", "list", "(", ")", "inputs", ".", "append", "(", "[", "line", "]", ")", "l...
https://github.com/crownpku/Information-Extraction-Chinese/blob/c0f649b63a4f9070e25bff20ab43936c41cd9936/NER_IDCNN_CRF/data_utils.py#L265-L279
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/backend_bases.py
python
RendererBase.open_group
(self, s, gid=None)
Open a grouping element with label *s*. If *gid* is given, use *gid* as the id of the group. Is only currently used by :mod:`~matplotlib.backends.backend_svg`.
Open a grouping element with label *s*. If *gid* is given, use *gid* as the id of the group. Is only currently used by :mod:`~matplotlib.backends.backend_svg`.
[ "Open", "a", "grouping", "element", "with", "label", "*", "s", "*", ".", "If", "*", "gid", "*", "is", "given", "use", "*", "gid", "*", "as", "the", "id", "of", "the", "group", ".", "Is", "only", "currently", "used", "by", ":", "mod", ":", "~matpl...
def open_group(self, s, gid=None): """ Open a grouping element with label *s*. If *gid* is given, use *gid* as the id of the group. Is only currently used by :mod:`~matplotlib.backends.backend_svg`. """
[ "def", "open_group", "(", "self", ",", "s", ",", "gid", "=", "None", ")", ":" ]
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/backend_bases.py#L151-L156
rigetti/grove
dc6bf6ec63e8c435fe52b1e00f707d5ce4cdb9b3
grove/utils/utility_programs.py
python
ControlledProgramBuilder.with_gate_name
(self, gate_name)
return self
Sets the name for the controlled gate, used in constructing and defining sqrts of the gate. :param String gate_name: :return: self, with gate_name set. :rtype: ControlledProgramBuilder
Sets the name for the controlled gate, used in constructing and defining sqrts of the gate.
[ "Sets", "the", "name", "for", "the", "controlled", "gate", "used", "in", "constructing", "and", "defining", "sqrts", "of", "the", "gate", "." ]
def with_gate_name(self, gate_name): """Sets the name for the controlled gate, used in constructing and defining sqrts of the gate. :param String gate_name: :return: self, with gate_name set. :rtype: ControlledProgramBuilder """ self.gate_name = gate_name ...
[ "def", "with_gate_name", "(", "self", ",", "gate_name", ")", ":", "self", ".", "gate_name", "=", "gate_name", "return", "self" ]
https://github.com/rigetti/grove/blob/dc6bf6ec63e8c435fe52b1e00f707d5ce4cdb9b3/grove/utils/utility_programs.py#L86-L95
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/enum.py
python
Flag.__repr__
(self)
return '<%s.%s: %r>' % ( cls.__name__, '|'.join([str(m._name_ or m._value_) for m in members]), self._value_, )
[]
def __repr__(self): cls = self.__class__ if self._name_ is not None: return '<%s.%s: %r>' % (cls.__name__, self._name_, self._value_) members, uncovered = _decompose(cls, self._value_) return '<%s.%s: %r>' % ( cls.__name__, '|'.join([str(m._nam...
[ "def", "__repr__", "(", "self", ")", ":", "cls", "=", "self", ".", "__class__", "if", "self", ".", "_name_", "is", "not", "None", ":", "return", "'<%s.%s: %r>'", "%", "(", "cls", ".", "__name__", ",", "self", ".", "_name_", ",", "self", ".", "_value_...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/enum.py#L703-L712
gammapy/gammapy
735b25cd5bbed35e2004d633621896dcd5295e8b
gammapy/scripts/info.py
python
get_info_system
()
return { "python_executable": sys.executable, "python_version": platform.python_version(), "machine": platform.machine(), "system": platform.system(), }
Get info about user system
Get info about user system
[ "Get", "info", "about", "user", "system" ]
def get_info_system(): """Get info about user system""" return { "python_executable": sys.executable, "python_version": platform.python_version(), "machine": platform.machine(), "system": platform.system(), }
[ "def", "get_info_system", "(", ")", ":", "return", "{", "\"python_executable\"", ":", "sys", ".", "executable", ",", "\"python_version\"", ":", "platform", ".", "python_version", "(", ")", ",", "\"machine\"", ":", "platform", ".", "machine", "(", ")", ",", "...
https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/gammapy/scripts/info.py#L76-L83
fabioz/PyDev.Debugger
0f8c02a010fe5690405da1dd30ed72326191ce63
pydevd_attach_to_process/winappdbg/process.py
python
_ProcessContainer.close_process_handles
(self)
Closes all open handles to processes in this snapshot.
Closes all open handles to processes in this snapshot.
[ "Closes", "all", "open", "handles", "to", "processes", "in", "this", "snapshot", "." ]
def close_process_handles(self): """ Closes all open handles to processes in this snapshot. """ for pid in self.get_process_ids(): aProcess = self.get_process(pid) try: aProcess.close_handle() except Exception: e = sys.e...
[ "def", "close_process_handles", "(", "self", ")", ":", "for", "pid", "in", "self", ".", "get_process_ids", "(", ")", ":", "aProcess", "=", "self", ".", "get_process", "(", "pid", ")", "try", ":", "aProcess", ".", "close_handle", "(", ")", "except", "Exce...
https://github.com/fabioz/PyDev.Debugger/blob/0f8c02a010fe5690405da1dd30ed72326191ce63/pydevd_attach_to_process/winappdbg/process.py#L4752-L4767
sosreport/sos
900e8bea7f3cd36c1dd48f3cbb351ab92f766654
sos/cleaner/__init__.py
python
SoSCleaner.preload_all_archives_into_maps
(self)
Before doing the actual obfuscation, if we have multiple archives to obfuscate then we need to preload each of them into the mappings to ensure that node1 is obfuscated in node2 as well as node2 being obfuscated in node1's archive.
Before doing the actual obfuscation, if we have multiple archives to obfuscate then we need to preload each of them into the mappings to ensure that node1 is obfuscated in node2 as well as node2 being obfuscated in node1's archive.
[ "Before", "doing", "the", "actual", "obfuscation", "if", "we", "have", "multiple", "archives", "to", "obfuscate", "then", "we", "need", "to", "preload", "each", "of", "them", "into", "the", "mappings", "to", "ensure", "that", "node1", "is", "obfuscated", "in...
def preload_all_archives_into_maps(self): """Before doing the actual obfuscation, if we have multiple archives to obfuscate then we need to preload each of them into the mappings to ensure that node1 is obfuscated in node2 as well as node2 being obfuscated in node1's archive. """...
[ "def", "preload_all_archives_into_maps", "(", "self", ")", ":", "self", ".", "log_info", "(", "\"Pre-loading all archives into obfuscation maps\"", ")", "for", "_arc", "in", "self", ".", "report_paths", ":", "for", "_parser", "in", "self", ".", "parsers", ":", "tr...
https://github.com/sosreport/sos/blob/900e8bea7f3cd36c1dd48f3cbb351ab92f766654/sos/cleaner/__init__.py#L501-L543
JaidedAI/EasyOCR
048e8ecb52ace84fb344be6c0ca847340816dfff
trainer/model.py
python
Model.__init__
(self, opt)
Transformation
Transformation
[ "Transformation" ]
def __init__(self, opt): super(Model, self).__init__() self.opt = opt self.stages = {'Trans': opt.Transformation, 'Feat': opt.FeatureExtraction, 'Seq': opt.SequenceModeling, 'Pred': opt.Prediction} """ Transformation """ if opt.Transformation == 'TPS': ...
[ "def", "__init__", "(", "self", ",", "opt", ")", ":", "super", "(", "Model", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "opt", "=", "opt", "self", ".", "stages", "=", "{", "'Trans'", ":", "opt", ".", "Transformation", ",", "'Feat'", ...
https://github.com/JaidedAI/EasyOCR/blob/048e8ecb52ace84fb344be6c0ca847340816dfff/trainer/model.py#L9-L50
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.4/django/db/models/sql/query.py
python
Query.need_force_having
(self, q_object)
return False
Returns whether or not all elements of this q_object need to be put together in the HAVING clause.
Returns whether or not all elements of this q_object need to be put together in the HAVING clause.
[ "Returns", "whether", "or", "not", "all", "elements", "of", "this", "q_object", "need", "to", "be", "put", "together", "in", "the", "HAVING", "clause", "." ]
def need_force_having(self, q_object): """ Returns whether or not all elements of this q_object need to be put together in the HAVING clause. """ for child in q_object.children: if isinstance(child, Node): if self.need_force_having(child): ...
[ "def", "need_force_having", "(", "self", ",", "q_object", ")", ":", "for", "child", "in", "q_object", ".", "children", ":", "if", "isinstance", "(", "child", ",", "Node", ")", ":", "if", "self", ".", "need_force_having", "(", "child", ")", ":", "return",...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/db/models/sql/query.py#L968-L980
Dozed12/df-style-worldgen
937455d54f4b02df9c4b10ae6418f4c932fd97bf
libtcodpy.py
python
Bsp.geth
(self)
return self.p.contents.h
[]
def geth(self): return self.p.contents.h
[ "def", "geth", "(", "self", ")", ":", "return", "self", ".", "p", ".", "contents", ".", "h" ]
https://github.com/Dozed12/df-style-worldgen/blob/937455d54f4b02df9c4b10ae6418f4c932fd97bf/libtcodpy.py#L1700-L1701
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/mailbox.py
python
Maildir.discard
(self, key)
If the keyed message exists, remove it.
If the keyed message exists, remove it.
[ "If", "the", "keyed", "message", "exists", "remove", "it", "." ]
def discard(self, key): """If the keyed message exists, remove it.""" try: self.remove(key) except KeyError: pass except OSError as e: if e.errno != errno.ENOENT: raise
[ "def", "discard", "(", "self", ",", "key", ")", ":", "try", ":", "self", ".", "remove", "(", "key", ")", "except", "KeyError", ":", "pass", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "!=", "errno", ".", "ENOENT", ":", "raise" ]
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/mailbox.py#L296-L304
openid/python-openid
afa6adacbe1a41d8f614c8bce2264dfbe9e76489
openid/consumer/consumer.py
python
GenericConsumer._verifyDiscoveredServices
(self, claimed_id, services, to_match_endpoints)
See @L{_discoverAndVerify}
See
[ "See" ]
def _verifyDiscoveredServices(self, claimed_id, services, to_match_endpoints): """See @L{_discoverAndVerify}""" # Search the services resulting from discovery to find one # that matches the information from the assertion failure_messages = [] for endpoint in services: ...
[ "def", "_verifyDiscoveredServices", "(", "self", ",", "claimed_id", ",", "services", ",", "to_match_endpoints", ")", ":", "# Search the services resulting from discovery to find one", "# that matches the information from the assertion", "failure_messages", "=", "[", "]", "for", ...
https://github.com/openid/python-openid/blob/afa6adacbe1a41d8f614c8bce2264dfbe9e76489/openid/consumer/consumer.py#L1058-L1082
out0fmemory/GoAgent-Always-Available
c4254984fea633ce3d1893fe5901debd9f22c2a9
server/lib/google/appengine/api/modules/modules.py
python
get_current_version_name
()
return os.environ['CURRENT_VERSION_ID'].split('.')[0]
Returns the version of the current instance. If this is version "v1" of module "module5" for app "my-app", this function will return "v1".
Returns the version of the current instance.
[ "Returns", "the", "version", "of", "the", "current", "instance", "." ]
def get_current_version_name(): """Returns the version of the current instance. If this is version "v1" of module "module5" for app "my-app", this function will return "v1". """ return os.environ['CURRENT_VERSION_ID'].split('.')[0]
[ "def", "get_current_version_name", "(", ")", ":", "return", "os", ".", "environ", "[", "'CURRENT_VERSION_ID'", "]", ".", "split", "(", "'.'", ")", "[", "0", "]" ]
https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/api/modules/modules.py#L84-L91
gmr/queries
6995ad18ee2b7fe2ce36d75f50979a47e3e2171d
queries/pool.py
python
PoolManager.remove_connection
(cls, pid, connection)
Remove a connection from the pool, closing it if is open. :param str pid: The pool ID :param connection: The connection to remove :type connection: psycopg2.extensions.connection :raises: ConnectionNotFoundError
Remove a connection from the pool, closing it if is open.
[ "Remove", "a", "connection", "from", "the", "pool", "closing", "it", "if", "is", "open", "." ]
def remove_connection(cls, pid, connection): """Remove a connection from the pool, closing it if is open. :param str pid: The pool ID :param connection: The connection to remove :type connection: psycopg2.extensions.connection :raises: ConnectionNotFoundError """ ...
[ "def", "remove_connection", "(", "cls", ",", "pid", ",", "connection", ")", ":", "cls", ".", "_ensure_pool_exists", "(", "pid", ")", "cls", ".", "_pools", "[", "pid", "]", ".", "remove", "(", "connection", ")" ]
https://github.com/gmr/queries/blob/6995ad18ee2b7fe2ce36d75f50979a47e3e2171d/queries/pool.py#L616-L626
ebroecker/canmatrix
219a19adf4639b0b4fd5328f039563c6d4060887
src/canmatrix/utils.py
python
decode_number
(value, float_factory)
return int(value, base)
Decode string to integer and guess correct base :param value: string input value :return: integer
Decode string to integer and guess correct base :param value: string input value :return: integer
[ "Decode", "string", "to", "integer", "and", "guess", "correct", "base", ":", "param", "value", ":", "string", "input", "value", ":", "return", ":", "integer" ]
def decode_number(value, float_factory): # type(string) -> (int) """ Decode string to integer and guess correct base :param value: string input value :return: integer """ if value is None: return 0 value = value.strip() if '.' in value: return float_factory(value) ...
[ "def", "decode_number", "(", "value", ",", "float_factory", ")", ":", "# type(string) -> (int)", "if", "value", "is", "None", ":", "return", "0", "value", "=", "value", ".", "strip", "(", ")", "if", "'.'", "in", "value", ":", "return", "float_factory", "("...
https://github.com/ebroecker/canmatrix/blob/219a19adf4639b0b4fd5328f039563c6d4060887/src/canmatrix/utils.py#L118-L139
xingag/spider_python
80668005f1416dab04c25569b35b679a2a6b2e5d
微信聊天记录/main.py
python
WeiXin.generate_wordcloud
(self, word)
生成词云 :param word:词云内容 :return:
生成词云 :param word:词云内容 :return:
[ "生成词云", ":", "param", "word", ":", "词云内容", ":", "return", ":" ]
def generate_wordcloud(self, word): """ 生成词云 :param word:词云内容 :return: """ img = WordCloud(font_path="./DroidSansFallbackFull.ttf", width=2000, height=2000, margin=2, collocations=False).generate(word) plt.imshow(img) plt.axis("off...
[ "def", "generate_wordcloud", "(", "self", ",", "word", ")", ":", "img", "=", "WordCloud", "(", "font_path", "=", "\"./DroidSansFallbackFull.ttf\"", ",", "width", "=", "2000", ",", "height", "=", "2000", ",", "margin", "=", "2", ",", "collocations", "=", "F...
https://github.com/xingag/spider_python/blob/80668005f1416dab04c25569b35b679a2a6b2e5d/微信聊天记录/main.py#L135-L147
gnemoug/sina_reptile
c3273681c1ba79273dd9197122b73135e10584a2
SDK1/weibopy/api.py
python
API.exists_block
(self, *args, **kargs)
return True
[]
def exists_block(self, *args, **kargs): try: bind_api( path = '/blocks/exists.json', allowed_param = ['id', 'user_id', 'screen_name'], require_auth = True )(self, *args, **kargs) except WeibopError: return False ...
[ "def", "exists_block", "(", "self", ",", "*", "args", ",", "*", "*", "kargs", ")", ":", "try", ":", "bind_api", "(", "path", "=", "'/blocks/exists.json'", ",", "allowed_param", "=", "[", "'id'", ",", "'user_id'", ",", "'screen_name'", "]", ",", "require_...
https://github.com/gnemoug/sina_reptile/blob/c3273681c1ba79273dd9197122b73135e10584a2/SDK1/weibopy/api.py#L504-L513
shekkizh/TensorflowProjects
5bd5563a5310df0b87725d989e84d49da0ea8c00
Misc/FindInceptionSimilarity.py
python
maybe_download_and_extract
()
[]
def maybe_download_and_extract(): dest_directory = FLAGS.model_dir if not os.path.exists(dest_directory): os.makedirs(dest_directory) filename = DATA_URL.split('/')[-1] filepath = os.path.join(dest_directory, filename) if not os.path.exists(filepath): def _progress(count, block_size,...
[ "def", "maybe_download_and_extract", "(", ")", ":", "dest_directory", "=", "FLAGS", ".", "model_dir", "if", "not", "os", ".", "path", ".", "exists", "(", "dest_directory", ")", ":", "os", ".", "makedirs", "(", "dest_directory", ")", "filename", "=", "DATA_UR...
https://github.com/shekkizh/TensorflowProjects/blob/5bd5563a5310df0b87725d989e84d49da0ea8c00/Misc/FindInceptionSimilarity.py#L32-L46
wistbean/fxxkpython
88e16d79d8dd37236ba6ecd0d0ff11d63143968c
vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py
python
IMetadataProvider.get_metadata
(name)
The named metadata resource as a string
The named metadata resource as a string
[ "The", "named", "metadata", "resource", "as", "a", "string" ]
def get_metadata(name): """The named metadata resource as a string"""
[ "def", "get_metadata", "(", "name", ")", ":" ]
https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L504-L505
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/utils/parsers/robots/data_structures.py
python
MultiBody.quaternion
(self)
return self.frame.quaternion
Return the tree frame orientation expressed as a quaternion [x,y,z,w].
Return the tree frame orientation expressed as a quaternion [x,y,z,w].
[ "Return", "the", "tree", "frame", "orientation", "expressed", "as", "a", "quaternion", "[", "x", "y", "z", "w", "]", "." ]
def quaternion(self): """Return the tree frame orientation expressed as a quaternion [x,y,z,w].""" return self.frame.quaternion
[ "def", "quaternion", "(", "self", ")", ":", "return", "self", ".", "frame", ".", "quaternion" ]
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/utils/parsers/robots/data_structures.py#L989-L991
Udayraj123/OMRChecker
4f11cf4a30c9f6c1cf780f300837d50f7db1fda7
main.py
python
evaluate
(resp, squad="H", explain=False)
return marks
[]
def evaluate(resp, squad="H", explain=False): # TODO: @contributors - Need help generalizing this function global Answers, Sections marks = 0 answers = Answers[squad] if(explain): print('Question\tStatus \t Streak\tSection \tMarks_Update\tMarked:\tAnswer:') for scheme, section in Section...
[ "def", "evaluate", "(", "resp", ",", "squad", "=", "\"H\"", ",", "explain", "=", "False", ")", ":", "# TODO: @contributors - Need help generalizing this function", "global", "Answers", ",", "Sections", "marks", "=", "0", "answers", "=", "Answers", "[", "squad", ...
https://github.com/Udayraj123/OMRChecker/blob/4f11cf4a30c9f6c1cf780f300837d50f7db1fda7/main.py#L154-L231
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/distribute/setuptools/command/bdist_egg.py
python
bdist_egg.make_init_files
(self)
return init_files
Create missing package __init__ files
Create missing package __init__ files
[ "Create", "missing", "package", "__init__", "files" ]
def make_init_files(self): """Create missing package __init__ files""" init_files = [] for base,dirs,files in walk_egg(self.bdist_dir): if base==self.bdist_dir: # don't put an __init__ in the root continue for name in files: ...
[ "def", "make_init_files", "(", "self", ")", ":", "init_files", "=", "[", "]", "for", "base", ",", "dirs", ",", "files", "in", "walk_egg", "(", "self", ".", "bdist_dir", ")", ":", "if", "base", "==", "self", ".", "bdist_dir", ":", "# don't put an __init__...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/distribute/setuptools/command/bdist_egg.py#L268-L291
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/gpt_neo/modeling_gpt_neo.py
python
GPTNeoSelfAttention._split_heads
(self, tensor, num_heads, attn_head_size)
return tensor.permute(0, 2, 1, 3)
Splits hidden_size dim into attn_head_size and num_heads
Splits hidden_size dim into attn_head_size and num_heads
[ "Splits", "hidden_size", "dim", "into", "attn_head_size", "and", "num_heads" ]
def _split_heads(self, tensor, num_heads, attn_head_size): """ Splits hidden_size dim into attn_head_size and num_heads """ new_shape = tensor.size()[:-1] + (num_heads, attn_head_size) tensor = tensor.view(*new_shape) return tensor.permute(0, 2, 1, 3)
[ "def", "_split_heads", "(", "self", ",", "tensor", ",", "num_heads", ",", "attn_head_size", ")", ":", "new_shape", "=", "tensor", ".", "size", "(", ")", "[", ":", "-", "1", "]", "+", "(", "num_heads", ",", "attn_head_size", ")", "tensor", "=", "tensor"...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/gpt_neo/modeling_gpt_neo.py#L171-L177
hasgeek/hasjob
38098e8034ee749704dea65394b366e8adc5c71f
hasjob/views/index.py
python
browse_by_email
(md5sum)
return index( basequery=basequery, md5sum=md5sum, showall=True, cached=False, template_vars={'jobpost_user': jobpost_user}, )
[]
def browse_by_email(md5sum): if not md5sum: abort(404) basequery = JobPost.query.filter_by(md5sum=md5sum) jobpost = basequery.first_or_404() jobpost_user = jobpost.user return index( basequery=basequery, md5sum=md5sum, showall=True, cached=False, templ...
[ "def", "browse_by_email", "(", "md5sum", ")", ":", "if", "not", "md5sum", ":", "abort", "(", "404", ")", "basequery", "=", "JobPost", ".", "query", ".", "filter_by", "(", "md5sum", "=", "md5sum", ")", "jobpost", "=", "basequery", ".", "first_or_404", "("...
https://github.com/hasgeek/hasjob/blob/38098e8034ee749704dea65394b366e8adc5c71f/hasjob/views/index.py#L845-L857
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/werkzeug/contrib/sessions.py
python
SessionMiddleware.__init__
(self, app, store, cookie_name='session_id', cookie_age=None, cookie_expires=None, cookie_path='/', cookie_domain=None, cookie_secure=None, cookie_httponly=False, environ_key='werkzeug.session')
[]
def __init__(self, app, store, cookie_name='session_id', cookie_age=None, cookie_expires=None, cookie_path='/', cookie_domain=None, cookie_secure=None, cookie_httponly=False, environ_key='werkzeug.session'): self.app = app self.store = store sel...
[ "def", "__init__", "(", "self", ",", "app", ",", "store", ",", "cookie_name", "=", "'session_id'", ",", "cookie_age", "=", "None", ",", "cookie_expires", "=", "None", ",", "cookie_path", "=", "'/'", ",", "cookie_domain", "=", "None", ",", "cookie_secure", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/werkzeug/contrib/sessions.py#L318-L331
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/indexes/range.py
python
RangeIndex.intersection
(self, other, sort=False)
return new_index
Form the intersection of two Index objects. Parameters ---------- other : Index or array-like sort : False or None, default False Sort the resulting index if possible .. versionadded:: 0.24.0 .. versionchanged:: 0.24.1 Changed the de...
Form the intersection of two Index objects.
[ "Form", "the", "intersection", "of", "two", "Index", "objects", "." ]
def intersection(self, other, sort=False): """ Form the intersection of two Index objects. Parameters ---------- other : Index or array-like sort : False or None, default False Sort the resulting index if possible .. versionadded:: 0.24.0 ...
[ "def", "intersection", "(", "self", ",", "other", ",", "sort", "=", "False", ")", ":", "self", ".", "_validate_sort_keyword", "(", "sort", ")", "if", "self", ".", "equals", "(", "other", ")", ":", "return", "self", ".", "_get_reconciled_name_object", "(", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/indexes/range.py#L346-L412
cloudera/impyla
0c736af4cad2bade9b8e313badc08ec50e81c948
impala/_thrift_gen/TCLIService/ttypes.py
python
TByteValue.__init__
(self, value=None,)
[]
def __init__(self, value=None,): self.value = value
[ "def", "__init__", "(", "self", ",", "value", "=", "None", ",", ")", ":", "self", ".", "value", "=", "value" ]
https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/TCLIService/ttypes.py#L1326-L1327
smicallef/spiderfoot
fd4bf9394c9ab3ecc90adc3115c56349fb23165b
modules/sfp_iban.py
python
sfp_iban.watchedEvents
(self)
return ["TARGET_WEB_CONTENT", "DARKNET_MENTION_CONTENT", "LEAKSITE_CONTENT"]
[]
def watchedEvents(self): return ["TARGET_WEB_CONTENT", "DARKNET_MENTION_CONTENT", "LEAKSITE_CONTENT"]
[ "def", "watchedEvents", "(", "self", ")", ":", "return", "[", "\"TARGET_WEB_CONTENT\"", ",", "\"DARKNET_MENTION_CONTENT\"", ",", "\"LEAKSITE_CONTENT\"", "]" ]
https://github.com/smicallef/spiderfoot/blob/fd4bf9394c9ab3ecc90adc3115c56349fb23165b/modules/sfp_iban.py#L46-L48
vaastav/Fantasy-Premier-League
487bc69c3ae2834f2a567ae34193dc6b2ca529c7
gameweek.py
python
get_recent_gameweek_id
()
Get's the most recent gameweek's ID.
Get's the most recent gameweek's ID.
[ "Get", "s", "the", "most", "recent", "gameweek", "s", "ID", "." ]
def get_recent_gameweek_id(): """ Get's the most recent gameweek's ID. """ data = requests.get('https://fantasy.premierleague.com/api/bootstrap-static/') data = json.loads(data.content) gameweeks = data['events'] now = datetime.utcnow() for gameweek in gameweeks: next_dead...
[ "def", "get_recent_gameweek_id", "(", ")", ":", "data", "=", "requests", ".", "get", "(", "'https://fantasy.premierleague.com/api/bootstrap-static/'", ")", "data", "=", "json", ".", "loads", "(", "data", ".", "content", ")", "gameweeks", "=", "data", "[", "'even...
https://github.com/vaastav/Fantasy-Premier-League/blob/487bc69c3ae2834f2a567ae34193dc6b2ca529c7/gameweek.py#L6-L20
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/internet/endpoints.py
python
_WrappingProtocol.fileDescriptorReceived
(self, descriptor)
return self._wrappedProtocol.fileDescriptorReceived(descriptor)
Proxy C{fileDescriptorReceived} calls to our C{self._wrappedProtocol}
Proxy C{fileDescriptorReceived} calls to our C{self._wrappedProtocol}
[ "Proxy", "C", "{", "fileDescriptorReceived", "}", "calls", "to", "our", "C", "{", "self", ".", "_wrappedProtocol", "}" ]
def fileDescriptorReceived(self, descriptor): """ Proxy C{fileDescriptorReceived} calls to our C{self._wrappedProtocol} """ return self._wrappedProtocol.fileDescriptorReceived(descriptor)
[ "def", "fileDescriptorReceived", "(", "self", ",", "descriptor", ")", ":", "return", "self", ".", "_wrappedProtocol", ".", "fileDescriptorReceived", "(", "descriptor", ")" ]
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/internet/endpoints.py#L149-L153
quantumlib/Cirq
89f88b01d69222d3f1ec14d649b7b3a85ed9211f
cirq-web/cirq_web/widget.py
python
Widget._get_bundle_script
(self)
return _to_script_tag(bundle_filename)
Returns the bundle script of a widget
Returns the bundle script of a widget
[ "Returns", "the", "bundle", "script", "of", "a", "widget" ]
def _get_bundle_script(self): """Returns the bundle script of a widget""" bundle_filename = self.get_widget_bundle_name() return _to_script_tag(bundle_filename)
[ "def", "_get_bundle_script", "(", "self", ")", ":", "bundle_filename", "=", "self", ".", "get_widget_bundle_name", "(", ")", "return", "_to_script_tag", "(", "bundle_filename", ")" ]
https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/cirq-web/cirq_web/widget.py#L94-L97
PaddlePaddle/PaddleSlim
f895aebe441b2bef79ecc434626d3cac4b3cbd09
paddleslim/teachers/bert/reader/cls.py
python
DataProcessor.get_dev_examples
(self, data_dir)
Gets a collection of `InputExample`s for the dev set.
Gets a collection of `InputExample`s for the dev set.
[ "Gets", "a", "collection", "of", "InputExample", "s", "for", "the", "dev", "set", "." ]
def get_dev_examples(self, data_dir): """Gets a collection of `InputExample`s for the dev set.""" raise NotImplementedError()
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/PaddlePaddle/PaddleSlim/blob/f895aebe441b2bef79ecc434626d3cac4b3cbd09/paddleslim/teachers/bert/reader/cls.py#L56-L58
happinesslz/TANet
2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f
pointpillars_with_TANet/second/core/box_np_ops.py
python
center_to_minmax_2d_0_5
(centers, dims)
return np.concatenate([centers - dims / 2, centers + dims / 2], axis=-1)
[]
def center_to_minmax_2d_0_5(centers, dims): return np.concatenate([centers - dims / 2, centers + dims / 2], axis=-1)
[ "def", "center_to_minmax_2d_0_5", "(", "centers", ",", "dims", ")", ":", "return", "np", ".", "concatenate", "(", "[", "centers", "-", "dims", "/", "2", ",", "centers", "+", "dims", "/", "2", "]", ",", "axis", "=", "-", "1", ")" ]
https://github.com/happinesslz/TANet/blob/2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f/pointpillars_with_TANet/second/core/box_np_ops.py#L450-L451
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/operators.py
python
ColumnOperators.collate
(self, collation)
return self.operate(collate, collation)
Produce a :func:`~.expression.collate` clause against the parent object, given the collation string. .. seealso:: :func:`~.expression.collate`
Produce a :func:`~.expression.collate` clause against the parent object, given the collation string.
[ "Produce", "a", ":", "func", ":", "~", ".", "expression", ".", "collate", "clause", "against", "the", "parent", "object", "given", "the", "collation", "string", "." ]
def collate(self, collation): """Produce a :func:`~.expression.collate` clause against the parent object, given the collation string. .. seealso:: :func:`~.expression.collate` """ return self.operate(collate, collation)
[ "def", "collate", "(", "self", ",", "collation", ")", ":", "return", "self", ".", "operate", "(", "collate", ",", "collation", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/operators.py#L902-L911
annoviko/pyclustering
bf4f51a472622292627ec8c294eb205585e50f52
pyclustering/gcolor/hysteresis.py
python
hysteresis_analyser.allocate_clusters
(self, tolerance=0.1, threshold_steps=10)
return self.allocate_sync_ensembles(tolerance, threshold_steps=threshold_steps)
! @brief Returns list of clusters in line with state of ocillators (phases). @param[in] tolerance (double): Maximum error for allocation of synchronous ensemble oscillators. @param[in] threshold_steps (uint): Number of steps from the end of simulation that should be analysed for ensembl...
!
[ "!" ]
def allocate_clusters(self, tolerance=0.1, threshold_steps=10): """! @brief Returns list of clusters in line with state of ocillators (phases). @param[in] tolerance (double): Maximum error for allocation of synchronous ensemble oscillators. @param[in] threshold_steps (uint): Num...
[ "def", "allocate_clusters", "(", "self", ",", "tolerance", "=", "0.1", ",", "threshold_steps", "=", "10", ")", ":", "return", "self", ".", "allocate_sync_ensembles", "(", "tolerance", ",", "threshold_steps", "=", "threshold_steps", ")" ]
https://github.com/annoviko/pyclustering/blob/bf4f51a472622292627ec8c294eb205585e50f52/pyclustering/gcolor/hysteresis.py#L33-L49
NSchrading/redditDataExtractor
12f7b0523cf698635c33de800bd59473c9af9ced
RedditDataExtractor/GUI/genericListModelObjects.py
python
Subreddit.mostRecentDownloadTimestamp
(self, utc)
Override of parent class method - additionally check that the subreddit sorting type is "new". If it isn't, then we don't set the timestamp because submissions can be out of order in relation to their created_utc with the other sorting methods. :type utc: float
Override of parent class method - additionally check that the subreddit sorting type is "new". If it isn't, then we don't set the timestamp because submissions can be out of order in relation to their created_utc with the other sorting methods. :type utc: float
[ "Override", "of", "parent", "class", "method", "-", "additionally", "check", "that", "the", "subreddit", "sorting", "type", "is", "new", ".", "If", "it", "isn", "t", "then", "we", "don", "t", "set", "the", "timestamp", "because", "submissions", "can", "be"...
def mostRecentDownloadTimestamp(self, utc): """ Override of parent class method - additionally check that the subreddit sorting type is "new". If it isn't, then we don't set the timestamp because submissions can be out of order in relation to their created_utc with the other sorting meth...
[ "def", "mostRecentDownloadTimestamp", "(", "self", ",", "utc", ")", ":", "if", "GenericListModelObj", ".", "subSort", "==", "\"new\"", "and", "self", ".", "_mostRecentDownloadTimestamp", "is", "None", ":", "self", ".", "_mostRecentDownloadTimestamp", "=", "utc", "...
https://github.com/NSchrading/redditDataExtractor/blob/12f7b0523cf698635c33de800bd59473c9af9ced/RedditDataExtractor/GUI/genericListModelObjects.py#L95-L105
mcfletch/pyopengl
02d11dad9ff18e50db10e975c4756e17bf198464
OpenGL/extensions.py
python
_Alternate.__init__
( self, name, *alternates )
Initialize set of alternative implementations of the same function
Initialize set of alternative implementations of the same function
[ "Initialize", "set", "of", "alternative", "implementations", "of", "the", "same", "function" ]
def __init__( self, name, *alternates ): """Initialize set of alternative implementations of the same function""" self.__name__ = name self._alternatives = alternates if root.MODULE_ANNOTATIONS: frame = sys._getframe().f_back if frame and frame.f_back and '__name_...
[ "def", "__init__", "(", "self", ",", "name", ",", "*", "alternates", ")", ":", "self", ".", "__name__", "=", "name", "self", ".", "_alternatives", "=", "alternates", "if", "root", ".", "MODULE_ANNOTATIONS", ":", "frame", "=", "sys", ".", "_getframe", "("...
https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/extensions.py#L216-L223
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/databases/oeis.py
python
OEISSequence._repr_
(self)
return "%s: %s" % (self.id(), self.name())
r""" Print the sequence number and a short summary of this sequence. OUTPUT: - string. EXAMPLES:: sage: f = oeis(45) # optional -- internet sage: f # optional -- internet A000045: Fibonac...
r""" Print the sequence number and a short summary of this sequence.
[ "r", "Print", "the", "sequence", "number", "and", "a", "short", "summary", "of", "this", "sequence", "." ]
def _repr_(self): r""" Print the sequence number and a short summary of this sequence. OUTPUT: - string. EXAMPLES:: sage: f = oeis(45) # optional -- internet sage: f # optional -- internet ...
[ "def", "_repr_", "(", "self", ")", ":", "return", "\"%s: %s\"", "%", "(", "self", ".", "id", "(", ")", ",", "self", ".", "name", "(", ")", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/databases/oeis.py#L1295-L1315
pgmpy/pgmpy
24279929a28082ea994c52f3d165ca63fc56b02b
pgmpy/readwrite/XMLBeliefNetwork.py
python
XBNReader.get_variables
(self)
return variables
Returns a list of variables. Examples -------- >>> reader = XBNReader('xbn_test.xml') >>> reader.get_variables() {'a': {'TYPE': 'discrete', 'XPOS': '13495', 'YPOS': '10465', 'DESCRIPTION': '(a) Metastatic Cancer', 'STATES': ['Present', 'Absent']} ...
Returns a list of variables.
[ "Returns", "a", "list", "of", "variables", "." ]
def get_variables(self): """ Returns a list of variables. Examples -------- >>> reader = XBNReader('xbn_test.xml') >>> reader.get_variables() {'a': {'TYPE': 'discrete', 'XPOS': '13495', 'YPOS': '10465', 'DESCRIPTION': '(a) Metastatic Cancer', ...
[ "def", "get_variables", "(", "self", ")", ":", "variables", "=", "{", "}", "for", "variable", "in", "self", ".", "bnmodel", ".", "find", "(", "\"VARIABLES\"", ")", ":", "variables", "[", "variable", ".", "get", "(", "\"NAME\"", ")", "]", "=", "{", "\...
https://github.com/pgmpy/pgmpy/blob/24279929a28082ea994c52f3d165ca63fc56b02b/pgmpy/readwrite/XMLBeliefNetwork.py#L102-L130
tosher/Mediawiker
81bf97cace59bedcb1668e7830b85c36e014428e
lib/Crypto.lin.x64/Crypto/Hash/BLAKE2s.py
python
BLAKE2s_Hash.update
(self, data)
return self
Continue hashing of a message by consuming the next chunk of data. Args: data (byte string/byte array/memoryview): The next chunk of the message being hashed.
Continue hashing of a message by consuming the next chunk of data.
[ "Continue", "hashing", "of", "a", "message", "by", "consuming", "the", "next", "chunk", "of", "data", "." ]
def update(self, data): """Continue hashing of a message by consuming the next chunk of data. Args: data (byte string/byte array/memoryview): The next chunk of the message being hashed. """ if self._digest_done and not self._update_after_digest: raise TypeError(...
[ "def", "update", "(", "self", ",", "data", ")", ":", "if", "self", ".", "_digest_done", "and", "not", "self", ".", "_update_after_digest", ":", "raise", "TypeError", "(", "\"You can only call 'digest' or 'hexdigest' on this object\"", ")", "result", "=", "_raw_blake...
https://github.com/tosher/Mediawiker/blob/81bf97cace59bedcb1668e7830b85c36e014428e/lib/Crypto.lin.x64/Crypto/Hash/BLAKE2s.py#L102-L117
modflowpy/flopy
eecd1ad193c5972093c9712e5c4b7a83284f0688
flopy/utils/datafile.py
python
LayerFile.plot
( self, axes=None, kstpkper=None, totim=None, mflay=None, filename_base=None, **kwargs, )
return PlotUtilities._plot_array_helper( plotarray, model=self.model, axes=axes, filenames=filenames, mflay=mflay, modelgrid=self.mg, **kwargs, )
Plot 3-D model output data in a specific location in LayerFile instance Parameters ---------- axes : list of matplotlib.pyplot.axis List of matplotlib.pyplot.axis that will be used to plot data for each layer. If axes=None axes will be generated. (def...
Plot 3-D model output data in a specific location in LayerFile instance
[ "Plot", "3", "-", "D", "model", "output", "data", "in", "a", "specific", "location", "in", "LayerFile", "instance" ]
def plot( self, axes=None, kstpkper=None, totim=None, mflay=None, filename_base=None, **kwargs, ): """ Plot 3-D model output data in a specific location in LayerFile instance Parameters ---------- axes : list of...
[ "def", "plot", "(", "self", ",", "axes", "=", "None", ",", "kstpkper", "=", "None", ",", "totim", "=", "None", ",", "mflay", "=", "None", ",", "filename_base", "=", "None", ",", "*", "*", "kwargs", ",", ")", ":", "if", "\"file_extension\"", "in", "...
https://github.com/modflowpy/flopy/blob/eecd1ad193c5972093c9712e5c4b7a83284f0688/flopy/utils/datafile.py#L279-L395
rcorcs/NatI
fdf014f4292afdc95250add7b6658468043228e1
en/parser/nltk_lite/contrib/lambda.py
python
expressions
()
return [N, P, S]
Return a sequence of test expressions.
Return a sequence of test expressions.
[ "Return", "a", "sequence", "of", "test", "expressions", "." ]
def expressions(): """Return a sequence of test expressions.""" A = Lambda('a') X = Lambda('x') Y = Lambda('y') Z = Lambda('z') XA = Lambda(X, A) XY = Lambda(X, Y) XZ = Lambda(X, Z) YZ = Lambda(Y, Z) XYZ = Lambda(XY, Z) xX = Lambda('x', X) xyX = Lambda('x', Lambda('y', X)...
[ "def", "expressions", "(", ")", ":", "A", "=", "Lambda", "(", "'a'", ")", "X", "=", "Lambda", "(", "'x'", ")", "Y", "=", "Lambda", "(", "'y'", ")", "Z", "=", "Lambda", "(", "'z'", ")", "XA", "=", "Lambda", "(", "X", ",", "A", ")", "XY", "="...
https://github.com/rcorcs/NatI/blob/fdf014f4292afdc95250add7b6658468043228e1/en/parser/nltk_lite/contrib/lambda.py#L106-L126
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/mattermost.py
python
_get_hook
()
return hook
Retrieves and return the Mattermost's configured hook :return: String: the hook string
Retrieves and return the Mattermost's configured hook
[ "Retrieves", "and", "return", "the", "Mattermost", "s", "configured", "hook" ]
def _get_hook(): """ Retrieves and return the Mattermost's configured hook :return: String: the hook string """ hook = __salt__["config.get"]("mattermost.hook") or __salt__["config.get"]( "mattermost:hook" ) if not hook: raise SaltInvocationError("No Mattermost Ho...
[ "def", "_get_hook", "(", ")", ":", "hook", "=", "__salt__", "[", "\"config.get\"", "]", "(", "\"mattermost.hook\"", ")", "or", "__salt__", "[", "\"config.get\"", "]", "(", "\"mattermost:hook\"", ")", "if", "not", "hook", ":", "raise", "SaltInvocationError", "(...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/mattermost.py#L38-L50
gpleiss/temperature_scaling
126a50975e0cd76c0496c44080bcaf7defca42b3
demo.py
python
demo
(data, save, depth=40, growth_rate=12, batch_size=256)
Applies temperature scaling to a trained model. Takes a pretrained DenseNet-CIFAR100 model, and a validation set (parameterized by indices on train set). Applies temperature scaling, and saves a temperature scaled version. NB: the "save" parameter references a DIRECTORY, not a file. In that direct...
Applies temperature scaling to a trained model.
[ "Applies", "temperature", "scaling", "to", "a", "trained", "model", "." ]
def demo(data, save, depth=40, growth_rate=12, batch_size=256): """ Applies temperature scaling to a trained model. Takes a pretrained DenseNet-CIFAR100 model, and a validation set (parameterized by indices on train set). Applies temperature scaling, and saves a temperature scaled version. NB:...
[ "def", "demo", "(", "data", ",", "save", ",", "depth", "=", "40", ",", "growth_rate", "=", "12", ",", "batch_size", "=", "256", ")", ":", "# Load model state dict", "model_filename", "=", "os", ".", "path", ".", "join", "(", "save", ",", "'model.pth'", ...
https://github.com/gpleiss/temperature_scaling/blob/126a50975e0cd76c0496c44080bcaf7defca42b3/demo.py#L10-L68
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/unsupervised/owtsne.py
python
invalidated.__str__
(self)
return "%s(%s)" % (self.__class__.__name__, ", ".join( "=".join([k, str(getattr(self, k))]) for k in ["pca_projection", "affinities", "tsne_embedding"] ))
[]
def __str__(self): return "%s(%s)" % (self.__class__.__name__, ", ".join( "=".join([k, str(getattr(self, k))]) for k in ["pca_projection", "affinities", "tsne_embedding"] ))
[ "def", "__str__", "(", "self", ")", ":", "return", "\"%s(%s)\"", "%", "(", "self", ".", "__class__", ".", "__name__", ",", "\", \"", ".", "join", "(", "\"=\"", ".", "join", "(", "[", "k", ",", "str", "(", "getattr", "(", "self", ",", "k", ")", ")...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/unsupervised/owtsne.py#L245-L249
WoLpH/python-statsd
a757da04375c48d03d322246405b33382d37f03f
statsd/timer.py
python
Timer.send
(self, subname, delta)
Send the data to statsd via self.connection :keyword subname: The subname to report the data to (appended to the client name) :type subname: str :keyword delta: The time delta (time.time() - time.time()) to report :type delta: float
Send the data to statsd via self.connection
[ "Send", "the", "data", "to", "statsd", "via", "self", ".", "connection" ]
def send(self, subname, delta): '''Send the data to statsd via self.connection :keyword subname: The subname to report the data to (appended to the client name) :type subname: str :keyword delta: The time delta (time.time() - time.time()) to report :type delta: float...
[ "def", "send", "(", "self", ",", "subname", ",", "delta", ")", ":", "ms", "=", "delta", "*", "1000", "if", "ms", ">", "self", ".", "min_send_threshold", ":", "name", "=", "self", ".", "_get_name", "(", "self", ".", "name", ",", "subname", ")", "sel...
https://github.com/WoLpH/python-statsd/blob/a757da04375c48d03d322246405b33382d37f03f/statsd/timer.py#L50-L65
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/asyncio/unix_events.py
python
AbstractChildWatcher.__exit__
(self, a, b, c)
Exit the watcher's context
Exit the watcher's context
[ "Exit", "the", "watcher", "s", "context" ]
def __exit__(self, a, b, c): """Exit the watcher's context""" raise NotImplementedError()
[ "def", "__exit__", "(", "self", ",", "a", ",", "b", ",", "c", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/asyncio/unix_events.py#L886-L888
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/json/encoder.py
python
JSONEncoder.__init__
(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)
Constructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str o...
Constructor for JSONEncoder, with sensible defaults.
[ "Constructor", "for", "JSONEncoder", "with", "sensible", "defaults", "." ]
def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None): """Constructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encodi...
[ "def", "__init__", "(", "self", ",", "skipkeys", "=", "False", ",", "ensure_ascii", "=", "True", ",", "check_circular", "=", "True", ",", "allow_nan", "=", "True", ",", "sort_keys", "=", "False", ",", "indent", "=", "None", ",", "separators", "=", "None"...
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/json/encoder.py#L104-L158
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlproc.py
python
XMLProcessor.set_data_after_wf_error
(self,stop_on_wf=0)
Sets the parser policy on well-formedness errors. If this is set to 0 data events are still delivered, even after well-formedness errors. Otherwise no more data events reach the application after such erors.
Sets the parser policy on well-formedness errors. If this is set to 0 data events are still delivered, even after well-formedness errors. Otherwise no more data events reach the application after such erors.
[ "Sets", "the", "parser", "policy", "on", "well", "-", "formedness", "errors", ".", "If", "this", "is", "set", "to", "0", "data", "events", "are", "still", "delivered", "even", "after", "well", "-", "formedness", "errors", ".", "Otherwise", "no", "more", ...
def set_data_after_wf_error(self,stop_on_wf=0): """Sets the parser policy on well-formedness errors. If this is set to 0 data events are still delivered, even after well-formedness errors. Otherwise no more data events reach the application after such erors. """ self.stop_on_wf=s...
[ "def", "set_data_after_wf_error", "(", "self", ",", "stop_on_wf", "=", "0", ")", ":", "self", ".", "stop_on_wf", "=", "stop_on_wf" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlproc.py#L48-L53
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/req/req_install.py
python
InstallRequirement.__init__
(self, req, comes_from, source_dir=None, editable=False, link=None, as_egg=False, update=True, pycompile=True, markers=None, isolated=False, options=None, wheel_cache=None, constraint=False)
[]
def __init__(self, req, comes_from, source_dir=None, editable=False, link=None, as_egg=False, update=True, pycompile=True, markers=None, isolated=False, options=None, wheel_cache=None, constraint=False): self.extras = () if isinstance(req, six.string_ty...
[ "def", "__init__", "(", "self", ",", "req", ",", "comes_from", ",", "source_dir", "=", "None", ",", "editable", "=", "False", ",", "link", "=", "None", ",", "as_egg", "=", "False", ",", "update", "=", "True", ",", "pycompile", "=", "True", ",", "mark...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/req/req_install.py#L75-L135
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/lib2to3/pytree.py
python
BasePattern.match_seq
(self, nodes, results=None)
return self.match(nodes[0], results)
Does this pattern exactly match a sequence of nodes? Default implementation for non-wildcard patterns.
Does this pattern exactly match a sequence of nodes?
[ "Does", "this", "pattern", "exactly", "match", "a", "sequence", "of", "nodes?" ]
def match_seq(self, nodes, results=None): """ Does this pattern exactly match a sequence of nodes? Default implementation for non-wildcard patterns. """ if len(nodes) != 1: return False return self.match(nodes[0], results)
[ "def", "match_seq", "(", "self", ",", "nodes", ",", "results", "=", "None", ")", ":", "if", "len", "(", "nodes", ")", "!=", "1", ":", "return", "False", "return", "self", ".", "match", "(", "nodes", "[", "0", "]", ",", "results", ")" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/lib2to3/pytree.py#L513-L521
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_utils/src/class/yedit.py
python
Yedit.get_curr_value
(invalue, val_type)
return curr_value
return the current value
return the current value
[ "return", "the", "current", "value" ]
def get_curr_value(invalue, val_type): '''return the current value''' if invalue is None: return None curr_value = invalue if val_type == 'yaml': curr_value = yaml.safe_load(str(invalue)) elif val_type == 'json': curr_value = json.loads(invalu...
[ "def", "get_curr_value", "(", "invalue", ",", "val_type", ")", ":", "if", "invalue", "is", "None", ":", "return", "None", "curr_value", "=", "invalue", "if", "val_type", "==", "'yaml'", ":", "curr_value", "=", "yaml", ".", "safe_load", "(", "str", "(", "...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_utils/src/class/yedit.py#L534-L545
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/lib-tk/Tkinter.py
python
Misc._grid_configure
(self, command, index, cnf, kw)
Internal function.
Internal function.
[ "Internal", "function", "." ]
def _grid_configure(self, command, index, cnf, kw): """Internal function.""" if type(cnf) is StringType and not kw: if cnf[-1:] == '_': cnf = cnf[:-1] if cnf[:1] != '-': cnf = '-'+cnf options = (cnf,) else: options =...
[ "def", "_grid_configure", "(", "self", ",", "command", ",", "index", ",", "cnf", ",", "kw", ")", ":", "if", "type", "(", "cnf", ")", "is", "StringType", "and", "not", "kw", ":", "if", "cnf", "[", "-", "1", ":", "]", "==", "'_'", ":", "cnf", "="...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/lib-tk/Tkinter.py#L1405-L1424
apple/coremltools
141a83af482fcbdd5179807c9eaff9a7999c2c49
coremltools/models/neural_network/builder.py
python
NeuralNetworkBuilder.add_reduce_max
( self, name, input_name, output_name, axes=None, keepdims=True, reduce_all=False )
return spec_layer
Add a reduce_max layer to the model that reduces the input tensor using ``max(elements across given dimensions)``. Refer to the ``ReduceMaxLayerParams`` message in the specification (NeuralNetwork.proto) for more details. Parameters ---------- name: str The n...
Add a reduce_max layer to the model that reduces the input tensor using ``max(elements across given dimensions)``. Refer to the ``ReduceMaxLayerParams`` message in the specification (NeuralNetwork.proto) for more details.
[ "Add", "a", "reduce_max", "layer", "to", "the", "model", "that", "reduces", "the", "input", "tensor", "using", "max", "(", "elements", "across", "given", "dimensions", ")", ".", "Refer", "to", "the", "ReduceMaxLayerParams", "message", "in", "the", "specificati...
def add_reduce_max( self, name, input_name, output_name, axes=None, keepdims=True, reduce_all=False ): """ Add a reduce_max layer to the model that reduces the input tensor using ``max(elements across given dimensions)``. Refer to the ``ReduceMaxLayerParams`` message in the s...
[ "def", "add_reduce_max", "(", "self", ",", "name", ",", "input_name", ",", "output_name", ",", "axes", "=", "None", ",", "keepdims", "=", "True", ",", "reduce_all", "=", "False", ")", ":", "spec_layer", "=", "self", ".", "_add_generic_layer", "(", "name", ...
https://github.com/apple/coremltools/blob/141a83af482fcbdd5179807c9eaff9a7999c2c49/coremltools/models/neural_network/builder.py#L8178-L8223
enthought/mayavi
2103a273568b8f0bd62328801aafbd6252543ae8
mayavi/tools/data_wizards/data_source_factory.py
python
view
(src)
Open up a mayavi scene and display the dataset in it.
Open up a mayavi scene and display the dataset in it.
[ "Open", "up", "a", "mayavi", "scene", "and", "display", "the", "dataset", "in", "it", "." ]
def view(src): """ Open up a mayavi scene and display the dataset in it. """ from mayavi import mlab mayavi = mlab.get_engine() fig = mlab.figure(bgcolor=(1, 1, 1), fgcolor=(0, 0, 0),) mayavi.add_source(src) mlab.pipeline.surface(src, opacity=0.1) mlab.pipeline.surface(mlab.pipeline.ext...
[ "def", "view", "(", "src", ")", ":", "from", "mayavi", "import", "mlab", "mayavi", "=", "mlab", ".", "get_engine", "(", ")", "fig", "=", "mlab", ".", "figure", "(", "bgcolor", "=", "(", "1", ",", "1", ",", "1", ")", ",", "fgcolor", "=", "(", "0...
https://github.com/enthought/mayavi/blob/2103a273568b8f0bd62328801aafbd6252543ae8/mayavi/tools/data_wizards/data_source_factory.py#L181-L191
freedombox/FreedomBox
335a7f92cc08f27981f838a7cddfc67740598e54
plinth/modules/wireguard/utils.py
python
add_client
(public_key)
Add a permission for a client to connect our server.
Add a permission for a client to connect our server.
[ "Add", "a", "permission", "for", "a", "client", "to", "connect", "our", "server", "." ]
def add_client(public_key): """Add a permission for a client to connect our server.""" setting_name = nm.SETTING_WIREGUARD_SETTING_NAME connection = _server_connection() settings = connection.get_setting_by_name(setting_name) peer, _ = settings.get_peer_by_public_key(public_key) if peer: ...
[ "def", "add_client", "(", "public_key", ")", ":", "setting_name", "=", "nm", ".", "SETTING_WIREGUARD_SETTING_NAME", "connection", "=", "_server_connection", "(", ")", "settings", "=", "connection", ".", "get_setting_by_name", "(", "setting_name", ")", "peer", ",", ...
https://github.com/freedombox/FreedomBox/blob/335a7f92cc08f27981f838a7cddfc67740598e54/plinth/modules/wireguard/utils.py#L258-L273
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/subliminal/providers/addic7ed.py
python
Addic7edProvider._get_show_ids
(self)
return show_ids
Get the ``dict`` of show ids per series by querying the `shows.php` page. :return: show id per series, lower case and without quotes. :rtype: dict
Get the ``dict`` of show ids per series by querying the `shows.php` page.
[ "Get", "the", "dict", "of", "show", "ids", "per", "series", "by", "querying", "the", "shows", ".", "php", "page", "." ]
def _get_show_ids(self): """Get the ``dict`` of show ids per series by querying the `shows.php` page. :return: show id per series, lower case and without quotes. :rtype: dict """ # get the show page logger.info('Getting show ids') r = self.session.get(self.serve...
[ "def", "_get_show_ids", "(", "self", ")", ":", "# get the show page", "logger", ".", "info", "(", "'Getting show ids'", ")", "r", "=", "self", ".", "session", ".", "get", "(", "self", ".", "server_url", "+", "'shows.php'", ",", "timeout", "=", "10", ")", ...
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/subliminal/providers/addic7ed.py#L124-L152
CouchPotato/CouchPotatoServer
7260c12f72447ddb6f062367c6dfbda03ecd4e9c
libs/pkg_resources.py
python
WorkingSet.find_plugins
(self, plugin_env, full_env=None, installer=None, fallback=True )
return distributions, error_info
Find all activatable distributions in `plugin_env` Example usage:: distributions, errors = working_set.find_plugins( Environment(plugin_dirlist) ) map(working_set.add, distributions) # add plugins+libs to sys.path print "Couldn't load", errors ...
Find all activatable distributions in `plugin_env`
[ "Find", "all", "activatable", "distributions", "in", "plugin_env" ]
def find_plugins(self, plugin_env, full_env=None, installer=None, fallback=True ): """Find all activatable distributions in `plugin_env` Example usage:: distributions, errors = working_set.find_plugins( Environment(plugin_dirlist) ) map(w...
[ "def", "find_plugins", "(", "self", ",", "plugin_env", ",", "full_env", "=", "None", ",", "installer", "=", "None", ",", "fallback", "=", "True", ")", ":", "plugin_projects", "=", "list", "(", "plugin_env", ")", "plugin_projects", ".", "sort", "(", ")", ...
https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/pkg_resources.py#L575-L651
mongodb/mongo-python-driver
c760f900f2e4109a247c2ffc8ad3549362007772
pymongo/client_session.py
python
ClientSession._starting_transaction
(self)
return self._transaction.starting()
True if this session is starting a multi-statement transaction.
True if this session is starting a multi-statement transaction.
[ "True", "if", "this", "session", "is", "starting", "a", "multi", "-", "statement", "transaction", "." ]
def _starting_transaction(self): """True if this session is starting a multi-statement transaction. """ return self._transaction.starting()
[ "def", "_starting_transaction", "(", "self", ")", ":", "return", "self", ".", "_transaction", ".", "starting", "(", ")" ]
https://github.com/mongodb/mongo-python-driver/blob/c760f900f2e4109a247c2ffc8ad3549362007772/pymongo/client_session.py#L872-L875
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_scale.py
python
OpenShiftCLI._delete
(self, resource, name=None, selector=None)
return self.openshift_cmd(cmd)
call oc delete on a resource
call oc delete on a resource
[ "call", "oc", "delete", "on", "a", "resource" ]
def _delete(self, resource, name=None, selector=None): '''call oc delete on a resource''' cmd = ['delete', resource] if selector is not None: cmd.append('--selector={}'.format(selector)) elif name is not None: cmd.append(name) else: raise OpenS...
[ "def", "_delete", "(", "self", ",", "resource", ",", "name", "=", "None", ",", "selector", "=", "None", ")", ":", "cmd", "=", "[", "'delete'", ",", "resource", "]", "if", "selector", "is", "not", "None", ":", "cmd", ".", "append", "(", "'--selector={...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_scale.py#L947-L957
complexdb/zincbase
0c8ce46bc392dfa8ee99414877adb3b41648451e
zincbase/graph/Node.py
python
Node.watch_for_new_neighbor
(self, fn)
Execute `fn` when node receives a new neighbor.
Execute `fn` when node receives a new neighbor.
[ "Execute", "fn", "when", "node", "receives", "a", "new", "neighbor", "." ]
def watch_for_new_neighbor(self, fn): """Execute `fn` when node receives a new neighbor.""" self.__setattr__('_new_neighbor_fn', fn)
[ "def", "watch_for_new_neighbor", "(", "self", ",", "fn", ")", ":", "self", ".", "__setattr__", "(", "'_new_neighbor_fn'", ",", "fn", ")" ]
https://github.com/complexdb/zincbase/blob/0c8ce46bc392dfa8ee99414877adb3b41648451e/zincbase/graph/Node.py#L162-L164
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/ipwhois/rdap.py
python
RDAP.lookup
(self, inc_raw=False, retry_count=3, asn_data=None, depth=0, excluded_entities=None, response=None, bootstrap=False, rate_limit_timeout=120, root_ent_check=True)
return results
The function for retrieving and parsing information for an IP address via RDAP (HTTP). Args: inc_raw (:obj:`bool`, optional): Whether to include the raw results in the returned dictionary. Defaults to False. retry_count (:obj:`int`): The number of times to retry ...
The function for retrieving and parsing information for an IP address via RDAP (HTTP).
[ "The", "function", "for", "retrieving", "and", "parsing", "information", "for", "an", "IP", "address", "via", "RDAP", "(", "HTTP", ")", "." ]
def lookup(self, inc_raw=False, retry_count=3, asn_data=None, depth=0, excluded_entities=None, response=None, bootstrap=False, rate_limit_timeout=120, root_ent_check=True): """ The function for retrieving and parsing information for an IP address via RDAP (HTTP). ...
[ "def", "lookup", "(", "self", ",", "inc_raw", "=", "False", ",", "retry_count", "=", "3", ",", "asn_data", "=", "None", ",", "depth", "=", "0", ",", "excluded_entities", "=", "None", ",", "response", "=", "None", ",", "bootstrap", "=", "False", ",", ...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/ipwhois/rdap.py#L778-L962
mapbox/robosat
cbb1c73328183afd2d6351b7bfa3f430b73103ea
robosat/tools/rasterize.py
python
burn
(tile, features, size)
return rasterize(shapes, out_shape=(size, size), transform=transform)
Burn tile with features. Args: tile: the mercantile tile to burn. features: the geojson features to burn. size: the size of burned image. Returns: image: rasterized file of size with features burned.
Burn tile with features.
[ "Burn", "tile", "with", "features", "." ]
def burn(tile, features, size): """Burn tile with features. Args: tile: the mercantile tile to burn. features: the geojson features to burn. size: the size of burned image. Returns: image: rasterized file of size with features burned. """ # the value you want in the output...
[ "def", "burn", "(", "tile", ",", "features", ",", "size", ")", ":", "# the value you want in the output raster where a shape exists", "burnval", "=", "1", "shapes", "=", "(", "(", "geometry", ",", "burnval", ")", "for", "feature", "in", "features", "for", "geome...
https://github.com/mapbox/robosat/blob/cbb1c73328183afd2d6351b7bfa3f430b73103ea/robosat/tools/rasterize.py#L64-L83
themix-project/oomox
1bb0f3033736c56652e25c7d7b47c7fc499bfeb1
oomox_gui/preset_list.py
python
ThemePresetList._get_current_treepath
(self)
return self.treeview.get_cursor()[0]
[]
def _get_current_treepath(self): return self.treeview.get_cursor()[0]
[ "def", "_get_current_treepath", "(", "self", ")", ":", "return", "self", ".", "treeview", ".", "get_cursor", "(", ")", "[", "0", "]" ]
https://github.com/themix-project/oomox/blob/1bb0f3033736c56652e25c7d7b47c7fc499bfeb1/oomox_gui/preset_list.py#L138-L139
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/pep517/colorlog.py
python
LogFormatter.__init__
(self, color=True, datefmt=None)
r""" :arg bool color: Enables color support. :arg string fmt: Log message format. It will be applied to the attributes dict of log records. The text between ``%(color)s`` and ``%(end_color)s`` will be colored depending on the level if color support is on. :arg dict colors...
r""" :arg bool color: Enables color support. :arg string fmt: Log message format. It will be applied to the attributes dict of log records. The text between ``%(color)s`` and ``%(end_color)s`` will be colored depending on the level if color support is on. :arg dict colors...
[ "r", ":", "arg", "bool", "color", ":", "Enables", "color", "support", ".", ":", "arg", "string", "fmt", ":", "Log", "message", "format", ".", "It", "will", "be", "applied", "to", "the", "attributes", "dict", "of", "log", "records", ".", "The", "text", ...
def __init__(self, color=True, datefmt=None): r""" :arg bool color: Enables color support. :arg string fmt: Log message format. It will be applied to the attributes dict of log records. The text between ``%(color)s`` and ``%(end_color)s`` will be colored depending on the ...
[ "def", "__init__", "(", "self", ",", "color", "=", "True", ",", "datefmt", "=", "None", ")", ":", "logging", ".", "Formatter", ".", "__init__", "(", "self", ",", "datefmt", "=", "datefmt", ")", "self", ".", "_colors", "=", "{", "}", "if", "color", ...
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/pep517/colorlog.py#L50-L91
renyijiu/douyin_downloader
20c4921fb1280b25e9abe42b959990b18ae1416d
douyin-bot.py
python
next_page
()
翻到下一页 :return:
翻到下一页 :return:
[ "翻到下一页", ":", "return", ":" ]
def next_page(): """ 翻到下一页 :return: """ time.sleep(1.5) cmd = 'shell input swipe {x1} {y1} {x2} {y2} {duration}'.format( x1=config['center_point']['x'], y1=config['center_point']['y'] + config['center_point']['ry'], x2=config['center_point']['x'], y2=config['cent...
[ "def", "next_page", "(", ")", ":", "time", ".", "sleep", "(", "1.5", ")", "cmd", "=", "'shell input swipe {x1} {y1} {x2} {y2} {duration}'", ".", "format", "(", "x1", "=", "config", "[", "'center_point'", "]", "[", "'x'", "]", ",", "y1", "=", "config", "[",...
https://github.com/renyijiu/douyin_downloader/blob/20c4921fb1280b25e9abe42b959990b18ae1416d/douyin-bot.py#L76-L90
vanheeringen-lab/genomepy
4c10e69b6886cf52381caf6498395391834a675b
genomepy/cli.py
python
get_install_options
()
return {}
Combine general and provider specific options. Add the provider name in front of the options to prevent overlap.
Combine general and provider specific options.
[ "Combine", "general", "and", "provider", "specific", "options", "." ]
def get_install_options(): """ Combine general and provider specific options. Add the provider name in front of the options to prevent overlap. """ if sys.argv[1] == "install": install_options = INSTALL_OPTIONS # extend install options with provider specific options for pro...
[ "def", "get_install_options", "(", ")", ":", "if", "sys", ".", "argv", "[", "1", "]", "==", "\"install\"", ":", "install_options", "=", "INSTALL_OPTIONS", "# extend install options with provider specific options", "for", "provider", "in", "genomepy", ".", "list_provid...
https://github.com/vanheeringen-lab/genomepy/blob/4c10e69b6886cf52381caf6498395391834a675b/genomepy/cli.py#L185-L206
rwth-i6/returnn
f2d718a197a280b0d5f0fd91a7fcb8658560dddb
returnn/tf/layers/basic.py
python
UnflattenNdLayer.get_out_data_from_opts
(cls, name, sources, num_axes, in_dim="T", out_dims=None, declare_same_sizes_as=None, **kwargs)
return out
:param str name: :param list[LayerBase] sources: :param int num_axes: :param Dim|str|None in_dim: :param list[Dim]|None out_dims: :param dict[int,LayerBase]|None declare_same_sizes_as: :rtype: Data
:param str name: :param list[LayerBase] sources: :param int num_axes: :param Dim|str|None in_dim: :param list[Dim]|None out_dims: :param dict[int,LayerBase]|None declare_same_sizes_as: :rtype: Data
[ ":", "param", "str", "name", ":", ":", "param", "list", "[", "LayerBase", "]", "sources", ":", ":", "param", "int", "num_axes", ":", ":", "param", "Dim|str|None", "in_dim", ":", ":", "param", "list", "[", "Dim", "]", "|None", "out_dims", ":", ":", "p...
def get_out_data_from_opts(cls, name, sources, num_axes, in_dim="T", out_dims=None, declare_same_sizes_as=None, **kwargs): """ :param str name: :param list[LayerBase] sources: :param int num_axes: :param Dim|str|None in_dim: :param list[Dim]|None out_dims: :param...
[ "def", "get_out_data_from_opts", "(", "cls", ",", "name", ",", "sources", ",", "num_axes", ",", "in_dim", "=", "\"T\"", ",", "out_dims", "=", "None", ",", "declare_same_sizes_as", "=", "None", ",", "*", "*", "kwargs", ")", ":", "out", "=", "get_concat_sour...
https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/tf/layers/basic.py#L3723-L3753
ucsb-seclab/karonte
427ac313e596f723e40768b95d13bd7a9fc92fd8
eval/multi_bin/bdg_bins/binary_dependency_graph/plugins/setter_getter.py
python
SetterGetter.role_strings_info
(self)
return self._role_strings_info
[]
def role_strings_info(self): return self._role_strings_info
[ "def", "role_strings_info", "(", "self", ")", ":", "return", "self", ".", "_role_strings_info" ]
https://github.com/ucsb-seclab/karonte/blob/427ac313e596f723e40768b95d13bd7a9fc92fd8/eval/multi_bin/bdg_bins/binary_dependency_graph/plugins/setter_getter.py#L146-L147
zvtvz/zvt
054bf8a3e7a049df7087c324fa87e8effbaf5bdc
examples/data_runner/index_runner.py
python
record_index_kdata
()
[]
def record_index_kdata(): run_data_recorder( domain=Index1dKdata, data_provider="em", entity_provider="exchange", codes=IMPORTANT_INDEX, day_data=True )
[ "def", "record_index_kdata", "(", ")", ":", "run_data_recorder", "(", "domain", "=", "Index1dKdata", ",", "data_provider", "=", "\"em\"", ",", "entity_provider", "=", "\"exchange\"", ",", "codes", "=", "IMPORTANT_INDEX", ",", "day_data", "=", "True", ")" ]
https://github.com/zvtvz/zvt/blob/054bf8a3e7a049df7087c324fa87e8effbaf5bdc/examples/data_runner/index_runner.py#L26-L29
wulczer/txpostgres
bd56a3648574bfd0c24543e4d9e4a611458c2da1
txpostgres/txpostgres.py
python
Connection.checkForNotifies
(self)
Check if :pg:`NOTIFY <notify>` events have been received and if so, dispatch them to the registered observers, using the :tm:`Cooperator <internet.task.Cooperator>` provided in the constructor. This is done automatically, user code should never need to call this method.
Check if :pg:`NOTIFY <notify>` events have been received and if so, dispatch them to the registered observers, using the :tm:`Cooperator <internet.task.Cooperator>` provided in the constructor. This is done automatically, user code should never need to call this method.
[ "Check", "if", ":", "pg", ":", "NOTIFY", "<notify", ">", "events", "have", "been", "received", "and", "if", "so", "dispatch", "them", "to", "the", "registered", "observers", "using", "the", ":", "tm", ":", "Cooperator", "<internet", ".", "task", ".", "Co...
def checkForNotifies(self): """ Check if :pg:`NOTIFY <notify>` events have been received and if so, dispatch them to the registered observers, using the :tm:`Cooperator <internet.task.Cooperator>` provided in the constructor. This is done automatically, user code should never nee...
[ "def", "checkForNotifies", "(", "self", ")", ":", "# avoid creating a CooperativeTask in the common case of no notifies", "if", "self", ".", "_connection", ".", "notifies", ":", "self", ".", "cooperator", ".", "cooperate", "(", "self", ".", "_checkForNotifies", "(", "...
https://github.com/wulczer/txpostgres/blob/bd56a3648574bfd0c24543e4d9e4a611458c2da1/txpostgres/txpostgres.py#L686-L695
fossfreedom/alternative-toolbar
b43709bc5de20c7ea66c0e992f59361793874ed3
alttoolbar_type.py
python
AltToolbarCompact.__init__
(self)
Initialises the object.
Initialises the object.
[ "Initialises", "the", "object", "." ]
def __init__(self): """ Initialises the object. """ super(AltToolbarCompact, self).__init__()
[ "def", "__init__", "(", "self", ")", ":", "super", "(", "AltToolbarCompact", ",", "self", ")", ".", "__init__", "(", ")" ]
https://github.com/fossfreedom/alternative-toolbar/blob/b43709bc5de20c7ea66c0e992f59361793874ed3/alttoolbar_type.py#L1286-L1290
pudo/dataset
7e921501f6ad90bedc3c3b66d0effccbb0ea0146
dataset/util.py
python
normalize_table_name
(name)
return name
Check if the table name is obviously invalid.
Check if the table name is obviously invalid.
[ "Check", "if", "the", "table", "name", "is", "obviously", "invalid", "." ]
def normalize_table_name(name): """Check if the table name is obviously invalid.""" if not isinstance(name, str): raise ValueError("Invalid table name: %r" % name) name = name.strip()[:63] if not len(name): raise ValueError("Invalid table name: %r" % name) return name
[ "def", "normalize_table_name", "(", "name", ")", ":", "if", "not", "isinstance", "(", "name", ",", "str", ")", ":", "raise", "ValueError", "(", "\"Invalid table name: %r\"", "%", "name", ")", "name", "=", "name", ".", "strip", "(", ")", "[", ":", "63", ...
https://github.com/pudo/dataset/blob/7e921501f6ad90bedc3c3b66d0effccbb0ea0146/dataset/util.py#L137-L144
STVIR/pysot
9b07c521fd370ba38d35f35f76b275156564a681
pysot/models/backbone/resnet_atrous.py
python
BasicBlock.forward
(self, x)
return out
[]
def forward(self, x): residual = x out = self.conv1(x) out = self.bn1(out) out = self.relu(out) out = self.conv2(out) out = self.bn2(out) if self.downsample is not None: residual = self.downsample(x) out += residual out = self.relu(...
[ "def", "forward", "(", "self", ",", "x", ")", ":", "residual", "=", "x", "out", "=", "self", ".", "conv1", "(", "x", ")", "out", "=", "self", ".", "bn1", "(", "out", ")", "out", "=", "self", ".", "relu", "(", "out", ")", "out", "=", "self", ...
https://github.com/STVIR/pysot/blob/9b07c521fd370ba38d35f35f76b275156564a681/pysot/models/backbone/resnet_atrous.py#L43-L59
openstack/keystone
771c943ad2116193e7bb118c74993c829d93bd71
keystone/server/flask/common.py
python
APIBase._output_json
(data, code, headers=None)
return resp
Make a Flask response with a JSON encoded body. This is a replacement of the default that is shipped with flask-RESTful as we need oslo_serialization for the wider datatypes in our objects that are serialized to json.
Make a Flask response with a JSON encoded body.
[ "Make", "a", "Flask", "response", "with", "a", "JSON", "encoded", "body", "." ]
def _output_json(data, code, headers=None): """Make a Flask response with a JSON encoded body. This is a replacement of the default that is shipped with flask-RESTful as we need oslo_serialization for the wider datatypes in our objects that are serialized to json. """ se...
[ "def", "_output_json", "(", "data", ",", "code", ",", "headers", "=", "None", ")", ":", "settings", "=", "flask", ".", "current_app", ".", "config", ".", "get", "(", "'RESTFUL_JSON'", ",", "{", "}", ")", "# If we're in debug mode, and the indent is not set, we s...
https://github.com/openstack/keystone/blob/771c943ad2116193e7bb118c74993c829d93bd71/keystone/server/flask/common.py#L535-L557
ronghanghu/seg_every_thing
0bd7b8b2c6b63a8540e01b551b062a714d7488c9
lib/datasets/task_evaluation.py
python
log_copy_paste_friendly_results
(results)
Log results in a format that makes it easy to copy-and-paste in a spreadsheet. Lines are prefixed with 'copypaste: ' to make grepping easy.
Log results in a format that makes it easy to copy-and-paste in a spreadsheet. Lines are prefixed with 'copypaste: ' to make grepping easy.
[ "Log", "results", "in", "a", "format", "that", "makes", "it", "easy", "to", "copy", "-", "and", "-", "paste", "in", "a", "spreadsheet", ".", "Lines", "are", "prefixed", "with", "copypaste", ":", "to", "make", "grepping", "easy", "." ]
def log_copy_paste_friendly_results(results): """Log results in a format that makes it easy to copy-and-paste in a spreadsheet. Lines are prefixed with 'copypaste: ' to make grepping easy. """ for dataset in results.keys(): logger.info('copypaste: Dataset: {}'.format(dataset)) for task, ...
[ "def", "log_copy_paste_friendly_results", "(", "results", ")", ":", "for", "dataset", "in", "results", ".", "keys", "(", ")", ":", "logger", ".", "info", "(", "'copypaste: Dataset: {}'", ".", "format", "(", "dataset", ")", ")", "for", "task", ",", "metrics",...
https://github.com/ronghanghu/seg_every_thing/blob/0bd7b8b2c6b63a8540e01b551b062a714d7488c9/lib/datasets/task_evaluation.py#L179-L190
glitchdotcom/WebPutty
4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7
ziplibs/werkzeug/_internal.py
python
_date_to_unix
(arg)
return seconds
Converts a timetuple, integer or datetime object into the seconds from epoch in utc.
Converts a timetuple, integer or datetime object into the seconds from epoch in utc.
[ "Converts", "a", "timetuple", "integer", "or", "datetime", "object", "into", "the", "seconds", "from", "epoch", "in", "utc", "." ]
def _date_to_unix(arg): """Converts a timetuple, integer or datetime object into the seconds from epoch in utc. """ if isinstance(arg, datetime): arg = arg.utctimetuple() elif isinstance(arg, (int, long, float)): return int(arg) year, month, day, hour, minute, second = arg[:6] ...
[ "def", "_date_to_unix", "(", "arg", ")", ":", "if", "isinstance", "(", "arg", ",", "datetime", ")", ":", "arg", "=", "arg", ".", "utctimetuple", "(", ")", "elif", "isinstance", "(", "arg", ",", "(", "int", ",", "long", ",", "float", ")", ")", ":", ...
https://github.com/glitchdotcom/WebPutty/blob/4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7/ziplibs/werkzeug/_internal.py#L250-L263
stoq/stoq
c26991644d1affcf96bc2e0a0434796cabdf8448
stoq/gui/accounts.py
python
BaseAccountWindow.show_details
(self, payment_view)
return payment
Shows some details about the payment, allowing to edit a few properties
Shows some details about the payment, allowing to edit a few properties
[ "Shows", "some", "details", "about", "the", "payment", "allowing", "to", "edit", "a", "few", "properties" ]
def show_details(self, payment_view): """Shows some details about the payment, allowing to edit a few properties """ with api.new_store() as store: payment = store.fetch(payment_view.payment) run_dialog(self.editor_class, self, store, payment) if store.co...
[ "def", "show_details", "(", "self", ",", "payment_view", ")", ":", "with", "api", ".", "new_store", "(", ")", "as", "store", ":", "payment", "=", "store", ".", "fetch", "(", "payment_view", ".", "payment", ")", "run_dialog", "(", "self", ".", "editor_cla...
https://github.com/stoq/stoq/blob/c26991644d1affcf96bc2e0a0434796cabdf8448/stoq/gui/accounts.py#L133-L145
gradio-app/gradio
e98c190b879e879e6be4dd82f75690488fe66a6f
gradio/inputs.py
python
Dropdown.preprocess
(self, x)
Parameters: x (str): selected choice Returns: (Union[str, int]): selected choice as string or index within choice list
Parameters: x (str): selected choice Returns: (Union[str, int]): selected choice as string or index within choice list
[ "Parameters", ":", "x", "(", "str", ")", ":", "selected", "choice", "Returns", ":", "(", "Union", "[", "str", "int", "]", ")", ":", "selected", "choice", "as", "string", "or", "index", "within", "choice", "list" ]
def preprocess(self, x): """ Parameters: x (str): selected choice Returns: (Union[str, int]): selected choice as string or index within choice list """ if self.type == "value": return x elif self.type == "index": return self.choices...
[ "def", "preprocess", "(", "self", ",", "x", ")", ":", "if", "self", ".", "type", "==", "\"value\"", ":", "return", "x", "elif", "self", ".", "type", "==", "\"index\"", ":", "return", "self", ".", "choices", ".", "index", "(", "x", ")", "else", ":",...
https://github.com/gradio-app/gradio/blob/e98c190b879e879e6be4dd82f75690488fe66a6f/gradio/inputs.py#L729-L742
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_lease.py
python
V1Lease.__init__
(self, api_version=None, kind=None, metadata=None, spec=None, local_vars_configuration=None)
V1Lease - a model defined in OpenAPI
V1Lease - a model defined in OpenAPI
[ "V1Lease", "-", "a", "model", "defined", "in", "OpenAPI" ]
def __init__(self, api_version=None, kind=None, metadata=None, spec=None, local_vars_configuration=None): # noqa: E501 """V1Lease - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configurati...
[ "def", "__init__", "(", "self", ",", "api_version", "=", "None", ",", "kind", "=", "None", ",", "metadata", "=", "None", ",", "spec", "=", "None", ",", "local_vars_configuration", "=", "None", ")", ":", "# noqa: E501", "# noqa: E501", "if", "local_vars_confi...
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_lease.py#L49-L68
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/scripts/sshbackdoors/rpyc/core/channel.py
python
Channel.send
(self, data)
Sends the given string of data as a packet over the underlying stream. Blocks until the packet has been sent. :param data: the byte string to send as a packet
Sends the given string of data as a packet over the underlying stream. Blocks until the packet has been sent. :param data: the byte string to send as a packet
[ "Sends", "the", "given", "string", "of", "data", "as", "a", "packet", "over", "the", "underlying", "stream", ".", "Blocks", "until", "the", "packet", "has", "been", "sent", ".", ":", "param", "data", ":", "the", "byte", "string", "to", "send", "as", "a...
def send(self, data): """Sends the given string of data as a packet over the underlying stream. Blocks until the packet has been sent. :param data: the byte string to send as a packet """ if self.compress and len(data) > self.COMPRESSION_THRESHOLD: compresse...
[ "def", "send", "(", "self", ",", "data", ")", ":", "if", "self", ".", "compress", "and", "len", "(", "data", ")", ">", "self", ".", "COMPRESSION_THRESHOLD", ":", "compressed", "=", "1", "data", "=", "zlib", ".", "compress", "(", "data", ",", "self", ...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/sshbackdoors/rpyc/core/channel.py#L56-L69
VirtueSecurity/aws-extender
d123b7e1a845847709ba3a481f11996bddc68a1c
BappModules/boto/storage_uri.py
python
FileStorageUri.is_file_uri
(self)
return True
Returns True if this URI names a file or directory.
Returns True if this URI names a file or directory.
[ "Returns", "True", "if", "this", "URI", "names", "a", "file", "or", "directory", "." ]
def is_file_uri(self): """Returns True if this URI names a file or directory.""" return True
[ "def", "is_file_uri", "(", "self", ")", ":", "return", "True" ]
https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/storage_uri.py#L852-L854
pycom/pycom-libraries
75d0e67cb421e0576a3a9677bb0d9d81f27ebdb7
examples/OTA-lorawan/diff_match_patch.py
python
diff_match_patch.diff_text1
(self, diffs)
return "".join(text)
Compute and return the source text (all equalities and deletions). Args: diffs: Array of diff tuples. Returns: Source text.
Compute and return the source text (all equalities and deletions).
[ "Compute", "and", "return", "the", "source", "text", "(", "all", "equalities", "and", "deletions", ")", "." ]
def diff_text1(self, diffs): """Compute and return the source text (all equalities and deletions). Args: diffs: Array of diff tuples. Returns: Source text. """ text = [] for (op, data) in diffs: if op != self.DIFF_INSERT: text.append(data) return "".join(text)
[ "def", "diff_text1", "(", "self", ",", "diffs", ")", ":", "text", "=", "[", "]", "for", "(", "op", ",", "data", ")", "in", "diffs", ":", "if", "op", "!=", "self", ".", "DIFF_INSERT", ":", "text", ".", "append", "(", "data", ")", "return", "\"\"",...
https://github.com/pycom/pycom-libraries/blob/75d0e67cb421e0576a3a9677bb0d9d81f27ebdb7/examples/OTA-lorawan/diff_match_patch.py#L1088-L1101
phantomcyber/playbooks
9e850ecc44cb98c5dde53784744213a1ed5799bd
trustar_network_enrichment.py
python
url_filter_none
(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs)
return
[]
def url_filter_none(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs): phantom.debug('url_filter_none() called') # collect filtered artifact ids for 'if' condition 1 matched_artifacts_1, matched_results_1 = ...
[ "def", "url_filter_none", "(", "action", "=", "None", ",", "success", "=", "None", ",", "container", "=", "None", ",", "results", "=", "None", ",", "handle", "=", "None", ",", "filtered_artifacts", "=", "None", ",", "filtered_results", "=", "None", ",", ...
https://github.com/phantomcyber/playbooks/blob/9e850ecc44cb98c5dde53784744213a1ed5799bd/trustar_network_enrichment.py#L352-L368
shidenggui/easytrader
dbb166564c6c73da3446588a19d2692ad52716cb
easytrader/webtrader.py
python
WebTrader.get_exchangebill
(self, start_date, end_date)
查询指定日期内的交割单 :param start_date: 20160211 :param end_date: 20160211 :return:
查询指定日期内的交割单 :param start_date: 20160211 :param end_date: 20160211 :return:
[ "查询指定日期内的交割单", ":", "param", "start_date", ":", "20160211", ":", "param", "end_date", ":", "20160211", ":", "return", ":" ]
def get_exchangebill(self, start_date, end_date): """ 查询指定日期内的交割单 :param start_date: 20160211 :param end_date: 20160211 :return: """ logger.warning("目前仅在 华泰子类 中实现, 其余券商需要补充")
[ "def", "get_exchangebill", "(", "self", ",", "start_date", ",", "end_date", ")", ":", "logger", ".", "warning", "(", "\"目前仅在 华泰子类 中实现, 其余券商需要补充\")", "" ]
https://github.com/shidenggui/easytrader/blob/dbb166564c6c73da3446588a19d2692ad52716cb/easytrader/webtrader.py#L167-L174
ungarj/mapchete
dc085b4af4bd4101d342e3d08440e165d07f4070
mapchete/formats/default/png.py
python
OutputDataWriter.write
(self, process_tile, data)
Write data from one or more process tiles. Parameters ---------- process_tile : ``BufferedTile`` must be member of process ``TilePyramid``
Write data from one or more process tiles.
[ "Write", "data", "from", "one", "or", "more", "process", "tiles", "." ]
def write(self, process_tile, data): """ Write data from one or more process tiles. Parameters ---------- process_tile : ``BufferedTile`` must be member of process ``TilePyramid`` """ rgba = self._prepare_array_for_png(data) data = ma.masked_w...
[ "def", "write", "(", "self", ",", "process_tile", ",", "data", ")", ":", "rgba", "=", "self", ".", "_prepare_array_for_png", "(", "data", ")", "data", "=", "ma", ".", "masked_where", "(", "rgba", "==", "self", ".", "output_params", "[", "\"nodata\"", "]"...
https://github.com/ungarj/mapchete/blob/dc085b4af4bd4101d342e3d08440e165d07f4070/mapchete/formats/default/png.py#L225-L255
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/distutils/cmd.py
python
Command.initialize_options
(self)
Set default values for all the options that this command supports. Note that these defaults may be overridden by other commands, by the setup script, by config files, or by the command-line. Thus, this is not the place to code dependencies between options; generally, 'initialize_option...
Set default values for all the options that this command supports. Note that these defaults may be overridden by other commands, by the setup script, by config files, or by the command-line. Thus, this is not the place to code dependencies between options; generally, 'initialize_option...
[ "Set", "default", "values", "for", "all", "the", "options", "that", "this", "command", "supports", ".", "Note", "that", "these", "defaults", "may", "be", "overridden", "by", "other", "commands", "by", "the", "setup", "script", "by", "config", "files", "or", ...
def initialize_options(self): """Set default values for all the options that this command supports. Note that these defaults may be overridden by other commands, by the setup script, by config files, or by the command-line. Thus, this is not the place to code dependencies betwe...
[ "def", "initialize_options", "(", "self", ")", ":", "raise", "RuntimeError", ",", "\"abstract method -- subclass %s must override\"", "%", "self", ".", "__class__" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/distutils/cmd.py#L125-L136
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/physics/mechanics/point.py
python
Point._pdict_list
(self, other, num)
Creates a list from self to other using _dcm_dict.
Creates a list from self to other using _dcm_dict.
[ "Creates", "a", "list", "from", "self", "to", "other", "using", "_dcm_dict", "." ]
def _pdict_list(self, other, num): """Creates a list from self to other using _dcm_dict. """ outlist = [[self]] oldlist = [[]] while outlist != oldlist: oldlist = outlist[:] for i, v in enumerate(outlist): templist = v[-1]._pdlist[num].keys() ...
[ "def", "_pdict_list", "(", "self", ",", "other", ",", "num", ")", ":", "outlist", "=", "[", "[", "self", "]", "]", "oldlist", "=", "[", "[", "]", "]", "while", "outlist", "!=", "oldlist", ":", "oldlist", "=", "outlist", "[", ":", "]", "for", "i",...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/physics/mechanics/point.py#L35-L55
blurstudio/cross3d
277968d1227de740fc87ef61005c75034420eadf
cross3d/abstract/abstractscenewrapper.py
python
AbstractSceneWrapper.setController
(self, name, controller)
return self._setNativeController(name, controller.nativePointer())
lookup a controller based on the inputed controllerName for this object :param name: str :param controller: :class:`cross3d.SceneAnimationController` or None
lookup a controller based on the inputed controllerName for this object :param name: str :param controller: :class:`cross3d.SceneAnimationController` or None
[ "lookup", "a", "controller", "based", "on", "the", "inputed", "controllerName", "for", "this", "object", ":", "param", "name", ":", "str", ":", "param", "controller", ":", ":", "class", ":", "cross3d", ".", "SceneAnimationController", "or", "None" ]
def setController(self, name, controller): """ lookup a controller based on the inputed controllerName for this object :param name: str :param controller: :class:`cross3d.SceneAnimationController` or None """ if isinstance(controller, cross3d.FCurve): fCurve = controller nativeController = cro...
[ "def", "setController", "(", "self", ",", "name", ",", "controller", ")", ":", "if", "isinstance", "(", "controller", ",", "cross3d", ".", "FCurve", ")", ":", "fCurve", "=", "controller", "nativeController", "=", "cross3d", ".", "SceneAnimationController", "."...
https://github.com/blurstudio/cross3d/blob/277968d1227de740fc87ef61005c75034420eadf/cross3d/abstract/abstractscenewrapper.py#L242-L261
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/user.py
python
User.getuserinfo
(self, code)
return self._get( '/user/getuserinfo', {'code': code} )
通过CODE换取用户身份 :param code: requestAuthCode接口中获取的CODE :return:
通过CODE换取用户身份
[ "通过CODE换取用户身份" ]
def getuserinfo(self, code): """ 通过CODE换取用户身份 :param code: requestAuthCode接口中获取的CODE :return: """ return self._get( '/user/getuserinfo', {'code': code} )
[ "def", "getuserinfo", "(", "self", ",", "code", ")", ":", "return", "self", ".", "_get", "(", "'/user/getuserinfo'", ",", "{", "'code'", ":", "code", "}", ")" ]
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/user.py#L30-L40
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pyparsing.py
python
ParserElement.__rsub__
(self, other )
return other - self
Implementation of - operator when left operand is not a C{L{ParserElement}}
Implementation of - operator when left operand is not a C{L{ParserElement}}
[ "Implementation", "of", "-", "operator", "when", "left", "operand", "is", "not", "a", "C", "{", "L", "{", "ParserElement", "}}" ]
def __rsub__(self, other ): """ Implementation of - operator when left operand is not a C{L{ParserElement}} """ if isinstance( other, basestring ): other = ParserElement._literalStringClass( other ) if not isinstance( other, ParserElement ): warnings.warn(...
[ "def", "__rsub__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElemen...
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pyparsing.py#L1824-L1834
pyload/pyload
4410827ca7711f1a3cf91a0b11e967b81bbbcaa2
src/pyload/plugins/addons/ExtractArchive.py
python
ExtractArchive.extract_package
(self, *ids)
Extract packages with given id.
Extract packages with given id.
[ "Extract", "packages", "with", "given", "id", "." ]
def extract_package(self, *ids): """ Extract packages with given id. """ for id in ids: self.queue.add(id) if not self.config.get("waitall") and not self.extracting: self.extract_queued()
[ "def", "extract_package", "(", "self", ",", "*", "ids", ")", ":", "for", "id", "in", "ids", ":", "self", ".", "queue", ".", "add", "(", "id", ")", "if", "not", "self", ".", "config", ".", "get", "(", "\"waitall\"", ")", "and", "not", "self", ".",...
https://github.com/pyload/pyload/blob/4410827ca7711f1a3cf91a0b11e967b81bbbcaa2/src/pyload/plugins/addons/ExtractArchive.py#L178-L185