repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L373-L380
def exists(self, using=None, **kwargs): """ Returns ``True`` if the index already exists in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists`` unchanged. """ return self._get_connection(using).indices.exists(index=self._nam...
[ "def", "exists", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "exists", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwargs"...
Returns ``True`` if the index already exists in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists`` unchanged.
[ "Returns", "True", "if", "the", "index", "already", "exists", "in", "elasticsearch", "." ]
python
train
40.625
apple/turicreate
src/unity/python/turicreate/data_structures/sframe.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3062-L3137
def select_columns(self, column_names): """ Selects all columns where the name of the column or the type of column is included in the column_names. An exception is raised if duplicate columns are selected i.e. sf.select_columns(['a','a']), or non-existent columns are selected. ...
[ "def", "select_columns", "(", "self", ",", "column_names", ")", ":", "if", "not", "_is_non_string_iterable", "(", "column_names", ")", ":", "raise", "TypeError", "(", "\"column_names must be an iterable\"", ")", "if", "not", "(", "all", "(", "[", "isinstance", "...
Selects all columns where the name of the column or the type of column is included in the column_names. An exception is raised if duplicate columns are selected i.e. sf.select_columns(['a','a']), or non-existent columns are selected. Throws an exception for all other input types. ...
[ "Selects", "all", "columns", "where", "the", "name", "of", "the", "column", "or", "the", "type", "of", "column", "is", "included", "in", "the", "column_names", ".", "An", "exception", "is", "raised", "if", "duplicate", "columns", "are", "selected", "i", "....
python
train
39.75
lsst-sqre/sqre-codekit
codekit/progressbar.py
https://github.com/lsst-sqre/sqre-codekit/blob/98122404cd9065d4d1d570867fe518042669126c/codekit/progressbar.py#L73-L90
def eta_bar(msg, max_value): """Display an adaptive ETA / countdown bar with a message. Parameters ---------- msg: str Message to prefix countdown bar line with max_value: max_value The max number of progress bar steps/updates """ widgets = [ "{msg}:".format(msg=ms...
[ "def", "eta_bar", "(", "msg", ",", "max_value", ")", ":", "widgets", "=", "[", "\"{msg}:\"", ".", "format", "(", "msg", "=", "msg", ")", ",", "progressbar", ".", "Bar", "(", ")", ",", "' '", ",", "progressbar", ".", "AdaptiveETA", "(", ")", ",", "]...
Display an adaptive ETA / countdown bar with a message. Parameters ---------- msg: str Message to prefix countdown bar line with max_value: max_value The max number of progress bar steps/updates
[ "Display", "an", "adaptive", "ETA", "/", "countdown", "bar", "with", "a", "message", "." ]
python
train
24.722222
google/grr
grr/client/grr_response_client/client_utils.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils.py#L61-L96
def StatEntryFromStat(stat, pathspec, ext_attrs = True): """Build a stat entry object from a given stat object. Args: stat: A `Stat` object. pathspec: A `PathSpec` from which `stat` was obtained. ext_attrs: Whether to include extended file attributes in the r...
[ "def", "StatEntryFromStat", "(", "stat", ",", "pathspec", ",", "ext_attrs", "=", "True", ")", ":", "result", "=", "rdf_client_fs", ".", "StatEntry", "(", "pathspec", "=", "pathspec", ")", "for", "attr", "in", "_STAT_ATTRS", ":", "value", "=", "getattr", "(...
Build a stat entry object from a given stat object. Args: stat: A `Stat` object. pathspec: A `PathSpec` from which `stat` was obtained. ext_attrs: Whether to include extended file attributes in the result. Returns: `StatEntry` object.
[ "Build", "a", "stat", "entry", "object", "from", "a", "given", "stat", "object", "." ]
python
train
28.5
Nic30/hwtGraph
hwtGraph/elk/fromHwt/mergeSplitsOnInterfaces.py
https://github.com/Nic30/hwtGraph/blob/6b7d4fdd759f263a0fdd2736f02f123e44e4354f/hwtGraph/elk/fromHwt/mergeSplitsOnInterfaces.py#L32-L40
def getRootIntfPort(port: LPort): """ :return: most top port which contains this port """ while True: if isinstance(port.parent, LNode): return port else: port = port.parent
[ "def", "getRootIntfPort", "(", "port", ":", "LPort", ")", ":", "while", "True", ":", "if", "isinstance", "(", "port", ".", "parent", ",", "LNode", ")", ":", "return", "port", "else", ":", "port", "=", "port", ".", "parent" ]
:return: most top port which contains this port
[ ":", "return", ":", "most", "top", "port", "which", "contains", "this", "port" ]
python
train
24.555556
Kortemme-Lab/klab
klab/bio/pymolmod/colors.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pymolmod/colors.py#L385-L397
def update(self, path, node): '''Update the dict with a new color using a 'path' through the dict. You can either pass an existing path e.g. 'Scaffold.mutations' to override a color or part of the hierarchy or you can add a new leaf node or dict.''' assert(type(path) == type(self.name)) ...
[ "def", "update", "(", "self", ",", "path", ",", "node", ")", ":", "assert", "(", "type", "(", "path", ")", "==", "type", "(", "self", ".", "name", ")", ")", "assert", "(", "type", "(", "node", ")", "==", "type", "(", "self", ".", "name", ")", ...
Update the dict with a new color using a 'path' through the dict. You can either pass an existing path e.g. 'Scaffold.mutations' to override a color or part of the hierarchy or you can add a new leaf node or dict.
[ "Update", "the", "dict", "with", "a", "new", "color", "using", "a", "path", "through", "the", "dict", ".", "You", "can", "either", "pass", "an", "existing", "path", "e", ".", "g", ".", "Scaffold", ".", "mutations", "to", "override", "a", "color", "or",...
python
train
47.076923
saltstack/salt
salt/modules/vault.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vault.py#L175-L197
def write_secret(path, **kwargs): ''' Set secret at the path in vault. The vault policy used must allow this. CLI Example: .. code-block:: bash salt '*' vault.write_secret "secret/my/secret" user="foo" password="bar" ''' log.debug('Writing vault secrets for %s at %s', __grains__['...
[ "def", "write_secret", "(", "path", ",", "*", "*", "kwargs", ")", ":", "log", ".", "debug", "(", "'Writing vault secrets for %s at %s'", ",", "__grains__", "[", "'id'", "]", ",", "path", ")", "data", "=", "dict", "(", "[", "(", "x", ",", "y", ")", "f...
Set secret at the path in vault. The vault policy used must allow this. CLI Example: .. code-block:: bash salt '*' vault.write_secret "secret/my/secret" user="foo" password="bar"
[ "Set", "secret", "at", "the", "path", "in", "vault", ".", "The", "vault", "policy", "used", "must", "allow", "this", "." ]
python
train
35.652174
pandas-dev/pandas
pandas/core/internals/managers.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L1325-L1346
def take(self, indexer, axis=1, verify=True, convert=True): """ Take items along any axis. """ self._consolidate_inplace() indexer = (np.arange(indexer.start, indexer.stop, indexer.step, dtype='int64') if isinstance(indexer, slice) ...
[ "def", "take", "(", "self", ",", "indexer", ",", "axis", "=", "1", ",", "verify", "=", "True", ",", "convert", "=", "True", ")", ":", "self", ".", "_consolidate_inplace", "(", ")", "indexer", "=", "(", "np", ".", "arange", "(", "indexer", ".", "sta...
Take items along any axis.
[ "Take", "items", "along", "any", "axis", "." ]
python
train
39
Hackerfleet/hfos
hfos/tool/installer.py
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/tool/installer.py#L186-L189
def provisions(ctx, provision, clear_existing, overwrite, list_provisions): """Install default provisioning data""" install_provisions(ctx, provision, clear_existing, overwrite, list_provisions)
[ "def", "provisions", "(", "ctx", ",", "provision", ",", "clear_existing", ",", "overwrite", ",", "list_provisions", ")", ":", "install_provisions", "(", "ctx", ",", "provision", ",", "clear_existing", ",", "overwrite", ",", "list_provisions", ")" ]
Install default provisioning data
[ "Install", "default", "provisioning", "data" ]
python
train
50
timothydmorton/VESPA
vespa/kepler.py
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/kepler.py#L114-L146
def modelshift_weaksec(koi): """ Max secondary depth based on model-shift secondary test from Jeff Coughlin secondary metric: mod_depth_sec_dv * (1 + 3*mod_fred_dv / mod_sig_sec_dv) """ num = KOIDATA.ix[ku.koiname(koi), 'koi_tce_plnt_num'] if np.isnan(num): num = 1 kid = KOIDATA.ix[...
[ "def", "modelshift_weaksec", "(", "koi", ")", ":", "num", "=", "KOIDATA", ".", "ix", "[", "ku", ".", "koiname", "(", "koi", ")", ",", "'koi_tce_plnt_num'", "]", "if", "np", ".", "isnan", "(", "num", ")", ":", "num", "=", "1", "kid", "=", "KOIDATA",...
Max secondary depth based on model-shift secondary test from Jeff Coughlin secondary metric: mod_depth_sec_dv * (1 + 3*mod_fred_dv / mod_sig_sec_dv)
[ "Max", "secondary", "depth", "based", "on", "model", "-", "shift", "secondary", "test", "from", "Jeff", "Coughlin" ]
python
train
34.757576
bcb/jsonrpcclient
jsonrpcclient/client.py
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/client.py#L206-L233
def request( self, method_name: str, *args: Any, trim_log_values: bool = False, validate_against_schema: bool = True, id_generator: Optional[Iterator] = None, **kwargs: Any ) -> Response: """ Send a request by passing the method and arguments. ...
[ "def", "request", "(", "self", ",", "method_name", ":", "str", ",", "*", "args", ":", "Any", ",", "trim_log_values", ":", "bool", "=", "False", ",", "validate_against_schema", ":", "bool", "=", "True", ",", "id_generator", ":", "Optional", "[", "Iterator",...
Send a request by passing the method and arguments. >>> client.request("cat", name="Yoko") <Response[1] Args: method_name: The remote procedure's method name. args: Positional arguments passed to the remote procedure. kwargs: Keyword arguments passed to the ...
[ "Send", "a", "request", "by", "passing", "the", "method", "and", "arguments", "." ]
python
train
37.928571
openvax/mhcflurry
mhcflurry/class1_affinity_predictor.py
https://github.com/openvax/mhcflurry/blob/deb7c1629111254b484a2711619eb2347db36524/mhcflurry/class1_affinity_predictor.py#L722-L766
def percentile_ranks(self, affinities, allele=None, alleles=None, throw=True): """ Return percentile ranks for the given ic50 affinities and alleles. The 'allele' and 'alleles' argument are as in the `predict` method. Specify one of these. Parameters ---------- ...
[ "def", "percentile_ranks", "(", "self", ",", "affinities", ",", "allele", "=", "None", ",", "alleles", "=", "None", ",", "throw", "=", "True", ")", ":", "if", "allele", "is", "not", "None", ":", "try", ":", "transform", "=", "self", ".", "allele_to_per...
Return percentile ranks for the given ic50 affinities and alleles. The 'allele' and 'alleles' argument are as in the `predict` method. Specify one of these. Parameters ---------- affinities : sequence of float nM affinities allele : string alleles : ...
[ "Return", "percentile", "ranks", "for", "the", "given", "ic50", "affinities", "and", "alleles", "." ]
python
train
36.111111
tensorflow/tensorboard
tensorboard/plugins/debugger/interactive_debugger_server_lib.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/interactive_debugger_server_lib.py#L286-L311
def on_core_metadata_event(self, event): """Implementation of the core metadata-carrying Event proto callback. Args: event: An Event proto that contains core metadata about the debugged Session::Run() in its log_message.message field, as a JSON string. See the doc string of debug_data.Deb...
[ "def", "on_core_metadata_event", "(", "self", ",", "event", ")", ":", "core_metadata", "=", "json", ".", "loads", "(", "event", ".", "log_message", ".", "message", ")", "input_names", "=", "','", ".", "join", "(", "core_metadata", "[", "'input_names'", "]", ...
Implementation of the core metadata-carrying Event proto callback. Args: event: An Event proto that contains core metadata about the debugged Session::Run() in its log_message.message field, as a JSON string. See the doc string of debug_data.DebugDumpDir.core_metadata for details.
[ "Implementation", "of", "the", "core", "metadata", "-", "carrying", "Event", "proto", "callback", "." ]
python
train
45.192308
xapple/fasta
fasta/__init__.py
https://github.com/xapple/fasta/blob/a827c3138812d555203be45187ffae1277dd0d76/fasta/__init__.py#L356-L364
def graphs(self): """Sorry for the black magic. The result is an object whose attributes are all the graphs found in graphs.py initialized with this instance as only argument.""" result = Dummy() for graph in graphs.__all__: cls = getattr(graphs, graph) se...
[ "def", "graphs", "(", "self", ")", ":", "result", "=", "Dummy", "(", ")", "for", "graph", "in", "graphs", ".", "__all__", ":", "cls", "=", "getattr", "(", "graphs", ",", "graph", ")", "setattr", "(", "result", ",", "cls", ".", "short_name", ",", "c...
Sorry for the black magic. The result is an object whose attributes are all the graphs found in graphs.py initialized with this instance as only argument.
[ "Sorry", "for", "the", "black", "magic", ".", "The", "result", "is", "an", "object", "whose", "attributes", "are", "all", "the", "graphs", "found", "in", "graphs", ".", "py", "initialized", "with", "this", "instance", "as", "only", "argument", "." ]
python
train
41.555556
SoCo/SoCo
soco/music_services/music_service.py
https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/music_services/music_service.py#L728-L744
def get_media_metadata(self, item_id): """Get metadata for a media item. Args: item_id (str): The item for which metadata is required. Returns: ~collections.OrderedDict: The item's metadata, or `None` See also: The Sonos `getMediaMetadata API ...
[ "def", "get_media_metadata", "(", "self", ",", "item_id", ")", ":", "response", "=", "self", ".", "soap_client", ".", "call", "(", "'getMediaMetadata'", ",", "[", "(", "'id'", ",", "item_id", ")", "]", ")", "return", "response", ".", "get", "(", "'getMed...
Get metadata for a media item. Args: item_id (str): The item for which metadata is required. Returns: ~collections.OrderedDict: The item's metadata, or `None` See also: The Sonos `getMediaMetadata API <http://musicpartners.sonos.com/node/83>`_
[ "Get", "metadata", "for", "a", "media", "item", "." ]
python
train
31.117647
aroberge/experimental
experimental/core/import_hook.py
https://github.com/aroberge/experimental/blob/031a9be10698b429998436da748b8fdb86f18b47/experimental/core/import_hook.py#L47-L70
def find_spec(self, fullname, path, target=None): '''finds the appropriate properties (spec) of a module, and sets its loader.''' if not path: path = [os.getcwd()] if "." in fullname: name = fullname.split(".")[-1] else: name = fullname ...
[ "def", "find_spec", "(", "self", ",", "fullname", ",", "path", ",", "target", "=", "None", ")", ":", "if", "not", "path", ":", "path", "=", "[", "os", ".", "getcwd", "(", ")", "]", "if", "\".\"", "in", "fullname", ":", "name", "=", "fullname", "....
finds the appropriate properties (spec) of a module, and sets its loader.
[ "finds", "the", "appropriate", "properties", "(", "spec", ")", "of", "a", "module", "and", "sets", "its", "loader", "." ]
python
train
41.458333
BerkeleyAutomation/autolab_core
autolab_core/json_serialization.py
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/json_serialization.py#L75-L82
def load(*args, **kwargs): """Load an numpy.ndarray from a file stream. This works exactly like the usual `json.load()` function, but it uses our custom deserializer. """ kwargs.update(dict(object_hook=json_numpy_obj_hook)) return _json.load(*args, **kwargs)
[ "def", "load", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update", "(", "dict", "(", "object_hook", "=", "json_numpy_obj_hook", ")", ")", "return", "_json", ".", "load", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
Load an numpy.ndarray from a file stream. This works exactly like the usual `json.load()` function, but it uses our custom deserializer.
[ "Load", "an", "numpy", ".", "ndarray", "from", "a", "file", "stream", "." ]
python
train
34.5
Alignak-monitoring/alignak
alignak/util.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/util.py#L230-L248
def format_t_into_dhms_format(timestamp): """ Convert an amount of second into day, hour, min and sec :param timestamp: seconds :type timestamp: int :return: 'Ad Bh Cm Ds' :rtype: str >>> format_t_into_dhms_format(456189) '5d 6h 43m 9s' >>> format_t_into_dhms_format(3600) '0d 1h 0...
[ "def", "format_t_into_dhms_format", "(", "timestamp", ")", ":", "mins", ",", "timestamp", "=", "divmod", "(", "timestamp", ",", "60", ")", "hour", ",", "mins", "=", "divmod", "(", "mins", ",", "60", ")", "day", ",", "hour", "=", "divmod", "(", "hour", ...
Convert an amount of second into day, hour, min and sec :param timestamp: seconds :type timestamp: int :return: 'Ad Bh Cm Ds' :rtype: str >>> format_t_into_dhms_format(456189) '5d 6h 43m 9s' >>> format_t_into_dhms_format(3600) '0d 1h 0m 0s'
[ "Convert", "an", "amount", "of", "second", "into", "day", "hour", "min", "and", "sec" ]
python
train
25.631579
selectel/pyte
pyte/screens.py
https://github.com/selectel/pyte/blob/8adad489f86da1788a7995720c344a2fa44f244e/pyte/screens.py#L568-L580
def reverse_index(self): """Move the cursor up one line in the same column. If the cursor is at the first line, create a new line at the top. """ top, bottom = self.margins or Margins(0, self.lines - 1) if self.cursor.y == top: # TODO: mark only the lines within margi...
[ "def", "reverse_index", "(", "self", ")", ":", "top", ",", "bottom", "=", "self", ".", "margins", "or", "Margins", "(", "0", ",", "self", ".", "lines", "-", "1", ")", "if", "self", ".", "cursor", ".", "y", "==", "top", ":", "# TODO: mark only the lin...
Move the cursor up one line in the same column. If the cursor is at the first line, create a new line at the top.
[ "Move", "the", "cursor", "up", "one", "line", "in", "the", "same", "column", ".", "If", "the", "cursor", "is", "at", "the", "first", "line", "create", "a", "new", "line", "at", "the", "top", "." ]
python
train
41.461538
clalancette/pycdlib
pycdlib/dr.py
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/dr.py#L311-L400
def _rr_new(self, rr_version, rr_name, rr_symlink_target, rr_relocated_child, rr_relocated, rr_relocated_parent, file_mode): # type: (str, bytes, bytes, bool, bool, bool, int) -> None ''' Internal method to add Rock Ridge to a Directory Record. Parameters: rr_ve...
[ "def", "_rr_new", "(", "self", ",", "rr_version", ",", "rr_name", ",", "rr_symlink_target", ",", "rr_relocated_child", ",", "rr_relocated", ",", "rr_relocated_parent", ",", "file_mode", ")", ":", "# type: (str, bytes, bytes, bool, bool, bool, int) -> None", "if", "self", ...
Internal method to add Rock Ridge to a Directory Record. Parameters: rr_version - A string containing the version of Rock Ridge to use for this record. rr_name - The Rock Ridge name to associate with this directory record. rr_symlink_target - The target for the ...
[ "Internal", "method", "to", "add", "Rock", "Ridge", "to", "a", "Directory", "Record", "." ]
python
train
56.011111
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_lldp_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_lldp_ext.py#L320-L336
def get_lldp_neighbor_detail_output_lldp_neighbor_detail_lldp_pdu_transmitted(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_lldp_neighbor_detail = ET.Element("get_lldp_neighbor_detail") config = get_lldp_neighbor_detail output = ET.SubEleme...
[ "def", "get_lldp_neighbor_detail_output_lldp_neighbor_detail_lldp_pdu_transmitted", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_lldp_neighbor_detail", "=", "ET", ".", "Element", "(", "\"get_lldp_nei...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
59.764706
SINGROUP/SOAPLite
soaplite/core.py
https://github.com/SINGROUP/SOAPLite/blob/80e27cc8d5b4c887011542c5a799583bfc6ff643/soaplite/core.py#L80-L169
def get_soap_locals(obj, Hpos, alp, bet, rCut=5.0, nMax=5, Lmax=5, crossOver=True, all_atomtypes=None, eta=1.0): """Get the RBF basis SOAP output for the given positions in a finite system. Args: obj(ase.Atoms): Atomic structure for which the SOAP output is calculated. Hpos: Positio...
[ "def", "get_soap_locals", "(", "obj", ",", "Hpos", ",", "alp", ",", "bet", ",", "rCut", "=", "5.0", ",", "nMax", "=", "5", ",", "Lmax", "=", "5", ",", "crossOver", "=", "True", ",", "all_atomtypes", "=", "None", ",", "eta", "=", "1.0", ")", ":", ...
Get the RBF basis SOAP output for the given positions in a finite system. Args: obj(ase.Atoms): Atomic structure for which the SOAP output is calculated. Hpos: Positions at which to calculate SOAP alp: Alphas bet: Betas rCut: Radial cutoff. nMax: Maximum ...
[ "Get", "the", "RBF", "basis", "SOAP", "output", "for", "the", "given", "positions", "in", "a", "finite", "system", "." ]
python
train
45.4
codelv/enaml-native
src/enamlnative/android/android_fragment.py
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_fragment.py#L117-L131
def on_create_view(self): """ Trigger the click """ d = self.declaration changed = not d.condition if changed: d.condition = True view = self.get_view() if changed: self.ready.set_result(True) return view
[ "def", "on_create_view", "(", "self", ")", ":", "d", "=", "self", ".", "declaration", "changed", "=", "not", "d", ".", "condition", "if", "changed", ":", "d", ".", "condition", "=", "True", "view", "=", "self", ".", "get_view", "(", ")", "if", "chang...
Trigger the click
[ "Trigger", "the", "click" ]
python
train
18.8
square/pylink
setup.py
https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/setup.py#L111-L121
def finalize_options(self): """Finalizes the command's options. Args: self (CoverageCommand): the ``CoverageCommand`` instance Returns: ``None`` """ self.cwd = os.path.abspath(os.path.dirname(__file__)) self.test_dir = os.path.join(self.cwd, 'tests')
[ "def", "finalize_options", "(", "self", ")", ":", "self", ".", "cwd", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "self", ".", "test_dir", "=", "os", ".", "path", ".", "join", "(", "s...
Finalizes the command's options. Args: self (CoverageCommand): the ``CoverageCommand`` instance Returns: ``None``
[ "Finalizes", "the", "command", "s", "options", "." ]
python
train
28.181818
noxdafox/clipspy
clips/classes.py
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L451-L453
def writable(self): """True if the Slot is writable.""" return bool(lib.EnvSlotWritableP(self._env, self._cls, self._name))
[ "def", "writable", "(", "self", ")", ":", "return", "bool", "(", "lib", ".", "EnvSlotWritableP", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ")", ")" ]
True if the Slot is writable.
[ "True", "if", "the", "Slot", "is", "writable", "." ]
python
train
45.666667
CellProfiler/centrosome
centrosome/threshold.py
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/threshold.py#L180-L247
def get_adaptive_threshold(threshold_method, image, threshold, mask = None, adaptive_window_size = 10, **kwargs): """Given a global threshold, compute a threshold per pixel Break the image into blocks, computing the thres...
[ "def", "get_adaptive_threshold", "(", "threshold_method", ",", "image", ",", "threshold", ",", "mask", "=", "None", ",", "adaptive_window_size", "=", "10", ",", "*", "*", "kwargs", ")", ":", "# for the X and Y direction, find the # of blocks, given the", "# size constra...
Given a global threshold, compute a threshold per pixel Break the image into blocks, computing the threshold per block. Afterwards, constrain the block threshold to .7 T < t < 1.5 T. Block sizes must be at least 50x50. Images > 500 x 500 get 10x10 blocks.
[ "Given", "a", "global", "threshold", "compute", "a", "threshold", "per", "pixel", "Break", "the", "image", "into", "blocks", "computing", "the", "threshold", "per", "block", ".", "Afterwards", "constrain", "the", "block", "threshold", "to", ".", "7", "T", "<...
python
train
38.588235
riga/law
law/cli/config.py
https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/cli/config.py#L55-L71
def get_config(name, expand=False): """ Returns the config value that corresponds to *name*, which must have the format ``<section>[.<option>]``. When an option is given and *expand* is *True*, variables are expanded in the returned value. """ cfg = Config.instance() only_section = "." not i...
[ "def", "get_config", "(", "name", ",", "expand", "=", "False", ")", ":", "cfg", "=", "Config", ".", "instance", "(", ")", "only_section", "=", "\".\"", "not", "in", "name", "# when only the section is given, print all keys", "if", "only_section", ":", "return", ...
Returns the config value that corresponds to *name*, which must have the format ``<section>[.<option>]``. When an option is given and *expand* is *True*, variables are expanded in the returned value.
[ "Returns", "the", "config", "value", "that", "corresponds", "to", "*", "name", "*", "which", "must", "have", "the", "format", "<section", ">", "[", ".", "<option", ">", "]", ".", "When", "an", "option", "is", "given", "and", "*", "expand", "*", "is", ...
python
train
33.764706
mkoura/dump2polarion
dump2polarion/properties.py
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/properties.py#L181-L190
def set_dry_run(xml_root, value=True): """Sets dry-run so records are not updated, only log file is produced.""" value_str = str(value).lower() assert value_str in ("true", "false") if xml_root.tag == "testsuites": _set_property(xml_root, "polarion-dry-run", value_str) elif xml_root.tag in (...
[ "def", "set_dry_run", "(", "xml_root", ",", "value", "=", "True", ")", ":", "value_str", "=", "str", "(", "value", ")", ".", "lower", "(", ")", "assert", "value_str", "in", "(", "\"true\"", ",", "\"false\"", ")", "if", "xml_root", ".", "tag", "==", "...
Sets dry-run so records are not updated, only log file is produced.
[ "Sets", "dry", "-", "run", "so", "records", "are", "not", "updated", "only", "log", "file", "is", "produced", "." ]
python
train
46.7
moralrecordings/mrcrowbar
mrcrowbar/utils.py
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L376-L382
def unpack_bits( byte ): """Expand a bitfield into a 64-bit int (8 bool bytes).""" longbits = byte & (0x00000000000000ff) longbits = (longbits | (longbits<<28)) & (0x0000000f0000000f) longbits = (longbits | (longbits<<14)) & (0x0003000300030003) longbits = (longbits | (longbits<<7)) & (0x01010101010...
[ "def", "unpack_bits", "(", "byte", ")", ":", "longbits", "=", "byte", "&", "(", "0x00000000000000ff", ")", "longbits", "=", "(", "longbits", "|", "(", "longbits", "<<", "28", ")", ")", "&", "(", "0x0000000f0000000f", ")", "longbits", "=", "(", "longbits"...
Expand a bitfield into a 64-bit int (8 bool bytes).
[ "Expand", "a", "bitfield", "into", "a", "64", "-", "bit", "int", "(", "8", "bool", "bytes", ")", "." ]
python
train
48.571429
SUSE-Enceladus/ipa
ipa/ipa_azure.py
https://github.com/SUSE-Enceladus/ipa/blob/0845eed0ea25a27dbb059ad1016105fa60002228/ipa/ipa_azure.py#L200-L213
def _create_resource_group(self, region, resource_group_name): """ Create resource group if it does not exist. """ resource_group_config = {'location': region} try: self.resource.resource_groups.create_or_update( resource_group_name, resource_group_co...
[ "def", "_create_resource_group", "(", "self", ",", "region", ",", "resource_group_name", ")", ":", "resource_group_config", "=", "{", "'location'", ":", "region", "}", "try", ":", "self", ".", "resource", ".", "resource_groups", ".", "create_or_update", "(", "re...
Create resource group if it does not exist.
[ "Create", "resource", "group", "if", "it", "does", "not", "exist", "." ]
python
train
34.5
QualiSystems/vCenterShell
package/cloudshell/cp/vcenter/network/vnic/vnic_service.py
https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/network/vnic/vnic_service.py#L200-L215
def vnic_attached_to_network(nicspec, network, logger): """ Attach vNIC to Network. :param nicspec: <vim.vm.device.VirtualDeviceSpec> :param network: <vim network obj> :return: updated 'nicspec' """ if nicspec: if network_is_portgroup(network): ...
[ "def", "vnic_attached_to_network", "(", "nicspec", ",", "network", ",", "logger", ")", ":", "if", "nicspec", ":", "if", "network_is_portgroup", "(", "network", ")", ":", "return", "VNicService", ".", "vnic_attach_to_network_distributed", "(", "nicspec", ",", "netw...
Attach vNIC to Network. :param nicspec: <vim.vm.device.VirtualDeviceSpec> :param network: <vim network obj> :return: updated 'nicspec'
[ "Attach", "vNIC", "to", "Network", ".", ":", "param", "nicspec", ":", "<vim", ".", "vm", ".", "device", ".", "VirtualDeviceSpec", ">", ":", "param", "network", ":", "<vim", "network", "obj", ">", ":", "return", ":", "updated", "nicspec" ]
python
train
44.0625
pymoca/pymoca
src/pymoca/backends/xml/generator.py
https://github.com/pymoca/pymoca/blob/14b5eb7425e96689de6cc5c10f400895d586a978/src/pymoca/backends/xml/generator.py#L144-L156
def generate(ast_tree: ast.Tree, model_name: str): """ :param ast_tree: AST to generate from :param model_name: class to generate :return: sympy source code for model """ component_ref = ast.ComponentRef.from_string(model_name) ast_tree_new = copy.deepcopy(ast_tree) ast_walker = TreeWalk...
[ "def", "generate", "(", "ast_tree", ":", "ast", ".", "Tree", ",", "model_name", ":", "str", ")", ":", "component_ref", "=", "ast", ".", "ComponentRef", ".", "from_string", "(", "model_name", ")", "ast_tree_new", "=", "copy", ".", "deepcopy", "(", "ast_tree...
:param ast_tree: AST to generate from :param model_name: class to generate :return: sympy source code for model
[ ":", "param", "ast_tree", ":", "AST", "to", "generate", "from", ":", "param", "model_name", ":", "class", "to", "generate", ":", "return", ":", "sympy", "source", "code", "for", "model" ]
python
train
39
shaded-enmity/docker-hica
injectors/introspect_runtime.py
https://github.com/shaded-enmity/docker-hica/blob/bc425586297e1eb228b70ee6fca8c499849ec87d/injectors/introspect_runtime.py#L81-L105
def inject_config(self, config, from_args): """ :param config: :type config: list :param from_args: :type from_args: dict """ # First get required values from labelStore runtime = self._get_runtime() whitelist = self._get_whitelist() #Run introspection on the libraries to retriev...
[ "def", "inject_config", "(", "self", ",", "config", ",", "from_args", ")", ":", "# First get required values from labelStore", "runtime", "=", "self", ".", "_get_runtime", "(", ")", "whitelist", "=", "self", ".", "_get_whitelist", "(", ")", "#Run introspection on th...
:param config: :type config: list :param from_args: :type from_args: dict
[ ":", "param", "config", ":", ":", "type", "config", ":", "list", ":", "param", "from_args", ":", ":", "type", "from_args", ":", "dict" ]
python
train
35.4
ray-project/ray
python/ray/tune/automlboard/backend/collector.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/automlboard/backend/collector.py#L62-L72
def init_logger(cls, log_level): """Initialize logger settings.""" logger = logging.getLogger("AutoMLBoard") handler = logging.StreamHandler() formatter = logging.Formatter("[%(levelname)s %(asctime)s] " "%(filename)s: %(lineno)d " ...
[ "def", "init_logger", "(", "cls", ",", "log_level", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "\"AutoMLBoard\"", ")", "handler", "=", "logging", ".", "StreamHandler", "(", ")", "formatter", "=", "logging", ".", "Formatter", "(", "\"[%(leveln...
Initialize logger settings.
[ "Initialize", "logger", "settings", "." ]
python
train
43.363636
apache/incubator-mxnet
python/mxnet/gluon/model_zoo/vision/squeezenet.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/gluon/model_zoo/vision/squeezenet.py#L113-L137
def get_squeezenet(version, pretrained=False, ctx=cpu(), root=os.path.join(base.data_dir(), 'models'), **kwargs): r"""SqueezeNet model from the `"SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" <https://arxiv.org/abs/1602.07360>`_ paper. SqueezeNet 1.1 ...
[ "def", "get_squeezenet", "(", "version", ",", "pretrained", "=", "False", ",", "ctx", "=", "cpu", "(", ")", ",", "root", "=", "os", ".", "path", ".", "join", "(", "base", ".", "data_dir", "(", ")", ",", "'models'", ")", ",", "*", "*", "kwargs", "...
r"""SqueezeNet model from the `"SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" <https://arxiv.org/abs/1602.07360>`_ paper. SqueezeNet 1.1 model from the `official SqueezeNet repo <https://github.com/DeepScale/SqueezeNet/tree/master/SqueezeNet_v1.1>`_. SqueezeNet 1.1 ...
[ "r", "SqueezeNet", "model", "from", "the", "SqueezeNet", ":", "AlexNet", "-", "level", "accuracy", "with", "50x", "fewer", "parameters", "and", "<0", ".", "5MB", "model", "size", "<https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1602", ".", "...
python
train
45.96
msiemens/tinydb
tinydb/queries.py
https://github.com/msiemens/tinydb/blob/10052cb1ae6a3682d26eb4272c44e3b020aa5877/tinydb/queries.py#L277-L289
def search(self, regex, flags=0): """ Run a regex test against a dict value (only substring string has to match). >>> Query().f1.search(r'^\w+$') :param regex: The regular expression to use for matching """ return self._generate_test( lambda value: r...
[ "def", "search", "(", "self", ",", "regex", ",", "flags", "=", "0", ")", ":", "return", "self", ".", "_generate_test", "(", "lambda", "value", ":", "re", ".", "search", "(", "regex", ",", "value", ",", "flags", ")", ",", "(", "'search'", ",", "self...
Run a regex test against a dict value (only substring string has to match). >>> Query().f1.search(r'^\w+$') :param regex: The regular expression to use for matching
[ "Run", "a", "regex", "test", "against", "a", "dict", "value", "(", "only", "substring", "string", "has", "to", "match", ")", "." ]
python
train
30
linkhub-sdk/popbill.py
popbill/messageService.py
https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/messageService.py#L524-L540
def getStates(self, Corpnum, reciptNumList, UserID=None): """ 전송내역 요약정보 확인 args CorpNum : 팝빌회원 사업자번호 reciptNumList : 문자전송 접수번호 배열 UserID : 팝빌회원 아이디 return 전송정보 as list raise PopbillExcept...
[ "def", "getStates", "(", "self", ",", "Corpnum", ",", "reciptNumList", ",", "UserID", "=", "None", ")", ":", "if", "reciptNumList", "==", "None", "or", "len", "(", "reciptNumList", ")", "<", "1", ":", "raise", "PopbillException", "(", "-", "99999999", ",...
전송내역 요약정보 확인 args CorpNum : 팝빌회원 사업자번호 reciptNumList : 문자전송 접수번호 배열 UserID : 팝빌회원 아이디 return 전송정보 as list raise PopbillException
[ "전송내역", "요약정보", "확인", "args", "CorpNum", ":", "팝빌회원", "사업자번호", "reciptNumList", ":", "문자전송", "접수번호", "배열", "UserID", ":", "팝빌회원", "아이디", "return", "전송정보", "as", "list", "raise", "PopbillException" ]
python
train
34.235294
PagerDuty/pagerduty-api-python-client
pypd/models/integration.py
https://github.com/PagerDuty/pagerduty-api-python-client/blob/f420b34ca9b29689cc2ecc9adca6dc5d56ae7161/pypd/models/integration.py#L63-L80
def create(cls, service=None, endpoint=None, data=None, *args, **kwargs): """ Create an integration within the scope of an service. Make sure that they should reasonably be able to query with an service or endpoint that knows about an service. """ cls.validate(data) ...
[ "def", "create", "(", "cls", ",", "service", "=", "None", ",", "endpoint", "=", "None", ",", "data", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "cls", ".", "validate", "(", "data", ")", "if", "service", "is", "None", "and",...
Create an integration within the scope of an service. Make sure that they should reasonably be able to query with an service or endpoint that knows about an service.
[ "Create", "an", "integration", "within", "the", "scope", "of", "an", "service", "." ]
python
train
43.777778
chrisspen/burlap
burlap/db.py
https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/db.py#L321-L382
def dump(self, dest_dir=None, to_local=1, from_local=0, archive=0, dump_fn=None, name=None, site=None, use_sudo=0, cleanup=1): """ Exports the target database to a single transportable file on the localhost, appropriate for loading using load(). """ r = self.local_renderer ...
[ "def", "dump", "(", "self", ",", "dest_dir", "=", "None", ",", "to_local", "=", "1", ",", "from_local", "=", "0", ",", "archive", "=", "0", ",", "dump_fn", "=", "None", ",", "name", "=", "None", ",", "site", "=", "None", ",", "use_sudo", "=", "0"...
Exports the target database to a single transportable file on the localhost, appropriate for loading using load().
[ "Exports", "the", "target", "database", "to", "a", "single", "transportable", "file", "on", "the", "localhost", "appropriate", "for", "loading", "using", "load", "()", "." ]
python
valid
35.322581
CiscoDevNet/webexteamssdk
examples/bot-example-flask.py
https://github.com/CiscoDevNet/webexteamssdk/blob/6fc2cc3557e080ba4b2a380664cb2a0532ae45cd/examples/bot-example-flask.py#L98-L158
def webex_teams_webhook_events(): """Processes incoming requests to the '/events' URI.""" if request.method == 'GET': return ("""<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Webex Tea...
[ "def", "webex_teams_webhook_events", "(", ")", ":", "if", "request", ".", "method", "==", "'GET'", ":", "return", "(", "\"\"\"<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n ...
Processes incoming requests to the '/events' URI.
[ "Processes", "incoming", "requests", "to", "the", "/", "events", "URI", "." ]
python
test
38.721311
pycontribs/pyrax
pyrax/image.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/image.py#L319-L345
def update_image_member(self, img_id, status): """ Updates the image whose ID is given with the status specified. This must be called by the user whose project_id is in the members for the image. If called by the owner of the image, an InvalidImageMember exception will be raised....
[ "def", "update_image_member", "(", "self", ",", "img_id", ",", "status", ")", ":", "if", "status", "not", "in", "(", "\"pending\"", ",", "\"accepted\"", ",", "\"rejected\"", ")", ":", "raise", "exc", ".", "InvalidImageMemberStatus", "(", "\"The status value must...
Updates the image whose ID is given with the status specified. This must be called by the user whose project_id is in the members for the image. If called by the owner of the image, an InvalidImageMember exception will be raised. Valid values for 'status' include: pending ...
[ "Updates", "the", "image", "whose", "ID", "is", "given", "with", "the", "status", "specified", ".", "This", "must", "be", "called", "by", "the", "user", "whose", "project_id", "is", "in", "the", "members", "for", "the", "image", ".", "If", "called", "by"...
python
train
44.703704
HDI-Project/RDT
rdt/transformers/null.py
https://github.com/HDI-Project/RDT/blob/b28fdd671a1d7fbd14983eefe0cfbd8d87ded92a/rdt/transformers/null.py#L47-L61
def reverse_transform(self, col): """Converts data back into original format. Args: col(pandas.DataFrame): Data to transform. Returns: pandas.DataFrame """ output = pd.DataFrame() new_name = '?' + self.col_name col.loc[col[new_name] == 0...
[ "def", "reverse_transform", "(", "self", ",", "col", ")", ":", "output", "=", "pd", ".", "DataFrame", "(", ")", "new_name", "=", "'?'", "+", "self", ".", "col_name", "col", ".", "loc", "[", "col", "[", "new_name", "]", "==", "0", ",", "self", ".", ...
Converts data back into original format. Args: col(pandas.DataFrame): Data to transform. Returns: pandas.DataFrame
[ "Converts", "data", "back", "into", "original", "format", "." ]
python
train
26.933333
google/dotty
efilter/transforms/solve.py
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/transforms/solve.py#L463-L475
def solve_filter(expr, vars): """Filter values on the LHS by evaluating RHS with each value. Returns any LHS values for which RHS evaluates to a true value. """ lhs_values, _ = __solve_for_repeated(expr.lhs, vars) def lazy_filter(): for lhs_value in repeated.getvalues(lhs_values): ...
[ "def", "solve_filter", "(", "expr", ",", "vars", ")", ":", "lhs_values", ",", "_", "=", "__solve_for_repeated", "(", "expr", ".", "lhs", ",", "vars", ")", "def", "lazy_filter", "(", ")", ":", "for", "lhs_value", "in", "repeated", ".", "getvalues", "(", ...
Filter values on the LHS by evaluating RHS with each value. Returns any LHS values for which RHS evaluates to a true value.
[ "Filter", "values", "on", "the", "LHS", "by", "evaluating", "RHS", "with", "each", "value", "." ]
python
train
35.461538
wind-python/windpowerlib
windpowerlib/wind_speed.py
https://github.com/wind-python/windpowerlib/blob/421b316139743311b7cb68a69f6b53d2665f7e23/windpowerlib/wind_speed.py#L14-L89
def logarithmic_profile(wind_speed, wind_speed_height, hub_height, roughness_length, obstacle_height=0.0): r""" Calculates the wind speed at hub height using a logarithmic wind profile. The logarithmic height equation is used. There is the possibility of including the height of ...
[ "def", "logarithmic_profile", "(", "wind_speed", ",", "wind_speed_height", ",", "hub_height", ",", "roughness_length", ",", "obstacle_height", "=", "0.0", ")", ":", "if", "0.7", "*", "obstacle_height", ">", "wind_speed_height", ":", "raise", "ValueError", "(", "\"...
r""" Calculates the wind speed at hub height using a logarithmic wind profile. The logarithmic height equation is used. There is the possibility of including the height of the surrounding obstacles in the calculation. This function is carried out when the parameter `wind_speed_model` of an instance...
[ "r", "Calculates", "the", "wind", "speed", "at", "hub", "height", "using", "a", "logarithmic", "wind", "profile", "." ]
python
train
41
BD2KOnFHIR/i2b2model
i2b2model/shared/tablenames.py
https://github.com/BD2KOnFHIR/i2b2model/blob/9d49bb53b0733dd83ab5b716014865e270a3c903/i2b2model/shared/tablenames.py#L46-L52
def all_tables(self) -> List[str]: """ List of all known tables :return: """ return sorted([k for k in self.__dict__.keys() if k not in _I2B2Tables._funcs and not k.startswith("_")])
[ "def", "all_tables", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "sorted", "(", "[", "k", "for", "k", "in", "self", ".", "__dict__", ".", "keys", "(", ")", "if", "k", "not", "in", "_I2B2Tables", ".", "_funcs", "and", "not", "k...
List of all known tables :return:
[ "List", "of", "all", "known", "tables", ":", "return", ":" ]
python
train
34.142857
crunchyroll/ef-open
efopen/ef_aws_resolver.py
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L53-L66
def _elbv2_load_balancer(self, lookup): """ Args: lookup: the friendly name of the V2 elb to look up Returns: A dict with the load balancer description Raises: botocore.exceptions.ClientError: no such load-balancer """ client = EFAwsResolver.__CLIENTS['elbv2'] elbs = client...
[ "def", "_elbv2_load_balancer", "(", "self", ",", "lookup", ")", ":", "client", "=", "EFAwsResolver", ".", "__CLIENTS", "[", "'elbv2'", "]", "elbs", "=", "client", ".", "describe_load_balancers", "(", "Names", "=", "[", "lookup", "]", ")", "# getting the first ...
Args: lookup: the friendly name of the V2 elb to look up Returns: A dict with the load balancer description Raises: botocore.exceptions.ClientError: no such load-balancer
[ "Args", ":", "lookup", ":", "the", "friendly", "name", "of", "the", "V2", "elb", "to", "look", "up", "Returns", ":", "A", "dict", "with", "the", "load", "balancer", "description", "Raises", ":", "botocore", ".", "exceptions", ".", "ClientError", ":", "no...
python
train
32.642857
google/grr
grr/server/grr_response_server/client_index.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/client_index.py#L275-L283
def AddClient(self, client): """Adds a client to the index. Args: client: A VFSGRRClient record to add or update. """ client_id, keywords = self.AnalyzeClient(client) self.AddKeywordsForName(client_id, keywords)
[ "def", "AddClient", "(", "self", ",", "client", ")", ":", "client_id", ",", "keywords", "=", "self", ".", "AnalyzeClient", "(", "client", ")", "self", ".", "AddKeywordsForName", "(", "client_id", ",", "keywords", ")" ]
Adds a client to the index. Args: client: A VFSGRRClient record to add or update.
[ "Adds", "a", "client", "to", "the", "index", "." ]
python
train
25.666667
primetang/qrtools
src/qrtools.py
https://github.com/primetang/qrtools/blob/3263c6136f54f0499b9945bfad593537d436c7a1/src/qrtools.py#L125-L133
def data_to_string(self): """Returns a UTF8 string with the QR Code's data""" # FIX-ME: if we don't add the BOM_UTF8 char, QtQR doesn't decode # correctly; but if we add it, mobile apps don't.- # Apparently is a zbar bug. if self.data_type == 'text': return BOM_UTF8 +...
[ "def", "data_to_string", "(", "self", ")", ":", "# FIX-ME: if we don't add the BOM_UTF8 char, QtQR doesn't decode", "# correctly; but if we add it, mobile apps don't.-", "# Apparently is a zbar bug.", "if", "self", ".", "data_type", "==", "'text'", ":", "return", "BOM_UTF8", "+",...
Returns a UTF8 string with the QR Code's data
[ "Returns", "a", "UTF8", "string", "with", "the", "QR", "Code", "s", "data" ]
python
train
53.888889
emc-openstack/storops
storops/unity/resource/snap.py
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/snap.py#L154-L172
def restore(self, backup=None, delete_backup=False): """Restore the snapshot to the associated storage resource. :param backup: name of the backup snapshot :param delete_backup: Whether to delete the backup snap after a successful restore. """ resp ...
[ "def", "restore", "(", "self", ",", "backup", "=", "None", ",", "delete_backup", "=", "False", ")", ":", "resp", "=", "self", ".", "_cli", ".", "action", "(", "self", ".", "resource_class", ",", "self", ".", "get_id", "(", ")", ",", "'restore'", ",",...
Restore the snapshot to the associated storage resource. :param backup: name of the backup snapshot :param delete_backup: Whether to delete the backup snap after a successful restore.
[ "Restore", "the", "snapshot", "to", "the", "associated", "storage", "resource", "." ]
python
train
40.526316
edx/edx-enterprise
enterprise/tpa_pipeline.py
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/tpa_pipeline.py#L77-L90
def get_user_from_social_auth(tpa_provider, tpa_username): """ Find the LMS user from the LMS model `UserSocialAuth`. Arguments: tpa_provider (third_party_auth.provider): third party auth provider object tpa_username (str): Username returned by the third party auth """ user_social_...
[ "def", "get_user_from_social_auth", "(", "tpa_provider", ",", "tpa_username", ")", ":", "user_social_auth", "=", "UserSocialAuth", ".", "objects", ".", "select_related", "(", "'user'", ")", ".", "filter", "(", "user__username", "=", "tpa_username", ",", "provider", ...
Find the LMS user from the LMS model `UserSocialAuth`. Arguments: tpa_provider (third_party_auth.provider): third party auth provider object tpa_username (str): Username returned by the third party auth
[ "Find", "the", "LMS", "user", "from", "the", "LMS", "model", "UserSocialAuth", "." ]
python
valid
36.928571
apache/airflow
airflow/models/taskinstance.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/taskinstance.py#L458-L467
def clear_xcom_data(self, session=None): """ Clears all XCom data from the database for the task instance """ session.query(XCom).filter( XCom.dag_id == self.dag_id, XCom.task_id == self.task_id, XCom.execution_date == self.execution_date ).del...
[ "def", "clear_xcom_data", "(", "self", ",", "session", "=", "None", ")", ":", "session", ".", "query", "(", "XCom", ")", ".", "filter", "(", "XCom", ".", "dag_id", "==", "self", ".", "dag_id", ",", "XCom", ".", "task_id", "==", "self", ".", "task_id"...
Clears all XCom data from the database for the task instance
[ "Clears", "all", "XCom", "data", "from", "the", "database", "for", "the", "task", "instance" ]
python
test
34.1
dh1tw/pyhamtools
pyhamtools/lookuplib.py
https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/lookuplib.py#L485-L538
def lookup_prefix(self, prefix, timestamp=timestamp_now): """ Returns lookup data of a Prefix Args: prefix (string): Prefix of a Amateur Radio callsign timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC) Returns: dict: Dictionary contai...
[ "def", "lookup_prefix", "(", "self", ",", "prefix", ",", "timestamp", "=", "timestamp_now", ")", ":", "prefix", "=", "prefix", ".", "strip", "(", ")", ".", "upper", "(", ")", "if", "self", ".", "_lookuptype", "==", "\"clublogxml\"", "or", "self", ".", ...
Returns lookup data of a Prefix Args: prefix (string): Prefix of a Amateur Radio callsign timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC) Returns: dict: Dictionary containing the country specific data of the Prefix Raises: KeyE...
[ "Returns", "lookup", "data", "of", "a", "Prefix" ]
python
train
30.722222
hannes-brt/hebel
hebel/layers/multitask_top_layer.py
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/multitask_top_layer.py#L178-L184
def parameters(self): """Return a list where each element contains the parameters for a task. """ parameters = [] for task in self.tasks: parameters.extend(task.parameters) return parameters
[ "def", "parameters", "(", "self", ")", ":", "parameters", "=", "[", "]", "for", "task", "in", "self", ".", "tasks", ":", "parameters", ".", "extend", "(", "task", ".", "parameters", ")", "return", "parameters" ]
Return a list where each element contains the parameters for a task.
[ "Return", "a", "list", "where", "each", "element", "contains", "the", "parameters", "for", "a", "task", "." ]
python
train
33.714286
inveniosoftware/invenio-formatter
invenio_formatter/filters/datetime.py
https://github.com/inveniosoftware/invenio-formatter/blob/aa25f36742e809f05e116b52e8255cdb362e5642/invenio_formatter/filters/datetime.py#L29-L39
def from_isodatetime(value, strict=False): """Convert an ISO formatted datetime into a Date object. :param value: The ISO formatted datetime. :param strict: If value is ``None``, then if strict is ``True`` it returns the Date object of today, otherwise it returns ``None``. (Default: ``False...
[ "def", "from_isodatetime", "(", "value", ",", "strict", "=", "False", ")", ":", "if", "value", "or", "strict", ":", "return", "arrow", ".", "get", "(", "value", ")", ".", "datetime" ]
Convert an ISO formatted datetime into a Date object. :param value: The ISO formatted datetime. :param strict: If value is ``None``, then if strict is ``True`` it returns the Date object of today, otherwise it returns ``None``. (Default: ``False``) :returns: The Date object or ``None``.
[ "Convert", "an", "ISO", "formatted", "datetime", "into", "a", "Date", "object", "." ]
python
train
39
metglobal/django-exchange
exchange/utils.py
https://github.com/metglobal/django-exchange/blob/2133593885e02f42a4ed2ed4be2763c4777a1245/exchange/utils.py#L5-L25
def import_class(class_path): """imports and returns given class string. :param class_path: Class path as string :type class_path: str :returns: Class that has given path :rtype: class :Example: >>> import_class('collections.OrderedDict').__name__ 'OrderedDict' """ try: ...
[ "def", "import_class", "(", "class_path", ")", ":", "try", ":", "from", "django", ".", "utils", ".", "importlib", "import", "import_module", "module_name", "=", "'.'", ".", "join", "(", "class_path", ".", "split", "(", "\".\"", ")", "[", ":", "-", "1", ...
imports and returns given class string. :param class_path: Class path as string :type class_path: str :returns: Class that has given path :rtype: class :Example: >>> import_class('collections.OrderedDict').__name__ 'OrderedDict'
[ "imports", "and", "returns", "given", "class", "string", "." ]
python
train
27.142857
lrgar/scope
scope/scope.py
https://github.com/lrgar/scope/blob/f1c5815b0efd6be75ce54370d69e9b7eca854844/scope/scope.py#L232-L238
def set_children(self, children): """Set children of the span block.""" if isinstance(children, tuple): self._children = list(children) else: self._children = [children] return self
[ "def", "set_children", "(", "self", ",", "children", ")", ":", "if", "isinstance", "(", "children", ",", "tuple", ")", ":", "self", ".", "_children", "=", "list", "(", "children", ")", "else", ":", "self", ".", "_children", "=", "[", "children", "]", ...
Set children of the span block.
[ "Set", "children", "of", "the", "span", "block", "." ]
python
train
33
spyder-ide/spyder
spyder/plugins/console/widgets/shell.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/widgets/shell.py#L523-L528
def write_error(self, text): """Simulate stderr""" self.flush() self.write(text, flush=True, error=True) if get_debug_level(): STDERR.write(text)
[ "def", "write_error", "(", "self", ",", "text", ")", ":", "self", ".", "flush", "(", ")", "self", ".", "write", "(", "text", ",", "flush", "=", "True", ",", "error", "=", "True", ")", "if", "get_debug_level", "(", ")", ":", "STDERR", ".", "write", ...
Simulate stderr
[ "Simulate", "stderr" ]
python
train
31.5
vertexproject/synapse
synapse/lib/editatom.py
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/lib/editatom.py#L55-L67
def _notifyDone(self): ''' Allow any other editatoms waiting on me to complete to resume ''' if self.notified: return self.doneevent.set() for buid in self.mybldgbuids: del self.allbldgbuids[buid] self.notified = True
[ "def", "_notifyDone", "(", "self", ")", ":", "if", "self", ".", "notified", ":", "return", "self", ".", "doneevent", ".", "set", "(", ")", "for", "buid", "in", "self", ".", "mybldgbuids", ":", "del", "self", ".", "allbldgbuids", "[", "buid", "]", "se...
Allow any other editatoms waiting on me to complete to resume
[ "Allow", "any", "other", "editatoms", "waiting", "on", "me", "to", "complete", "to", "resume" ]
python
train
22.153846
mitsei/dlkit
dlkit/json_/proxy/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/proxy/sessions.py#L45-L65
def get_proxy(self, input_): """Gets a proxy. arg: input (osid.proxy.ProxyCondition): a proxy condition return: (osid.proxy.Proxy) - a proxy raise: NullArgument - ``input`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - au...
[ "def", "get_proxy", "(", "self", ",", "input_", ")", ":", "if", "input_", ".", "_http_request", "is", "not", "None", ":", "authentication", "=", "Authentication", "(", ")", "authentication", ".", "set_django_user", "(", "input_", ".", "_http_request", ".", "...
Gets a proxy. arg: input (osid.proxy.ProxyCondition): a proxy condition return: (osid.proxy.Proxy) - a proxy raise: NullArgument - ``input`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure raise: Unsu...
[ "Gets", "a", "proxy", "." ]
python
train
43.52381
trevisanj/f311
f311/filetypes/filesqlitedb.py
https://github.com/trevisanj/f311/blob/9e502a3d1e1f74d4290a8a0bae9a34ef8d7b29f7/f311/filetypes/filesqlitedb.py#L179-L201
def __get_conn(self, flag_force_new=False, filename=None): """Returns connection to database. Tries to return existing connection, unless flag_force_new Args: flag_force_new: filename: Returns: sqlite3.Connection object **Note** this is a private method because...
[ "def", "__get_conn", "(", "self", ",", "flag_force_new", "=", "False", ",", "filename", "=", "None", ")", ":", "flag_open_new", "=", "flag_force_new", "or", "not", "self", ".", "_conn_is_open", "(", ")", "if", "flag_open_new", ":", "if", "filename", "is", ...
Returns connection to database. Tries to return existing connection, unless flag_force_new Args: flag_force_new: filename: Returns: sqlite3.Connection object **Note** this is a private method because you can get a connection to any file, so it has to b...
[ "Returns", "connection", "to", "database", ".", "Tries", "to", "return", "existing", "connection", "unless", "flag_force_new" ]
python
train
34
hobson/aima
aima/agents.py
https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/agents.py#L310-L313
def percept(self, agent): "By default, agent perceives things within a default radius." return [self.thing_percept(thing, agent) for thing in self.things_near(agent.location)]
[ "def", "percept", "(", "self", ",", "agent", ")", ":", "return", "[", "self", ".", "thing_percept", "(", "thing", ",", "agent", ")", "for", "thing", "in", "self", ".", "things_near", "(", "agent", ".", "location", ")", "]" ]
By default, agent perceives things within a default radius.
[ "By", "default", "agent", "perceives", "things", "within", "a", "default", "radius", "." ]
python
valid
51
minio/minio-py
minio/api.py
https://github.com/minio/minio-py/blob/7107c84183cf5fb4deff68c0a16ab9f1c0b4c37e/minio/api.py#L1055-L1103
def remove_objects(self, bucket_name, objects_iter): """ Removes multiple objects from a bucket. :param bucket_name: Bucket from which to remove objects :param objects_iter: A list, tuple or iterator that provides objects names to delete. :return: An iterator of MultiD...
[ "def", "remove_objects", "(", "self", ",", "bucket_name", ",", "objects_iter", ")", ":", "is_valid_bucket_name", "(", "bucket_name", ")", "if", "isinstance", "(", "objects_iter", ",", "basestring", ")", ":", "raise", "TypeError", "(", "'objects_iter cannot be `str` ...
Removes multiple objects from a bucket. :param bucket_name: Bucket from which to remove objects :param objects_iter: A list, tuple or iterator that provides objects names to delete. :return: An iterator of MultiDeleteError instances for each object that had a delete error.
[ "Removes", "multiple", "objects", "from", "a", "bucket", "." ]
python
train
34.22449
RediSearch/redisearch-py
redisearch/auto_complete.py
https://github.com/RediSearch/redisearch-py/blob/f65d1dd078713cbe9b83584e86655a254d0531ab/redisearch/auto_complete.py#L81-L98
def add_suggestions(self, *suggestions, **kwargs): """ Add suggestion terms to the AutoCompleter engine. Each suggestion has a score and string. If kwargs['increment'] is true and the terms are already in the server's dictionary, we increment their scores """ pipe = self.redis....
[ "def", "add_suggestions", "(", "self", ",", "*", "suggestions", ",", "*", "*", "kwargs", ")", ":", "pipe", "=", "self", ".", "redis", ".", "pipeline", "(", ")", "for", "sug", "in", "suggestions", ":", "args", "=", "[", "AutoCompleter", ".", "SUGADD_COM...
Add suggestion terms to the AutoCompleter engine. Each suggestion has a score and string. If kwargs['increment'] is true and the terms are already in the server's dictionary, we increment their scores
[ "Add", "suggestion", "terms", "to", "the", "AutoCompleter", "engine", ".", "Each", "suggestion", "has", "a", "score", "and", "string", "." ]
python
valid
38.888889
StackStorm/pybind
pybind/slxos/v17s_1_02/protocol/cfm/domain_name/ma_name/cfm_ma_sub_commands/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/protocol/cfm/domain_name/ma_name/cfm_ma_sub_commands/__init__.py#L127-L148
def _set_mip_policy(self, v, load=False): """ Setter method for mip_policy, mapped from YANG variable /protocol/cfm/domain_name/ma_name/cfm_ma_sub_commands/mip_policy (mip-policy-type) If this variable is read-only (config: false) in the source YANG file, then _set_mip_policy is considered as a private ...
[ "def", "_set_mip_policy", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "bas...
Setter method for mip_policy, mapped from YANG variable /protocol/cfm/domain_name/ma_name/cfm_ma_sub_commands/mip_policy (mip-policy-type) If this variable is read-only (config: false) in the source YANG file, then _set_mip_policy is considered as a private method. Backends looking to populate this variable...
[ "Setter", "method", "for", "mip_policy", "mapped", "from", "YANG", "variable", "/", "protocol", "/", "cfm", "/", "domain_name", "/", "ma_name", "/", "cfm_ma_sub_commands", "/", "mip_policy", "(", "mip", "-", "policy", "-", "type", ")", "If", "this", "variabl...
python
train
98
has2k1/plotnine
plotnine/layer.py
https://github.com/has2k1/plotnine/blob/566e579af705367e584fb27a74e6c5199624ca89/plotnine/layer.py#L229-L249
def generate_data(self, plot_data): """ Generate data to be used by this layer Parameters ---------- plot_data : dataframe ggplot object data """ # Each layer that does not have data gets a copy of # of the ggplot.data. If the has data it is r...
[ "def", "generate_data", "(", "self", ",", "plot_data", ")", ":", "# Each layer that does not have data gets a copy of", "# of the ggplot.data. If the has data it is replaced", "# by copy so that we do not alter the users data", "if", "self", ".", "data", "is", "None", ":", "self"...
Generate data to be used by this layer Parameters ---------- plot_data : dataframe ggplot object data
[ "Generate", "data", "to", "be", "used", "by", "this", "layer" ]
python
train
34.952381
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2736-L2760
def calc_fft_with_PyCUDA(Signal): """ Calculates the FFT of the passed signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signal : ndarray Signal to be transformed into Fourier space Returns ------- Signalfft : ndarray Array containi...
[ "def", "calc_fft_with_PyCUDA", "(", "Signal", ")", ":", "print", "(", "\"starting fft\"", ")", "Signal", "=", "Signal", ".", "astype", "(", "_np", ".", "float32", ")", "Signal_gpu", "=", "_gpuarray", ".", "to_gpu", "(", "Signal", ")", "Signalfft_gpu", "=", ...
Calculates the FFT of the passed signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signal : ndarray Signal to be transformed into Fourier space Returns ------- Signalfft : ndarray Array containing the signal's FFT
[ "Calculates", "the", "FFT", "of", "the", "passed", "signal", "by", "using", "the", "scikit", "-", "cuda", "libary", "which", "relies", "on", "PyCUDA" ]
python
train
31.32
geopy/geopy
geopy/geocoders/here.py
https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/here.py#L96-L202
def geocode( self, query, bbox=None, mapview=None, exactly_one=True, maxresults=None, pageinformation=None, language=None, additional_data=False, timeout=DEFAULT_SENTINEL ): """ Re...
[ "def", "geocode", "(", "self", ",", "query", ",", "bbox", "=", "None", ",", "mapview", "=", "None", ",", "exactly_one", "=", "True", ",", "maxresults", "=", "None", ",", "pageinformation", "=", "None", ",", "language", "=", "None", ",", "additional_data"...
Return a location point by address. This implementation supports only a subset of all available parameters. A list of all parameters of the pure REST API is available here: https://developer.here.com/documentation/geocoder/topics/resource-geocode.html :param str query: The address or q...
[ "Return", "a", "location", "point", "by", "address", "." ]
python
train
43.429907
hollenstein/maspy
maspy/core.py
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L1071-L1082
def _fromJSON(cls, jsonobject): """Generates a new instance of :class:`maspy.core.MzmlScan` from a decoded JSON object (as generated by :func:`maspy.core.MzmlScan._reprJSON()`). :param jsonobject: decoded JSON object :returns: a new instance of :class:`MzmlScan` """ ...
[ "def", "_fromJSON", "(", "cls", ",", "jsonobject", ")", ":", "scanWindowList", "=", "_mzmlListAttribToTuple", "(", "jsonobject", "[", "0", "]", ")", "params", "=", "[", "tuple", "(", "param", ")", "for", "param", "in", "jsonobject", "[", "1", "]", "]", ...
Generates a new instance of :class:`maspy.core.MzmlScan` from a decoded JSON object (as generated by :func:`maspy.core.MzmlScan._reprJSON()`). :param jsonobject: decoded JSON object :returns: a new instance of :class:`MzmlScan`
[ "Generates", "a", "new", "instance", "of", ":", "class", ":", "maspy", ".", "core", ".", "MzmlScan", "from", "a", "decoded", "JSON", "object", "(", "as", "generated", "by", ":", "func", ":", "maspy", ".", "core", ".", "MzmlScan", ".", "_reprJSON", "()"...
python
train
39.166667
ihmeuw/vivarium
src/vivarium/framework/randomness.py
https://github.com/ihmeuw/vivarium/blob/c5f5d50f775c8bf337d3aae1ff7c57c025a8e258/src/vivarium/framework/randomness.py#L157-L159
def clip_to_seconds(m: Union[int, pd.Series]) -> Union[int, pd.Series]: """Clips UTC datetime in nanoseconds to seconds.""" return m // pd.Timedelta(1, unit='s').value
[ "def", "clip_to_seconds", "(", "m", ":", "Union", "[", "int", ",", "pd", ".", "Series", "]", ")", "->", "Union", "[", "int", ",", "pd", ".", "Series", "]", ":", "return", "m", "//", "pd", ".", "Timedelta", "(", "1", ",", "unit", "=", "'s'", ")"...
Clips UTC datetime in nanoseconds to seconds.
[ "Clips", "UTC", "datetime", "in", "nanoseconds", "to", "seconds", "." ]
python
train
60.333333
proycon/pynlpl
pynlpl/formats/folia.py
https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2419-L2421
def context(self, size, placeholder=None, scope=None): """Returns this word in context, {size} words to the left, the current word, and {size} words to the right""" return self.leftcontext(size, placeholder,scope) + [self] + self.rightcontext(size, placeholder,scope)
[ "def", "context", "(", "self", ",", "size", ",", "placeholder", "=", "None", ",", "scope", "=", "None", ")", ":", "return", "self", ".", "leftcontext", "(", "size", ",", "placeholder", ",", "scope", ")", "+", "[", "self", "]", "+", "self", ".", "ri...
Returns this word in context, {size} words to the left, the current word, and {size} words to the right
[ "Returns", "this", "word", "in", "context", "{", "size", "}", "words", "to", "the", "left", "the", "current", "word", "and", "{", "size", "}", "words", "to", "the", "right" ]
python
train
93.666667
PlaidWeb/Publ
publ/markdown.py
https://github.com/PlaidWeb/Publ/blob/ce7893632ddc3cb70b4978a41ffd7dd06fa13565/publ/markdown.py#L144-L164
def _render_image(self, spec, container_args, alt_text=None): """ Render an image specification into an <img> tag """ try: path, image_args, title = image.parse_image_spec(spec) except Exception as err: # pylint: disable=broad-except logger.exception("Got error on spec ...
[ "def", "_render_image", "(", "self", ",", "spec", ",", "container_args", ",", "alt_text", "=", "None", ")", ":", "try", ":", "path", ",", "image_args", ",", "title", "=", "image", ".", "parse_image_spec", "(", "spec", ")", "except", "Exception", "as", "e...
Render an image specification into an <img> tag
[ "Render", "an", "image", "specification", "into", "an", "<img", ">", "tag" ]
python
train
48.809524
soxofaan/dahuffman
dahuffman/huffmancodec.py
https://github.com/soxofaan/dahuffman/blob/e6e1cf6ab3f6cb29f21e642fbcdd63084e5d63c2/dahuffman/huffmancodec.py#L42-L49
def _guess_concat(data): """ Guess concat function from given data """ return { type(u''): u''.join, type(b''): concat_bytes, }.get(type(data), list)
[ "def", "_guess_concat", "(", "data", ")", ":", "return", "{", "type", "(", "u''", ")", ":", "u''", ".", "join", ",", "type", "(", "b''", ")", ":", "concat_bytes", ",", "}", ".", "get", "(", "type", "(", "data", ")", ",", "list", ")" ]
Guess concat function from given data
[ "Guess", "concat", "function", "from", "given", "data" ]
python
train
22.25
xapple/plumbing
plumbing/runner.py
https://github.com/xapple/plumbing/blob/4a7706c7722f5996d0ca366f191aff9ac145880a/plumbing/runner.py#L108-L113
def logs(self): """Find the log directory and return all the logs sorted.""" if not self.parent.loaded: self.parent.load() logs = self.parent.p.logs_dir.flat_directories logs.sort(key=lambda x: x.mod_time) return logs
[ "def", "logs", "(", "self", ")", ":", "if", "not", "self", ".", "parent", ".", "loaded", ":", "self", ".", "parent", ".", "load", "(", ")", "logs", "=", "self", ".", "parent", ".", "p", ".", "logs_dir", ".", "flat_directories", "logs", ".", "sort",...
Find the log directory and return all the logs sorted.
[ "Find", "the", "log", "directory", "and", "return", "all", "the", "logs", "sorted", "." ]
python
train
42
mitsei/dlkit
dlkit/json_/grading/searches.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/searches.py#L97-L108
def get_grade_systems(self): """Gets the grade system list resulting from the search. return: (osid.grading.GradeSystemList) - the grade system list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.ret...
[ "def", "get_grade_systems", "(", "self", ")", ":", "if", "self", ".", "retrieved", ":", "raise", "errors", ".", "IllegalState", "(", "'List has already been retrieved.'", ")", "self", ".", "retrieved", "=", "True", "return", "objects", ".", "GradeSystemList", "(...
Gets the grade system list resulting from the search. return: (osid.grading.GradeSystemList) - the grade system list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "grade", "system", "list", "resulting", "from", "the", "search", "." ]
python
train
41.416667
samstav/requests-chef
requests_chef/mixlib_auth.py
https://github.com/samstav/requests-chef/blob/a0bf013b925abd0cf76eeaf6300cf32659632773/requests_chef/mixlib_auth.py#L127-L137
def canonical_request(self, method, path, content, timestamp): """Return the canonical request string.""" request = collections.OrderedDict([ ('Method', method.upper()), ('Hashed Path', path), ('X-Ops-Content-Hash', content), ('X-Ops-Timestamp', timestamp)...
[ "def", "canonical_request", "(", "self", ",", "method", ",", "path", ",", "content", ",", "timestamp", ")", ":", "request", "=", "collections", ".", "OrderedDict", "(", "[", "(", "'Method'", ",", "method", ".", "upper", "(", ")", ")", ",", "(", "'Hashe...
Return the canonical request string.
[ "Return", "the", "canonical", "request", "string", "." ]
python
train
43.363636
MartinThoma/hwrt
hwrt/handwritten_data.py
https://github.com/MartinThoma/hwrt/blob/725c21a3d0f5a30b8492cbc184b3688ceb364e1c/hwrt/handwritten_data.py#L221-L233
def feature_extraction(self, algorithms): """Get a list of features. Every algorithm has to return the features as a list.""" assert type(algorithms) is list features = [] for algorithm in algorithms: new_features = algorithm(self) assert len(new_features...
[ "def", "feature_extraction", "(", "self", ",", "algorithms", ")", ":", "assert", "type", "(", "algorithms", ")", "is", "list", "features", "=", "[", "]", "for", "algorithm", "in", "algorithms", ":", "new_features", "=", "algorithm", "(", "self", ")", "asse...
Get a list of features. Every algorithm has to return the features as a list.
[ "Get", "a", "list", "of", "features", "." ]
python
train
43
coursera/courseraoauth2client
courseraoauth2client/oauth2.py
https://github.com/coursera/courseraoauth2client/blob/4edd991defe26bfc768ab28a30368cace40baf44/courseraoauth2client/oauth2.py#L417-L434
def _exchange_refresh_tokens(self): 'Exchanges a refresh token for an access token' if self.token_cache is not None and 'refresh' in self.token_cache: # Attempt to use the refresh token to get a new access token. refresh_form = { 'grant_type': 'refresh_token', ...
[ "def", "_exchange_refresh_tokens", "(", "self", ")", ":", "if", "self", ".", "token_cache", "is", "not", "None", "and", "'refresh'", "in", "self", ".", "token_cache", ":", "# Attempt to use the refresh token to get a new access token.", "refresh_form", "=", "{", "'gra...
Exchanges a refresh token for an access token
[ "Exchanges", "a", "refresh", "token", "for", "an", "access", "token" ]
python
train
46.111111
h2oai/h2o-3
h2o-docs/src/product/sphinxext/apigen.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L154-L159
def _path2uri(self, dirpath): ''' Convert directory path to uri ''' relpath = dirpath.replace(self.root_path, self.package_name) if relpath.startswith(os.path.sep): relpath = relpath[1:] return relpath.replace(os.path.sep, '.')
[ "def", "_path2uri", "(", "self", ",", "dirpath", ")", ":", "relpath", "=", "dirpath", ".", "replace", "(", "self", ".", "root_path", ",", "self", ".", "package_name", ")", "if", "relpath", ".", "startswith", "(", "os", ".", "path", ".", "sep", ")", "...
Convert directory path to uri
[ "Convert", "directory", "path", "to", "uri" ]
python
test
44.333333
tensorflow/hub
tensorflow_hub/native_module.py
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L758-L766
def check_collections_are_supported(saved_model_handler, supported): """Checks that SavedModelHandler only uses supported collections.""" for meta_graph in saved_model_handler.meta_graphs: used_collection_keys = set(meta_graph.collection_def.keys()) unsupported = used_collection_keys - supported if unsu...
[ "def", "check_collections_are_supported", "(", "saved_model_handler", ",", "supported", ")", ":", "for", "meta_graph", "in", "saved_model_handler", ".", "meta_graphs", ":", "used_collection_keys", "=", "set", "(", "meta_graph", ".", "collection_def", ".", "keys", "(",...
Checks that SavedModelHandler only uses supported collections.
[ "Checks", "that", "SavedModelHandler", "only", "uses", "supported", "collections", "." ]
python
train
58.666667
quantopian/zipline
zipline/algorithm.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/algorithm.py#L1077-L1105
def symbols(self, *args, **kwargs): """Lookup multuple Equities as a list. Parameters ---------- *args : iterable[str] The ticker symbols to lookup. country_code : str or None, optional A country to limit symbol searches to. Returns ---...
[ "def", "symbols", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "[", "self", ".", "symbol", "(", "identifier", ",", "*", "*", "kwargs", ")", "for", "identifier", "in", "args", "]" ]
Lookup multuple Equities as a list. Parameters ---------- *args : iterable[str] The ticker symbols to lookup. country_code : str or None, optional A country to limit symbol searches to. Returns ------- equities : list[Equity] ...
[ "Lookup", "multuple", "Equities", "as", "a", "list", "." ]
python
train
26.103448
mikedh/trimesh
trimesh/path/traversal.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/path/traversal.py#L145-L185
def closed_paths(entities, vertices): """ Paths are lists of entity indices. We first generate vertex paths using graph cycle algorithms, and then convert them to entity paths. This will also change the ordering of entity.points in place so a path may be traversed without having to reverse the ...
[ "def", "closed_paths", "(", "entities", ",", "vertices", ")", ":", "# get a networkx graph of entities", "graph", ",", "closed", "=", "vertex_graph", "(", "entities", ")", "# add entities that are closed as single- entity paths", "entity_paths", "=", "np", ".", "reshape",...
Paths are lists of entity indices. We first generate vertex paths using graph cycle algorithms, and then convert them to entity paths. This will also change the ordering of entity.points in place so a path may be traversed without having to reverse the entity. Parameters ------------- enti...
[ "Paths", "are", "lists", "of", "entity", "indices", ".", "We", "first", "generate", "vertex", "paths", "using", "graph", "cycle", "algorithms", "and", "then", "convert", "them", "to", "entity", "paths", "." ]
python
train
33.829268
jameshilliard/hlk-sw16
hlk_sw16/protocol.py
https://github.com/jameshilliard/hlk-sw16/blob/4f0c5a7b76b42167f4dc9d2aa6312c7518a8cd56/hlk_sw16/protocol.py#L138-L143
def format_packet(command): """Format packet to be sent.""" frame_header = b"\xaa" verify = b"\x0b" send_delim = b"\xbb" return frame_header + command.ljust(17, b"\x00") + verify + send_delim
[ "def", "format_packet", "(", "command", ")", ":", "frame_header", "=", "b\"\\xaa\"", "verify", "=", "b\"\\x0b\"", "send_delim", "=", "b\"\\xbb\"", "return", "frame_header", "+", "command", ".", "ljust", "(", "17", ",", "b\"\\x00\"", ")", "+", "verify", "+", ...
Format packet to be sent.
[ "Format", "packet", "to", "be", "sent", "." ]
python
train
37.666667
tensorflow/tensor2tensor
tensor2tensor/models/research/moe_experiments.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/moe_experiments.py#L356-L361
def xmoe2_v1_l4k_local_only(): """With sequence length 4096.""" hparams = xmoe2_v1_l4k() hparams.decoder_layers = [ "local_att" if l == "att" else l for l in hparams.decoder_layers] return hparams
[ "def", "xmoe2_v1_l4k_local_only", "(", ")", ":", "hparams", "=", "xmoe2_v1_l4k", "(", ")", "hparams", ".", "decoder_layers", "=", "[", "\"local_att\"", "if", "l", "==", "\"att\"", "else", "l", "for", "l", "in", "hparams", ".", "decoder_layers", "]", "return"...
With sequence length 4096.
[ "With", "sequence", "length", "4096", "." ]
python
train
34.166667
locationlabs/mockredis
mockredis/client.py
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L552-L557
def hmget(self, hashkey, keys, *args): """Emulate hmget.""" redis_hash = self._get_hash(hashkey, 'HMGET') attributes = self._list_or_args(keys, args) return [redis_hash.get(self._encode(attribute)) for attribute in attributes]
[ "def", "hmget", "(", "self", ",", "hashkey", ",", "keys", ",", "*", "args", ")", ":", "redis_hash", "=", "self", ".", "_get_hash", "(", "hashkey", ",", "'HMGET'", ")", "attributes", "=", "self", ".", "_list_or_args", "(", "keys", ",", "args", ")", "r...
Emulate hmget.
[ "Emulate", "hmget", "." ]
python
train
42.333333
nion-software/nionswift
nion/swift/Application.py
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Application.py#L176-L229
def start(self, skip_choose=False, fixed_workspace_dir=None): """ Start the application. Looks for workspace_location persistent string. If it doesn't find it, uses a default workspace location. Then checks to see if that workspace exists. If not and if skip_cho...
[ "def", "start", "(", "self", ",", "skip_choose", "=", "False", ",", "fixed_workspace_dir", "=", "None", ")", ":", "logging", ".", "getLogger", "(", "\"migration\"", ")", ".", "setLevel", "(", "logging", ".", "INFO", ")", "if", "fixed_workspace_dir", ":", "...
Start the application. Looks for workspace_location persistent string. If it doesn't find it, uses a default workspace location. Then checks to see if that workspace exists. If not and if skip_choose has not been set to True, asks the user for a workspace location. User...
[ "Start", "the", "application", "." ]
python
train
52
bwohlberg/sporco
sporco/admm/rpca.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/admm/rpca.py#L215-L227
def eval_objfn(self): """Compute components of objective function as well as total contribution to objective function. """ if self.opt['fEvalX']: rnn = np.sum(self.ss) else: rnn = sp.norm_nuclear(self.obfn_fvar()) rl1 = np.sum(np.abs(self.obfn_gva...
[ "def", "eval_objfn", "(", "self", ")", ":", "if", "self", ".", "opt", "[", "'fEvalX'", "]", ":", "rnn", "=", "np", ".", "sum", "(", "self", ".", "ss", ")", "else", ":", "rnn", "=", "sp", ".", "norm_nuclear", "(", "self", ".", "obfn_fvar", "(", ...
Compute components of objective function as well as total contribution to objective function.
[ "Compute", "components", "of", "objective", "function", "as", "well", "as", "total", "contribution", "to", "objective", "function", "." ]
python
train
33.769231
tensorflow/tensorboard
tensorboard/plugins/audio/audio_plugin.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L176-L198
def _query_for_individual_audio(self, run, tag, sample, index): """Builds a URL for accessing the specified audio. This should be kept in sync with _serve_audio_metadata. Note that the URL is *not* guaranteed to always return the same audio, since audio may be unloaded from the reservoir as new audio e...
[ "def", "_query_for_individual_audio", "(", "self", ",", "run", ",", "tag", ",", "sample", ",", "index", ")", ":", "query_string", "=", "urllib", ".", "parse", ".", "urlencode", "(", "{", "'run'", ":", "run", ",", "'tag'", ":", "tag", ",", "'sample'", "...
Builds a URL for accessing the specified audio. This should be kept in sync with _serve_audio_metadata. Note that the URL is *not* guaranteed to always return the same audio, since audio may be unloaded from the reservoir as new audio entries come in. Args: run: The name of the run. tag: T...
[ "Builds", "a", "URL", "for", "accessing", "the", "specified", "audio", "." ]
python
train
32.782609
DataDog/integrations-core
datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L225-L241
def parse_metric_family(self, response, scraper_config): """ Parse the MetricFamily from a valid requests.Response object to provide a MetricFamily object (see [0]) The text format uses iter_lines() generator. :param response: requests.Response :return: core.Metric """ ...
[ "def", "parse_metric_family", "(", "self", ",", "response", ",", "scraper_config", ")", ":", "input_gen", "=", "response", ".", "iter_lines", "(", "chunk_size", "=", "self", ".", "REQUESTS_CHUNK_SIZE", ",", "decode_unicode", "=", "True", ")", "if", "scraper_conf...
Parse the MetricFamily from a valid requests.Response object to provide a MetricFamily object (see [0]) The text format uses iter_lines() generator. :param response: requests.Response :return: core.Metric
[ "Parse", "the", "MetricFamily", "from", "a", "valid", "requests", ".", "Response", "object", "to", "provide", "a", "MetricFamily", "object", "(", "see", "[", "0", "]", ")", "The", "text", "format", "uses", "iter_lines", "()", "generator", ".", ":", "param"...
python
train
50.764706
Chilipp/docrep
docrep/__init__.py
https://github.com/Chilipp/docrep/blob/637971f76e1a6e1c70e36dcd1b02bbc37ba02487/docrep/__init__.py#L915-L943
def get_extended_summary(self, s, base=None): """Get the extended summary from a docstring This here is the extended summary Parameters ---------- s: str The docstring to use base: str or None A key under which the summary shall be stored in the ...
[ "def", "get_extended_summary", "(", "self", ",", "s", ",", "base", "=", "None", ")", ":", "# Remove the summary and dedent", "s", "=", "self", ".", "_remove_summary", "(", "s", ")", "ret", "=", "''", "if", "not", "self", ".", "_all_sections_patt", ".", "ma...
Get the extended summary from a docstring This here is the extended summary Parameters ---------- s: str The docstring to use base: str or None A key under which the summary shall be stored in the :attr:`params` attribute. If not None, the su...
[ "Get", "the", "extended", "summary", "from", "a", "docstring" ]
python
train
31.724138
PmagPy/PmagPy
pmagpy/mapping/map_magic.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/mapping/map_magic.py#L368-L382
def convert_meas(direction, Rec): """ converts measurments tables from magic 2 to 3 (direction=magic3) or from model 3 to 2.5 (direction=magic2) [not available] """ if direction == 'magic3': columns = meas_magic2_2_magic3_map MeasRec = {} for key in columns: if ke...
[ "def", "convert_meas", "(", "direction", ",", "Rec", ")", ":", "if", "direction", "==", "'magic3'", ":", "columns", "=", "meas_magic2_2_magic3_map", "MeasRec", "=", "{", "}", "for", "key", "in", "columns", ":", "if", "key", "in", "list", "(", "Rec", ".",...
converts measurments tables from magic 2 to 3 (direction=magic3) or from model 3 to 2.5 (direction=magic2) [not available]
[ "converts", "measurments", "tables", "from", "magic", "2", "to", "3", "(", "direction", "=", "magic3", ")", "or", "from", "model", "3", "to", "2", ".", "5", "(", "direction", "=", "magic2", ")", "[", "not", "available", "]" ]
python
train
35.066667
EUDAT-B2SAFE/B2HANDLE
b2handle/util/logutils.py
https://github.com/EUDAT-B2SAFE/B2HANDLE/blob/a6d216d459644e01fbdfd5b318a535950bc5cdbb/b2handle/util/logutils.py#L31-L58
def log_instantiation(LOGGER, classname, args, forbidden, with_date=False): ''' Log the instantiation of an object to the given logger. :LOGGER: A logger to log to. Please see module "logging". :classname: The name of the class that is being instantiated. :args: A dictionary of arguments pa...
[ "def", "log_instantiation", "(", "LOGGER", ",", "classname", ",", "args", ",", "forbidden", ",", "with_date", "=", "False", ")", ":", "# Info:", "if", "with_date", ":", "LOGGER", ".", "info", "(", "'Instantiating '", "+", "classname", "+", "' at '", "+", "...
Log the instantiation of an object to the given logger. :LOGGER: A logger to log to. Please see module "logging". :classname: The name of the class that is being instantiated. :args: A dictionary of arguments passed to the instantiation, which will be logged on debug level. :forbidden: ...
[ "Log", "the", "instantiation", "of", "an", "object", "to", "the", "given", "logger", "." ]
python
train
36.928571
globocom/GloboNetworkAPI-client-python
networkapiclient/Vlan.py
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vlan.py#L713-L752
def listar_permissao(self, nome_equipamento, nome_interface): """List all VLANS having communication permission to trunk from a port in switch. Run script 'configurador'. :: The value of 'stdout' key of return dictionary can have a list of numbers or number intervals of VL...
[ "def", "listar_permissao", "(", "self", ",", "nome_equipamento", ",", "nome_interface", ")", ":", "vlan_map", "=", "dict", "(", ")", "vlan_map", "[", "'nome'", "]", "=", "nome_equipamento", "vlan_map", "[", "'nome_interface'", "]", "=", "nome_interface", "code",...
List all VLANS having communication permission to trunk from a port in switch. Run script 'configurador'. :: The value of 'stdout' key of return dictionary can have a list of numbers or number intervals of VLAN´s, comma separated. Examples of possible returns of 'stdout' below: ...
[ "List", "all", "VLANS", "having", "communication", "permission", "to", "trunk", "from", "a", "port", "in", "switch", "." ]
python
train
42
aboSamoor/polyglot
polyglot/load.py
https://github.com/aboSamoor/polyglot/blob/d0d2aa8d06cec4e03bd96618ae960030f7069a17/polyglot/load.py#L89-L103
def load_ner_model(lang="en", version="2"): """Return a named entity extractor parameters for `lang` and of version `version` Args: lang (string): language code. version (string): version of the parameters to be used. """ src_dir = "ner{}".format(version) p = locate_resource(src_dir, lang) fh = _op...
[ "def", "load_ner_model", "(", "lang", "=", "\"en\"", ",", "version", "=", "\"2\"", ")", ":", "src_dir", "=", "\"ner{}\"", ".", "format", "(", "version", ")", "p", "=", "locate_resource", "(", "src_dir", ",", "lang", ")", "fh", "=", "_open", "(", "p", ...
Return a named entity extractor parameters for `lang` and of version `version` Args: lang (string): language code. version (string): version of the parameters to be used.
[ "Return", "a", "named", "entity", "extractor", "parameters", "for", "lang", "and", "of", "version", "version" ]
python
train
29
numenta/htmresearch
projects/sdr_paper/poirazi_neuron_model/run_correlation_false_positive_experiment.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/sdr_paper/poirazi_neuron_model/run_correlation_false_positive_experiment.py#L33-L95
def run_false_positive_experiment_correlation(seed, num_neurons = 1, a = 32, dim = 4000, num_samples = 20000, ...
[ "def", "run_false_positive_experiment_correlation", "(", "seed", ",", "num_neurons", "=", "1", ",", "a", "=", "32", ",", "dim", "=", "4000", ",", "num_samples", "=", "20000", ",", "num_dendrites", "=", "500", ",", "dendrite_length", "=", "20", ",", "num_tria...
Run an experiment to test the false positive rate based on the correlation between bits. Correlation is measured as the average pairwise correlation between bits for each pattern in the data (across all of the data). To generate the results shown in the false positive vs. correlation figure, we used the param...
[ "Run", "an", "experiment", "to", "test", "the", "false", "positive", "rate", "based", "on", "the", "correlation", "between", "bits", ".", "Correlation", "is", "measured", "as", "the", "average", "pairwise", "correlation", "between", "bits", "for", "each", "pat...
python
train
55.142857
dmlc/gluon-nlp
src/gluonnlp/data/transforms.py
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/src/gluonnlp/data/transforms.py#L758-L778
def _tokenize(self, text): """Tokenizes a piece of text.""" text = self._clean_text(text) # This was added on November 1st, 2018 for the multilingual and Chinese # models. This is also applied to the English models now, but it doesn't # matter since the English models were not t...
[ "def", "_tokenize", "(", "self", ",", "text", ")", ":", "text", "=", "self", ".", "_clean_text", "(", "text", ")", "# This was added on November 1st, 2018 for the multilingual and Chinese", "# models. This is also applied to the English models now, but it doesn't", "# matter sinc...
Tokenizes a piece of text.
[ "Tokenizes", "a", "piece", "of", "text", "." ]
python
train
46.714286
bpannier/simpletr64
simpletr64/actions/lan.py
https://github.com/bpannier/simpletr64/blob/31081139f4e6c85084a56de1617df73927135466/simpletr64/actions/lan.py#L108-L124
def getHostDetailsByIndex(self, index, lanInterfaceId=1, timeout=1): """Execute GetGenericHostEntry action to get detailed information's of a connected host. :param index: the index of the host :param int lanInterfaceId: the id of the LAN interface :param float timeout: the timeout to w...
[ "def", "getHostDetailsByIndex", "(", "self", ",", "index", ",", "lanInterfaceId", "=", "1", ",", "timeout", "=", "1", ")", ":", "namespace", "=", "Lan", ".", "getServiceType", "(", "\"getHostDetailsByIndex\"", ")", "+", "str", "(", "lanInterfaceId", ")", "ur...
Execute GetGenericHostEntry action to get detailed information's of a connected host. :param index: the index of the host :param int lanInterfaceId: the id of the LAN interface :param float timeout: the timeout to wait for the action to be executed :return: the detailed information's of...
[ "Execute", "GetGenericHostEntry", "action", "to", "get", "detailed", "information", "s", "of", "a", "connected", "host", "." ]
python
train
46.647059
Murali-group/halp
halp/algorithms/directed_random_walk.py
https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/algorithms/directed_random_walk.py#L16-L64
def stationary_distribution(H, pi=None, P=None): """Computes the stationary distribution of a random walk on the given hypergraph using the iterative approach explained in the paper: Aurelien Ducournau, Alain Bretto, Random walks in directed hypergraphs and application to semi-supervised image segmentat...
[ "def", "stationary_distribution", "(", "H", ",", "pi", "=", "None", ",", "P", "=", "None", ")", ":", "if", "not", "isinstance", "(", "H", ",", "DirectedHypergraph", ")", ":", "raise", "TypeError", "(", "\"Algorithm only applicable to undirected hypergraphs\"", "...
Computes the stationary distribution of a random walk on the given hypergraph using the iterative approach explained in the paper: Aurelien Ducournau, Alain Bretto, Random walks in directed hypergraphs and application to semi-supervised image segmentation, Computer Vision and Image Understanding, Volume...
[ "Computes", "the", "stationary", "distribution", "of", "a", "random", "walk", "on", "the", "given", "hypergraph", "using", "the", "iterative", "approach", "explained", "in", "the", "paper", ":", "Aurelien", "Ducournau", "Alain", "Bretto", "Random", "walks", "in"...
python
train
43.469388
pudo-attic/loadkit
loadkit/logger.py
https://github.com/pudo-attic/loadkit/blob/1fb17e69e2ffaf3dac4f40b574c3b7afb2198b7c/loadkit/logger.py#L49-L77
def load(package, prefix, offset=0, limit=1000): """ Load lines from the log file with pagination support. """ logs = package.all(LogFile, unicode(prefix)) logs = sorted(logs, key=lambda l: l.name, reverse=True) seen = 0 record = None tmp = tempfile.NamedTemporaryFile(suffix='.log') for log ...
[ "def", "load", "(", "package", ",", "prefix", ",", "offset", "=", "0", ",", "limit", "=", "1000", ")", ":", "logs", "=", "package", ".", "all", "(", "LogFile", ",", "unicode", "(", "prefix", ")", ")", "logs", "=", "sorted", "(", "logs", ",", "key...
Load lines from the log file with pagination support.
[ "Load", "lines", "from", "the", "log", "file", "with", "pagination", "support", "." ]
python
train
34.172414
AnalogJ/lexicon
lexicon/providers/route53.py
https://github.com/AnalogJ/lexicon/blob/9330b871988753cad44fe2876a217b4c67b1fa0e/lexicon/providers/route53.py#L122-L134
def _authenticate(self): """Determine the hosted zone id for the domain.""" try: hosted_zones = self.r53_client.list_hosted_zones_by_name()[ 'HostedZones' ] hosted_zone = next( hz for hz in hosted_zones if self.filter_zo...
[ "def", "_authenticate", "(", "self", ")", ":", "try", ":", "hosted_zones", "=", "self", ".", "r53_client", ".", "list_hosted_zones_by_name", "(", ")", "[", "'HostedZones'", "]", "hosted_zone", "=", "next", "(", "hz", "for", "hz", "in", "hosted_zones", "if", ...
Determine the hosted zone id for the domain.
[ "Determine", "the", "hosted", "zone", "id", "for", "the", "domain", "." ]
python
train
34.769231
NASA-AMMOS/AIT-Core
ait/core/bsc.py
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L603-L613
def rotate_capture_handler_log(self, name): ''' Force a rotation of a handler's log file Args: name: The name of the handler who's log file should be rotated. ''' for sc_key, sc in self._stream_capturers.iteritems(): for h in sc[0].capture_handler...
[ "def", "rotate_capture_handler_log", "(", "self", ",", "name", ")", ":", "for", "sc_key", ",", "sc", "in", "self", ".", "_stream_capturers", ".", "iteritems", "(", ")", ":", "for", "h", "in", "sc", "[", "0", "]", ".", "capture_handlers", ":", "if", "h"...
Force a rotation of a handler's log file Args: name: The name of the handler who's log file should be rotated.
[ "Force", "a", "rotation", "of", "a", "handler", "s", "log", "file" ]
python
train
35.545455