repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
rytilahti/python-songpal
songpal/group.py
https://github.com/rytilahti/python-songpal/blob/0443de6b3d960b9067a851d82261ca00e46b4618/songpal/group.py#L181-L185
async def get_codec(self): """Get codec settings.""" act = self.service.action("X_GetCodec") res = await act.async_call() return res
[ "async", "def", "get_codec", "(", "self", ")", ":", "act", "=", "self", ".", "service", ".", "action", "(", "\"X_GetCodec\"", ")", "res", "=", "await", "act", ".", "async_call", "(", ")", "return", "res" ]
Get codec settings.
[ "Get", "codec", "settings", "." ]
python
train
pyroscope/pyrocore
src/pyrocore/torrent/watch.py
https://github.com/pyroscope/pyrocore/blob/89ad01346a570943d20311a0b488440975876612/src/pyrocore/torrent/watch.py#L271-L279
def process_default(self, event): """ Fallback. """ if self.job.LOG.isEnabledFor(logging.DEBUG): # On debug level, we subscribe to ALL events, so they're expected in that case ;) if self.job.config.trace_inotify: self.job.LOG.debug("Ignored inotify event:\...
[ "def", "process_default", "(", "self", ",", "event", ")", ":", "if", "self", ".", "job", ".", "LOG", ".", "isEnabledFor", "(", "logging", ".", "DEBUG", ")", ":", "# On debug level, we subscribe to ALL events, so they're expected in that case ;)", "if", "self", ".", ...
Fallback.
[ "Fallback", "." ]
python
train
upsight/doctor
doctor/schema.py
https://github.com/upsight/doctor/blob/2cf1d433f6f1aa1355644b449a757c0660793cdd/doctor/schema.py#L20-L35
def _format_stack(self, stack, current=None): """Prettifies a scope stack for use in error messages. :param list(str) stack: List of scopes. :param str current: The current scope. If specified, will be appended onto the stack before formatting. :returns: str """ ...
[ "def", "_format_stack", "(", "self", ",", "stack", ",", "current", "=", "None", ")", ":", "if", "current", "is", "not", "None", ":", "stack", "=", "stack", "+", "[", "current", "]", "if", "len", "(", "stack", ")", ">", "1", ":", "prefix", "=", "o...
Prettifies a scope stack for use in error messages. :param list(str) stack: List of scopes. :param str current: The current scope. If specified, will be appended onto the stack before formatting. :returns: str
[ "Prettifies", "a", "scope", "stack", "for", "use", "in", "error", "messages", "." ]
python
train
phaethon/kamene
kamene/contrib/gsm_um.py
https://github.com/phaethon/kamene/blob/11d4064844f4f68ac5d7546f5633ac7d02082914/kamene/contrib/gsm_um.py#L333-L340
def channelModeModifyAcknowledge(): """CHANNEL MODE MODIFY ACKNOWLEDGE Section 9.1.6""" a = TpPd(pd=0x6) b = MessageType(mesType=0x17) # 00010111 c = ChannelDescription2() d = ChannelMode() packet = a / b / c / d return packet
[ "def", "channelModeModifyAcknowledge", "(", ")", ":", "a", "=", "TpPd", "(", "pd", "=", "0x6", ")", "b", "=", "MessageType", "(", "mesType", "=", "0x17", ")", "# 00010111", "c", "=", "ChannelDescription2", "(", ")", "d", "=", "ChannelMode", "(", ")", "...
CHANNEL MODE MODIFY ACKNOWLEDGE Section 9.1.6
[ "CHANNEL", "MODE", "MODIFY", "ACKNOWLEDGE", "Section", "9", ".", "1", ".", "6" ]
python
train
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L3216-L3227
def cublasCtpmv(handle, uplo, trans, diag, n, AP, x, incx): """ Matrix-vector product for complex triangular-packed matrix. """ status = _libcublas.cublasCtpmv_v2(handle, _CUBLAS_FILL_MODE[uplo], _CUBLAS_OP[trans], ...
[ "def", "cublasCtpmv", "(", "handle", ",", "uplo", ",", "trans", ",", "diag", ",", "n", ",", "AP", ",", "x", ",", "incx", ")", ":", "status", "=", "_libcublas", ".", "cublasCtpmv_v2", "(", "handle", ",", "_CUBLAS_FILL_MODE", "[", "uplo", "]", ",", "_C...
Matrix-vector product for complex triangular-packed matrix.
[ "Matrix", "-", "vector", "product", "for", "complex", "triangular", "-", "packed", "matrix", "." ]
python
train
jeffknupp/sandman2
sandman2/model.py
https://github.com/jeffknupp/sandman2/blob/1ce21d6f7a6df77fa96fab694b0f9bb8469c166b/sandman2/model.py#L114-L123
def update(self, attributes): """Update the current instance based on attribute->value items in *attributes*. :param dict attributes: Dictionary of attributes to be updated :rtype: :class:`sandman2.model.Model` """ for attribute in attributes: setattr(self, a...
[ "def", "update", "(", "self", ",", "attributes", ")", ":", "for", "attribute", "in", "attributes", ":", "setattr", "(", "self", ",", "attribute", ",", "attributes", "[", "attribute", "]", ")", "return", "self" ]
Update the current instance based on attribute->value items in *attributes*. :param dict attributes: Dictionary of attributes to be updated :rtype: :class:`sandman2.model.Model`
[ "Update", "the", "current", "instance", "based", "on", "attribute", "-", ">", "value", "items", "in", "*", "attributes", "*", "." ]
python
train
orweis/winpcapy
winpcapy/winpcapy.py
https://github.com/orweis/winpcapy/blob/47ddb7f34de865c7ff6391c73b36b3af9a595158/winpcapy/winpcapy.py#L174-L180
def capture_on_device_name(device_name, callback): """ :param device_name: the name (guid) of a device as provided by WinPcapDevices.list_devices() :param callback: a function to call with each intercepted packet """ with WinPcap(device_name) as capture: capture.run(c...
[ "def", "capture_on_device_name", "(", "device_name", ",", "callback", ")", ":", "with", "WinPcap", "(", "device_name", ")", "as", "capture", ":", "capture", ".", "run", "(", "callback", "=", "callback", ")" ]
:param device_name: the name (guid) of a device as provided by WinPcapDevices.list_devices() :param callback: a function to call with each intercepted packet
[ ":", "param", "device_name", ":", "the", "name", "(", "guid", ")", "of", "a", "device", "as", "provided", "by", "WinPcapDevices", ".", "list_devices", "()", ":", "param", "callback", ":", "a", "function", "to", "call", "with", "each", "intercepted", "packe...
python
train
JelteF/PyLaTeX
pylatex/document.py
https://github.com/JelteF/PyLaTeX/blob/62d9d9912ce8445e6629cdbcb80ad86143a1ed23/pylatex/document.py#L330-L349
def add_color(self, name, model, description): r"""Add a color that can be used throughout the document. Args ---- name: str Name to set for the color model: str The color model to use when defining the color description: str The value...
[ "def", "add_color", "(", "self", ",", "name", ",", "model", ",", "description", ")", ":", "if", "self", ".", "color", "is", "False", ":", "self", ".", "packages", ".", "append", "(", "Package", "(", "\"color\"", ")", ")", "self", ".", "color", "=", ...
r"""Add a color that can be used throughout the document. Args ---- name: str Name to set for the color model: str The color model to use when defining the color description: str The values to use to define the color
[ "r", "Add", "a", "color", "that", "can", "be", "used", "throughout", "the", "document", "." ]
python
train
sorrowless/battery_systray
batticon/batticon.py
https://github.com/sorrowless/battery_systray/blob/4594fca6f357660e081c2800af4a8b21c607bef1/batticon/batticon.py#L49-L60
def add_menu_item(self, command, title): """ Add mouse right click menu item. Args: command (callable): function that will be called after left mouse click on title title (str): label that will be shown in menu """ m_item = Gtk.MenuItem() m_item.set_la...
[ "def", "add_menu_item", "(", "self", ",", "command", ",", "title", ")", ":", "m_item", "=", "Gtk", ".", "MenuItem", "(", ")", "m_item", ".", "set_label", "(", "title", ")", "m_item", ".", "connect", "(", "'activate'", ",", "command", ")", "self", ".", ...
Add mouse right click menu item. Args: command (callable): function that will be called after left mouse click on title title (str): label that will be shown in menu
[ "Add", "mouse", "right", "click", "menu", "item", ".", "Args", ":", "command", "(", "callable", ")", ":", "function", "that", "will", "be", "called", "after", "left", "mouse", "click", "on", "title", "title", "(", "str", ")", ":", "label", "that", "wil...
python
train
zetaops/pyoko
pyoko/listnode.py
https://github.com/zetaops/pyoko/blob/236c509ad85640933ac0f89ad8f7ed95f62adf07/pyoko/listnode.py#L98-L108
def _generate_instances(self): """ ListNode item generator. Will be used internally by __iter__ and __getitem__ Yields: ListNode items (instances) """ for node in self.node_stack: yield node while self._data: yield self._make_instance(...
[ "def", "_generate_instances", "(", "self", ")", ":", "for", "node", "in", "self", ".", "node_stack", ":", "yield", "node", "while", "self", ".", "_data", ":", "yield", "self", ".", "_make_instance", "(", "self", ".", "_data", ".", "pop", "(", "0", ")",...
ListNode item generator. Will be used internally by __iter__ and __getitem__ Yields: ListNode items (instances)
[ "ListNode", "item", "generator", ".", "Will", "be", "used", "internally", "by", "__iter__", "and", "__getitem__" ]
python
train
UCL-INGI/INGInious
inginious/frontend/template_helper.py
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/template_helper.py#L76-L96
def get_custom_renderer(self, dir_path, layout=True): """ Create a template renderer on templates in the directory specified, and returns it. :param dir_path: the path to the template dir. If it is not absolute, it will be taken from the root of the inginious package. :param layout: can ...
[ "def", "get_custom_renderer", "(", "self", ",", "dir_path", ",", "layout", "=", "True", ")", ":", "# if dir_path/base is a absolute path, os.path.join(something, an_absolute_path) returns an_absolute_path.", "root_path", "=", "inginious", ".", "get_root_path", "(", ")", "if",...
Create a template renderer on templates in the directory specified, and returns it. :param dir_path: the path to the template dir. If it is not absolute, it will be taken from the root of the inginious package. :param layout: can either be True (use the base layout of the running app), False (use no lay...
[ "Create", "a", "template", "renderer", "on", "templates", "in", "the", "directory", "specified", "and", "returns", "it", ".", ":", "param", "dir_path", ":", "the", "path", "to", "the", "template", "dir", ".", "If", "it", "is", "not", "absolute", "it", "w...
python
train
brainiak/brainiak
brainiak/utils/fmrisim.py
https://github.com/brainiak/brainiak/blob/408f12dec2ff56559a26873a848a09e4c8facfeb/brainiak/utils/fmrisim.py#L1199-L1282
def _calc_ARMA_noise(volume, mask, auto_reg_order=1, ma_order=1, sample_num=100, ): """ Calculate the the ARMA noise of a volume This calculates the autoregressive and moving average noise of the volume ...
[ "def", "_calc_ARMA_noise", "(", "volume", ",", "mask", ",", "auto_reg_order", "=", "1", ",", "ma_order", "=", "1", ",", "sample_num", "=", "100", ",", ")", ":", "# Pull out the non masked voxels", "if", "len", "(", "volume", ".", "shape", ")", ">", "1", ...
Calculate the the ARMA noise of a volume This calculates the autoregressive and moving average noise of the volume over time by sampling brain voxels and averaging them. Parameters ---------- volume : 4d array or 1d array, float Take a volume time series to extract the middle slice from th...
[ "Calculate", "the", "the", "ARMA", "noise", "of", "a", "volume", "This", "calculates", "the", "autoregressive", "and", "moving", "average", "noise", "of", "the", "volume", "over", "time", "by", "sampling", "brain", "voxels", "and", "averaging", "them", "." ]
python
train
inveniosoftware-attic/invenio-utils
invenio_utils/htmlwasher.py
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/htmlwasher.py#L117-L125
def handle_entityref(self, name): """Process a general entity reference of the form "&name;". Transform to text whenever possible.""" char_code = html_entities.name2codepoint.get(name, None) if char_code is not None: try: self.result += unichr(char_code).encod...
[ "def", "handle_entityref", "(", "self", ",", "name", ")", ":", "char_code", "=", "html_entities", ".", "name2codepoint", ".", "get", "(", "name", ",", "None", ")", "if", "char_code", "is", "not", "None", ":", "try", ":", "self", ".", "result", "+=", "u...
Process a general entity reference of the form "&name;". Transform to text whenever possible.
[ "Process", "a", "general", "entity", "reference", "of", "the", "form", "&name", ";", ".", "Transform", "to", "text", "whenever", "possible", "." ]
python
train
dbrattli/OSlash
oslash/ioaction.py
https://github.com/dbrattli/OSlash/blob/ffdc714c5d454f7519f740254de89f70850929eb/oslash/ioaction.py#L114-L120
def run(self, world: int) -> IO: """Run IO Action""" func = self._value new_world, text = pure_input(world) action = func(text) return action(world=new_world)
[ "def", "run", "(", "self", ",", "world", ":", "int", ")", "->", "IO", ":", "func", "=", "self", ".", "_value", "new_world", ",", "text", "=", "pure_input", "(", "world", ")", "action", "=", "func", "(", "text", ")", "return", "action", "(", "world"...
Run IO Action
[ "Run", "IO", "Action" ]
python
train
Scille/autobahn-sync
autobahn_sync/session.py
https://github.com/Scille/autobahn-sync/blob/d75fceff0d1aee61fa6dd0168eb1cd40794ad827/autobahn_sync/session.py#L78-L83
def call(self, procedure, *args, **kwargs): """Call a remote procedure. Replace :meth:`autobahn.wamp.interface.IApplicationSession.call` """ return self._async_session.call(procedure, *args, **kwargs)
[ "def", "call", "(", "self", ",", "procedure", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_async_session", ".", "call", "(", "procedure", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Call a remote procedure. Replace :meth:`autobahn.wamp.interface.IApplicationSession.call`
[ "Call", "a", "remote", "procedure", "." ]
python
train
tanghaibao/goatools
goatools/rpt/write_hierarchy_base.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/rpt/write_hierarchy_base.py#L34-L68
def prt_hier_rec(self, item_id, depth=1): """Write hierarchy for a GO Term record and all GO IDs down to the leaf level.""" # Shortens hierarchy report by only printing the hierarchy # for the sub-set of user-specified GO terms which are connected. if self.include_only and item_id not in...
[ "def", "prt_hier_rec", "(", "self", ",", "item_id", ",", "depth", "=", "1", ")", ":", "# Shortens hierarchy report by only printing the hierarchy", "# for the sub-set of user-specified GO terms which are connected.", "if", "self", ".", "include_only", "and", "item_id", "not",...
Write hierarchy for a GO Term record and all GO IDs down to the leaf level.
[ "Write", "hierarchy", "for", "a", "GO", "Term", "record", "and", "all", "GO", "IDs", "down", "to", "the", "leaf", "level", "." ]
python
train
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/connect/connect.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/connect/connect.py#L208-L224
def list_resources(self, device_id): """List all resources registered to a connected device. .. code-block:: python >>> for r in api.list_resources(device_id): print(r.name, r.observable, r.uri) None,True,/3/0/1 Update,False,/5/0/3 .....
[ "def", "list_resources", "(", "self", ",", "device_id", ")", ":", "api", "=", "self", ".", "_get_api", "(", "mds", ".", "EndpointsApi", ")", "return", "[", "Resource", "(", "r", ")", "for", "r", "in", "api", ".", "get_endpoint_resources", "(", "device_id...
List all resources registered to a connected device. .. code-block:: python >>> for r in api.list_resources(device_id): print(r.name, r.observable, r.uri) None,True,/3/0/1 Update,False,/5/0/3 ... :param str device_id: The ID of the d...
[ "List", "all", "resources", "registered", "to", "a", "connected", "device", "." ]
python
train
karimbahgat/Pytess
pytess/tesselator.py
https://github.com/karimbahgat/Pytess/blob/026d0c6bfc281361d850d9a44af1da6fed45b170/pytess/tesselator.py#L772-L788
def computeVoronoiDiagram(points): """ Takes a list of point objects (which must have x and y fields). Returns a 3-tuple of: (1) a list of 2-tuples, which are the x,y coordinates of the Voronoi diagram vertices (2) a list of 3-tuples (a,b,c) which are the equations of ...
[ "def", "computeVoronoiDiagram", "(", "points", ")", ":", "siteList", "=", "SiteList", "(", "points", ")", "context", "=", "Context", "(", ")", "voronoi", "(", "siteList", ",", "context", ")", "return", "(", "context", ".", "vertices", ",", "context", ".", ...
Takes a list of point objects (which must have x and y fields). Returns a 3-tuple of: (1) a list of 2-tuples, which are the x,y coordinates of the Voronoi diagram vertices (2) a list of 3-tuples (a,b,c) which are the equations of the lines in the Voronoi dia...
[ "Takes", "a", "list", "of", "point", "objects", "(", "which", "must", "have", "x", "and", "y", "fields", ")", ".", "Returns", "a", "3", "-", "tuple", "of", ":" ]
python
train
gem/oq-engine
openquake/hazardlib/probability_map.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/probability_map.py#L128-L139
def build(cls, shape_y, shape_z, sids, initvalue=0., dtype=F64): """ :param shape_y: the total number of intensity measure levels :param shape_z: the number of inner levels :param sids: a set of site indices :param initvalue: the initial value of the probability (default 0) ...
[ "def", "build", "(", "cls", ",", "shape_y", ",", "shape_z", ",", "sids", ",", "initvalue", "=", "0.", ",", "dtype", "=", "F64", ")", ":", "dic", "=", "cls", "(", "shape_y", ",", "shape_z", ")", "for", "sid", "in", "sids", ":", "dic", ".", "setdef...
:param shape_y: the total number of intensity measure levels :param shape_z: the number of inner levels :param sids: a set of site indices :param initvalue: the initial value of the probability (default 0) :returns: a ProbabilityMap dictionary
[ ":", "param", "shape_y", ":", "the", "total", "number", "of", "intensity", "measure", "levels", ":", "param", "shape_z", ":", "the", "number", "of", "inner", "levels", ":", "param", "sids", ":", "a", "set", "of", "site", "indices", ":", "param", "initval...
python
train
openstax/rhaptos.cnxmlutils
rhaptos/cnxmlutils/utils.py
https://github.com/openstax/rhaptos.cnxmlutils/blob/c32b1a7428dc652e8cd745f3fdf4019a20543649/rhaptos/cnxmlutils/utils.py#L180-L184
def _make_xsl(filename): """Helper that creates a XSLT stylesheet """ path = pkg_resources.resource_filename('rhaptos.cnxmlutils.xsl', filename) xml = etree.parse(path) return etree.XSLT(xml)
[ "def", "_make_xsl", "(", "filename", ")", ":", "path", "=", "pkg_resources", ".", "resource_filename", "(", "'rhaptos.cnxmlutils.xsl'", ",", "filename", ")", "xml", "=", "etree", ".", "parse", "(", "path", ")", "return", "etree", ".", "XSLT", "(", "xml", "...
Helper that creates a XSLT stylesheet
[ "Helper", "that", "creates", "a", "XSLT", "stylesheet" ]
python
train
numenta/nupic
src/nupic/algorithms/fdrutilities.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L445-L457
def sameTMParams(tp1, tp2): """Given two TM instances, see if any parameters are different.""" result = True for param in ["numberOfCols", "cellsPerColumn", "initialPerm", "connectedPerm", "minThreshold", "newSynapseCount", "permanenceInc", "permanenceDec", "permanenceMax", "global...
[ "def", "sameTMParams", "(", "tp1", ",", "tp2", ")", ":", "result", "=", "True", "for", "param", "in", "[", "\"numberOfCols\"", ",", "\"cellsPerColumn\"", ",", "\"initialPerm\"", ",", "\"connectedPerm\"", ",", "\"minThreshold\"", ",", "\"newSynapseCount\"", ",", ...
Given two TM instances, see if any parameters are different.
[ "Given", "two", "TM", "instances", "see", "if", "any", "parameters", "are", "different", "." ]
python
valid
oasis-open/cti-stix-validator
stix2validator/v21/shoulds.py
https://github.com/oasis-open/cti-stix-validator/blob/a607014e3fa500a7678f8b61b278456ca581f9d0/stix2validator/v21/shoulds.py#L771-L796
def protocols(instance): """Ensure the 'protocols' property of network-traffic objects contains only values from the IANA Service Name and Transport Protocol Port Number Registry. """ for key, obj in instance['objects'].items(): if ('type' in obj and obj['type'] == 'network-traffic' and ...
[ "def", "protocols", "(", "instance", ")", ":", "for", "key", ",", "obj", "in", "instance", "[", "'objects'", "]", ".", "items", "(", ")", ":", "if", "(", "'type'", "in", "obj", "and", "obj", "[", "'type'", "]", "==", "'network-traffic'", "and", "'pro...
Ensure the 'protocols' property of network-traffic objects contains only values from the IANA Service Name and Transport Protocol Port Number Registry.
[ "Ensure", "the", "protocols", "property", "of", "network", "-", "traffic", "objects", "contains", "only", "values", "from", "the", "IANA", "Service", "Name", "and", "Transport", "Protocol", "Port", "Number", "Registry", "." ]
python
train
TeamHG-Memex/scrapy-rotating-proxies
rotating_proxies/expire.py
https://github.com/TeamHG-Memex/scrapy-rotating-proxies/blob/89bb677fea6285a5e02e0a5c7dfb1c40330b17f0/rotating_proxies/expire.py#L67-L86
def mark_dead(self, proxy, _time=None): """ Mark a proxy as dead """ if proxy not in self.proxies: logger.warn("Proxy <%s> was not found in proxies list" % proxy) return if proxy in self.good: logger.debug("GOOD proxy became DEAD: <%s>" % proxy) else:...
[ "def", "mark_dead", "(", "self", ",", "proxy", ",", "_time", "=", "None", ")", ":", "if", "proxy", "not", "in", "self", ".", "proxies", ":", "logger", ".", "warn", "(", "\"Proxy <%s> was not found in proxies list\"", "%", "proxy", ")", "return", "if", "pro...
Mark a proxy as dead
[ "Mark", "a", "proxy", "as", "dead" ]
python
train
BernardFW/bernard
src/bernard/platforms/management.py
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/platforms/management.py#L173-L188
async def build_platform(self, cls: Type[Platform], custom_id): """ Build the Facebook platform. Nothing fancy. """ from bernard.server.http import router p = cls() if custom_id: p._id = custom_id await p.async_init() p.on_message(self.fsm....
[ "async", "def", "build_platform", "(", "self", ",", "cls", ":", "Type", "[", "Platform", "]", ",", "custom_id", ")", ":", "from", "bernard", ".", "server", ".", "http", "import", "router", "p", "=", "cls", "(", ")", "if", "custom_id", ":", "p", ".", ...
Build the Facebook platform. Nothing fancy.
[ "Build", "the", "Facebook", "platform", ".", "Nothing", "fancy", "." ]
python
train
ryanjdillon/pyotelem
pyotelem/plots/plotutils.py
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/plots/plotutils.py#L66-L76
def nsamples_to_hourminsec(x, pos): '''Convert axes labels to experiment duration in hours/minutes/seconds Notes ----- Matplotlib FuncFormatter function https://matplotlib.org/examples/pylab_examples/custom_ticker1.html ''' h, m, s = hourminsec(x/16.0) return '{:.0f}h {:2.0f}′ {:2.1f}″...
[ "def", "nsamples_to_hourminsec", "(", "x", ",", "pos", ")", ":", "h", ",", "m", ",", "s", "=", "hourminsec", "(", "x", "/", "16.0", ")", "return", "'{:.0f}h {:2.0f}′ {:2.1f}″'.for", "m", "at(h, ", "m", ",", " ", ")", "", "", "" ]
Convert axes labels to experiment duration in hours/minutes/seconds Notes ----- Matplotlib FuncFormatter function https://matplotlib.org/examples/pylab_examples/custom_ticker1.html
[ "Convert", "axes", "labels", "to", "experiment", "duration", "in", "hours", "/", "minutes", "/", "seconds" ]
python
train
pycontribs/pyrax
pyrax/cloudloadbalancers.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudloadbalancers.py#L766-L790
def update_ssl_termination(self, loadbalancer, securePort=None, enabled=None, secureTrafficOnly=None): """ Updates existing SSL termination information for the load balancer without affecting the existing certificates/keys. """ ssl_info = self.get_ssl_termination(load...
[ "def", "update_ssl_termination", "(", "self", ",", "loadbalancer", ",", "securePort", "=", "None", ",", "enabled", "=", "None", ",", "secureTrafficOnly", "=", "None", ")", ":", "ssl_info", "=", "self", ".", "get_ssl_termination", "(", "loadbalancer", ")", "if"...
Updates existing SSL termination information for the load balancer without affecting the existing certificates/keys.
[ "Updates", "existing", "SSL", "termination", "information", "for", "the", "load", "balancer", "without", "affecting", "the", "existing", "certificates", "/", "keys", "." ]
python
train
adamcharnock/swiftwind
swiftwind/housemates/forms.py
https://github.com/adamcharnock/swiftwind/blob/72c715800841c3b2feabded3f3b65b76388b4cea/swiftwind/housemates/forms.py#L28-L44
def clean_account(self): """Ensure this is an income account""" account = self.cleaned_data['account'] if not account: return if account.type != Account.TYPES.income: raise ValidationError('Account must be an income account') try: account.hou...
[ "def", "clean_account", "(", "self", ")", ":", "account", "=", "self", ".", "cleaned_data", "[", "'account'", "]", "if", "not", "account", ":", "return", "if", "account", ".", "type", "!=", "Account", ".", "TYPES", ".", "income", ":", "raise", "Validatio...
Ensure this is an income account
[ "Ensure", "this", "is", "an", "income", "account" ]
python
train
juju/charm-helpers
charmhelpers/contrib/hardening/audits/file.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/audits/file.py#L190-L193
def comply(self, path): """Issues a chown and chmod to the file paths specified.""" utils.ensure_permissions(path, self.user.pw_name, self.group.gr_name, self.mode)
[ "def", "comply", "(", "self", ",", "path", ")", ":", "utils", ".", "ensure_permissions", "(", "path", ",", "self", ".", "user", ".", "pw_name", ",", "self", ".", "group", ".", "gr_name", ",", "self", ".", "mode", ")" ]
Issues a chown and chmod to the file paths specified.
[ "Issues", "a", "chown", "and", "chmod", "to", "the", "file", "paths", "specified", "." ]
python
train
skggm/skggm
inverse_covariance/metrics.py
https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/metrics.py#L33-L56
def kl_loss(covariance, precision): """Computes the KL divergence between precision estimate and reference covariance. The loss is computed as: Trace(Theta_1 * Sigma_0) - log(Theta_0 * Sigma_1) - dim(Sigma) Parameters ---------- covariance : 2D ndarray (n_features, n_features) ...
[ "def", "kl_loss", "(", "covariance", ",", "precision", ")", ":", "assert", "covariance", ".", "shape", "==", "precision", ".", "shape", "dim", ",", "_", "=", "precision", ".", "shape", "logdet_p_dot_c", "=", "fast_logdet", "(", "np", ".", "dot", "(", "pr...
Computes the KL divergence between precision estimate and reference covariance. The loss is computed as: Trace(Theta_1 * Sigma_0) - log(Theta_0 * Sigma_1) - dim(Sigma) Parameters ---------- covariance : 2D ndarray (n_features, n_features) Maximum Likelihood Estimator of covariance...
[ "Computes", "the", "KL", "divergence", "between", "precision", "estimate", "and", "reference", "covariance", "." ]
python
train
saltstack/salt
salt/modules/wordpress.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/wordpress.py#L151-L172
def is_installed(path, user=None): ''' Check if wordpress is installed and setup path path to wordpress install location user user to run the command as CLI Example: .. code-block:: bash salt '*' wordpress.is_installed /var/www/html apache ''' retcode = __sal...
[ "def", "is_installed", "(", "path", ",", "user", "=", "None", ")", ":", "retcode", "=", "__salt__", "[", "'cmd.retcode'", "]", "(", "(", "'wp --path={0} core is-installed'", ")", ".", "format", "(", "path", ")", ",", "runas", "=", "user", ")", "if", "ret...
Check if wordpress is installed and setup path path to wordpress install location user user to run the command as CLI Example: .. code-block:: bash salt '*' wordpress.is_installed /var/www/html apache
[ "Check", "if", "wordpress", "is", "installed", "and", "setup" ]
python
train
robotools/fontParts
Lib/fontParts/base/contour.py
https://github.com/robotools/fontParts/blob/d2ff106fe95f9d566161d936a645157626568712/Lib/fontParts/base/contour.py#L930-L944
def removePoint(self, point, preserveCurve=False): """ Remove the point from the contour. point can be a point object or an index. If ``preserveCurve`` is set to ``True`` an attempt will be made to preserve the shape of the curve if the environment supports that functiona...
[ "def", "removePoint", "(", "self", ",", "point", ",", "preserveCurve", "=", "False", ")", ":", "if", "not", "isinstance", "(", "point", ",", "int", ")", ":", "point", "=", "self", ".", "points", ".", "index", "(", "point", ")", "point", "=", "normali...
Remove the point from the contour. point can be a point object or an index. If ``preserveCurve`` is set to ``True`` an attempt will be made to preserve the shape of the curve if the environment supports that functionality.
[ "Remove", "the", "point", "from", "the", "contour", ".", "point", "can", "be", "a", "point", "object", "or", "an", "index", ".", "If", "preserveCurve", "is", "set", "to", "True", "an", "attempt", "will", "be", "made", "to", "preserve", "the", "shape", ...
python
train
edx/ecommerce-worker
ecommerce_worker/sailthru/v1/tasks.py
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L234-L305
def update_course_enrollment(self, email, course_url, purchase_incomplete, mode, unit_cost=None, course_id=None, currency=None, message_id=None, site_code=None, sku=None): """Adds/updates Sailthru when a user adds to cart/purchases/upgrades a course Args: email(str): The u...
[ "def", "update_course_enrollment", "(", "self", ",", "email", ",", "course_url", ",", "purchase_incomplete", ",", "mode", ",", "unit_cost", "=", "None", ",", "course_id", "=", "None", ",", "currency", "=", "None", ",", "message_id", "=", "None", ",", "site_c...
Adds/updates Sailthru when a user adds to cart/purchases/upgrades a course Args: email(str): The user's email address course_url(str): Course home page url purchase_incomplete(boolean): True if adding to cart mode(string): enroll mode (audit, verification, ...) unit_cost(de...
[ "Adds", "/", "updates", "Sailthru", "when", "a", "user", "adds", "to", "cart", "/", "purchases", "/", "upgrades", "a", "course" ]
python
test
gwastro/pycbc
pycbc/rate.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/rate.py#L103-L113
def hpd_coverage(mu, pdf, thresh): ''' Integrates a pdf over mu taking only bins where the mean over the bin is above a given threshold This gives the coverage of the HPD interval for the given threshold. ''' dp = integral_element(mu, pdf) bin_mean = (pdf[1:] + pdf[:-1]) / 2. return...
[ "def", "hpd_coverage", "(", "mu", ",", "pdf", ",", "thresh", ")", ":", "dp", "=", "integral_element", "(", "mu", ",", "pdf", ")", "bin_mean", "=", "(", "pdf", "[", "1", ":", "]", "+", "pdf", "[", ":", "-", "1", "]", ")", "/", "2.", "return", ...
Integrates a pdf over mu taking only bins where the mean over the bin is above a given threshold This gives the coverage of the HPD interval for the given threshold.
[ "Integrates", "a", "pdf", "over", "mu", "taking", "only", "bins", "where", "the", "mean", "over", "the", "bin", "is", "above", "a", "given", "threshold", "This", "gives", "the", "coverage", "of", "the", "HPD", "interval", "for", "the", "given", "threshold"...
python
train
kislyuk/ensure
ensure/main.py
https://github.com/kislyuk/ensure/blob/0a562a4b469ffbaf71c75dc4d394e94334c831f0/ensure/main.py#L354-L359
def is_false(self): """ Ensures :attr:`subject` is ``False``. """ self._run(unittest_case.assertFalse, (self._subject,)) return ChainInspector(self._subject)
[ "def", "is_false", "(", "self", ")", ":", "self", ".", "_run", "(", "unittest_case", ".", "assertFalse", ",", "(", "self", ".", "_subject", ",", ")", ")", "return", "ChainInspector", "(", "self", ".", "_subject", ")" ]
Ensures :attr:`subject` is ``False``.
[ "Ensures", ":", "attr", ":", "subject", "is", "False", "." ]
python
train
pypa/setuptools
setuptools/command/build_py.py
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/build_py.py#L80-L83
def _get_data_files(self): """Generate list of '(package,src_dir,build_dir,filenames)' tuples""" self.analyze_manifest() return list(map(self._get_pkg_data_files, self.packages or ()))
[ "def", "_get_data_files", "(", "self", ")", ":", "self", ".", "analyze_manifest", "(", ")", "return", "list", "(", "map", "(", "self", ".", "_get_pkg_data_files", ",", "self", ".", "packages", "or", "(", ")", ")", ")" ]
Generate list of '(package,src_dir,build_dir,filenames)' tuples
[ "Generate", "list", "of", "(", "package", "src_dir", "build_dir", "filenames", ")", "tuples" ]
python
train
saltstack/salt
salt/utils/win_dacl.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1189-L1270
def get_owner(obj_name, obj_type='file'): r''' Gets the owner of the passed object Args: obj_name (str): The path for which to obtain owner information. The format of this parameter is different depending on the ``obj_type`` obj_type (str): The type of ...
[ "def", "get_owner", "(", "obj_name", ",", "obj_type", "=", "'file'", ")", ":", "# Not all filesystems mountable within windows have SecurityDescriptors.", "# For instance, some mounted SAMBA shares, or VirtualBox shared folders. If", "# we can't load a file descriptor for the file, we defaul...
r''' Gets the owner of the passed object Args: obj_name (str): The path for which to obtain owner information. The format of this parameter is different depending on the ``obj_type`` obj_type (str): The type of object to query. This value changes the format...
[ "r", "Gets", "the", "owner", "of", "the", "passed", "object" ]
python
train
Accelize/pycosio
pycosio/_core/functions_os.py
https://github.com/Accelize/pycosio/blob/1cc1f8fdf5394d92918b7bae2bfa682169ccc48c/pycosio/_core/functions_os.py#L69-L104
def mkdir(path, mode=0o777, dir_fd=None): """ Create a directory named path with numeric mode mode. Equivalent to "os.mkdir". Args: path (path-like object): Path or URL. mode (int): The mode parameter is passed to os.mkdir(); see the os.mkdir() description for how it is int...
[ "def", "mkdir", "(", "path", ",", "mode", "=", "0o777", ",", "dir_fd", "=", "None", ")", ":", "system", "=", "get_instance", "(", "path", ")", "relative", "=", "system", ".", "relpath", "(", "path", ")", "# Checks if parent directory exists", "parent_dir", ...
Create a directory named path with numeric mode mode. Equivalent to "os.mkdir". Args: path (path-like object): Path or URL. mode (int): The mode parameter is passed to os.mkdir(); see the os.mkdir() description for how it is interpreted. Not supported on cloud storage o...
[ "Create", "a", "directory", "named", "path", "with", "numeric", "mode", "mode", "." ]
python
train
malramsay64/experi
src/experi/run.py
https://github.com/malramsay64/experi/blob/7159644df0420e4a395c87c0c08e11567f401443/src/experi/run.py#L486-L514
def determine_scheduler( scheduler: Optional[str], experiment_definition: Dict[str, YamlValue] ) -> str: """Determine the scheduler to use to run the jobs.""" # Scheduler value from command line has first priority if scheduler is not None: if scheduler in ["shell", "pbs", "slurm"]: ...
[ "def", "determine_scheduler", "(", "scheduler", ":", "Optional", "[", "str", "]", ",", "experiment_definition", ":", "Dict", "[", "str", ",", "YamlValue", "]", ")", "->", "str", ":", "# Scheduler value from command line has first priority", "if", "scheduler", "is", ...
Determine the scheduler to use to run the jobs.
[ "Determine", "the", "scheduler", "to", "use", "to", "run", "the", "jobs", "." ]
python
train
rsmuc/health_monitoring_plugins
health_monitoring_plugins/raritan.py
https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/raritan.py#L68-L77
def real_value(value, digit): """ function to calculate the real value we need to devide the value by the digit e.g. value = 100 digit = 2 return: "1.0" """ return str(float(value) / math.pow(10, float(digit)))
[ "def", "real_value", "(", "value", ",", "digit", ")", ":", "return", "str", "(", "float", "(", "value", ")", "/", "math", ".", "pow", "(", "10", ",", "float", "(", "digit", ")", ")", ")" ]
function to calculate the real value we need to devide the value by the digit e.g. value = 100 digit = 2 return: "1.0"
[ "function", "to", "calculate", "the", "real", "value", "we", "need", "to", "devide", "the", "value", "by", "the", "digit", "e", ".", "g", ".", "value", "=", "100", "digit", "=", "2", "return", ":", "1", ".", "0" ]
python
train
inveniosoftware-contrib/record-recommender
record_recommender/profiles.py
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/profiles.py#L158-L186
def _create_user_profiles(self, profiles, file, valid_records, ip_user=False, year=None, week=None): """ Create user profiles with all the records visited or downloaded. Returns: Dictionary with the user id and a record list. {'2323': [1, 2, 4]} """...
[ "def", "_create_user_profiles", "(", "self", ",", "profiles", ",", "file", ",", "valid_records", ",", "ip_user", "=", "False", ",", "year", "=", "None", ",", "week", "=", "None", ")", ":", "for", "record", "in", "file", ".", "get_records", "(", ")", ":...
Create user profiles with all the records visited or downloaded. Returns: Dictionary with the user id and a record list. {'2323': [1, 2, 4]}
[ "Create", "user", "profiles", "with", "all", "the", "records", "visited", "or", "downloaded", "." ]
python
train
Spinmob/spinmob
_prefs.py
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_prefs.py#L110-L119
def Dump(self): """ Dumps the current prefs to the preferences.txt file """ prefs_file = open(self.prefs_path, 'w') for n in range(0,len(self.prefs)): if len(list(self.prefs.items())[n]) > 1: prefs_file.write(str(list(self.prefs.items())[n][0]) + ' = '...
[ "def", "Dump", "(", "self", ")", ":", "prefs_file", "=", "open", "(", "self", ".", "prefs_path", ",", "'w'", ")", "for", "n", "in", "range", "(", "0", ",", "len", "(", "self", ".", "prefs", ")", ")", ":", "if", "len", "(", "list", "(", "self", ...
Dumps the current prefs to the preferences.txt file
[ "Dumps", "the", "current", "prefs", "to", "the", "preferences", ".", "txt", "file" ]
python
train
howie6879/ruia
ruia/request.py
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/request.py#L85-L126
async def fetch(self) -> Response: """Fetch all the information by using aiohttp""" if self.request_config.get('DELAY', 0) > 0: await asyncio.sleep(self.request_config['DELAY']) timeout = self.request_config.get('TIMEOUT', 10) try: async with async_timeout.timeou...
[ "async", "def", "fetch", "(", "self", ")", "->", "Response", ":", "if", "self", ".", "request_config", ".", "get", "(", "'DELAY'", ",", "0", ")", ">", "0", ":", "await", "asyncio", ".", "sleep", "(", "self", ".", "request_config", "[", "'DELAY'", "]"...
Fetch all the information by using aiohttp
[ "Fetch", "all", "the", "information", "by", "using", "aiohttp" ]
python
test
aleju/imgaug
imgaug/imgaug.py
https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1297-L1422
def pad(arr, top=0, right=0, bottom=0, left=0, mode="constant", cval=0): """ Pad an image-like array on its top/right/bottom/left side. This function is a wrapper around :func:`numpy.pad`. dtype support:: * ``uint8``: yes; fully tested (1) * ``uint16``: yes; fully tested (1) *...
[ "def", "pad", "(", "arr", ",", "top", "=", "0", ",", "right", "=", "0", ",", "bottom", "=", "0", ",", "left", "=", "0", ",", "mode", "=", "\"constant\"", ",", "cval", "=", "0", ")", ":", "do_assert", "(", "arr", ".", "ndim", "in", "[", "2", ...
Pad an image-like array on its top/right/bottom/left side. This function is a wrapper around :func:`numpy.pad`. dtype support:: * ``uint8``: yes; fully tested (1) * ``uint16``: yes; fully tested (1) * ``uint32``: yes; fully tested (2) (3) * ``uint64``: yes; fully tested (2) (3...
[ "Pad", "an", "image", "-", "like", "array", "on", "its", "top", "/", "right", "/", "bottom", "/", "left", "side", "." ]
python
valid
spyder-ide/spyder-notebook
spyder_notebook/notebookplugin.py
https://github.com/spyder-ide/spyder-notebook/blob/54e626b9d2a3fccd3e4625b0f97fe06e5bb1a6db/spyder_notebook/notebookplugin.py#L204-L214
def check_compatibility(self): """Check compatibility for PyQt and sWebEngine.""" message = '' value = True if PYQT4 or PYSIDE: message = _("You are working with Qt4 and in order to use this " "plugin you need to have Qt5.<br><br>" ...
[ "def", "check_compatibility", "(", "self", ")", ":", "message", "=", "''", "value", "=", "True", "if", "PYQT4", "or", "PYSIDE", ":", "message", "=", "_", "(", "\"You are working with Qt4 and in order to use this \"", "\"plugin you need to have Qt5.<br><br>\"", "\"Please...
Check compatibility for PyQt and sWebEngine.
[ "Check", "compatibility", "for", "PyQt", "and", "sWebEngine", "." ]
python
train
cloudendpoints/endpoints-python
endpoints/api_config.py
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L2073-L2098
def __frontend_limit_rules_descriptor(self, api_info): """Builds a frontend limit rules descriptor from API info. Args: api_info: An _ApiInfo object. Returns: A list of dictionaries with frontend limit rules information. """ if not api_info.frontend_limits.rules: return None ...
[ "def", "__frontend_limit_rules_descriptor", "(", "self", ",", "api_info", ")", ":", "if", "not", "api_info", ".", "frontend_limits", ".", "rules", ":", "return", "None", "rules", "=", "[", "]", "for", "rule", "in", "api_info", ".", "frontend_limits", ".", "r...
Builds a frontend limit rules descriptor from API info. Args: api_info: An _ApiInfo object. Returns: A list of dictionaries with frontend limit rules information.
[ "Builds", "a", "frontend", "limit", "rules", "descriptor", "from", "API", "info", "." ]
python
train
gmr/rejected
rejected/process.py
https://github.com/gmr/rejected/blob/610a3e1401122ecb98d891b6795cca0255e5b044/rejected/process.py#L297-L305
def maybe_submit_measurement(self): """Check for configured instrumentation backends and if found, submit the message measurement info. """ if self.statsd: self.submit_statsd_measurements() if self.influxdb: self.submit_influxdb_measurement()
[ "def", "maybe_submit_measurement", "(", "self", ")", ":", "if", "self", ".", "statsd", ":", "self", ".", "submit_statsd_measurements", "(", ")", "if", "self", ".", "influxdb", ":", "self", ".", "submit_influxdb_measurement", "(", ")" ]
Check for configured instrumentation backends and if found, submit the message measurement info.
[ "Check", "for", "configured", "instrumentation", "backends", "and", "if", "found", "submit", "the", "message", "measurement", "info", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xchart/axes/xnumberaxis.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/axes/xnumberaxis.py#L59-L88
def calculateValues(self): """ Overloads the calculate values method to calculate the values for this axis based on the minimum and maximum values, and the number of steps desired. :return [<variant>, ..] """ if self.maximum() <= self.minimum(...
[ "def", "calculateValues", "(", "self", ")", ":", "if", "self", ".", "maximum", "(", ")", "<=", "self", ".", "minimum", "(", ")", ":", "return", "[", "]", "max_labels", "=", "self", ".", "maximumLabelCount", "(", ")", "step", "=", "(", "self", ".", ...
Overloads the calculate values method to calculate the values for this axis based on the minimum and maximum values, and the number of steps desired. :return [<variant>, ..]
[ "Overloads", "the", "calculate", "values", "method", "to", "calculate", "the", "values", "for", "this", "axis", "based", "on", "the", "minimum", "and", "maximum", "values", "and", "the", "number", "of", "steps", "desired", ".", ":", "return", "[", "<variant"...
python
train
NYUCCL/psiTurk
psiturk/amt_services.py
https://github.com/NYUCCL/psiTurk/blob/7170b992a0b5f56c165929cf87b3d3a1f3336c36/psiturk/amt_services.py#L410-L419
def approve_worker(self, assignment_id, override_rejection = False): ''' Approve worker ''' if not self.connect_to_turk(): return False try: self.mtc.approve_assignment(AssignmentId=assignment_id, OverrideRejection=override_rejection) return Tr...
[ "def", "approve_worker", "(", "self", ",", "assignment_id", ",", "override_rejection", "=", "False", ")", ":", "if", "not", "self", ".", "connect_to_turk", "(", ")", ":", "return", "False", "try", ":", "self", ".", "mtc", ".", "approve_assignment", "(", "A...
Approve worker
[ "Approve", "worker" ]
python
train
ronaldguillen/wave
wave/reverse.py
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/reverse.py#L55-L66
def _reverse(viewname, args=None, kwargs=None, request=None, format=None, **extra): """ Same as `django.core.urlresolvers.reverse`, but optionally takes a request and returns a fully qualified URL, using the request to get the base URL. """ if format is not None: kwargs = kwargs or {} ...
[ "def", "_reverse", "(", "viewname", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "request", "=", "None", ",", "format", "=", "None", ",", "*", "*", "extra", ")", ":", "if", "format", "is", "not", "None", ":", "kwargs", "=", "kwargs", ...
Same as `django.core.urlresolvers.reverse`, but optionally takes a request and returns a fully qualified URL, using the request to get the base URL.
[ "Same", "as", "django", ".", "core", ".", "urlresolvers", ".", "reverse", "but", "optionally", "takes", "a", "request", "and", "returns", "a", "fully", "qualified", "URL", "using", "the", "request", "to", "get", "the", "base", "URL", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/revnet.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/revnet.py#L425-L431
def revnet_164_cifar(): """Tiny hparams suitable for CIFAR/etc.""" hparams = revnet_cifar_base() hparams.bottleneck = True hparams.num_channels = [16, 32, 64] hparams.num_layers_per_block = [8, 8, 8] return hparams
[ "def", "revnet_164_cifar", "(", ")", ":", "hparams", "=", "revnet_cifar_base", "(", ")", "hparams", ".", "bottleneck", "=", "True", "hparams", ".", "num_channels", "=", "[", "16", ",", "32", ",", "64", "]", "hparams", ".", "num_layers_per_block", "=", "[",...
Tiny hparams suitable for CIFAR/etc.
[ "Tiny", "hparams", "suitable", "for", "CIFAR", "/", "etc", "." ]
python
train
buriburisuri/sugartensor
sugartensor/sg_logging.py
https://github.com/buriburisuri/sugartensor/blob/d2c039954777c7fbe3eb0c2ae40c45c9854deb40/sugartensor/sg_logging.py#L122-L139
def sg_summary_image(tensor, prefix=None, name=None): r"""Register `tensor` to summary report as `image` Args: tensor: A tensor to log as image prefix: A `string`. A prefix to display in the tensor board web UI. name: A `string`. A name to display in the tensor board web UI. Returns: ...
[ "def", "sg_summary_image", "(", "tensor", ",", "prefix", "=", "None", ",", "name", "=", "None", ")", ":", "# defaults", "prefix", "=", "''", "if", "prefix", "is", "None", "else", "prefix", "+", "'/'", "# summary name", "name", "=", "prefix", "+", "_prett...
r"""Register `tensor` to summary report as `image` Args: tensor: A tensor to log as image prefix: A `string`. A prefix to display in the tensor board web UI. name: A `string`. A name to display in the tensor board web UI. Returns: None
[ "r", "Register", "tensor", "to", "summary", "report", "as", "image" ]
python
train
Diaoul/subliminal
subliminal/providers/tvsubtitles.py
https://github.com/Diaoul/subliminal/blob/a952dfb2032eb0fd6eb1eb89f04080923c11c4cf/subliminal/providers/tvsubtitles.py#L92-L124
def search_show_id(self, series, year=None): """Search the show id from the `series` and `year`. :param str series: series of the episode. :param year: year of the series, if any. :type year: int :return: the show id, if any. :rtype: int """ # make the s...
[ "def", "search_show_id", "(", "self", ",", "series", ",", "year", "=", "None", ")", ":", "# make the search", "logger", ".", "info", "(", "'Searching show id for %r'", ",", "series", ")", "r", "=", "self", ".", "session", ".", "post", "(", "self", ".", "...
Search the show id from the `series` and `year`. :param str series: series of the episode. :param year: year of the series, if any. :type year: int :return: the show id, if any. :rtype: int
[ "Search", "the", "show", "id", "from", "the", "series", "and", "year", "." ]
python
train
zhmcclient/python-zhmcclient
zhmcclient/_storage_group.py
https://github.com/zhmcclient/python-zhmcclient/blob/9657563e5d9184c51d3c903442a58b9725fdf335/zhmcclient/_storage_group.py#L328-L341
def cpc(self): """ :class:`~zhmcclient.Cpc`: The :term:`CPC` to which this storage group is associated. The returned :class:`~zhmcclient.Cpc` has only a minimal set of properties populated. """ # We do here some lazy loading. if not self._cpc: ...
[ "def", "cpc", "(", "self", ")", ":", "# We do here some lazy loading.", "if", "not", "self", ".", "_cpc", ":", "cpc_uri", "=", "self", ".", "get_property", "(", "'cpc-uri'", ")", "cpc_mgr", "=", "self", ".", "manager", ".", "console", ".", "manager", ".", ...
:class:`~zhmcclient.Cpc`: The :term:`CPC` to which this storage group is associated. The returned :class:`~zhmcclient.Cpc` has only a minimal set of properties populated.
[ ":", "class", ":", "~zhmcclient", ".", "Cpc", ":", "The", ":", "term", ":", "CPC", "to", "which", "this", "storage", "group", "is", "associated", "." ]
python
train
peepall/FancyLogger
FancyLogger/__init__.py
https://github.com/peepall/FancyLogger/blob/7f13f1397e76ed768fb6b6358194118831fafc6d/FancyLogger/__init__.py#L277-L286
def set_level(self, level, console_only=False): """ Defines the logging level (from standard logging module) for log messages. :param level: Level of logging for the file logger. :param console_only: [Optional] If True then the file logger...
[ "def", "set_level", "(", "self", ",", "level", ",", "console_only", "=", "False", ")", ":", "self", ".", "queue", ".", "put", "(", "dill", ".", "dumps", "(", "SetLevelCommand", "(", "level", "=", "level", ",", "console_only", "=", "console_only", ")", ...
Defines the logging level (from standard logging module) for log messages. :param level: Level of logging for the file logger. :param console_only: [Optional] If True then the file logger will not be affected.
[ "Defines", "the", "logging", "level", "(", "from", "standard", "logging", "module", ")", "for", "log", "messages", ".", ":", "param", "level", ":", "Level", "of", "logging", "for", "the", "file", "logger", ".", ":", "param", "console_only", ":", "[", "Op...
python
train
econ-ark/HARK
HARK/ConsumptionSaving/ConsAggShockModel.py
https://github.com/econ-ark/HARK/blob/3d184153a189e618a87c9540df1cd12044039cc5/HARK/ConsumptionSaving/ConsAggShockModel.py#L1045-L1089
def calcRandW(self,aLvlNow,pLvlNow): ''' Calculates the interest factor and wage rate this period using each agent's capital stock to get the aggregate capital ratio. Parameters ---------- aLvlNow : [np.array] Agents' current end-of-period assets. Elements o...
[ "def", "calcRandW", "(", "self", ",", "aLvlNow", ",", "pLvlNow", ")", ":", "# Calculate aggregate savings", "AaggPrev", "=", "np", ".", "mean", "(", "np", ".", "array", "(", "aLvlNow", ")", ")", "/", "np", ".", "mean", "(", "pLvlNow", ")", "# End-of-peri...
Calculates the interest factor and wage rate this period using each agent's capital stock to get the aggregate capital ratio. Parameters ---------- aLvlNow : [np.array] Agents' current end-of-period assets. Elements of the list correspond to types in the economy...
[ "Calculates", "the", "interest", "factor", "and", "wage", "rate", "this", "period", "using", "each", "agent", "s", "capital", "stock", "to", "get", "the", "aggregate", "capital", "ratio", "." ]
python
train
thebigmunch/google-music
src/google_music/clients/mobileclient.py
https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L2024-L2030
def top_charts_genres(self): """Get a listing of genres from the browse top charts tab.""" response = self._call(mc_calls.BrowseTopChartGenres) top_chart_genres = response.body.get('genres', []) return top_chart_genres
[ "def", "top_charts_genres", "(", "self", ")", ":", "response", "=", "self", ".", "_call", "(", "mc_calls", ".", "BrowseTopChartGenres", ")", "top_chart_genres", "=", "response", ".", "body", ".", "get", "(", "'genres'", ",", "[", "]", ")", "return", "top_c...
Get a listing of genres from the browse top charts tab.
[ "Get", "a", "listing", "of", "genres", "from", "the", "browse", "top", "charts", "tab", "." ]
python
train
tbreitenfeldt/invisible_ui
invisible_ui/events/eventManager.py
https://github.com/tbreitenfeldt/invisible_ui/blob/1a6907bfa61bded13fa9fb83ec7778c0df84487f/invisible_ui/events/eventManager.py#L32-L57
def handle_event(self, event): """ An abstract method that must be overwritten by child classes used to handle events. event - the event to be handled returns true or false if the event could be handled here default code is given for this method, however subclasses must still ...
[ "def", "handle_event", "(", "self", ",", "event", ")", ":", "# loop through the handlers associated with the event type.", "for", "h", "in", "self", ".", "_events", ".", "get", "(", "event", ".", "type", ",", "[", "]", ")", ":", "# Iterate through the handler's di...
An abstract method that must be overwritten by child classes used to handle events. event - the event to be handled returns true or false if the event could be handled here default code is given for this method, however subclasses must still override this method to insure the subclass has the...
[ "An", "abstract", "method", "that", "must", "be", "overwritten", "by", "child", "classes", "used", "to", "handle", "events", "." ]
python
train
pylp/pylp
pylp/lib/src.py
https://github.com/pylp/pylp/blob/7ebaa55fbaf61cb8175f211dd41ef2928c22d4d4/pylp/lib/src.py#L17-L45
def find_files(globs): """Find files to include.""" last_cwd = os.getcwd() os.chdir(config.cwd) gex, gin = separate_globs(globs) # Find excluded files exclude = [] for glob in gex: parse_glob(glob, exclude) files = [] include = [] order = 0 # Find included files and removed excluded files for glob in...
[ "def", "find_files", "(", "globs", ")", ":", "last_cwd", "=", "os", ".", "getcwd", "(", ")", "os", ".", "chdir", "(", "config", ".", "cwd", ")", "gex", ",", "gin", "=", "separate_globs", "(", "globs", ")", "# Find excluded files", "exclude", "=", "[", ...
Find files to include.
[ "Find", "files", "to", "include", "." ]
python
train
impact27/registrator
registrator/image.py
https://github.com/impact27/registrator/blob/04c099d83e0466207dc5b2e40d9b03db020d4dad/registrator/image.py#L1043-L1120
def get_peak_pos(im, wrap=False): """Get the peak position with subpixel precision Parameters ---------- im: 2d array The image containing a peak wrap: boolean, defaults False True if the image reoresents a torric world Returns ------- [y,x]: 2 numbers The posit...
[ "def", "get_peak_pos", "(", "im", ",", "wrap", "=", "False", ")", ":", "im", "=", "np", ".", "asarray", "(", "im", ")", "# remove invalid values (assuming im>0)", "im", "[", "np", ".", "logical_not", "(", "np", ".", "isfinite", "(", "im", ")", ")", "]"...
Get the peak position with subpixel precision Parameters ---------- im: 2d array The image containing a peak wrap: boolean, defaults False True if the image reoresents a torric world Returns ------- [y,x]: 2 numbers The position of the highest peak with subpixel pre...
[ "Get", "the", "peak", "position", "with", "subpixel", "precision" ]
python
train
wummel/linkchecker
third_party/dnspython/dns/zone.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/dnspython/dns/zone.py#L506-L520
def check_origin(self): """Do some simple checking of the zone's origin. @raises dns.zone.NoSOA: there is no SOA RR @raises dns.zone.NoNS: there is no NS RRset @raises KeyError: there is no origin node """ if self.relativize: name = dns.name.empty els...
[ "def", "check_origin", "(", "self", ")", ":", "if", "self", ".", "relativize", ":", "name", "=", "dns", ".", "name", ".", "empty", "else", ":", "name", "=", "self", ".", "origin", "if", "self", ".", "get_rdataset", "(", "name", ",", "dns", ".", "rd...
Do some simple checking of the zone's origin. @raises dns.zone.NoSOA: there is no SOA RR @raises dns.zone.NoNS: there is no NS RRset @raises KeyError: there is no origin node
[ "Do", "some", "simple", "checking", "of", "the", "zone", "s", "origin", "." ]
python
train
pywavefront/PyWavefront
pywavefront/material.py
https://github.com/pywavefront/PyWavefront/blob/39ee5186cb37750d4654d19ebe43f723ecd01e2f/pywavefront/material.py#L217-L220
def parse_map_Ka(self): """Ambient map""" Kd = os.path.join(self.dir, " ".join(self.values[1:])) self.this_material.set_texture_ambient(Kd)
[ "def", "parse_map_Ka", "(", "self", ")", ":", "Kd", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dir", ",", "\" \"", ".", "join", "(", "self", ".", "values", "[", "1", ":", "]", ")", ")", "self", ".", "this_material", ".", "set_texture...
Ambient map
[ "Ambient", "map" ]
python
train
gbowerman/azurerm
azurerm/computerp.py
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L619-L635
def list_vms(access_token, subscription_id, resource_group): '''List VMs in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. Returns: HTTP response....
[ "def", "list_vms", "(", "access_token", ",", "subscription_id", ",", "resource_group", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups/'", ",", "resourc...
List VMs in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. Returns: HTTP response. JSON body of a list of VM model views.
[ "List", "VMs", "in", "a", "resource", "group", "." ]
python
train
pypa/setuptools
setuptools/dist.py
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/dist.py#L561-L621
def _parse_config_files(self, filenames=None): """ Adapted from distutils.dist.Distribution.parse_config_files, this method provides the same functionality in subtly-improved ways. """ from setuptools.extern.six.moves.configparser import ConfigParser # Ignore ins...
[ "def", "_parse_config_files", "(", "self", ",", "filenames", "=", "None", ")", ":", "from", "setuptools", ".", "extern", ".", "six", ".", "moves", ".", "configparser", "import", "ConfigParser", "# Ignore install directory options if we have a venv", "if", "six", "."...
Adapted from distutils.dist.Distribution.parse_config_files, this method provides the same functionality in subtly-improved ways.
[ "Adapted", "from", "distutils", ".", "dist", ".", "Distribution", ".", "parse_config_files", "this", "method", "provides", "the", "same", "functionality", "in", "subtly", "-", "improved", "ways", "." ]
python
train
jonathf/chaospy
chaospy/distributions/sampler/sequences/sobol.py
https://github.com/jonathf/chaospy/blob/25ecfa7bf5608dc10c0b31d142ded0e3755f5d74/chaospy/distributions/sampler/sequences/sobol.py#L118-L190
def create_sobol_samples(order, dim, seed=1): """ Args: order (int): Number of unique samples to generate. dim (int): Number of spacial dimensions. Must satisfy ``0 < dim < 41``. seed (int): Starting seed. Non-positive values are treated as 1. If omitt...
[ "def", "create_sobol_samples", "(", "order", ",", "dim", ",", "seed", "=", "1", ")", ":", "assert", "0", "<", "dim", "<", "DIM_MAX", ",", "\"dim in [1, 40]\"", "# global RANDOM_SEED # pylint: disable=global-statement", "# if seed is None:", "# seed = RANDOM_SEED", ...
Args: order (int): Number of unique samples to generate. dim (int): Number of spacial dimensions. Must satisfy ``0 < dim < 41``. seed (int): Starting seed. Non-positive values are treated as 1. If omitted, consecutive samples are used. Returns...
[ "Args", ":", "order", "(", "int", ")", ":", "Number", "of", "unique", "samples", "to", "generate", ".", "dim", "(", "int", ")", ":", "Number", "of", "spacial", "dimensions", ".", "Must", "satisfy", "0", "<", "dim", "<", "41", ".", "seed", "(", "int...
python
train
jilljenn/tryalgo
tryalgo/fenwick.py
https://github.com/jilljenn/tryalgo/blob/89a4dd9655e7b6b0a176f72b4c60d0196420dfe1/tryalgo/fenwick.py#L38-L46
def add(self, i, val): """ :param int i: positive :modifies: adds val to t[i] """ assert i > 0 while i < len(self.s): self.s[i] += val i += (i & -i)
[ "def", "add", "(", "self", ",", "i", ",", "val", ")", ":", "assert", "i", ">", "0", "while", "i", "<", "len", "(", "self", ".", "s", ")", ":", "self", ".", "s", "[", "i", "]", "+=", "val", "i", "+=", "(", "i", "&", "-", "i", ")" ]
:param int i: positive :modifies: adds val to t[i]
[ ":", "param", "int", "i", ":", "positive", ":", "modifies", ":", "adds", "val", "to", "t", "[", "i", "]" ]
python
train
pytroll/satpy
satpy/readers/goes_imager_nc.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/goes_imager_nc.py#L816-L835
def _calibrate(self, radiance, coefs, channel, calibration): """Convert radiance to reflectance or brightness temperature""" if self._is_vis(channel): if not calibration == 'reflectance': raise ValueError('Cannot calibrate VIS channel to ' '{}...
[ "def", "_calibrate", "(", "self", ",", "radiance", ",", "coefs", ",", "channel", ",", "calibration", ")", ":", "if", "self", ".", "_is_vis", "(", "channel", ")", ":", "if", "not", "calibration", "==", "'reflectance'", ":", "raise", "ValueError", "(", "'C...
Convert radiance to reflectance or brightness temperature
[ "Convert", "radiance", "to", "reflectance", "or", "brightness", "temperature" ]
python
train
jantman/awslimitchecker
awslimitchecker/services/route53.py
https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/route53.py#L111-L125
def _get_hosted_zones(self): """ Return all available hosted zones :returns: dict of hosted zones :rtype: dict """ results = paginate_dict( self.conn.list_hosted_zones, alc_marker_path=['NextMarker'], alc_data_path=['HostedZones'], ...
[ "def", "_get_hosted_zones", "(", "self", ")", ":", "results", "=", "paginate_dict", "(", "self", ".", "conn", ".", "list_hosted_zones", ",", "alc_marker_path", "=", "[", "'NextMarker'", "]", ",", "alc_data_path", "=", "[", "'HostedZones'", "]", ",", "alc_marke...
Return all available hosted zones :returns: dict of hosted zones :rtype: dict
[ "Return", "all", "available", "hosted", "zones" ]
python
train
eqcorrscan/EQcorrscan
eqcorrscan/core/subspace.py
https://github.com/eqcorrscan/EQcorrscan/blob/3121b4aca801ee5d38f56ca297ce1c0f9515d9ff/eqcorrscan/core/subspace.py#L253-L320
def detect(self, st, threshold, trig_int, moveout=0, min_trig=0, process=True, extract_detections=False, cores=1, debug=0): """ Detect within continuous data using the subspace method. :type st: obspy.core.stream.Stream :param st: Un-processed stream to detect...
[ "def", "detect", "(", "self", ",", "st", ",", "threshold", ",", "trig_int", ",", "moveout", "=", "0", ",", "min_trig", "=", "0", ",", "process", "=", "True", ",", "extract_detections", "=", "False", ",", "cores", "=", "1", ",", "debug", "=", "0", "...
Detect within continuous data using the subspace method. :type st: obspy.core.stream.Stream :param st: Un-processed stream to detect within using the subspace detector. :type threshold: float :param threshold: Threshold value for detections between 0-1 :type trig_int...
[ "Detect", "within", "continuous", "data", "using", "the", "subspace", "method", "." ]
python
train
astooke/gtimer
gtimer/util.py
https://github.com/astooke/gtimer/blob/2146dab459e5d959feb291821733d3d3ba7c523c/gtimer/util.py#L20-L36
def compat_py2_py3(): """ For Python 2, 3 compatibility. """ if (sys.version_info > (3, 0)): def iteritems(dictionary): return dictionary.items() def itervalues(dictionary): return dictionary.values() else: def iteritems(dictionary): return dicti...
[ "def", "compat_py2_py3", "(", ")", ":", "if", "(", "sys", ".", "version_info", ">", "(", "3", ",", "0", ")", ")", ":", "def", "iteritems", "(", "dictionary", ")", ":", "return", "dictionary", ".", "items", "(", ")", "def", "itervalues", "(", "diction...
For Python 2, 3 compatibility.
[ "For", "Python", "2", "3", "compatibility", "." ]
python
train
eyurtsev/FlowCytometryTools
FlowCytometryTools/core/bases.py
https://github.com/eyurtsev/FlowCytometryTools/blob/4355632508b875273d68c7e2972c17668bcf7b40/FlowCytometryTools/core/bases.py#L838-L845
def _is_valid_position(self, position): ''' check if given position is valid for this collection ''' row, col = position valid_r = row in self.row_labels valid_c = col in self.col_labels return valid_r and valid_c
[ "def", "_is_valid_position", "(", "self", ",", "position", ")", ":", "row", ",", "col", "=", "position", "valid_r", "=", "row", "in", "self", ".", "row_labels", "valid_c", "=", "col", "in", "self", ".", "col_labels", "return", "valid_r", "and", "valid_c" ]
check if given position is valid for this collection
[ "check", "if", "given", "position", "is", "valid", "for", "this", "collection" ]
python
train
inveniosoftware/invenio-accounts
invenio_accounts/tasks.py
https://github.com/inveniosoftware/invenio-accounts/blob/b0d2f0739b00dbefea22ca15d7d374a1b4a63aec/invenio_accounts/tasks.py#L24-L31
def send_security_email(data): """Celery task to send security email. :param data: Contains the email data. """ msg = Message() msg.__dict__.update(data) current_app.extensions['mail'].send(msg)
[ "def", "send_security_email", "(", "data", ")", ":", "msg", "=", "Message", "(", ")", "msg", ".", "__dict__", ".", "update", "(", "data", ")", "current_app", ".", "extensions", "[", "'mail'", "]", ".", "send", "(", "msg", ")" ]
Celery task to send security email. :param data: Contains the email data.
[ "Celery", "task", "to", "send", "security", "email", "." ]
python
train
wbond/oscrypto
oscrypto/_win/asymmetric.py
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L3126-L3174
def _decrypt(private_key, ciphertext, rsa_oaep_padding=False): """ Encrypts a value using an RSA private key :param private_key: A PrivateKey instance to decrypt with :param ciphertext: A byte string of the data to decrypt :param rsa_oaep_padding: If OAEP padding should be...
[ "def", "_decrypt", "(", "private_key", ",", "ciphertext", ",", "rsa_oaep_padding", "=", "False", ")", ":", "if", "not", "isinstance", "(", "private_key", ",", "PrivateKey", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n private_key m...
Encrypts a value using an RSA private key :param private_key: A PrivateKey instance to decrypt with :param ciphertext: A byte string of the data to decrypt :param rsa_oaep_padding: If OAEP padding should be used instead of PKCS#1 v1.5 :raises: ValueError - when any of...
[ "Encrypts", "a", "value", "using", "an", "RSA", "private", "key" ]
python
valid
Capitains/MyCapytain
MyCapytain/retrievers/cts5.py
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/retrievers/cts5.py#L157-L173
def getPassagePlus(self, urn, inventory=None, context=None): """ Retrieve a passage and information about it :param urn: URN identifying the text's passage (Minimum depth : 1) :type urn: text :param inventory: Name of the inventory :type inventory: text :param context: N...
[ "def", "getPassagePlus", "(", "self", ",", "urn", ",", "inventory", "=", "None", ",", "context", "=", "None", ")", ":", "return", "self", ".", "call", "(", "{", "\"inv\"", ":", "inventory", ",", "\"urn\"", ":", "urn", ",", "\"context\"", ":", "context"...
Retrieve a passage and information about it :param urn: URN identifying the text's passage (Minimum depth : 1) :type urn: text :param inventory: Name of the inventory :type inventory: text :param context: Number of citation units at the same level of the citation hierarchy as th...
[ "Retrieve", "a", "passage", "and", "information", "about", "it" ]
python
train
aliyun/aliyun-odps-python-sdk
odps/lib/futures/_base.py
https://github.com/aliyun/aliyun-odps-python-sdk/blob/4b0de18f5864386df6068f26f026e62f932c41e4/odps/lib/futures/_base.py#L176-L233
def as_completed(fs, timeout=None): """An iterator over the given futures that yields each as it completes. Args: fs: The sequence of Futures (possibly created by different Executors) to iterate over. timeout: The maximum number of seconds to wait. If None, then there is...
[ "def", "as_completed", "(", "fs", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "not", "None", ":", "end_time", "=", "timeout", "+", "time", ".", "time", "(", ")", "fs", "=", "set", "(", "fs", ")", "with", "_AcquireFutures", "(", "f...
An iterator over the given futures that yields each as it completes. Args: fs: The sequence of Futures (possibly created by different Executors) to iterate over. timeout: The maximum number of seconds to wait. If None, then there is no limit on the wait time. Returns: ...
[ "An", "iterator", "over", "the", "given", "futures", "that", "yields", "each", "as", "it", "completes", "." ]
python
train
ethereum/pyrlp
rlp/codec.py
https://github.com/ethereum/pyrlp/blob/bb898f8056da3973204c699621350bf9565e43df/rlp/codec.py#L98-L111
def length_prefix(length, offset): """Construct the prefix to lists or strings denoting their length. :param length: the length of the item in bytes :param offset: ``0x80`` when encoding raw bytes, ``0xc0`` when encoding a list """ if length < 56: return ALL_BYTES[offset ...
[ "def", "length_prefix", "(", "length", ",", "offset", ")", ":", "if", "length", "<", "56", ":", "return", "ALL_BYTES", "[", "offset", "+", "length", "]", "elif", "length", "<", "LONG_LENGTH", ":", "length_string", "=", "int_to_big_endian", "(", "length", "...
Construct the prefix to lists or strings denoting their length. :param length: the length of the item in bytes :param offset: ``0x80`` when encoding raw bytes, ``0xc0`` when encoding a list
[ "Construct", "the", "prefix", "to", "lists", "or", "strings", "denoting", "their", "length", "." ]
python
train
numenta/htmresearch
htmresearch/frameworks/union_temporal_pooling/union_temporal_pooler_experiment.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/frameworks/union_temporal_pooling/union_temporal_pooler_experiment.py#L230-L247
def getBurstingColumnsStats(self): """ Gets statistics on the Temporal Memory's bursting columns. Used as a metric of Temporal Memory's learning performance. :return: mean, standard deviation, and max of Temporal Memory's bursting columns over time """ traceData = self.tm.mmGetTraceUnpredict...
[ "def", "getBurstingColumnsStats", "(", "self", ")", ":", "traceData", "=", "self", ".", "tm", ".", "mmGetTraceUnpredictedActiveColumns", "(", ")", ".", "data", "resetData", "=", "self", ".", "tm", ".", "mmGetTraceResets", "(", ")", ".", "data", "countTrace", ...
Gets statistics on the Temporal Memory's bursting columns. Used as a metric of Temporal Memory's learning performance. :return: mean, standard deviation, and max of Temporal Memory's bursting columns over time
[ "Gets", "statistics", "on", "the", "Temporal", "Memory", "s", "bursting", "columns", ".", "Used", "as", "a", "metric", "of", "Temporal", "Memory", "s", "learning", "performance", ".", ":", "return", ":", "mean", "standard", "deviation", "and", "max", "of", ...
python
train
limodou/uliweb
uliweb/contrib/generic/__init__.py
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/contrib/generic/__init__.py#L115-L127
def _query_view(self, model, **kwargs): """ :param model: :return: (query, condition) Default use QueryForm """ QueryForm = functions.get_form('QueryForm') if 'form_cls' not in kwargs: kwargs['form_cls'] = QueryForm query = functions.QueryVie...
[ "def", "_query_view", "(", "self", ",", "model", ",", "*", "*", "kwargs", ")", ":", "QueryForm", "=", "functions", ".", "get_form", "(", "'QueryForm'", ")", "if", "'form_cls'", "not", "in", "kwargs", ":", "kwargs", "[", "'form_cls'", "]", "=", "QueryForm...
:param model: :return: (query, condition) Default use QueryForm
[ ":", "param", "model", ":", ":", "return", ":", "(", "query", "condition", ")" ]
python
train
DLR-RM/RAFCON
source/rafcon/gui/controllers/states_editor.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/states_editor.py#L546-L553
def selection_notification(self, model, property, info): """If a single state is selected, open the corresponding tab""" if model is not self.current_state_machine_m or len(self.current_state_machine_m.ongoing_complex_actions) > 0: return state_machine_m = model assert isinst...
[ "def", "selection_notification", "(", "self", ",", "model", ",", "property", ",", "info", ")", ":", "if", "model", "is", "not", "self", ".", "current_state_machine_m", "or", "len", "(", "self", ".", "current_state_machine_m", ".", "ongoing_complex_actions", ")",...
If a single state is selected, open the corresponding tab
[ "If", "a", "single", "state", "is", "selected", "open", "the", "corresponding", "tab" ]
python
train
JinnLynn/genpac
genpac/pysocks/socks.py
https://github.com/JinnLynn/genpac/blob/2f466d28f403a9a5624e02edcd538475fe475fc8/genpac/pysocks/socks.py#L355-L390
def bind(self, *pos, **kw): """ Implements proxy connection for UDP sockets, which happens during the bind() phase. """ proxy_type, proxy_addr, proxy_port, rdns, username, password = self.proxy if not proxy_type or self.type != socket.SOCK_DGRAM: return _orig_...
[ "def", "bind", "(", "self", ",", "*", "pos", ",", "*", "*", "kw", ")", ":", "proxy_type", ",", "proxy_addr", ",", "proxy_port", ",", "rdns", ",", "username", ",", "password", "=", "self", ".", "proxy", "if", "not", "proxy_type", "or", "self", ".", ...
Implements proxy connection for UDP sockets, which happens during the bind() phase.
[ "Implements", "proxy", "connection", "for", "UDP", "sockets", "which", "happens", "during", "the", "bind", "()", "phase", "." ]
python
train
wandb/client
wandb/vendor/prompt_toolkit/key_binding/bindings/emacs.py
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/vendor/prompt_toolkit/key_binding/bindings/emacs.py#L21-L299
def load_emacs_bindings(): """ Some e-macs extensions. """ # Overview of Readline emacs commands: # http://www.catonmat.net/download/readline-emacs-editing-mode-cheat-sheet.pdf registry = ConditionalRegistry(Registry(), EmacsMode()) handle = registry.add_binding insert_mode = EmacsInser...
[ "def", "load_emacs_bindings", "(", ")", ":", "# Overview of Readline emacs commands:", "# http://www.catonmat.net/download/readline-emacs-editing-mode-cheat-sheet.pdf", "registry", "=", "ConditionalRegistry", "(", "Registry", "(", ")", ",", "EmacsMode", "(", ")", ")", "handle",...
Some e-macs extensions.
[ "Some", "e", "-", "macs", "extensions", "." ]
python
train
jtwhite79/pyemu
pyemu/utils/gw_utils.py
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/utils/gw_utils.py#L203-L249
def setup_pilotpoints_grid(ml=None,sr=None,ibound=None,prefix_dict=None, every_n_cell=4, use_ibound_zones=False, pp_dir='.',tpl_dir='.', shapename="pp.shp"): """ setup regularly-spaced (gridded) pilot point p...
[ "def", "setup_pilotpoints_grid", "(", "ml", "=", "None", ",", "sr", "=", "None", ",", "ibound", "=", "None", ",", "prefix_dict", "=", "None", ",", "every_n_cell", "=", "4", ",", "use_ibound_zones", "=", "False", ",", "pp_dir", "=", "'.'", ",", "tpl_dir",...
setup regularly-spaced (gridded) pilot point parameterization Parameters ---------- ml : flopy.mbase a flopy mbase dervied type. If None, sr must not be None. sr : flopy.utils.reference.SpatialReference a spatial reference use to locate the model grid in space. If None, ml mus...
[ "setup", "regularly", "-", "spaced", "(", "gridded", ")", "pilot", "point", "parameterization" ]
python
train
SBRG/ssbio
ssbio/protein/structure/properties/opm.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/opm.py#L44-L116
def run_ppm_server(pdb_file, outfile, force_rerun=False): """Run the PPM server from OPM to predict transmembrane residues. Args: pdb_file (str): Path to PDB file outfile (str): Path to output HTML results file force_rerun (bool): Flag to rerun PPM if HTML results file already exists ...
[ "def", "run_ppm_server", "(", "pdb_file", ",", "outfile", ",", "force_rerun", "=", "False", ")", ":", "if", "ssbio", ".", "utils", ".", "force_rerun", "(", "outfile", "=", "outfile", ",", "flag", "=", "force_rerun", ")", ":", "url", "=", "'http://sunshine....
Run the PPM server from OPM to predict transmembrane residues. Args: pdb_file (str): Path to PDB file outfile (str): Path to output HTML results file force_rerun (bool): Flag to rerun PPM if HTML results file already exists Returns: dict: Dictionary of information from the PPM ...
[ "Run", "the", "PPM", "server", "from", "OPM", "to", "predict", "transmembrane", "residues", "." ]
python
train
saltstack/salt
salt/modules/vsphere.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vsphere.py#L7446-L7483
def set_advanced_configs(vm_name, datacenter, advanced_configs, service_instance=None): ''' Appends extra config parameters to a virtual machine advanced config list vm_name Virtual machine name datacenter Datacenter name where the virtual machine is available ...
[ "def", "set_advanced_configs", "(", "vm_name", ",", "datacenter", ",", "advanced_configs", ",", "service_instance", "=", "None", ")", ":", "current_config", "=", "get_vm_config", "(", "vm_name", ",", "datacenter", "=", "datacenter", ",", "objects", "=", "True", ...
Appends extra config parameters to a virtual machine advanced config list vm_name Virtual machine name datacenter Datacenter name where the virtual machine is available advanced_configs Dictionary with advanced parameter key value pairs service_instance vCenter servic...
[ "Appends", "extra", "config", "parameters", "to", "a", "virtual", "machine", "advanced", "config", "list" ]
python
train
scikit-hep/root_numpy
root_numpy/tmva/_data.py
https://github.com/scikit-hep/root_numpy/blob/3a9bfbcf89f90dc20ca6869480a63a85e1ceebb8/root_numpy/tmva/_data.py#L16-L100
def add_classification_events(obj, events, labels, signal_label=None, weights=None, test=False): """Add classification events to a TMVA::Factory or TMVA::DataLoader from NumPy arrays. Parameters ---------- obj : TMVA::Factory or TMVA::DataLoader A TMVA::Factory or ...
[ "def", "add_classification_events", "(", "obj", ",", "events", ",", "labels", ",", "signal_label", "=", "None", ",", "weights", "=", "None", ",", "test", "=", "False", ")", ":", "if", "NEW_TMVA_API", ":", "# pragma: no cover", "if", "not", "isinstance", "(",...
Add classification events to a TMVA::Factory or TMVA::DataLoader from NumPy arrays. Parameters ---------- obj : TMVA::Factory or TMVA::DataLoader A TMVA::Factory or TMVA::DataLoader (TMVA's interface as of ROOT 6.07/04) instance with variables already booked in exactly the same orde...
[ "Add", "classification", "events", "to", "a", "TMVA", "::", "Factory", "or", "TMVA", "::", "DataLoader", "from", "NumPy", "arrays", "." ]
python
train
Clinical-Genomics/scout
scout/adapter/mongo/institute.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/institute.py#L16-L36
def add_institute(self, institute_obj): """Add a institute to the database Args: institute_obj(Institute) """ internal_id = institute_obj['internal_id'] display_name = institute_obj['internal_id'] # Check if institute already exists if self.i...
[ "def", "add_institute", "(", "self", ",", "institute_obj", ")", ":", "internal_id", "=", "institute_obj", "[", "'internal_id'", "]", "display_name", "=", "institute_obj", "[", "'internal_id'", "]", "# Check if institute already exists", "if", "self", ".", "institute",...
Add a institute to the database Args: institute_obj(Institute)
[ "Add", "a", "institute", "to", "the", "database" ]
python
test
epandurski/flask_signalbus
flask_signalbus/signalbus_cli.py
https://github.com/epandurski/flask_signalbus/blob/253800118443821a40404f04416422b076d62b6e/flask_signalbus/signalbus_cli.py#L21-L55
def flush(signal_names, exclude, wait): """Send pending signals over the message bus. If a list of SIGNAL_NAMES is specified, flushes only those signals. If no SIGNAL_NAMES are specified, flushes all signals. """ signalbus = current_app.extensions['signalbus'] signal_names = set(signal_names)...
[ "def", "flush", "(", "signal_names", ",", "exclude", ",", "wait", ")", ":", "signalbus", "=", "current_app", ".", "extensions", "[", "'signalbus'", "]", "signal_names", "=", "set", "(", "signal_names", ")", "exclude", "=", "set", "(", "exclude", ")", "mode...
Send pending signals over the message bus. If a list of SIGNAL_NAMES is specified, flushes only those signals. If no SIGNAL_NAMES are specified, flushes all signals.
[ "Send", "pending", "signals", "over", "the", "message", "bus", "." ]
python
train
anjos/rrbob
rr/database.py
https://github.com/anjos/rrbob/blob/d32d35bab2aa2698d3caa923fd02afb6d67f3235/rr/database.py#L44-L78
def get(protocol, subset, classes=CLASSES, variables=VARIABLES): '''Returns the data subset given a particular protocol Parameters protocol (string): one of the valid protocols supported by this interface subset (string): one of 'train' or 'test' classes (list of string): a list of strings containi...
[ "def", "get", "(", "protocol", ",", "subset", ",", "classes", "=", "CLASSES", ",", "variables", "=", "VARIABLES", ")", ":", "retval", "=", "split_data", "(", "bob", ".", "db", ".", "iris", ".", "data", "(", ")", ",", "subset", ",", "PROTOCOLS", "[", ...
Returns the data subset given a particular protocol Parameters protocol (string): one of the valid protocols supported by this interface subset (string): one of 'train' or 'test' classes (list of string): a list of strings containing the names of the classes from which you want to have the data...
[ "Returns", "the", "data", "subset", "given", "a", "particular", "protocol" ]
python
train
saltstack/salt
salt/modules/moosefs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/moosefs.py#L46-L89
def fileinfo(path): ''' Return information on a file located on the Moose CLI Example: .. code-block:: bash salt '*' moosefs.fileinfo /path/to/dir/ ''' cmd = 'mfsfileinfo ' + path ret = {} chunknum = '' out = __salt__['cmd.run_all'](cmd, python_shell=False) output = o...
[ "def", "fileinfo", "(", "path", ")", ":", "cmd", "=", "'mfsfileinfo '", "+", "path", "ret", "=", "{", "}", "chunknum", "=", "''", "out", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", "output", "=", "o...
Return information on a file located on the Moose CLI Example: .. code-block:: bash salt '*' moosefs.fileinfo /path/to/dir/
[ "Return", "information", "on", "a", "file", "located", "on", "the", "Moose" ]
python
train
ranaroussi/pywallet
pywallet/utils/bip32.py
https://github.com/ranaroussi/pywallet/blob/206ff224389c490d8798f660c9e79fe97ebb64cf/pywallet/utils/bip32.py#L677-L699
def new_random_wallet(cls, user_entropy=None, network=BitcoinMainNet): """ Generate a new wallet using a randomly generated 512 bit seed. Args: user_entropy: Optional user-supplied entropy which is combined combined with the random seed, to help counteract compromise...
[ "def", "new_random_wallet", "(", "cls", ",", "user_entropy", "=", "None", ",", "network", "=", "BitcoinMainNet", ")", ":", "seed", "=", "str", "(", "urandom", "(", "64", ")", ")", "# 512/8", "# weak extra protection inspired by pybitcointools implementation:", "seed...
Generate a new wallet using a randomly generated 512 bit seed. Args: user_entropy: Optional user-supplied entropy which is combined combined with the random seed, to help counteract compromised PRNGs. You are encouraged to add an optional `user_entropy` stri...
[ "Generate", "a", "new", "wallet", "using", "a", "randomly", "generated", "512", "bit", "seed", "." ]
python
train
zarr-developers/zarr
zarr/storage.py
https://github.com/zarr-developers/zarr/blob/fb8e6d5ea6bc26e451e5cf0eaaee36977556d5b5/zarr/storage.py#L207-L323
def init_array(store, shape, chunks=True, dtype=None, compressor='default', fill_value=None, order='C', overwrite=False, path=None, chunk_store=None, filters=None, object_codec=None): """Initialize an array store with the given configuration. Note that this is a low-level function ...
[ "def", "init_array", "(", "store", ",", "shape", ",", "chunks", "=", "True", ",", "dtype", "=", "None", ",", "compressor", "=", "'default'", ",", "fill_value", "=", "None", ",", "order", "=", "'C'", ",", "overwrite", "=", "False", ",", "path", "=", "...
Initialize an array store with the given configuration. Note that this is a low-level function and there should be no need to call this directly from user code. Parameters ---------- store : MutableMapping A mapping that supports string keys and bytes-like values. shape : int or tuple of in...
[ "Initialize", "an", "array", "store", "with", "the", "given", "configuration", ".", "Note", "that", "this", "is", "a", "low", "-", "level", "function", "and", "there", "should", "be", "no", "need", "to", "call", "this", "directly", "from", "user", "code", ...
python
train
mapillary/mapillary_tools
mapillary_tools/gps_parser.py
https://github.com/mapillary/mapillary_tools/blob/816785e90c589cae6e8e34a5530ce8417d29591c/mapillary_tools/gps_parser.py#L20-L47
def get_lat_lon_time_from_gpx(gpx_file, local_time=True): ''' Read location and time stamps from a track in a GPX file. Returns a list of tuples (time, lat, lon). GPX stores time in UTC, by default we assume your camera used the local time and convert accordingly. ''' with open(gpx_file, '...
[ "def", "get_lat_lon_time_from_gpx", "(", "gpx_file", ",", "local_time", "=", "True", ")", ":", "with", "open", "(", "gpx_file", ",", "'r'", ")", "as", "f", ":", "gpx", "=", "gpxpy", ".", "parse", "(", "f", ")", "points", "=", "[", "]", "if", "len", ...
Read location and time stamps from a track in a GPX file. Returns a list of tuples (time, lat, lon). GPX stores time in UTC, by default we assume your camera used the local time and convert accordingly.
[ "Read", "location", "and", "time", "stamps", "from", "a", "track", "in", "a", "GPX", "file", "." ]
python
train
vaexio/vaex
packages/vaex-hdf5/vaex/hdf5/dataset.py
https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-hdf5/vaex/hdf5/dataset.py#L70-L98
def write_meta(self): """ucds, descriptions and units are written as attributes in the hdf5 file, instead of a seperate file as the default :func:`Dataset.write_meta`. """ with h5py.File(self.filename, "r+") as h5file_output: h5table_root = h5file_output[self.h5table_root_n...
[ "def", "write_meta", "(", "self", ")", ":", "with", "h5py", ".", "File", "(", "self", ".", "filename", ",", "\"r+\"", ")", "as", "h5file_output", ":", "h5table_root", "=", "h5file_output", "[", "self", ".", "h5table_root_name", "]", "if", "self", ".", "d...
ucds, descriptions and units are written as attributes in the hdf5 file, instead of a seperate file as the default :func:`Dataset.write_meta`.
[ "ucds", "descriptions", "and", "units", "are", "written", "as", "attributes", "in", "the", "hdf5", "file", "instead", "of", "a", "seperate", "file", "as", "the", "default", ":", "func", ":", "Dataset", ".", "write_meta", "." ]
python
test
Diviyan-Kalainathan/CausalDiscoveryToolbox
cdt/causality/pairwise/ANM.py
https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/pairwise/ANM.py#L134-L147
def predict_proba(self, a, b, **kwargs): """Prediction method for pairwise causal inference using the ANM model. Args: a (numpy.ndarray): Variable 1 b (numpy.ndarray): Variable 2 Returns: float: Causation score (Value : 1 if a->b and -1 if b->a) """ ...
[ "def", "predict_proba", "(", "self", ",", "a", ",", "b", ",", "*", "*", "kwargs", ")", ":", "a", "=", "scale", "(", "a", ")", ".", "reshape", "(", "(", "-", "1", ",", "1", ")", ")", "b", "=", "scale", "(", "b", ")", ".", "reshape", "(", "...
Prediction method for pairwise causal inference using the ANM model. Args: a (numpy.ndarray): Variable 1 b (numpy.ndarray): Variable 2 Returns: float: Causation score (Value : 1 if a->b and -1 if b->a)
[ "Prediction", "method", "for", "pairwise", "causal", "inference", "using", "the", "ANM", "model", "." ]
python
valid
dusktreader/flask-praetorian
example/custom_claims.py
https://github.com/dusktreader/flask-praetorian/blob/d530cf3ffeffd61bfff1b8c79e8b45e9bfa0db0c/example/custom_claims.py#L103-L124
def login(): """ Logs a user in by parsing a POST request containing user credentials and issuing a JWT token. .. example:: $ curl http://localhost:5000/login -X POST \ -d '{"username":"Walter","password":"calmerthanyouare"}' """ req = flask.request.get_json(force=True) user...
[ "def", "login", "(", ")", ":", "req", "=", "flask", ".", "request", ".", "get_json", "(", "force", "=", "True", ")", "username", "=", "req", ".", "pop", "(", "'username'", ",", "None", ")", "password", "=", "req", ".", "pop", "(", "'password'", ","...
Logs a user in by parsing a POST request containing user credentials and issuing a JWT token. .. example:: $ curl http://localhost:5000/login -X POST \ -d '{"username":"Walter","password":"calmerthanyouare"}'
[ "Logs", "a", "user", "in", "by", "parsing", "a", "POST", "request", "containing", "user", "credentials", "and", "issuing", "a", "JWT", "token", "." ]
python
train
miguelgrinberg/python-socketio
socketio/asyncio_server.py
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_server.py#L121-L158
async def send(self, data, room=None, skip_sid=None, namespace=None, callback=None, **kwargs): """Send a message to one or more connected clients. This function emits an event with the name ``'message'``. Use :func:`emit` to issue custom event names. :param data: The...
[ "async", "def", "send", "(", "self", ",", "data", ",", "room", "=", "None", ",", "skip_sid", "=", "None", ",", "namespace", "=", "None", ",", "callback", "=", "None", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "emit", "(", "'message'"...
Send a message to one or more connected clients. This function emits an event with the name ``'message'``. Use :func:`emit` to issue custom event names. :param data: The data to send to the client or clients. Data can be of type ``str``, ``bytes``, ``list`` or ``dict``. If...
[ "Send", "a", "message", "to", "one", "or", "more", "connected", "clients", "." ]
python
train
push-things/django-th
th_evernote/my_evernote.py
https://github.com/push-things/django-th/blob/86c999d16bcf30b6224206e5b40824309834ac8c/th_evernote/my_evernote.py#L191-L214
def _notebook(trigger, note_store): """ :param trigger: trigger object :param note_store: note_store object :return: note object """ note = Types.Note() if trigger.notebook: # get the notebookGUID ... notebook_id = EvernoteMgr.get_notebook(...
[ "def", "_notebook", "(", "trigger", ",", "note_store", ")", ":", "note", "=", "Types", ".", "Note", "(", ")", "if", "trigger", ".", "notebook", ":", "# get the notebookGUID ...", "notebook_id", "=", "EvernoteMgr", ".", "get_notebook", "(", "note_store", ",", ...
:param trigger: trigger object :param note_store: note_store object :return: note object
[ ":", "param", "trigger", ":", "trigger", "object", ":", "param", "note_store", ":", "note_store", "object", ":", "return", ":", "note", "object" ]
python
train
dswah/pyGAM
pygam/pygam.py
https://github.com/dswah/pyGAM/blob/b3e5c3cd580f0a3ad69f9372861624f67760c325/pygam/pygam.py#L561-L593
def _W(self, mu, weights, y=None): """ compute the PIRLS weights for model predictions. TODO lets verify the formula for this. if we use the square root of the mu with the stable opt, we get the same results as when we use non-sqrt mu with naive opt. this makes me think...
[ "def", "_W", "(", "self", ",", "mu", ",", "weights", ",", "y", "=", "None", ")", ":", "return", "sp", ".", "sparse", ".", "diags", "(", "(", "self", ".", "link", ".", "gradient", "(", "mu", ",", "self", ".", "distribution", ")", "**", "2", "*",...
compute the PIRLS weights for model predictions. TODO lets verify the formula for this. if we use the square root of the mu with the stable opt, we get the same results as when we use non-sqrt mu with naive opt. this makes me think that they are equivalent. also, using non-sqr...
[ "compute", "the", "PIRLS", "weights", "for", "model", "predictions", "." ]
python
train
openstack/networking-cisco
networking_cisco/apps/saf/agent/iptables_driver.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/iptables_driver.py#L90-L100
def _find_rule_no(self, mac): """Find rule number associated with a given mac.""" ipt_cmd = ['iptables', '-L', '--line-numbers'] cmdo = dsl.execute(ipt_cmd, self._root_helper, log_output=False) for o in cmdo.split('\n'): if mac in o.lower(): rule_no = o.split...
[ "def", "_find_rule_no", "(", "self", ",", "mac", ")", ":", "ipt_cmd", "=", "[", "'iptables'", ",", "'-L'", ",", "'--line-numbers'", "]", "cmdo", "=", "dsl", ".", "execute", "(", "ipt_cmd", ",", "self", ".", "_root_helper", ",", "log_output", "=", "False"...
Find rule number associated with a given mac.
[ "Find", "rule", "number", "associated", "with", "a", "given", "mac", "." ]
python
train
sorgerlab/indra
indra/statements/statements.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/statements.py#L525-L553
def make_generic_copy(self, deeply=False): """Make a new matching Statement with no provenance. All agents and other attributes besides evidence, belief, supports, and supported_by will be copied over, and a new uuid will be assigned. Thus, the new Statement will satisfy `new_stmt.match...
[ "def", "make_generic_copy", "(", "self", ",", "deeply", "=", "False", ")", ":", "if", "deeply", ":", "kwargs", "=", "deepcopy", "(", "self", ".", "__dict__", ")", "else", ":", "kwargs", "=", "self", ".", "__dict__", ".", "copy", "(", ")", "for", "att...
Make a new matching Statement with no provenance. All agents and other attributes besides evidence, belief, supports, and supported_by will be copied over, and a new uuid will be assigned. Thus, the new Statement will satisfy `new_stmt.matches(old_stmt)`. If `deeply` is set to True, al...
[ "Make", "a", "new", "matching", "Statement", "with", "no", "provenance", "." ]
python
train
T-002/pycast
pycast/common/timeseries.py
https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/timeseries.py#L170-L194
def from_twodim_list(cls, datalist, tsformat=None): """Creates a new TimeSeries instance from the data stored inside a two dimensional list. :param list datalist: List containing multiple iterables with at least two values. The first item will always be used as timestamp in the predefine...
[ "def", "from_twodim_list", "(", "cls", ",", "datalist", ",", "tsformat", "=", "None", ")", ":", "# create and fill the given TimeSeries", "ts", "=", "TimeSeries", "(", ")", "ts", ".", "set_timeformat", "(", "tsformat", ")", "for", "entry", "in", "datalist", ":...
Creates a new TimeSeries instance from the data stored inside a two dimensional list. :param list datalist: List containing multiple iterables with at least two values. The first item will always be used as timestamp in the predefined format, the second represents the value. All othe...
[ "Creates", "a", "new", "TimeSeries", "instance", "from", "the", "data", "stored", "inside", "a", "two", "dimensional", "list", "." ]
python
train