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
openstack/proliantutils
proliantutils/ilo/ris.py
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/ris.py#L1497-L1525
def _get_persistent_boot_devices(self): """Get details of persistent boot devices, its order :returns: List of dictionary of boot sources and list of boot device order :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not ...
[ "def", "_get_persistent_boot_devices", "(", "self", ")", ":", "# Check if the BIOS resource if exists.", "headers_bios", ",", "bios_uri", ",", "bios_settings", "=", "self", ".", "_check_bios_resource", "(", ")", "# Get the Boot resource.", "boot_settings", "=", "self", "....
Get details of persistent boot devices, its order :returns: List of dictionary of boot sources and list of boot device order :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
[ "Get", "details", "of", "persistent", "boot", "devices", "its", "order" ]
python
train
37.172414
ccubed/PyMoe
Pymoe/Anidb/dump.py
https://github.com/ccubed/PyMoe/blob/5b2a2591bb113bd80d838e65aaa06f3a97ff3670/Pymoe/Anidb/dump.py#L13-L37
def download(which, destination=None): """ I realize that the download for the dumps is going to take awhile. Given that, I've decided to approach this using threads. When you call this method, it will launch a thread to download the data. By default, the dump is dropped into the...
[ "def", "download", "(", "which", ",", "destination", "=", "None", ")", ":", "if", "destination", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "destination", ")", ":", "os", ".", "makedirs", "(", "destination", ")", "pthread", "=", "threadin...
I realize that the download for the dumps is going to take awhile. Given that, I've decided to approach this using threads. When you call this method, it will launch a thread to download the data. By default, the dump is dropped into the current working directory. If the directory given ...
[ "I", "realize", "that", "the", "download", "for", "the", "dumps", "is", "going", "to", "take", "awhile", ".", "Given", "that", "I", "ve", "decided", "to", "approach", "this", "using", "threads", ".", "When", "you", "call", "this", "method", "it", "will",...
python
train
38
assemblerflow/flowcraft
flowcraft/generator/process.py
https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/process.py#L622-L673
def set_compiler_channels(self, channel_list, operator="mix"): """General method for setting the input channels for the status process Given a list of status channels that are gathered during the pipeline construction, this method will automatically set the input channel for the status ...
[ "def", "set_compiler_channels", "(", "self", ",", "channel_list", ",", "operator", "=", "\"mix\"", ")", ":", "if", "not", "channel_list", ":", "raise", "eh", ".", "ProcessError", "(", "\"At least one status channel must be \"", "\"provided to include this process in the \...
General method for setting the input channels for the status process Given a list of status channels that are gathered during the pipeline construction, this method will automatically set the input channel for the status process. This makes use of the ``mix`` channel operator of nextflo...
[ "General", "method", "for", "setting", "the", "input", "channels", "for", "the", "status", "process" ]
python
test
34.519231
Esri/ArcREST
src/arcrest/webmap/symbols.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/webmap/symbols.py#L461-L474
def asDictionary(self): """ returns the object as a dictionary """ template = { "type" : "esriPMS", "url" : self._url, "imageData" : self._imageDate, "contentType" : self._contentType, "width" : self._width, "height" : self._height,...
[ "def", "asDictionary", "(", "self", ")", ":", "template", "=", "{", "\"type\"", ":", "\"esriPMS\"", ",", "\"url\"", ":", "self", ".", "_url", ",", "\"imageData\"", ":", "self", ".", "_imageDate", ",", "\"contentType\"", ":", "self", ".", "_contentType", ",...
returns the object as a dictionary
[ "returns", "the", "object", "as", "a", "dictionary" ]
python
train
32.357143
facelessuser/bracex
bracex/__init__.py
https://github.com/facelessuser/bracex/blob/1fdf83e2bdfb939e78ba9966bcef80cd7a5c8534/bracex/__init__.py#L159-L166
def get_escape(self, c, i): """Get an escape.""" try: escaped = next(i) except StopIteration: escaped = '' return c + escaped if self.keep_escapes else escaped
[ "def", "get_escape", "(", "self", ",", "c", ",", "i", ")", ":", "try", ":", "escaped", "=", "next", "(", "i", ")", "except", "StopIteration", ":", "escaped", "=", "''", "return", "c", "+", "escaped", "if", "self", ".", "keep_escapes", "else", "escape...
Get an escape.
[ "Get", "an", "escape", "." ]
python
train
26.125
wglass/lighthouse
lighthouse/reporter.py
https://github.com/wglass/lighthouse/blob/f4ce6550895acc31e433ede0c05d366718a3ffe5/lighthouse/reporter.py#L103-L126
def run_checks(self, service): """ Runs each check for the service and reports to the service's discovery method based on the results. If all checks pass and the service's present node was previously reported as down, the present node is reported as up. Conversely, if a...
[ "def", "run_checks", "(", "self", ",", "service", ")", ":", "logger", ".", "debug", "(", "\"Running checks. (%s)\"", ",", "service", ".", "name", ")", "if", "service", ".", "discovery", "not", "in", "self", ".", "configurables", "[", "Discovery", "]", ":",...
Runs each check for the service and reports to the service's discovery method based on the results. If all checks pass and the service's present node was previously reported as down, the present node is reported as up. Conversely, if any of the checks fail and the service's present nod...
[ "Runs", "each", "check", "for", "the", "service", "and", "reports", "to", "the", "service", "s", "discovery", "method", "based", "on", "the", "results", "." ]
python
train
36.75
CZ-NIC/yangson
yangson/instance.py
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L266-L271
def top(self) -> "InstanceNode": """Return an instance node corresponding to the root of the data tree.""" inst = self while inst.parinst: inst = inst.up() return inst
[ "def", "top", "(", "self", ")", "->", "\"InstanceNode\"", ":", "inst", "=", "self", "while", "inst", ".", "parinst", ":", "inst", "=", "inst", ".", "up", "(", ")", "return", "inst" ]
Return an instance node corresponding to the root of the data tree.
[ "Return", "an", "instance", "node", "corresponding", "to", "the", "root", "of", "the", "data", "tree", "." ]
python
train
34.333333
Jaymon/pout
pout/reflect.py
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/reflect.py#L368-L405
def _get_arg_info(self): ''' get all the info of a method call this will find what arg names you passed into the method and tie them to their passed in values, it will also find file and line number return -- dict -- a bunch of info on the call ''' ret_dict = { ...
[ "def", "_get_arg_info", "(", "self", ")", ":", "ret_dict", "=", "{", "'args'", ":", "[", "]", ",", "#'frame': None,", "'line'", ":", "'Unknown'", ",", "'file'", ":", "'Unknown'", ",", "'arg_names'", ":", "[", "]", "}", "arg_vals", "=", "self", ".", "ar...
get all the info of a method call this will find what arg names you passed into the method and tie them to their passed in values, it will also find file and line number return -- dict -- a bunch of info on the call
[ "get", "all", "the", "info", "of", "a", "method", "call" ]
python
train
30.763158
ejeschke/ginga
ginga/gtk3w/ImageViewGtk.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/gtk3w/ImageViewGtk.py#L75-L84
def save_plain_image_as_file(self, filepath, format='png', quality=90): """Used for generating thumbnails. Does not include overlaid graphics. """ pixbuf = self.get_plain_image_as_pixbuf() options, values = [], [] if format == 'jpeg': options.append('quality'...
[ "def", "save_plain_image_as_file", "(", "self", ",", "filepath", ",", "format", "=", "'png'", ",", "quality", "=", "90", ")", ":", "pixbuf", "=", "self", ".", "get_plain_image_as_pixbuf", "(", ")", "options", ",", "values", "=", "[", "]", ",", "[", "]", ...
Used for generating thumbnails. Does not include overlaid graphics.
[ "Used", "for", "generating", "thumbnails", ".", "Does", "not", "include", "overlaid", "graphics", "." ]
python
train
40.8
lemieuxl/pyGenClean
pyGenClean/MarkerMissingness/snp_missingness.py
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/MarkerMissingness/snp_missingness.py#L97-L115
def runPlink(options): """Runs Plink with the geno option. :param options: the options. :type options: argparse.Namespace """ # The plink command plinkCommand = ["plink", "--noweb", "--bfile", options.bfile, "--geno", str(options.geno), "--make-bed", "--out", options.out] ...
[ "def", "runPlink", "(", "options", ")", ":", "# The plink command", "plinkCommand", "=", "[", "\"plink\"", ",", "\"--noweb\"", ",", "\"--bfile\"", ",", "options", ".", "bfile", ",", "\"--geno\"", ",", "str", "(", "options", ".", "geno", ")", ",", "\"--make-b...
Runs Plink with the geno option. :param options: the options. :type options: argparse.Namespace
[ "Runs", "Plink", "with", "the", "geno", "option", "." ]
python
train
30.526316
rosshamish/undoredo
undoredo.py
https://github.com/rosshamish/undoredo/blob/634941181a74477b7ebafa43d9900e6f21fd0458/undoredo.py#L105-L118
def undoable(method): """ Decorator undoable allows an instance method to be undone. It does this by wrapping the method call as a Command, then calling self.do() on the command. Classes which use this decorator should implement a do() method like such: def do(self, command): retu...
[ "def", "undoable", "(", "method", ")", ":", "def", "undoable_method", "(", "self", ",", "*", "args", ")", ":", "return", "self", ".", "do", "(", "Command", "(", "self", ",", "method", ",", "*", "args", ")", ")", "return", "undoable_method" ]
Decorator undoable allows an instance method to be undone. It does this by wrapping the method call as a Command, then calling self.do() on the command. Classes which use this decorator should implement a do() method like such: def do(self, command): return self.undo_manager.do(command)
[ "Decorator", "undoable", "allows", "an", "instance", "method", "to", "be", "undone", "." ]
python
train
33.214286
FutunnOpen/futuquant
futuquant/examples/learn/get_realtime_data.py
https://github.com/FutunnOpen/futuquant/blob/1512b321845f92ec9c578ce2689aa4e8482669e4/futuquant/examples/learn/get_realtime_data.py#L125-L134
def _example_stock_basic(quote_ctx): """ 获取股票信息,输出 股票代码,股票名,每手数量,股票类型,子类型所属正股 """ ret_status, ret_data = quote_ctx.get_stock_basicinfo(ft.Market.HK, ft.SecurityType.STOCK) if ret_status != ft.RET_OK: print(ret_data) exit() print("stock_basic") print(ret_data)
[ "def", "_example_stock_basic", "(", "quote_ctx", ")", ":", "ret_status", ",", "ret_data", "=", "quote_ctx", ".", "get_stock_basicinfo", "(", "ft", ".", "Market", ".", "HK", ",", "ft", ".", "SecurityType", ".", "STOCK", ")", "if", "ret_status", "!=", "ft", ...
获取股票信息,输出 股票代码,股票名,每手数量,股票类型,子类型所属正股
[ "获取股票信息,输出", "股票代码,股票名,每手数量,股票类型,子类型所属正股" ]
python
train
29.4
apriha/lineage
src/lineage/individual.py
https://github.com/apriha/lineage/blob/13106a62a959a80ac26c68d1566422de08aa877b/src/lineage/individual.py#L429-L444
def _set_snps(self, snps, build=37): """ Set `_snps` and `_build` properties of this ``Individual``. Notes ----- Intended to be used internally to `lineage`. Parameters ---------- snps : pandas.DataFrame individual's genetic data normalized for use w...
[ "def", "_set_snps", "(", "self", ",", "snps", ",", "build", "=", "37", ")", ":", "self", ".", "_snps", "=", "snps", "self", ".", "_build", "=", "build" ]
Set `_snps` and `_build` properties of this ``Individual``. Notes ----- Intended to be used internally to `lineage`. Parameters ---------- snps : pandas.DataFrame individual's genetic data normalized for use with `lineage` build : int bui...
[ "Set", "_snps", "and", "_build", "properties", "of", "this", "Individual", "." ]
python
train
28.25
DataBiosphere/dsub
dsub/providers/local.py
https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L797-L816
def _get_input_target_path(self, local_file_path): """Returns a directory or file path to be the target for "gsutil cp". If the filename contains a wildcard, then the target path must be a directory in order to ensure consistency whether the source pattern contains one or multiple files. Args: ...
[ "def", "_get_input_target_path", "(", "self", ",", "local_file_path", ")", ":", "path", ",", "filename", "=", "os", ".", "path", ".", "split", "(", "local_file_path", ")", "if", "'*'", "in", "filename", ":", "return", "path", "+", "'/'", "else", ":", "re...
Returns a directory or file path to be the target for "gsutil cp". If the filename contains a wildcard, then the target path must be a directory in order to ensure consistency whether the source pattern contains one or multiple files. Args: local_file_path: A full path terminating in a file or ...
[ "Returns", "a", "directory", "or", "file", "path", "to", "be", "the", "target", "for", "gsutil", "cp", "." ]
python
valid
29.3
hydroshare/hs_restclient
hs_restclient/endpoints/resources.py
https://github.com/hydroshare/hs_restclient/blob/9cd106238b512e01ecd3e33425fe48c13b7f63d5/hs_restclient/endpoints/resources.py#L37-L49
def get(self): """ :param payload: a key/value object containing the scimeta you want to store e.g. {"weather": "sunny", "temperature": "80C" } :return: empty (200 status code) """ url = "{url_base}/resource/{pid}/scimeta/custom/".for...
[ "def", "get", "(", "self", ")", ":", "url", "=", "\"{url_base}/resource/{pid}/scimeta/custom/\"", ".", "format", "(", "url_base", "=", "self", ".", "hs", ".", "url_base", ",", "pid", "=", "self", ".", "pid", ")", "r", "=", "self", ".", "hs", ".", "_req...
:param payload: a key/value object containing the scimeta you want to store e.g. {"weather": "sunny", "temperature": "80C" } :return: empty (200 status code)
[ ":", "param", "payload", ":", "a", "key", "/", "value", "object", "containing", "the", "scimeta", "you", "want", "to", "store", "e", ".", "g", ".", "{", "weather", ":", "sunny", "temperature", ":", "80C", "}", ":", "return", ":", "empty", "(", "200",...
python
train
38.076923
CityOfZion/neo-python
neo/Network/NeoNode.py
https://github.com/CityOfZion/neo-python/blob/fe90f62e123d720d4281c79af0598d9df9e776fb/neo/Network/NeoNode.py#L638-L651
def SendSerializedMessage(self, message): """ Send the `message` to the remote client. Args: message (neo.Network.Message): """ try: ba = Helper.ToArray(message) ba2 = binascii.unhexlify(ba) self.bytes_out += len(ba2) s...
[ "def", "SendSerializedMessage", "(", "self", ",", "message", ")", ":", "try", ":", "ba", "=", "Helper", ".", "ToArray", "(", "message", ")", "ba2", "=", "binascii", ".", "unhexlify", "(", "ba", ")", "self", ".", "bytes_out", "+=", "len", "(", "ba2", ...
Send the `message` to the remote client. Args: message (neo.Network.Message):
[ "Send", "the", "message", "to", "the", "remote", "client", "." ]
python
train
30.642857
noahbenson/neuropythy
neuropythy/commands/atlas.py
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/commands/atlas.py#L158-L243
def calc_atlas_projections(subject_cortices, atlas_cortices, atlas_map, worklog, atlases=Ellipsis): ''' calc_atlas_projections calculates the lazy map of atlas projections. Afferent parameters: @ atlases The atlases that should be applied to the subject. This can be specified as a list/tuple...
[ "def", "calc_atlas_projections", "(", "subject_cortices", ",", "atlas_cortices", ",", "atlas_map", ",", "worklog", ",", "atlases", "=", "Ellipsis", ")", ":", "# Parse the atlases argument first:", "if", "atlases", "is", "Ellipsis", ":", "atlases", "=", "(", "'benson...
calc_atlas_projections calculates the lazy map of atlas projections. Afferent parameters: @ atlases The atlases that should be applied to the subject. This can be specified as a list/tuple of atlas names or as a string where the atlas names are separated by whitespace, commas, or sem...
[ "calc_atlas_projections", "calculates", "the", "lazy", "map", "of", "atlas", "projections", "." ]
python
train
55.372093
googleapis/google-cloud-python
bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py#L424-L443
def _copy_stream_position(position): """Copy a StreamPosition. Args: position (Union[ \ dict, \ ~google.cloud.bigquery_storage_v1beta1.types.StreamPosition \ ]): StreamPostion (or dictionary in StreamPosition format) to copy. Returns: ~google.clo...
[ "def", "_copy_stream_position", "(", "position", ")", ":", "if", "isinstance", "(", "position", ",", "types", ".", "StreamPosition", ")", ":", "output", "=", "types", ".", "StreamPosition", "(", ")", "output", ".", "CopyFrom", "(", "position", ")", "return",...
Copy a StreamPosition. Args: position (Union[ \ dict, \ ~google.cloud.bigquery_storage_v1beta1.types.StreamPosition \ ]): StreamPostion (or dictionary in StreamPosition format) to copy. Returns: ~google.cloud.bigquery_storage_v1beta1.types.StreamPosi...
[ "Copy", "a", "StreamPosition", "." ]
python
train
29.85
swharden/SWHLab
swhlab/tools/activeFolders/scan.py
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/tools/activeFolders/scan.py#L13-L17
def fileModifiedTimestamp(fname): """return "YYYY-MM-DD" when the file was modified.""" modifiedTime=os.path.getmtime(fname) stamp=time.strftime('%Y-%m-%d', time.localtime(modifiedTime)) return stamp
[ "def", "fileModifiedTimestamp", "(", "fname", ")", ":", "modifiedTime", "=", "os", ".", "path", ".", "getmtime", "(", "fname", ")", "stamp", "=", "time", ".", "strftime", "(", "'%Y-%m-%d'", ",", "time", ".", "localtime", "(", "modifiedTime", ")", ")", "r...
return "YYYY-MM-DD" when the file was modified.
[ "return", "YYYY", "-", "MM", "-", "DD", "when", "the", "file", "was", "modified", "." ]
python
valid
43
apache/incubator-mxnet
python/mxnet/gluon/parameter.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/gluon/parameter.py#L287-L298
def _init_impl(self, data, ctx_list): """Sets data and grad.""" self._ctx_list = list(ctx_list) self._ctx_map = [[], []] for i, ctx in enumerate(self._ctx_list): dev_list = self._ctx_map[ctx.device_typeid&1] while len(dev_list) <= ctx.device_id: de...
[ "def", "_init_impl", "(", "self", ",", "data", ",", "ctx_list", ")", ":", "self", ".", "_ctx_list", "=", "list", "(", "ctx_list", ")", "self", ".", "_ctx_map", "=", "[", "[", "]", ",", "[", "]", "]", "for", "i", ",", "ctx", "in", "enumerate", "("...
Sets data and grad.
[ "Sets", "data", "and", "grad", "." ]
python
train
38.416667
pytroll/satpy
satpy/readers/viirs_sdr.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/viirs_sdr.py#L532-L544
def get_right_geo_fhs(self, dsid, fhs): """Find the right geographical file handlers for given dataset ID *dsid*.""" ds_info = self.ids[dsid] req_geo, rem_geo = self._get_req_rem_geo(ds_info) desired, other = split_desired_other(fhs, req_geo, rem_geo) if desired: try:...
[ "def", "get_right_geo_fhs", "(", "self", ",", "dsid", ",", "fhs", ")", ":", "ds_info", "=", "self", ".", "ids", "[", "dsid", "]", "req_geo", ",", "rem_geo", "=", "self", ".", "_get_req_rem_geo", "(", "ds_info", ")", "desired", ",", "other", "=", "split...
Find the right geographical file handlers for given dataset ID *dsid*.
[ "Find", "the", "right", "geographical", "file", "handlers", "for", "given", "dataset", "ID", "*", "dsid", "*", "." ]
python
train
37.230769
d0c-s4vage/pfp
pfp/interp.py
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L419-L429
def get_id(self, name, recurse=True): """Get the first id matching ``name``. Will either be a local or a var. :name: TODO :returns: TODO """ self._dlog("getting id '{}'".format(name)) var = self._search("vars", name, recurse) return var
[ "def", "get_id", "(", "self", ",", "name", ",", "recurse", "=", "True", ")", ":", "self", ".", "_dlog", "(", "\"getting id '{}'\"", ".", "format", "(", "name", ")", ")", "var", "=", "self", ".", "_search", "(", "\"vars\"", ",", "name", ",", "recurse"...
Get the first id matching ``name``. Will either be a local or a var. :name: TODO :returns: TODO
[ "Get", "the", "first", "id", "matching", "name", ".", "Will", "either", "be", "a", "local", "or", "a", "var", "." ]
python
train
26.545455
tensorflow/cleverhans
examples/nips17_adversarial_competition/eval_infra/code/eval_lib/image_batches.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/image_batches.py#L102-L114
def init_from_datastore(self): """Initializes batches by reading from the datastore.""" self._data = {} for entity in self._datastore_client.query_fetch( kind=self._entity_kind_batches): batch_id = entity.key.flat_path[-1] self._data[batch_id] = dict(entity) self._data[batch_id]['i...
[ "def", "init_from_datastore", "(", "self", ")", ":", "self", ".", "_data", "=", "{", "}", "for", "entity", "in", "self", ".", "_datastore_client", ".", "query_fetch", "(", "kind", "=", "self", ".", "_entity_kind_batches", ")", ":", "batch_id", "=", "entity...
Initializes batches by reading from the datastore.
[ "Initializes", "batches", "by", "reading", "from", "the", "datastore", "." ]
python
train
43.076923
GuyAllard/markov_clustering
markov_clustering/mcl.py
https://github.com/GuyAllard/markov_clustering/blob/28787cf64ef06bf024ff915246008c767ea830cf/markov_clustering/mcl.py#L7-L13
def sparse_allclose(a, b, rtol=1e-5, atol=1e-8): """ Version of np.allclose for use with sparse matrices """ c = np.abs(a - b) - rtol * np.abs(b) # noinspection PyUnresolvedReferences return c.max() <= atol
[ "def", "sparse_allclose", "(", "a", ",", "b", ",", "rtol", "=", "1e-5", ",", "atol", "=", "1e-8", ")", ":", "c", "=", "np", ".", "abs", "(", "a", "-", "b", ")", "-", "rtol", "*", "np", ".", "abs", "(", "b", ")", "# noinspection PyUnresolvedRefere...
Version of np.allclose for use with sparse matrices
[ "Version", "of", "np", ".", "allclose", "for", "use", "with", "sparse", "matrices" ]
python
train
32
jvamvas/rhymediscovery
rhymediscovery/evaluate_schemes.py
https://github.com/jvamvas/rhymediscovery/blob/b76509c98554b12efa06fe9ab557cca5fa5e4a79/rhymediscovery/evaluate_schemes.py#L76-L79
def get_wordset(poems): """get all words""" words = sorted(list(set(reduce(lambda x, y: x + y, poems)))) return words
[ "def", "get_wordset", "(", "poems", ")", ":", "words", "=", "sorted", "(", "list", "(", "set", "(", "reduce", "(", "lambda", "x", ",", "y", ":", "x", "+", "y", ",", "poems", ")", ")", ")", ")", "return", "words" ]
get all words
[ "get", "all", "words" ]
python
train
31.5
thriftrw/thriftrw-python
thriftrw/idl/parser.py
https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/idl/parser.py#L182-L186
def p_enum(self, p): # noqa '''enum : ENUM IDENTIFIER '{' enum_seq '}' annotations''' p[0] = ast.Enum( name=p[2], items=p[4], annotations=p[6], lineno=p.lineno(2) )
[ "def", "p_enum", "(", "self", ",", "p", ")", ":", "# noqa", "p", "[", "0", "]", "=", "ast", ".", "Enum", "(", "name", "=", "p", "[", "2", "]", ",", "items", "=", "p", "[", "4", "]", ",", "annotations", "=", "p", "[", "6", "]", ",", "linen...
enum : ENUM IDENTIFIER '{' enum_seq '}' annotations
[ "enum", ":", "ENUM", "IDENTIFIER", "{", "enum_seq", "}", "annotations" ]
python
train
39.4
v1k45/python-qBittorrent
qbittorrent/client.py
https://github.com/v1k45/python-qBittorrent/blob/04f9482a022dcc78c56b0b9acb9ca455f855ae24/qbittorrent/client.py#L459-L466
def decrease_priority(self, infohash_list): """ Decrease priority of torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/decreasePrio', data=data)
[ "def", "decrease_priority", "(", "self", ",", "infohash_list", ")", ":", "data", "=", "self", ".", "_process_infohash_list", "(", "infohash_list", ")", "return", "self", ".", "_post", "(", "'command/decreasePrio'", ",", "data", "=", "data", ")" ]
Decrease priority of torrents. :param infohash_list: Single or list() of infohashes.
[ "Decrease", "priority", "of", "torrents", "." ]
python
train
35.125
opencobra/cobrapy
cobra/sampling/hr_sampler.py
https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/sampling/hr_sampler.py#L194-L236
def __build_problem(self): """Build the matrix representation of the sampling problem.""" # Set up the mathematical problem prob = constraint_matrices(self.model, zero_tol=self.feasibility_tol) # check if there any non-zero equality constraints equalities = prob.equalities ...
[ "def", "__build_problem", "(", "self", ")", ":", "# Set up the mathematical problem", "prob", "=", "constraint_matrices", "(", "self", ".", "model", ",", "zero_tol", "=", "self", ".", "feasibility_tol", ")", "# check if there any non-zero equality constraints", "equalitie...
Build the matrix representation of the sampling problem.
[ "Build", "the", "matrix", "representation", "of", "the", "sampling", "problem", "." ]
python
valid
45.209302
pmorissette/ffn
ffn/core.py
https://github.com/pmorissette/ffn/blob/ef09f28b858b7ffcd2627ce6a4dc618183a6bc8a/ffn/core.py#L1623-L1695
def calc_erc_weights(returns, initial_weights=None, risk_weights=None, covar_method='ledoit-wolf', risk_parity_method='ccd', maximum_iterations=100, tolerance=1E-8): """ Calculates the e...
[ "def", "calc_erc_weights", "(", "returns", ",", "initial_weights", "=", "None", ",", "risk_weights", "=", "None", ",", "covar_method", "=", "'ledoit-wolf'", ",", "risk_parity_method", "=", "'ccd'", ",", "maximum_iterations", "=", "100", ",", "tolerance", "=", "1...
Calculates the equal risk contribution / risk parity weights given a DataFrame of returns. Args: * returns (DataFrame): Returns for multiple securities. * initial_weights (list): Starting asset weights [default inverse vol]. * risk_weights (list): Risk target weights [default equal weig...
[ "Calculates", "the", "equal", "risk", "contribution", "/", "risk", "parity", "weights", "given", "a", "DataFrame", "of", "returns", "." ]
python
train
33.684932
coins13/twins
twins/twins.py
https://github.com/coins13/twins/blob/d66cc850007a25f01812a9d8c7e3efe64a631ca2/twins/twins.py#L255-L272
def get_registered_credits (self): """ 登録単位数合計の取得 """ self.req("RSW0001000-flow") r = self.get({ "_eventId": "search", "moduleCode": 1, "gakkiKbnCode": "A" }) html = r.text # XXX ...
[ "def", "get_registered_credits", "(", "self", ")", ":", "self", ".", "req", "(", "\"RSW0001000-flow\"", ")", "r", "=", "self", ".", "get", "(", "{", "\"_eventId\"", ":", "\"search\"", ",", "\"moduleCode\"", ":", "1", ",", "\"gakkiKbnCode\"", ":", "\"A\"", ...
登録単位数合計の取得
[ "登録単位数合計の取得" ]
python
train
28.888889
brbsix/subsystem
subsystem/subsystem.py
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L148-L165
def devnull(): """Temporarily redirect stdout and stderr to /dev/null.""" try: original_stderr = os.dup(sys.stderr.fileno()) original_stdout = os.dup(sys.stdout.fileno()) null = open(os.devnull, 'w') os.dup2(null.fileno(), sys.stderr.fileno()) os.dup2(null.fileno(), sys....
[ "def", "devnull", "(", ")", ":", "try", ":", "original_stderr", "=", "os", ".", "dup", "(", "sys", ".", "stderr", ".", "fileno", "(", ")", ")", "original_stdout", "=", "os", ".", "dup", "(", "sys", ".", "stdout", ".", "fileno", "(", ")", ")", "nu...
Temporarily redirect stdout and stderr to /dev/null.
[ "Temporarily", "redirect", "stdout", "and", "stderr", "to", "/", "dev", "/", "null", "." ]
python
train
33.166667
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L480-L497
def removeBreakpoint( self, lineno = -1 ): """ Removes the breakpoint at the inputed line number. If the lineno is -1, then the current line number will be used :note The lineno is 0-based, while the editor displays lines as a 1-based system. So...
[ "def", "removeBreakpoint", "(", "self", ",", "lineno", "=", "-", "1", ")", ":", "if", "(", "lineno", "==", "-", "1", ")", ":", "lineno", ",", "colno", "=", "self", ".", "getCursorPosition", "(", ")", "self", ".", "markerDelete", "(", "lineno", ",", ...
Removes the breakpoint at the inputed line number. If the lineno is -1, then the current line number will be used :note The lineno is 0-based, while the editor displays lines as a 1-based system. So, if you remove a breakpoint at visual line ...
[ "Removes", "the", "breakpoint", "at", "the", "inputed", "line", "number", ".", "If", "the", "lineno", "is", "-", "1", "then", "the", "current", "line", "number", "will", "be", "used", ":", "note", "The", "lineno", "is", "0", "-", "based", "while", "the...
python
train
39.388889
l04m33/pyx
pyx/http.py
https://github.com/l04m33/pyx/blob/b70efec605832ba3c7079e991584db3f5d1da8cb/pyx/http.py#L662-L692
def parse_multipart_formdata(reader, boundary, cb): """Read data from ``reader`` and parse multipart/form-data fields. ``boundary`` is the multipart/form-data boundary. ``cb`` is a callable that will be called as ``cb(headers, reader)`` to handle the parsed field. """ breader = BoundaryReader(...
[ "def", "parse_multipart_formdata", "(", "reader", ",", "boundary", ",", "cb", ")", ":", "breader", "=", "BoundaryReader", "(", "reader", ",", "boundary", ")", "# The BoundaryReader expects a new line before the boundary string,", "# We make sure the new line exists", "breader...
Read data from ``reader`` and parse multipart/form-data fields. ``boundary`` is the multipart/form-data boundary. ``cb`` is a callable that will be called as ``cb(headers, reader)`` to handle the parsed field.
[ "Read", "data", "from", "reader", "and", "parse", "multipart", "/", "form", "-", "data", "fields", "." ]
python
train
35.129032
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L420-L451
def _fix_gatk_header(exist_files, out_file, config): """Ensure consistent headers for VCF concatenation. Fixes problems for genomes that start with chrM by reheadering the first file. These files do haploid variant calling which lack the PID phasing key/value pair in FORMAT, so initial chrM samples cau...
[ "def", "_fix_gatk_header", "(", "exist_files", ",", "out_file", ",", "config", ")", ":", "from", "bcbio", ".", "variation", "import", "ploidy", "c", ",", "base_file", "=", "exist_files", "[", "0", "]", "replace_file", "=", "base_file", "items", "=", "[", "...
Ensure consistent headers for VCF concatenation. Fixes problems for genomes that start with chrM by reheadering the first file. These files do haploid variant calling which lack the PID phasing key/value pair in FORMAT, so initial chrM samples cause errors during concatenation due to the lack of header...
[ "Ensure", "consistent", "headers", "for", "VCF", "concatenation", "." ]
python
train
52.84375
mdgoldberg/sportsref
sportsref/nba/players.py
https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nba/players.py#L170-L172
def stats_per36(self, kind='R', summary=False): """Returns a DataFrame of per-36-minutes stats.""" return self._get_stats_table('per_minute', kind=kind, summary=summary)
[ "def", "stats_per36", "(", "self", ",", "kind", "=", "'R'", ",", "summary", "=", "False", ")", ":", "return", "self", ".", "_get_stats_table", "(", "'per_minute'", ",", "kind", "=", "kind", ",", "summary", "=", "summary", ")" ]
Returns a DataFrame of per-36-minutes stats.
[ "Returns", "a", "DataFrame", "of", "per", "-", "36", "-", "minutes", "stats", "." ]
python
test
61
Vauxoo/cfdilib
cfdilib/tools.py
https://github.com/Vauxoo/cfdilib/blob/acd73d159f62119f3100d963a061820bbe3f93ea/cfdilib/tools.py#L144-L169
def check_s3(self, bucket, element): # pragma: no cover """This method is a helper con `cache_s3`. Read method `cache_s3` for more information. :param bucket: :param element: :return: """ session = boto3.Session(profile_name=self.profile_name) s3 = sessi...
[ "def", "check_s3", "(", "self", ",", "bucket", ",", "element", ")", ":", "# pragma: no cover", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "self", ".", "profile_name", ")", "s3", "=", "session", ".", "resource", "(", "'s3'", ")", "...
This method is a helper con `cache_s3`. Read method `cache_s3` for more information. :param bucket: :param element: :return:
[ "This", "method", "is", "a", "helper", "con", "cache_s3", ".", "Read", "method", "cache_s3", "for", "more", "information", "." ]
python
train
35
aiidateam/aiida-ase
aiida_ase/calculations/ase.py
https://github.com/aiidateam/aiida-ase/blob/688a01fa872717ee3babdb1f10405b306371cf44/aiida_ase/calculations/ase.py#L453-L474
def convert_the_args(raw_args): """ Function used to convert the arguments of methods """ if not raw_args: return "" if isinstance(raw_args,dict): out_args = ", ".join([ "{}={}".format(k,v) for k,v in raw_args.iteritems() ]) elif isinstance(raw_args,(list,tuple)): ...
[ "def", "convert_the_args", "(", "raw_args", ")", ":", "if", "not", "raw_args", ":", "return", "\"\"", "if", "isinstance", "(", "raw_args", ",", "dict", ")", ":", "out_args", "=", "\", \"", ".", "join", "(", "[", "\"{}={}\"", ".", "format", "(", "k", ",...
Function used to convert the arguments of methods
[ "Function", "used", "to", "convert", "the", "arguments", "of", "methods" ]
python
train
34.681818
jasonbot/arcrest
arcrest/server.py
https://github.com/jasonbot/arcrest/blob/b1ba71fd59bb6349415e7879d753d307dbc0da26/arcrest/server.py#L2084-L2110
def SolveServiceArea(self, facilities=None, barriers=None, polylineBarriers=None, polygonBarriers=None, attributeParameterValues=None, defaultBreaks=None, excludeSourcesF...
[ "def", "SolveServiceArea", "(", "self", ",", "facilities", "=", "None", ",", "barriers", "=", "None", ",", "polylineBarriers", "=", "None", ",", "polygonBarriers", "=", "None", ",", "attributeParameterValues", "=", "None", ",", "defaultBreaks", "=", "None", ",...
The solve operation is performed on a network layer resource of type service area (layerType is esriNAServerServiceArea).
[ "The", "solve", "operation", "is", "performed", "on", "a", "network", "layer", "resource", "of", "type", "service", "area", "(", "layerType", "is", "esriNAServerServiceArea", ")", "." ]
python
train
50.555556
wummel/linkchecker
linkcheck/logger/__init__.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/logger/__init__.py#L389-L395
def write_outro (self): """Write outro comments.""" self.stoptime = time.time() duration = self.stoptime - self.starttime self.comment(_("Stopped checking at %(time)s (%(duration)s)") % {"time": strformat.strtime(self.stoptime), "duration": strformat.strduratio...
[ "def", "write_outro", "(", "self", ")", ":", "self", ".", "stoptime", "=", "time", ".", "time", "(", ")", "duration", "=", "self", ".", "stoptime", "-", "self", ".", "starttime", "self", ".", "comment", "(", "_", "(", "\"Stopped checking at %(time)s (%(dur...
Write outro comments.
[ "Write", "outro", "comments", "." ]
python
train
47.428571
tanghaibao/jcvi
jcvi/annotation/reformat.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/annotation/reformat.py#L1104-L1152
def publocus(args): """ %prog publocus idsfile > idsfiles.publocus Given a list of model identifiers, convert each into a GenBank approved pub_locus. Example output: Medtr1g007020.1 MTR_1g007020 Medtr1g007030.1 MTR_1g007030 Medtr1g007060.1 MTR_1g007060A Medtr1g007060.2 MTR_1g00...
[ "def", "publocus", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "publocus", ".", "__doc__", ")", "p", ".", "add_option", "(", "\"--locus_tag\"", ",", "default", "=", "\"MTR_\"", ",", "help", "=", "\"GenBank locus tag [default: %default]\"", ")", "opts...
%prog publocus idsfile > idsfiles.publocus Given a list of model identifiers, convert each into a GenBank approved pub_locus. Example output: Medtr1g007020.1 MTR_1g007020 Medtr1g007030.1 MTR_1g007030 Medtr1g007060.1 MTR_1g007060A Medtr1g007060.2 MTR_1g007060B
[ "%prog", "publocus", "idsfile", ">", "idsfiles", ".", "publocus" ]
python
train
35.979592
astropy/astropy-healpix
astropy_healpix/high_level.py
https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L203-L227
def cone_search_lonlat(self, lon, lat, radius): """ Find all the HEALPix pixels within a given radius of a longitude/latitude. Note that this returns all pixels that overlap, including partially, with the search cone. This function can only be used for a single lon/lat pair at a...
[ "def", "cone_search_lonlat", "(", "self", ",", "lon", ",", "lat", ",", "radius", ")", ":", "if", "not", "lon", ".", "isscalar", "or", "not", "lat", ".", "isscalar", "or", "not", "radius", ".", "isscalar", ":", "raise", "ValueError", "(", "'The longitude,...
Find all the HEALPix pixels within a given radius of a longitude/latitude. Note that this returns all pixels that overlap, including partially, with the search cone. This function can only be used for a single lon/lat pair at a time, since different calls to the function may result in a differe...
[ "Find", "all", "the", "HEALPix", "pixels", "within", "a", "given", "radius", "of", "a", "longitude", "/", "latitude", "." ]
python
train
42.36
DistrictDataLabs/yellowbrick
yellowbrick/text/dispersion.py
https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/dispersion.py#L178-L226
def draw(self, points, target=None, **kwargs): """ Called from the fit method, this method creates the canvas and draws the plot on it. Parameters ---------- kwargs: generic keyword arguments. """ # Resolve the labels with the classes labels = sel...
[ "def", "draw", "(", "self", ",", "points", ",", "target", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Resolve the labels with the classes", "labels", "=", "self", ".", "labels", "if", "self", ".", "labels", "is", "not", "None", "else", "self", "."...
Called from the fit method, this method creates the canvas and draws the plot on it. Parameters ---------- kwargs: generic keyword arguments.
[ "Called", "from", "the", "fit", "method", "this", "method", "creates", "the", "canvas", "and", "draws", "the", "plot", "on", "it", ".", "Parameters", "----------", "kwargs", ":", "generic", "keyword", "arguments", "." ]
python
train
37.979592
bunq/sdk_python
bunq/sdk/model/generated/object_.py
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/model/generated/object_.py#L5764-L5775
def create_from_pointer(cls, pointer): """ :type pointer: Pointer """ instance = cls.__new__(cls) instance.pointer = pointer instance.label_monetary_account = LabelMonetaryAccount() instance.label_monetary_account._iban = pointer.value instance.label_mone...
[ "def", "create_from_pointer", "(", "cls", ",", "pointer", ")", ":", "instance", "=", "cls", ".", "__new__", "(", "cls", ")", "instance", ".", "pointer", "=", "pointer", "instance", ".", "label_monetary_account", "=", "LabelMonetaryAccount", "(", ")", "instance...
:type pointer: Pointer
[ ":", "type", "pointer", ":", "Pointer" ]
python
train
31.25
un33k/django-toolware
toolware/utils/generic.py
https://github.com/un33k/django-toolware/blob/973f3e003dc38b812897dab88455bee37dcaf931/toolware/utils/generic.py#L93-L100
def get_unique_key_from_get(get_dict): """ Build a unique key from get data """ site = Site.objects.get_current() key = get_dict_to_encoded_url(get_dict) cache_key = '{}_{}'.format(site.domain, key) return hashlib.md5(cache_key).hexdigest()
[ "def", "get_unique_key_from_get", "(", "get_dict", ")", ":", "site", "=", "Site", ".", "objects", ".", "get_current", "(", ")", "key", "=", "get_dict_to_encoded_url", "(", "get_dict", ")", "cache_key", "=", "'{}_{}'", ".", "format", "(", "site", ".", "domain...
Build a unique key from get data
[ "Build", "a", "unique", "key", "from", "get", "data" ]
python
test
32.625
Qiskit/qiskit-terra
qiskit/tools/qcvv/tomography.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qcvv/tomography.py#L515-L592
def create_tomography_circuits(circuit, qreg, creg, tomoset): """ Add tomography measurement circuits to a QuantumProgram. The quantum program must contain a circuit 'name', which is treated as a state preparation circuit for state tomography, or as teh circuit being measured for process tomography...
[ "def", "create_tomography_circuits", "(", "circuit", ",", "qreg", ",", "creg", ",", "tomoset", ")", ":", "if", "not", "isinstance", "(", "circuit", ",", "QuantumCircuit", ")", ":", "raise", "QiskitError", "(", "'Input circuit must be a QuantumCircuit object'", ")", ...
Add tomography measurement circuits to a QuantumProgram. The quantum program must contain a circuit 'name', which is treated as a state preparation circuit for state tomography, or as teh circuit being measured for process tomography. This function then appends the circuit with a set of measurements sp...
[ "Add", "tomography", "measurement", "circuits", "to", "a", "QuantumProgram", "." ]
python
test
41.948718
dswah/pyGAM
pygam/pygam.py
https://github.com/dswah/pyGAM/blob/b3e5c3cd580f0a3ad69f9372861624f67760c325/pygam/pygam.py#L2656-L2684
def fit(self, X, y, exposure=None, weights=None): """Fit the generalized additive model. Parameters ---------- X : array-like, shape (n_samples, m_features) Training vectors, where n_samples is the number of samples and m_features is the number of features. ...
[ "def", "fit", "(", "self", ",", "X", ",", "y", ",", "exposure", "=", "None", ",", "weights", "=", "None", ")", ":", "y", ",", "weights", "=", "self", ".", "_exposure_to_weights", "(", "y", ",", "exposure", ",", "weights", ")", "return", "super", "(...
Fit the generalized additive model. Parameters ---------- X : array-like, shape (n_samples, m_features) Training vectors, where n_samples is the number of samples and m_features is the number of features. y : array-like, shape (n_samples,) Target val...
[ "Fit", "the", "generalized", "additive", "model", "." ]
python
train
35.655172
Qiskit/qiskit-terra
qiskit/visualization/text.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/text.py#L367-L379
def fillup_layer(layer, first_clbit): """ Given a layer, replace the Nones in it with EmptyWire elements. Args: layer (list): The layer that contains Nones. first_clbit (int): The first wire that is classic. Returns: list: The new layer, with no Nones...
[ "def", "fillup_layer", "(", "layer", ",", "first_clbit", ")", ":", "for", "nones", "in", "[", "i", "for", "i", ",", "x", "in", "enumerate", "(", "layer", ")", "if", "x", "is", "None", "]", ":", "layer", "[", "nones", "]", "=", "EmptyWire", "(", "...
Given a layer, replace the Nones in it with EmptyWire elements. Args: layer (list): The layer that contains Nones. first_clbit (int): The first wire that is classic. Returns: list: The new layer, with no Nones.
[ "Given", "a", "layer", "replace", "the", "Nones", "in", "it", "with", "EmptyWire", "elements", ".", "Args", ":", "layer", "(", "list", ")", ":", "The", "layer", "that", "contains", "Nones", ".", "first_clbit", "(", "int", ")", ":", "The", "first", "wir...
python
test
38.153846
waqasbhatti/astrobase
astrobase/awsutils.py
https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L322-L369
def s3_delete_file(bucket, filename, client=None, raiseonfail=False): """This deletes a file from S3. Parameters ---------- bucket : str The AWS S3 bucket to delete the file from. filename : str The full file name of the file to delete, including any prefixes. client : boto3....
[ "def", "s3_delete_file", "(", "bucket", ",", "filename", ",", "client", "=", "None", ",", "raiseonfail", "=", "False", ")", ":", "if", "not", "client", ":", "client", "=", "boto3", ".", "client", "(", "'s3'", ")", "try", ":", "resp", "=", "client", "...
This deletes a file from S3. Parameters ---------- bucket : str The AWS S3 bucket to delete the file from. filename : str The full file name of the file to delete, including any prefixes. client : boto3.Client or None If None, this function will instantiate a new `boto3.C...
[ "This", "deletes", "a", "file", "from", "S3", "." ]
python
valid
30.375
tensorlayer/tensorlayer
tensorlayer/prepro.py
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L1582-L1605
def brightness_multi(x, gamma=1, gain=1, is_random=False): """Change the brightness of multiply images, randomly or non-randomly. Usually be used for image segmentation which x=[X, Y], X and Y should be matched. Parameters ----------- x : list of numpyarray List of images with dimension of ...
[ "def", "brightness_multi", "(", "x", ",", "gamma", "=", "1", ",", "gain", "=", "1", ",", "is_random", "=", "False", ")", ":", "if", "is_random", ":", "gamma", "=", "np", ".", "random", ".", "uniform", "(", "1", "-", "gamma", ",", "1", "+", "gamma...
Change the brightness of multiply images, randomly or non-randomly. Usually be used for image segmentation which x=[X, Y], X and Y should be matched. Parameters ----------- x : list of numpyarray List of images with dimension of [n_images, row, col, channel] (default). others : args ...
[ "Change", "the", "brightness", "of", "multiply", "images", "randomly", "or", "non", "-", "randomly", ".", "Usually", "be", "used", "for", "image", "segmentation", "which", "x", "=", "[", "X", "Y", "]", "X", "and", "Y", "should", "be", "matched", "." ]
python
valid
28.583333
YeoLab/anchor
anchor/model.py
https://github.com/YeoLab/anchor/blob/1f9c9d6d30235b1e77b945e6ef01db5a0e55d53a/anchor/model.py#L131-L169
def violinplot(self, n=1000, **kwargs): """Plot violins of each distribution in the model family Parameters ---------- n : int Number of random variables to generate kwargs : dict or keywords Any keyword arguments to seaborn.violinplot Returns ...
[ "def", "violinplot", "(", "self", ",", "n", "=", "1000", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'palette'", ",", "'Purples'", ")", "dfs", "=", "[", "]", "for", "rv", "in", "self", ".", "rvs", ":", "psi", "=", "rv", ...
Plot violins of each distribution in the model family Parameters ---------- n : int Number of random variables to generate kwargs : dict or keywords Any keyword arguments to seaborn.violinplot Returns ------- ax : matplotlib.Axes object ...
[ "Plot", "violins", "of", "each", "distribution", "in", "the", "model", "family" ]
python
train
30.923077
helixyte/everest
everest/utils.py
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/utils.py#L203-L232
def app_name_from_ini_parser(ini_parser): """ Returns the name of the main application from the given ini file parser. The name is found as follows: * If the ini file contains only one app:<app name> section, return this app name; * Else, if the ini file contains a pipeline:main section, us...
[ "def", "app_name_from_ini_parser", "(", "ini_parser", ")", ":", "app_names", "=", "[", "sect", ".", "split", "(", "':'", ")", "[", "-", "1", "]", "for", "sect", "in", "ini_parser", ".", "sections", "(", ")", "if", "sect", "[", ":", "4", "]", "==", ...
Returns the name of the main application from the given ini file parser. The name is found as follows: * If the ini file contains only one app:<app name> section, return this app name; * Else, if the ini file contains a pipeline:main section, use the name of the innermost app; * Else ra...
[ "Returns", "the", "name", "of", "the", "main", "application", "from", "the", "given", "ini", "file", "parser", ".", "The", "name", "is", "found", "as", "follows", ":", "*", "If", "the", "ini", "file", "contains", "only", "one", "app", ":", "<app", "nam...
python
train
40.433333
wummel/dosage
dosagelib/comic.py
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/comic.py#L27-L33
def getDownloader(self, url): """Get an image downloader.""" filename = self.namer(url, self.stripUrl) if filename is None: filename = url.rsplit('/', 1)[1] dirname = getDirname(self.name) return ComicImage(self.name, url, self.stripUrl, dirname, filename, self.sessio...
[ "def", "getDownloader", "(", "self", ",", "url", ")", ":", "filename", "=", "self", ".", "namer", "(", "url", ",", "self", ".", "stripUrl", ")", "if", "filename", "is", "None", ":", "filename", "=", "url", ".", "rsplit", "(", "'/'", ",", "1", ")", ...
Get an image downloader.
[ "Get", "an", "image", "downloader", "." ]
python
train
47.428571
Esri/ArcREST
src/arcrest/security/security.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/security/security.py#L500-L504
def key_file(self, value): """gets/sets the certificate file""" import os if os.path.isfile(value): self._keyfile = value
[ "def", "key_file", "(", "self", ",", "value", ")", ":", "import", "os", "if", "os", ".", "path", ".", "isfile", "(", "value", ")", ":", "self", ".", "_keyfile", "=", "value" ]
gets/sets the certificate file
[ "gets", "/", "sets", "the", "certificate", "file" ]
python
train
30.6
wonambi-python/wonambi
wonambi/trans/select.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L718-L746
def _select_channels(data, channels): """Select channels. Parameters ---------- data : instance of ChanTime data with all the channels channels : list channels of interest Returns ------- instance of ChanTime data with only channels of interest Notes --...
[ "def", "_select_channels", "(", "data", ",", "channels", ")", ":", "output", "=", "data", ".", "_copy", "(", ")", "chan_list", "=", "list", "(", "data", ".", "axis", "[", "'chan'", "]", "[", "0", "]", ")", "idx_chan", "=", "[", "chan_list", ".", "i...
Select channels. Parameters ---------- data : instance of ChanTime data with all the channels channels : list channels of interest Returns ------- instance of ChanTime data with only channels of interest Notes ----- This function does the same as wonamb...
[ "Select", "channels", "." ]
python
train
26.724138
chimera0/accel-brain-code
Reinforcement-Learning/demo/demo_maze_greedy_q_learning.py
https://github.com/chimera0/accel-brain-code/blob/03661f6f544bed656269fcd4b3c23c9061629daa/Reinforcement-Learning/demo/demo_maze_greedy_q_learning.py#L90-L113
def observe_reward_value(self, state_key, action_key): ''' Compute the reward value. Args: state_key: The key of state. action_key: The key of action. Returns: Reward value. ''' x, y = state_k...
[ "def", "observe_reward_value", "(", "self", ",", "state_key", ",", "action_key", ")", ":", "x", ",", "y", "=", "state_key", "if", "self", ".", "__map_arr", "[", "y", "]", "[", "x", "]", "==", "self", ".", "__end_point_label", ":", "return", "100.0", "e...
Compute the reward value. Args: state_key: The key of state. action_key: The key of action. Returns: Reward value.
[ "Compute", "the", "reward", "value", ".", "Args", ":", "state_key", ":", "The", "key", "of", "state", ".", "action_key", ":", "The", "key", "of", "action", ".", "Returns", ":", "Reward", "value", "." ]
python
train
31.333333
Azure/azure-uamqp-python
uamqp/async_ops/sender_async.py
https://github.com/Azure/azure-uamqp-python/blob/b67e4fcaf2e8a337636947523570239c10a58ae2/uamqp/async_ops/sender_async.py#L129-L158
async def send_async(self, message, callback, timeout=0): """Add a single message to the internal pending queue to be processed by the Connection without waiting for it to be sent. :param message: The message to send. :type message: ~uamqp.message.Message :param callback: The ca...
[ "async", "def", "send_async", "(", "self", ",", "message", ",", "callback", ",", "timeout", "=", "0", ")", ":", "# pylint: disable=protected-access", "try", ":", "raise", "self", ".", "_error", "except", "TypeError", ":", "pass", "except", "Exception", "as", ...
Add a single message to the internal pending queue to be processed by the Connection without waiting for it to be sent. :param message: The message to send. :type message: ~uamqp.message.Message :param callback: The callback to be run once a disposition is received in receipt o...
[ "Add", "a", "single", "message", "to", "the", "internal", "pending", "queue", "to", "be", "processed", "by", "the", "Connection", "without", "waiting", "for", "it", "to", "be", "sent", "." ]
python
train
46.966667
konstantint/intervaltree-bio
intervaltree_bio/__init__.py
https://github.com/konstantint/intervaltree-bio/blob/2d0bea6b534f9588c60ae7b6c30584138433c14b/intervaltree_bio/__init__.py#L111-L155
def from_bed(fileobj, field_sep=b'\t', interval_maker=None): ''' Initialize a ``GenomeIntervalTree`` from a BED file. Each line of the file must consist of several fields, separated using ``field_sep``. The first three fields are ``chrom``, ``start`` and ``end`` (where ``start`` is 0-bas...
[ "def", "from_bed", "(", "fileobj", ",", "field_sep", "=", "b'\\t'", ",", "interval_maker", "=", "None", ")", ":", "# We collect all intervals into a set of lists, and then put them all at once into the tree structures", "# It is slightly more efficient than adding intervals one by one....
Initialize a ``GenomeIntervalTree`` from a BED file. Each line of the file must consist of several fields, separated using ``field_sep``. The first three fields are ``chrom``, ``start`` and ``end`` (where ``start`` is 0-based and the corresponding interval is ``[start, end)``). The remaining fie...
[ "Initialize", "a", "GenomeIntervalTree", "from", "a", "BED", "file", ".", "Each", "line", "of", "the", "file", "must", "consist", "of", "several", "fields", "separated", "using", "field_sep", ".", "The", "first", "three", "fields", "are", "chrom", "start", "...
python
train
63.066667
bolt-project/bolt
bolt/utils.py
https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/utils.py#L193-L208
def allstack(vals, depth=0): """ If an ndarray has been split into multiple chunks by splitting it along each axis at a number of locations, this function rebuilds the original array from chunks. Parameters ---------- vals : nested lists of ndarrays each level of nesting of the list...
[ "def", "allstack", "(", "vals", ",", "depth", "=", "0", ")", ":", "if", "type", "(", "vals", "[", "0", "]", ")", "is", "ndarray", ":", "return", "concatenate", "(", "vals", ",", "axis", "=", "depth", ")", "else", ":", "return", "concatenate", "(", ...
If an ndarray has been split into multiple chunks by splitting it along each axis at a number of locations, this function rebuilds the original array from chunks. Parameters ---------- vals : nested lists of ndarrays each level of nesting of the lists representing a dimension of the...
[ "If", "an", "ndarray", "has", "been", "split", "into", "multiple", "chunks", "by", "splitting", "it", "along", "each", "axis", "at", "a", "number", "of", "locations", "this", "function", "rebuilds", "the", "original", "array", "from", "chunks", "." ]
python
test
33.4375
sorgerlab/indra
indra/util/statement_presentation.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/statement_presentation.py#L112-L134
def make_stmt_from_sort_key(key, verb): """Make a Statement from the sort key. Specifically, the sort key used by `group_and_sort_statements`. """ def make_agent(name): if name == 'None' or name is None: return None return Agent(name) StmtClass = get_statement_by_name(v...
[ "def", "make_stmt_from_sort_key", "(", "key", ",", "verb", ")", ":", "def", "make_agent", "(", "name", ")", ":", "if", "name", "==", "'None'", "or", "name", "is", "None", ":", "return", "None", "return", "Agent", "(", "name", ")", "StmtClass", "=", "ge...
Make a Statement from the sort key. Specifically, the sort key used by `group_and_sort_statements`.
[ "Make", "a", "Statement", "from", "the", "sort", "key", "." ]
python
train
36.086957
calston/rhumba
rhumba/client.py
https://github.com/calston/rhumba/blob/05e3cbf4e531cc51b4777912eb98a4f006893f5e/rhumba/client.py#L30-L48
def queue(self, queue, message, params={}, uids=[]): """ Queue a job in Rhumba """ d = { 'id': uuid.uuid1().get_hex(), 'version': 1, 'message': message, 'params': params } if uids: for uid in uids: ...
[ "def", "queue", "(", "self", ",", "queue", ",", "message", ",", "params", "=", "{", "}", ",", "uids", "=", "[", "]", ")", ":", "d", "=", "{", "'id'", ":", "uuid", ".", "uuid1", "(", ")", ".", "get_hex", "(", ")", ",", "'version'", ":", "1", ...
Queue a job in Rhumba
[ "Queue", "a", "job", "in", "Rhumba" ]
python
train
27.473684
dereneaton/ipyrad
ipyrad/assemble/cluster_across.py
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L718-L742
def fill_dups_arr(data): """ fills the duplicates array from the multi_muscle_align tmp files """ ## build the duplicates array duplefiles = glob.glob(os.path.join(data.tmpdir, "duples_*.tmp.npy")) duplefiles.sort(key=lambda x: int(x.rsplit("_", 1)[-1][:-8])) ## enter the duplicates filter ...
[ "def", "fill_dups_arr", "(", "data", ")", ":", "## build the duplicates array", "duplefiles", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "data", ".", "tmpdir", ",", "\"duples_*.tmp.npy\"", ")", ")", "duplefiles", ".", "sort", "(", ...
fills the duplicates array from the multi_muscle_align tmp files
[ "fills", "the", "duplicates", "array", "from", "the", "multi_muscle_align", "tmp", "files" ]
python
valid
30.92
eerimoq/bincopy
bincopy.py
https://github.com/eerimoq/bincopy/blob/5e02cd001c3e9b54729425db6bffad5f03e1beac/bincopy.py#L1358-L1373
def crop(self, minimum_address, maximum_address): """Keep given range and discard the rest. `minimum_address` is the first word address to keep (including). `maximum_address` is the last word address to keep (excluding). """ minimum_address *= self.word_size_b...
[ "def", "crop", "(", "self", ",", "minimum_address", ",", "maximum_address", ")", ":", "minimum_address", "*=", "self", ".", "word_size_bytes", "maximum_address", "*=", "self", ".", "word_size_bytes", "maximum_address_address", "=", "self", ".", "_segments", ".", "...
Keep given range and discard the rest. `minimum_address` is the first word address to keep (including). `maximum_address` is the last word address to keep (excluding).
[ "Keep", "given", "range", "and", "discard", "the", "rest", "." ]
python
train
34
IRC-SPHERE/HyperStream
hyperstream/workflow/workflow.py
https://github.com/IRC-SPHERE/HyperStream/blob/98478f4d31ed938f4aa7c958ed0d4c3ffcb2e780/hyperstream/workflow/workflow.py#L376-L409
def create_node_creation_factor(self, tool, source, output_plate, plate_manager): """ Creates a factor that itself creates an output node, and ensures that the plate for the output node exists along with all relevant meta-data :param tool: The tool :param source: The source node...
[ "def", "create_node_creation_factor", "(", "self", ",", "tool", ",", "source", ",", "output_plate", ",", "plate_manager", ")", ":", "# if isinstance(tool, dict):", "# tool = self.channels.get_tool(**tool)", "if", "not", "isinstance", "(", "tool", ",", "PlateCreationTo...
Creates a factor that itself creates an output node, and ensures that the plate for the output node exists along with all relevant meta-data :param tool: The tool :param source: The source node :param output_plate: The details of the plate that will be created (dict) :param plat...
[ "Creates", "a", "factor", "that", "itself", "creates", "an", "output", "node", "and", "ensures", "that", "the", "plate", "for", "the", "output", "node", "exists", "along", "with", "all", "relevant", "meta", "-", "data" ]
python
train
35.705882
awslabs/serverless-application-model
samtranslator/intrinsics/actions.py
https://github.com/awslabs/serverless-application-model/blob/cccb0c96b5c91e53355ebc07e542467303a5eedd/samtranslator/intrinsics/actions.py#L41-L52
def can_handle(self, input_dict): """ Validates that the input dictionary contains only one key and is of the given intrinsic_name :param input_dict: Input dictionary representing the intrinsic function :return: True if it matches expected structure, False otherwise """ ...
[ "def", "can_handle", "(", "self", ",", "input_dict", ")", ":", "return", "input_dict", "is", "not", "None", "and", "isinstance", "(", "input_dict", ",", "dict", ")", "and", "len", "(", "input_dict", ")", "==", "1", "and", "self", ".", "intrinsic_name", "...
Validates that the input dictionary contains only one key and is of the given intrinsic_name :param input_dict: Input dictionary representing the intrinsic function :return: True if it matches expected structure, False otherwise
[ "Validates", "that", "the", "input", "dictionary", "contains", "only", "one", "key", "and", "is", "of", "the", "given", "intrinsic_name" ]
python
train
39.75
src-d/modelforge
modelforge/meta.py
https://github.com/src-d/modelforge/blob/4f73c2bf0318261ac01bc8b6c0d4250a5d303418/modelforge/meta.py#L73-L95
def extract_model_meta(base_meta: dict, extra_meta: dict, model_url: str) -> dict: """ Merge the metadata from the backend and the extra metadata into a dict which is suitable for \ `index.json`. :param base_meta: tree["meta"] :class:`dict` containing data from the backend. :param extra_meta: dict ...
[ "def", "extract_model_meta", "(", "base_meta", ":", "dict", ",", "extra_meta", ":", "dict", ",", "model_url", ":", "str", ")", "->", "dict", ":", "meta", "=", "{", "\"default\"", ":", "{", "\"default\"", ":", "base_meta", "[", "\"uuid\"", "]", ",", "\"de...
Merge the metadata from the backend and the extra metadata into a dict which is suitable for \ `index.json`. :param base_meta: tree["meta"] :class:`dict` containing data from the backend. :param extra_meta: dict containing data from the user, similar to `template_meta.json`. :param model_url: public UR...
[ "Merge", "the", "metadata", "from", "the", "backend", "and", "the", "extra", "metadata", "into", "a", "dict", "which", "is", "suitable", "for", "\\", "index", ".", "json", "." ]
python
train
49.26087
letuananh/chirptext
chirptext/deko.py
https://github.com/letuananh/chirptext/blob/ce60b47257b272a587c8703ea1f86cd1a45553a7/chirptext/deko.py#L122-L131
def to_ruby(self): ''' Convert one MeCabToken into HTML ''' if self.need_ruby(): surface = self.surface reading = self.reading_hira() return '<ruby><rb>{sur}</rb><rt>{read}</rt></ruby>'.format(sur=surface, read=reading) elif self.is_eos: return '' ...
[ "def", "to_ruby", "(", "self", ")", ":", "if", "self", ".", "need_ruby", "(", ")", ":", "surface", "=", "self", ".", "surface", "reading", "=", "self", ".", "reading_hira", "(", ")", "return", "'<ruby><rb>{sur}</rb><rt>{read}</rt></ruby>'", ".", "format", "(...
Convert one MeCabToken into HTML
[ "Convert", "one", "MeCabToken", "into", "HTML" ]
python
train
35.6
apache/incubator-mxnet
example/sparse/factorization_machine/model.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/sparse/factorization_machine/model.py#L20-L54
def factorization_machine_model(factor_size, num_features, lr_mult_config, wd_mult_config, init_config): """ builds factorization machine network with proper formulation: y = w_0 \sum(x_i w_i) + 0.5(\sum\sum<v_i,v_j>x_ix_j - \sum<v_iv_i>x_i^2) """ x = mx.symbol.Variable("...
[ "def", "factorization_machine_model", "(", "factor_size", ",", "num_features", ",", "lr_mult_config", ",", "wd_mult_config", ",", "init_config", ")", ":", "x", "=", "mx", ".", "symbol", ".", "Variable", "(", "\"data\"", ",", "stype", "=", "'csr'", ")", "# fact...
builds factorization machine network with proper formulation: y = w_0 \sum(x_i w_i) + 0.5(\sum\sum<v_i,v_j>x_ix_j - \sum<v_iv_i>x_i^2)
[ "builds", "factorization", "machine", "network", "with", "proper", "formulation", ":", "y", "=", "w_0", "\\", "sum", "(", "x_i", "w_i", ")", "+", "0", ".", "5", "(", "\\", "sum", "\\", "sum<v_i", "v_j", ">", "x_ix_j", "-", "\\", "sum<v_iv_i", ">", "x...
python
train
44.771429
jim-easterbrook/pyctools
src/pyctools/core/base.py
https://github.com/jim-easterbrook/pyctools/blob/2a958665326892f45f249bebe62c2c23f306732b/src/pyctools/core/base.py#L324-L342
def start_event(self): """Called by the event loop when it is started. Creates the output frame pools (if used) then calls :py:meth:`on_start`. Creating the output frame pools now allows their size to be configured before starting the component. """ # create object pool...
[ "def", "start_event", "(", "self", ")", ":", "# create object pool for each output", "if", "self", ".", "with_outframe_pool", ":", "self", ".", "update_config", "(", ")", "for", "name", "in", "self", ".", "outputs", ":", "self", ".", "outframe_pool", "[", "nam...
Called by the event loop when it is started. Creates the output frame pools (if used) then calls :py:meth:`on_start`. Creating the output frame pools now allows their size to be configured before starting the component.
[ "Called", "by", "the", "event", "loop", "when", "it", "is", "started", "." ]
python
train
36.947368
jadolg/rocketchat_API
rocketchat_API/rocketchat.py
https://github.com/jadolg/rocketchat_API/blob/f220d094434991cb9892418245f054ea06f28aad/rocketchat_API/rocketchat.py#L507-L509
def groups_open(self, room_id, **kwargs): """Adds the private group back to the user’s list of private groups.""" return self.__call_api_post('groups.open', roomId=room_id, kwargs=kwargs)
[ "def", "groups_open", "(", "self", ",", "room_id", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "__call_api_post", "(", "'groups.open'", ",", "roomId", "=", "room_id", ",", "kwargs", "=", "kwargs", ")" ]
Adds the private group back to the user’s list of private groups.
[ "Adds", "the", "private", "group", "back", "to", "the", "user’s", "list", "of", "private", "groups", "." ]
python
train
67
inveniosoftware-attic/invenio-documents
invenio_documents/api.py
https://github.com/inveniosoftware-attic/invenio-documents/blob/cdfcd21ea5d9ad26f4405f418863fcc3df636176/invenio_documents/api.py#L55-L58
def open(self, mode='r', **kwargs): """Open file ``uri`` under the pointer.""" _fs, filename = opener.parse(self.uri) return _fs.open(filename, mode=mode, **kwargs)
[ "def", "open", "(", "self", ",", "mode", "=", "'r'", ",", "*", "*", "kwargs", ")", ":", "_fs", ",", "filename", "=", "opener", ".", "parse", "(", "self", ".", "uri", ")", "return", "_fs", ".", "open", "(", "filename", ",", "mode", "=", "mode", ...
Open file ``uri`` under the pointer.
[ "Open", "file", "uri", "under", "the", "pointer", "." ]
python
train
46.25
phoebe-project/phoebe2
phoebe/frontend/bundle.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L2429-L2502
def remove_dataset(self, dataset=None, **kwargs): """ Remove a dataset from the Bundle. This removes all matching Parameters from the dataset, model, and constraint contexts (by default if the context tag is not provided). You must provide some sort of filter or this will raise an Erro...
[ "def", "remove_dataset", "(", "self", ",", "dataset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_kwargs_checks", "(", "kwargs", ")", "# Let's avoid deleting ALL parameters from the matching contexts", "if", "dataset", "is", "None", "and", "not"...
Remove a dataset from the Bundle. This removes all matching Parameters from the dataset, model, and constraint contexts (by default if the context tag is not provided). You must provide some sort of filter or this will raise an Error (so that all Parameters are not accidentally removed...
[ "Remove", "a", "dataset", "from", "the", "Bundle", "." ]
python
train
38.445946
ulule/django-badgify
badgify/recipe.py
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/recipe.py#L261-L275
def bulk_create_awards(objects, batch_size=500, post_save_signal=True): """ Saves award objects. """ count = len(objects) if not count: return badge = objects[0].badge try: Award.objects.bulk_create(objects, batch_size=batch_size) if post_save_signal: for ...
[ "def", "bulk_create_awards", "(", "objects", ",", "batch_size", "=", "500", ",", "post_save_signal", "=", "True", ")", ":", "count", "=", "len", "(", "objects", ")", "if", "not", "count", ":", "return", "badge", "=", "objects", "[", "0", "]", ".", "bad...
Saves award objects.
[ "Saves", "award", "objects", "." ]
python
train
34.733333
BernardFW/bernard
src/bernard/utils.py
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/utils.py#L234-L259
def dict_is_subset(subset: Any, full_set: Any) -> bool: """ Checks that all keys present in `subset` are present and have the same value in `full_set`. If a key is in `full_set` but not in `subset` then True will be returned anyways. """ if not isinstance(subset, full_set.__class__): re...
[ "def", "dict_is_subset", "(", "subset", ":", "Any", ",", "full_set", ":", "Any", ")", "->", "bool", ":", "if", "not", "isinstance", "(", "subset", ",", "full_set", ".", "__class__", ")", ":", "return", "False", "elif", "isinstance", "(", "subset", ",", ...
Checks that all keys present in `subset` are present and have the same value in `full_set`. If a key is in `full_set` but not in `subset` then True will be returned anyways.
[ "Checks", "that", "all", "keys", "present", "in", "subset", "are", "present", "and", "have", "the", "same", "value", "in", "full_set", ".", "If", "a", "key", "is", "in", "full_set", "but", "not", "in", "subset", "then", "True", "will", "be", "returned", ...
python
train
29.923077
IBMStreams/pypi.streamsx
streamsx/rest_primitives.py
https://github.com/IBMStreams/pypi.streamsx/blob/abd67b4757120f6f805787fba390f53e9df9cdd8/streamsx/rest_primitives.py#L609-L650
def fetch_tuples(self, max_tuples=20, timeout=None): """ Fetch a number of tuples from this view. Fetching of data must have been started with :py:meth:`start_data_fetch` before calling this method. If ``timeout`` is ``None`` then the returned list will contain ``max_tu...
[ "def", "fetch_tuples", "(", "self", ",", "max_tuples", "=", "20", ",", "timeout", "=", "None", ")", ":", "tuples", "=", "list", "(", ")", "if", "timeout", "is", "None", ":", "while", "len", "(", "tuples", ")", "<", "max_tuples", ":", "fetcher", "=", ...
Fetch a number of tuples from this view. Fetching of data must have been started with :py:meth:`start_data_fetch` before calling this method. If ``timeout`` is ``None`` then the returned list will contain ``max_tuples`` tuples. Otherwise if the timeout is reached the list may c...
[ "Fetch", "a", "number", "of", "tuples", "from", "this", "view", "." ]
python
train
32.761905
RudolfCardinal/pythonlib
cardinal_pythonlib/sqlalchemy/list_types.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sqlalchemy/list_types.py#L223-L227
def process_result_value(self, value: Optional[str], dialect: Dialect) -> List[str]: """Convert things on the way from the database to Python.""" retval = self._dbstr_to_strlist(value) return retval
[ "def", "process_result_value", "(", "self", ",", "value", ":", "Optional", "[", "str", "]", ",", "dialect", ":", "Dialect", ")", "->", "List", "[", "str", "]", ":", "retval", "=", "self", ".", "_dbstr_to_strlist", "(", "value", ")", "return", "retval" ]
Convert things on the way from the database to Python.
[ "Convert", "things", "on", "the", "way", "from", "the", "database", "to", "Python", "." ]
python
train
49.4
dmlc/gluon-nlp
scripts/bert/fp16_utils.py
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/scripts/bert/fp16_utils.py#L147-L183
def step(self, batch_size, max_norm=None): """Makes one step of parameter update. Should be called after `fp16_optimizer.backward()`, and outside of `record()` scope. Parameters ---------- batch_size : int Batch size of data processed. Gradient will be normalized by ...
[ "def", "step", "(", "self", ",", "batch_size", ",", "max_norm", "=", "None", ")", ":", "self", ".", "fp32_trainer", ".", "allreduce_grads", "(", ")", "step_size", "=", "batch_size", "*", "self", ".", "_scaler", ".", "loss_scale", "if", "max_norm", ":", "...
Makes one step of parameter update. Should be called after `fp16_optimizer.backward()`, and outside of `record()` scope. Parameters ---------- batch_size : int Batch size of data processed. Gradient will be normalized by `1/batch_size`. Set this to 1 if you norma...
[ "Makes", "one", "step", "of", "parameter", "update", ".", "Should", "be", "called", "after", "fp16_optimizer", ".", "backward", "()", "and", "outside", "of", "record", "()", "scope", "." ]
python
train
47.72973
henzk/featuremonkey
featuremonkey/importhooks.py
https://github.com/henzk/featuremonkey/blob/e44414fc68427bcd71ad33ec2d816da0dd78eefa/featuremonkey/importhooks.py#L34-L40
def _uninstall(cls): """ uninstall the hook if installed """ if cls._hook: sys.meta_path.remove(cls._hook) cls._hook = None
[ "def", "_uninstall", "(", "cls", ")", ":", "if", "cls", ".", "_hook", ":", "sys", ".", "meta_path", ".", "remove", "(", "cls", ".", "_hook", ")", "cls", ".", "_hook", "=", "None" ]
uninstall the hook if installed
[ "uninstall", "the", "hook", "if", "installed" ]
python
train
24.714286
mistio/mist.client
src/mistclient/__init__.py
https://github.com/mistio/mist.client/blob/bc190af2cba358fa556a69b205c12a77a34eb2a8/src/mistclient/__init__.py#L145-L171
def clouds(self, id=None, name=None, provider=None, search=None): """ Property-like function to call the _list_clouds function in order to populate self._clouds dict :returns: A list of Cloud instances. """ if self._clouds is None: self._clouds = {} ...
[ "def", "clouds", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ",", "provider", "=", "None", ",", "search", "=", "None", ")", ":", "if", "self", ".", "_clouds", "is", "None", ":", "self", ".", "_clouds", "=", "{", "}", "self", ...
Property-like function to call the _list_clouds function in order to populate self._clouds dict :returns: A list of Cloud instances.
[ "Property", "-", "like", "function", "to", "call", "the", "_list_clouds", "function", "in", "order", "to", "populate", "self", ".", "_clouds", "dict" ]
python
train
43.592593
halcy/Mastodon.py
mastodon/Mastodon.py
https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L878-L888
def account(self, id): """ Fetch account information by user `id`. Does not require authentication. Returns a `user dict`_. """ id = self.__unpack_id(id) url = '/api/v1/accounts/{0}'.format(str(id)) return self.__api_request('GET', url)
[ "def", "account", "(", "self", ",", "id", ")", ":", "id", "=", "self", ".", "__unpack_id", "(", "id", ")", "url", "=", "'/api/v1/accounts/{0}'", ".", "format", "(", "str", "(", "id", ")", ")", "return", "self", ".", "__api_request", "(", "'GET'", ","...
Fetch account information by user `id`. Does not require authentication. Returns a `user dict`_.
[ "Fetch", "account", "information", "by", "user", "id", ".", "Does", "not", "require", "authentication", ".", "Returns", "a", "user", "dict", "_", "." ]
python
train
28
blockstack/blockstack-core
blockstack/lib/nameset/namedb.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L788-L849
def get_DID_name(self, did): """ Given a DID, get the name Return None if not found, or if the name was revoked Raise if the DID is invalid """ did = str(did) did_info = None try: did_info = parse_DID(did) assert did_info['name_type...
[ "def", "get_DID_name", "(", "self", ",", "did", ")", ":", "did", "=", "str", "(", "did", ")", "did_info", "=", "None", "try", ":", "did_info", "=", "parse_DID", "(", "did", ")", "assert", "did_info", "[", "'name_type'", "]", "==", "'name'", "except", ...
Given a DID, get the name Return None if not found, or if the name was revoked Raise if the DID is invalid
[ "Given", "a", "DID", "get", "the", "name", "Return", "None", "if", "not", "found", "or", "if", "the", "name", "was", "revoked", "Raise", "if", "the", "DID", "is", "invalid" ]
python
train
32.467742
michael-lazar/rtv
rtv/terminal.py
https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L414-L423
def get_link_page_text(link_page): """ Construct the dialog box to display a list of links to the user. """ text = '' for i, link in enumerate(link_page): capped_link_text = (link['text'] if len(link['text']) <= 20 else link['text'][:19...
[ "def", "get_link_page_text", "(", "link_page", ")", ":", "text", "=", "''", "for", "i", ",", "link", "in", "enumerate", "(", "link_page", ")", ":", "capped_link_text", "=", "(", "link", "[", "'text'", "]", "if", "len", "(", "link", "[", "'text'", "]", ...
Construct the dialog box to display a list of links to the user.
[ "Construct", "the", "dialog", "box", "to", "display", "a", "list", "of", "links", "to", "the", "user", "." ]
python
train
41.9
theislab/scanpy
scanpy/plotting/_tools/scatterplots.py
https://github.com/theislab/scanpy/blob/9e4e5ee02e04cf618872d9b098e24f0542e8b227/scanpy/plotting/_tools/scatterplots.py#L398-L412
def pca(adata, **kwargs) -> Union[Axes, List[Axes], None]: """\ Scatter plot in PCA coordinates. Parameters ---------- {adata_color_etc} {scatter_bulk} {show_save_ax} Returns ------- If `show==False` a :class:`~matplotlib.axes.Axes` or a list of it. """ return plot_scat...
[ "def", "pca", "(", "adata", ",", "*", "*", "kwargs", ")", "->", "Union", "[", "Axes", ",", "List", "[", "Axes", "]", ",", "None", "]", ":", "return", "plot_scatter", "(", "adata", ",", "'pca'", ",", "*", "*", "kwargs", ")" ]
\ Scatter plot in PCA coordinates. Parameters ---------- {adata_color_etc} {scatter_bulk} {show_save_ax} Returns ------- If `show==False` a :class:`~matplotlib.axes.Axes` or a list of it.
[ "\\", "Scatter", "plot", "in", "PCA", "coordinates", "." ]
python
train
22.2
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L369-L439
def send_photo(self, chat_id, photo, caption=None, parse_mode=None, disable_notification=None, reply_to_message_id=None, reply_markup=None): """ Use this method to send photos. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendphoto Parameters: ...
[ "def", "send_photo", "(", "self", ",", "chat_id", ",", "photo", ",", "caption", "=", "None", ",", "parse_mode", "=", "None", ",", "disable_notification", "=", "None", ",", "reply_to_message_id", "=", "None", ",", "reply_markup", "=", "None", ")", ":", "fro...
Use this method to send photos. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendphoto Parameters: :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) :type chat_id: ...
[ "Use", "this", "method", "to", "send", "photos", ".", "On", "success", "the", "sent", "Message", "is", "returned", "." ]
python
train
57.915493
spyder-ide/spyder
spyder/plugins/editor/widgets/editor.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/editor.py#L2403-L2408
def remove_trailing_spaces(self, index=None): """Remove trailing spaces""" if index is None: index = self.get_stack_index() finfo = self.data[index] finfo.editor.remove_trailing_spaces()
[ "def", "remove_trailing_spaces", "(", "self", ",", "index", "=", "None", ")", ":", "if", "index", "is", "None", ":", "index", "=", "self", ".", "get_stack_index", "(", ")", "finfo", "=", "self", ".", "data", "[", "index", "]", "finfo", ".", "editor", ...
Remove trailing spaces
[ "Remove", "trailing", "spaces" ]
python
train
38.333333
rjw57/starman
starman/kalman.py
https://github.com/rjw57/starman/blob/1f9475e2354c9630a61f4898ad871de1d2fdbc71/starman/kalman.py#L206-L246
def update(self, measurement, measurement_matrix): """ After each :py:meth:`predict`, this method may be called repeatedly to provide additional measurements for each time step. Args: measurement (MultivariateNormal): Measurement for this time step with speci...
[ "def", "update", "(", "self", ",", "measurement", ",", "measurement_matrix", ")", ":", "# Sanitise input arguments", "measurement_matrix", "=", "np", ".", "atleast_2d", "(", "measurement_matrix", ")", "expected_meas_mat_shape", "=", "(", "measurement", ".", "mean", ...
After each :py:meth:`predict`, this method may be called repeatedly to provide additional measurements for each time step. Args: measurement (MultivariateNormal): Measurement for this time step with specified mean and covariance. measurement_matrix (array): Measu...
[ "After", "each", ":", "py", ":", "meth", ":", "predict", "this", "method", "may", "be", "called", "repeatedly", "to", "provide", "additional", "measurements", "for", "each", "time", "step", "." ]
python
train
43.121951
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L2114-L2136
def magic(self, arg_s): """DEPRECATED. Use run_line_magic() instead. Call a magic function by name. Input: a string containing the name of the magic function to call and any additional arguments to be passed to the magic. magic('name -opt foo bar') is equivalent to typing at t...
[ "def", "magic", "(", "self", ",", "arg_s", ")", ":", "# TODO: should we issue a loud deprecation warning here?", "magic_name", ",", "_", ",", "magic_arg_s", "=", "arg_s", ".", "partition", "(", "' '", ")", "magic_name", "=", "magic_name", ".", "lstrip", "(", "pr...
DEPRECATED. Use run_line_magic() instead. Call a magic function by name. Input: a string containing the name of the magic function to call and any additional arguments to be passed to the magic. magic('name -opt foo bar') is equivalent to typing at the ipython prompt: ...
[ "DEPRECATED", ".", "Use", "run_line_magic", "()", "instead", "." ]
python
test
37.913043
pyQode/pyqode.core
pyqode/core/widgets/filesystem_treeview.py
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/filesystem_treeview.py#L502-L536
def rename(self): """ Renames the selected item in the tree view """ src = self.get_current_path() pardir, name = os.path.split(src) new_name, status = QtWidgets.QInputDialog.getText( self.tree_view, _('Rename '), _('New name:'), QtWidgets.QLineEdi...
[ "def", "rename", "(", "self", ")", ":", "src", "=", "self", ".", "get_current_path", "(", ")", "pardir", ",", "name", "=", "os", ".", "path", ".", "split", "(", "src", ")", "new_name", ",", "status", "=", "QtWidgets", ".", "QInputDialog", ".", "getTe...
Renames the selected item in the tree view
[ "Renames", "the", "selected", "item", "in", "the", "tree", "view" ]
python
train
41.714286
cloud9ers/gurumate
environment/share/doc/ipython/examples/parallel/interengine/bintree.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/interengine/bintree.py#L83-L90
def depth(n, tree): """get depth of an element in the tree""" d = 0 parent = tree[n] while parent is not None: d += 1 parent = tree[parent] return d
[ "def", "depth", "(", "n", ",", "tree", ")", ":", "d", "=", "0", "parent", "=", "tree", "[", "n", "]", "while", "parent", "is", "not", "None", ":", "d", "+=", "1", "parent", "=", "tree", "[", "parent", "]", "return", "d" ]
get depth of an element in the tree
[ "get", "depth", "of", "an", "element", "in", "the", "tree" ]
python
test
22.125
AbletonAG/abl.vpath
abl/vpath/base/fs.py
https://github.com/AbletonAG/abl.vpath/blob/a57491347f6e7567afa047216e5b6f6035226eaf/abl/vpath/base/fs.py#L738-L749
def walk(self, topdown=True, followlinks=True): """ walk: walk the filesystem (just like os.walk). Use like: path = URI('/some/dir') for root, dirs, files in path.walk(): do_something() root will be an URI object. """ return self.connection.w...
[ "def", "walk", "(", "self", ",", "topdown", "=", "True", ",", "followlinks", "=", "True", ")", ":", "return", "self", ".", "connection", ".", "walk", "(", "self", ",", "topdown", "=", "topdown", ",", "followlinks", "=", "followlinks", ")" ]
walk: walk the filesystem (just like os.walk). Use like: path = URI('/some/dir') for root, dirs, files in path.walk(): do_something() root will be an URI object.
[ "walk", ":", "walk", "the", "filesystem", "(", "just", "like", "os", ".", "walk", ")", ".", "Use", "like", ":" ]
python
train
30
charettes/django-mutant
mutant/management/__init__.py
https://github.com/charettes/django-mutant/blob/865a1b712ce30501901c4691ce2110ab03f0f93b/mutant/management/__init__.py#L189-L211
def field_definition_post_save(sender, instance, created, raw, **kwargs): """ This signal is connected by all FieldDefinition subclasses see comment in FieldDefinitionBase for more details """ model_class = instance.model_def.model_class().render_state() field = instance.construct_for_migrate() ...
[ "def", "field_definition_post_save", "(", "sender", ",", "instance", ",", "created", ",", "raw", ",", "*", "*", "kwargs", ")", ":", "model_class", "=", "instance", ".", "model_def", ".", "model_class", "(", ")", ".", "render_state", "(", ")", "field", "=",...
This signal is connected by all FieldDefinition subclasses see comment in FieldDefinitionBase for more details
[ "This", "signal", "is", "connected", "by", "all", "FieldDefinition", "subclasses", "see", "comment", "in", "FieldDefinitionBase", "for", "more", "details" ]
python
train
48.347826
inveniosoftware/invenio-oauth2server
invenio_oauth2server/views/settings.py
https://github.com/inveniosoftware/invenio-oauth2server/blob/7033d3495c1a2b830e101e43918e92a37bbb49f2/invenio_oauth2server/views/settings.py#L227-L252
def token_view(token): """Show token details.""" if request.method == "POST" and 'delete' in request.form: db.session.delete(token) db.session.commit() return redirect(url_for('.index')) show_token = session.pop('show_personal_access_token', False) form = TokenForm(request.form...
[ "def", "token_view", "(", "token", ")", ":", "if", "request", ".", "method", "==", "\"POST\"", "and", "'delete'", "in", "request", ".", "form", ":", "db", ".", "session", ".", "delete", "(", "token", ")", "db", ".", "session", ".", "commit", "(", ")"...
Show token details.
[ "Show", "token", "details", "." ]
python
train
30.769231
mitsei/dlkit
dlkit/json_/repository/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/objects.py#L1392-L1402
def get_asset_id(self): """Gets the ``Asset Id`` corresponding to this content. return: (osid.id.Id) - the asset ``Id`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.learning.Activity.get_objective_id if not bool(se...
[ "def", "get_asset_id", "(", "self", ")", ":", "# Implemented from template for osid.learning.Activity.get_objective_id", "if", "not", "bool", "(", "self", ".", "_my_map", "[", "'assetId'", "]", ")", ":", "raise", "errors", ".", "IllegalState", "(", "'asset empty'", ...
Gets the ``Asset Id`` corresponding to this content. return: (osid.id.Id) - the asset ``Id`` *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "Asset", "Id", "corresponding", "to", "this", "content", "." ]
python
train
39
kgaughan/dbkit
examples/notary/notary.py
https://github.com/kgaughan/dbkit/blob/2aef6376a60965d7820c91692046f4bcf7d43640/examples/notary/notary.py#L35-L40
def strip_accents(s): """ Strip accents to prepare for slugification. """ nfkd = unicodedata.normalize('NFKD', unicode(s)) return u''.join(ch for ch in nfkd if not unicodedata.combining(ch))
[ "def", "strip_accents", "(", "s", ")", ":", "nfkd", "=", "unicodedata", ".", "normalize", "(", "'NFKD'", ",", "unicode", "(", "s", ")", ")", "return", "u''", ".", "join", "(", "ch", "for", "ch", "in", "nfkd", "if", "not", "unicodedata", ".", "combini...
Strip accents to prepare for slugification.
[ "Strip", "accents", "to", "prepare", "for", "slugification", "." ]
python
train
34.166667
Erotemic/utool
utool/util_list.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_list.py#L594-L665
def invertible_flatten2(unflat_list): """ An alternative to invertible_flatten1 which uses cumsum Flattens ``list`` but remember how to reconstruct the unflat ``list`` Returns flat ``list`` and the unflat ``list`` with indexes into the flat ``list`` Args: unflat_list (list): Retur...
[ "def", "invertible_flatten2", "(", "unflat_list", ")", ":", "sublen_list", "=", "list", "(", "map", "(", "len", ",", "unflat_list", ")", ")", "if", "not", "util_type", ".", "HAVE_NUMPY", ":", "cumlen_list", "=", "np", ".", "cumsum", "(", "sublen_list", ")"...
An alternative to invertible_flatten1 which uses cumsum Flattens ``list`` but remember how to reconstruct the unflat ``list`` Returns flat ``list`` and the unflat ``list`` with indexes into the flat ``list`` Args: unflat_list (list): Returns: tuple: flat_list, cumlen_list See...
[ "An", "alternative", "to", "invertible_flatten1", "which", "uses", "cumsum" ]
python
train
38.902778
santoshphilip/eppy
eppy/modeleditor.py
https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L241-L245
def iddofobject(data, commdct, key): """from commdct, return the idd of the object key""" dtls = data.dtls i = dtls.index(key) return commdct[i]
[ "def", "iddofobject", "(", "data", ",", "commdct", ",", "key", ")", ":", "dtls", "=", "data", ".", "dtls", "i", "=", "dtls", ".", "index", "(", "key", ")", "return", "commdct", "[", "i", "]" ]
from commdct, return the idd of the object key
[ "from", "commdct", "return", "the", "idd", "of", "the", "object", "key" ]
python
train
31.2
openid/JWTConnect-Python-OidcMsg
src/oidcmsg/message.py
https://github.com/openid/JWTConnect-Python-OidcMsg/blob/58ade5eb67131abfb99f38b6a92d43b697c9f2fa/src/oidcmsg/message.py#L736-L745
def extra(self): """ Return the extra parameters that this instance. Extra meaning those that are not listed in the c_params specification. :return: The key,value pairs for keys that are not in the c_params specification, """ return dict([(key, val) f...
[ "def", "extra", "(", "self", ")", ":", "return", "dict", "(", "[", "(", "key", ",", "val", ")", "for", "key", ",", "val", "in", "self", ".", "_dict", ".", "items", "(", ")", "if", "key", "not", "in", "self", ".", "c_param", "]", ")" ]
Return the extra parameters that this instance. Extra meaning those that are not listed in the c_params specification. :return: The key,value pairs for keys that are not in the c_params specification,
[ "Return", "the", "extra", "parameters", "that", "this", "instance", ".", "Extra", "meaning", "those", "that", "are", "not", "listed", "in", "the", "c_params", "specification", ".", ":", "return", ":", "The", "key", "value", "pairs", "for", "keys", "that", ...
python
train
39.4
saltstack/salt
salt/modules/status.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/status.py#L268-L293
def loadavg(): ''' Return the load averages for this minion .. versionchanged:: 2016.11.4 Added support for AIX CLI Example: .. code-block:: bash salt '*' status.loadavg :raises CommandExecutionError: If the system cannot report loadaverages to Python ''' if __gr...
[ "def", "loadavg", "(", ")", ":", "if", "__grains__", "[", "'kernel'", "]", "==", "'AIX'", ":", "return", "_aix_loadavg", "(", ")", "try", ":", "load_avg", "=", "os", ".", "getloadavg", "(", ")", "except", "AttributeError", ":", "# Some UNIX-based operating s...
Return the load averages for this minion .. versionchanged:: 2016.11.4 Added support for AIX CLI Example: .. code-block:: bash salt '*' status.loadavg :raises CommandExecutionError: If the system cannot report loadaverages to Python
[ "Return", "the", "load", "averages", "for", "this", "minion" ]
python
train
27.038462
wilzbach/smarkov
smarkov/hmm.py
https://github.com/wilzbach/smarkov/blob/c98c08cc432e18c5c87fb9a6e013b1b8eaa54d37/smarkov/hmm.py#L93-L96
def _emitHMM(self, token_type, past_states, past_emissions): """ emits a word based on previous tokens """ assert token_type in self.emissions return utils.weighted_choice(self.emissions[token_type].items())
[ "def", "_emitHMM", "(", "self", ",", "token_type", ",", "past_states", ",", "past_emissions", ")", ":", "assert", "token_type", "in", "self", ".", "emissions", "return", "utils", ".", "weighted_choice", "(", "self", ".", "emissions", "[", "token_type", "]", ...
emits a word based on previous tokens
[ "emits", "a", "word", "based", "on", "previous", "tokens" ]
python
train
57
taskcluster/taskcluster-client.py
taskcluster/aio/queue.py
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/queue.py#L809-L820
async def getWorker(self, *args, **kwargs): """ Get a worker-type Get a worker from a worker-type. This method gives output: ``v1/worker-response.json#`` This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["getWorker"], *args, **kw...
[ "async", "def", "getWorker", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"getWorker\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Get a worker-type Get a worker from a worker-type. This method gives output: ``v1/worker-response.json#`` This method is ``experimental``
[ "Get", "a", "worker", "-", "type" ]
python
train
26.166667
consbio/gis-metadata-parser
gis_metadata/arcgis_metadata_parser.py
https://github.com/consbio/gis-metadata-parser/blob/59eefb2e51cd4d8cc3e94623a2167499ca9ef70f/gis_metadata/arcgis_metadata_parser.py#L407-L440
def _update_report_item(self, **update_props): """ Update the text for each element at the configured path if attribute matches """ tree_to_update = update_props['tree_to_update'] prop = update_props['prop'] values = wrap_value(update_props['values']) xroot = self._get_xroot_for...
[ "def", "_update_report_item", "(", "self", ",", "*", "*", "update_props", ")", ":", "tree_to_update", "=", "update_props", "[", "'tree_to_update'", "]", "prop", "=", "update_props", "[", "'prop'", "]", "values", "=", "wrap_value", "(", "update_props", "[", "'v...
Update the text for each element at the configured path if attribute matches
[ "Update", "the", "text", "for", "each", "element", "at", "the", "configured", "path", "if", "attribute", "matches" ]
python
train
35.323529