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
persephone-tools/persephone
persephone/preprocess/elan.py
https://github.com/persephone-tools/persephone/blob/f94c63e4d5fe719fb1deba449b177bb299d225fb/persephone/preprocess/elan.py#L43-L59
def initialize_media_descriptor(self) -> None: """ Returns the media descriptor for the first media descriptor where the file can be found. """ for md in self.media_descriptors: media_path = self.get_media_path(md) if media_path.is_file(): ...
[ "def", "initialize_media_descriptor", "(", "self", ")", "->", "None", ":", "for", "md", "in", "self", ".", "media_descriptors", ":", "media_path", "=", "self", ".", "get_media_path", "(", "md", ")", "if", "media_path", ".", "is_file", "(", ")", ":", "self"...
Returns the media descriptor for the first media descriptor where the file can be found.
[ "Returns", "the", "media", "descriptor", "for", "the", "first", "media", "descriptor", "where", "the", "file", "can", "be", "found", "." ]
python
train
37.647059
mitsei/dlkit
dlkit/records/osid/base_records.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1677-L1683
def clear_time_value(self): """stub""" if (self.get_time_value_metadata().is_read_only() or self.get_time_value_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['timeValue'] = \ dict(self.get_time_value_metadata().get_default_du...
[ "def", "clear_time_value", "(", "self", ")", ":", "if", "(", "self", ".", "get_time_value_metadata", "(", ")", ".", "is_read_only", "(", ")", "or", "self", ".", "get_time_value_metadata", "(", ")", ".", "is_required", "(", ")", ")", ":", "raise", "NoAccess...
stub
[ "stub" ]
python
train
47.571429
praekeltfoundation/molo
molo/core/utils.py
https://github.com/praekeltfoundation/molo/blob/57702fda4fab261d67591415f7d46bc98fa38525/molo/core/utils.py#L210-L235
def get_image_hash(image): ''' Returns an MD5 hash of the image file Handles images stored locally and on AWS I know this code is ugly. Please don't ask. The rabbit hole is deep. ''' md5 = hashlib.md5() try: for chunk in image.file.chunks(): md5.update(chunk) ...
[ "def", "get_image_hash", "(", "image", ")", ":", "md5", "=", "hashlib", ".", "md5", "(", ")", "try", ":", "for", "chunk", "in", "image", ".", "file", ".", "chunks", "(", ")", ":", "md5", ".", "update", "(", "chunk", ")", "return", "md5", ".", "he...
Returns an MD5 hash of the image file Handles images stored locally and on AWS I know this code is ugly. Please don't ask. The rabbit hole is deep.
[ "Returns", "an", "MD5", "hash", "of", "the", "image", "file" ]
python
train
28.423077
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_vswitch.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_vswitch.py#L388-L400
def get_vnetwork_dvpgs_output_vnetwork_dvpgs_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_vnetwork_dvpgs = ET.Element("get_vnetwork_dvpgs") config = get_vnetwork_dvpgs output = ET.SubElement(get_vnetwork_dvpgs, "output") vnetw...
[ "def", "get_vnetwork_dvpgs_output_vnetwork_dvpgs_name", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_vnetwork_dvpgs", "=", "ET", ".", "Element", "(", "\"get_vnetwork_dvpgs\"", ")", "config", "=...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
41.692308
studionow/pybrightcove
pybrightcove/video.py
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L297-L311
def _find_video(self): """ Lookup and populate ``pybrightcove.video.Video`` object given a video id or reference_id. """ data = None if self.id: data = self.connection.get_item( 'find_video_by_id', video_id=self.id) elif self.reference_...
[ "def", "_find_video", "(", "self", ")", ":", "data", "=", "None", "if", "self", ".", "id", ":", "data", "=", "self", ".", "connection", ".", "get_item", "(", "'find_video_by_id'", ",", "video_id", "=", "self", ".", "id", ")", "elif", "self", ".", "re...
Lookup and populate ``pybrightcove.video.Video`` object given a video id or reference_id.
[ "Lookup", "and", "populate", "pybrightcove", ".", "video", ".", "Video", "object", "given", "a", "video", "id", "or", "reference_id", "." ]
python
train
31.933333
michaeljoseph/changes
changes/cli.py
https://github.com/michaeljoseph/changes/blob/a8beb409671c58cdf28ee913bad0a5c7d5374ade/changes/cli.py#L85-L93
def stage(draft, discard, repo_directory, release_name, release_description): """ Stages a release """ with work_in(repo_directory): if discard: stage_command.discard(release_name, release_description) else: stage_command.stage(draft, release_name, release_descrip...
[ "def", "stage", "(", "draft", ",", "discard", ",", "repo_directory", ",", "release_name", ",", "release_description", ")", ":", "with", "work_in", "(", "repo_directory", ")", ":", "if", "discard", ":", "stage_command", ".", "discard", "(", "release_name", ",",...
Stages a release
[ "Stages", "a", "release" ]
python
train
35.222222
Kortemme-Lab/klab
klab/bio/clustalo.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/clustalo.py#L224-L232
def get_residue_mapping(self): '''Returns a mapping between the sequences ONLY IF there are exactly two. This restriction makes the code much simpler.''' if len(self.sequence_ids) == 2: if not self.alignment_output: self.align() assert(self.alignment_output) ...
[ "def", "get_residue_mapping", "(", "self", ")", ":", "if", "len", "(", "self", ".", "sequence_ids", ")", "==", "2", ":", "if", "not", "self", ".", "alignment_output", ":", "self", ".", "align", "(", ")", "assert", "(", "self", ".", "alignment_output", ...
Returns a mapping between the sequences ONLY IF there are exactly two. This restriction makes the code much simpler.
[ "Returns", "a", "mapping", "between", "the", "sequences", "ONLY", "IF", "there", "are", "exactly", "two", ".", "This", "restriction", "makes", "the", "code", "much", "simpler", "." ]
python
train
51.222222
paramiko/paramiko
paramiko/sftp_client.py
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L402-L423
def rename(self, oldpath, newpath): """ Rename a file or folder from ``oldpath`` to ``newpath``. .. note:: This method implements 'standard' SFTP ``RENAME`` behavior; those seeking the OpenSSH "POSIX rename" extension behavior should use `posix_rename`. ...
[ "def", "rename", "(", "self", ",", "oldpath", ",", "newpath", ")", ":", "oldpath", "=", "self", ".", "_adjust_cwd", "(", "oldpath", ")", "newpath", "=", "self", ".", "_adjust_cwd", "(", "newpath", ")", "self", ".", "_log", "(", "DEBUG", ",", "\"rename(...
Rename a file or folder from ``oldpath`` to ``newpath``. .. note:: This method implements 'standard' SFTP ``RENAME`` behavior; those seeking the OpenSSH "POSIX rename" extension behavior should use `posix_rename`. :param str oldpath: existing name of the...
[ "Rename", "a", "file", "or", "folder", "from", "oldpath", "to", "newpath", "." ]
python
train
36.545455
nkavaldj/myhdl_lib
myhdl_lib/pipeline_control.py
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/pipeline_control.py#L60-L121
def pipeline_control_new(rst, clk, rx_rdy, rx_vld, tx_rdy, tx_vld, stage_enable, stop_rx=None, stop_tx=None): """ Pipeline control unit rx_rdy, rx_vld, - (o)(i) handshake at the pipeline input (front of the pipeline) tx_rdy, tx_vld, - (i)(o) handshake at the pipeline output (back o...
[ "def", "pipeline_control_new", "(", "rst", ",", "clk", ",", "rx_rdy", ",", "rx_vld", ",", "tx_rdy", ",", "tx_vld", ",", "stage_enable", ",", "stop_rx", "=", "None", ",", "stop_tx", "=", "None", ")", ":", "NUM_STAGES", "=", "len", "(", "stage_enable", ")"...
Pipeline control unit rx_rdy, rx_vld, - (o)(i) handshake at the pipeline input (front of the pipeline) tx_rdy, tx_vld, - (i)(o) handshake at the pipeline output (back of the pipeline) stage_enable - (o) vector of enable signals, one signal per stage, that controls t...
[ "Pipeline", "control", "unit", "rx_rdy", "rx_vld", "-", "(", "o", ")", "(", "i", ")", "handshake", "at", "the", "pipeline", "input", "(", "front", "of", "the", "pipeline", ")", "tx_rdy", "tx_vld", "-", "(", "i", ")", "(", "o", ")", "handshake", "at",...
python
train
47.483871
apache/spark
python/pyspark/sql/udf.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/udf.py#L177-L204
def _wrapped(self): """ Wrap this udf with a function and attach docstring from func """ # It is possible for a callable instance without __name__ attribute or/and # __module__ attribute to be wrapped here. For example, functools.partial. In this case, # we should avoid ...
[ "def", "_wrapped", "(", "self", ")", ":", "# It is possible for a callable instance without __name__ attribute or/and", "# __module__ attribute to be wrapped here. For example, functools.partial. In this case,", "# we should avoid wrapping the attributes from the wrapped function to the wrapper", ...
Wrap this udf with a function and attach docstring from func
[ "Wrap", "this", "udf", "with", "a", "function", "and", "attach", "docstring", "from", "func" ]
python
train
45.357143
f3at/feat
src/feat/agents/common/dns.py
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/src/feat/agents/common/dns.py#L36-L40
def remove_mapping(agent, prefix, ip): """Removes a mapping with a contract. It has high latency but gives some kind of guarantee.""" return _broadcast(agent, RemoveMappingManager, RecordType.record_A, prefix, ip)
[ "def", "remove_mapping", "(", "agent", ",", "prefix", ",", "ip", ")", ":", "return", "_broadcast", "(", "agent", ",", "RemoveMappingManager", ",", "RecordType", ".", "record_A", ",", "prefix", ",", "ip", ")" ]
Removes a mapping with a contract. It has high latency but gives some kind of guarantee.
[ "Removes", "a", "mapping", "with", "a", "contract", ".", "It", "has", "high", "latency", "but", "gives", "some", "kind", "of", "guarantee", "." ]
python
train
48.6
redcanari/canari3
src/canari/mode.py
https://github.com/redcanari/canari3/blob/322d2bae4b49ac728229f418b786b51fcc227352/src/canari/mode.py#L100-L111
def set_canari_mode(mode=CanariMode.Unknown): """ Sets the global operating mode for Canari. This is used to alter the behaviour of dangerous classes like the CanariConfigParser. :param mode: the numeric Canari operating mode (CanariMode.Local, CanariMode.Remote, etc.). :return: previous operating ...
[ "def", "set_canari_mode", "(", "mode", "=", "CanariMode", ".", "Unknown", ")", ":", "global", "canari_mode", "old_mode", "=", "canari_mode", "canari_mode", "=", "mode", "return", "old_mode" ]
Sets the global operating mode for Canari. This is used to alter the behaviour of dangerous classes like the CanariConfigParser. :param mode: the numeric Canari operating mode (CanariMode.Local, CanariMode.Remote, etc.). :return: previous operating mode.
[ "Sets", "the", "global", "operating", "mode", "for", "Canari", ".", "This", "is", "used", "to", "alter", "the", "behaviour", "of", "dangerous", "classes", "like", "the", "CanariConfigParser", "." ]
python
train
34.583333
watson-developer-cloud/python-sdk
ibm_watson/assistant_v2.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/assistant_v2.py#L1763-L1770
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'intent') and self.intent is not None: _dict['intent'] = self.intent if hasattr(self, 'confidence') and self.confidence is not None: _dict['confidence'] = self....
[ "def", "_to_dict", "(", "self", ")", ":", "_dict", "=", "{", "}", "if", "hasattr", "(", "self", ",", "'intent'", ")", "and", "self", ".", "intent", "is", "not", "None", ":", "_dict", "[", "'intent'", "]", "=", "self", ".", "intent", "if", "hasattr"...
Return a json dictionary representing this model.
[ "Return", "a", "json", "dictionary", "representing", "this", "model", "." ]
python
train
43
mar10/wsgidav
wsgidav/dav_provider.py
https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/dav_provider.py#L582-L716
def get_property_value(self, name): """Return the value of a property. name: the property name in Clark notation. return value: may have different types, depending on the status: - string or unicode: for standard property values. - lxml.etree.Ele...
[ "def", "get_property_value", "(", "self", ",", "name", ")", ":", "refUrl", "=", "self", ".", "get_ref_url", "(", ")", "# lock properties", "lm", "=", "self", ".", "provider", ".", "lock_manager", "if", "lm", "and", "name", "==", "\"{DAV:}lockdiscovery\"", ":...
Return the value of a property. name: the property name in Clark notation. return value: may have different types, depending on the status: - string or unicode: for standard property values. - lxml.etree.Element: for complex values. If the p...
[ "Return", "the", "value", "of", "a", "property", "." ]
python
valid
45.044444
ladybug-tools/ladybug
ladybug/epw.py
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L340-L349
def annual_heating_design_day_990(self): """A design day object representing the annual 99.0% heating design day.""" self._load_header_check() if bool(self._heating_dict) is True: avg_press = self.atmospheric_station_pressure.average avg_press = None if avg_press == 99999...
[ "def", "annual_heating_design_day_990", "(", "self", ")", ":", "self", ".", "_load_header_check", "(", ")", "if", "bool", "(", "self", ".", "_heating_dict", ")", "is", "True", ":", "avg_press", "=", "self", ".", "atmospheric_station_pressure", ".", "average", ...
A design day object representing the annual 99.0% heating design day.
[ "A", "design", "day", "object", "representing", "the", "annual", "99", ".", "0%", "heating", "design", "day", "." ]
python
train
48.8
SmokinCaterpillar/pypet
pypet/parameter.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2337-L2342
def _supports(self, item): """Supports everything of parent class and csr, csc, bsr, and dia sparse matrices.""" if SparseParameter._is_supported_matrix(item): return True else: return super(SparseResult, self)._supports(item)
[ "def", "_supports", "(", "self", ",", "item", ")", ":", "if", "SparseParameter", ".", "_is_supported_matrix", "(", "item", ")", ":", "return", "True", "else", ":", "return", "super", "(", "SparseResult", ",", "self", ")", ".", "_supports", "(", "item", "...
Supports everything of parent class and csr, csc, bsr, and dia sparse matrices.
[ "Supports", "everything", "of", "parent", "class", "and", "csr", "csc", "bsr", "and", "dia", "sparse", "matrices", "." ]
python
test
44.833333
sosy-lab/benchexec
benchexec/containerexecutor.py
https://github.com/sosy-lab/benchexec/blob/44428f67f41384c03aea13e7e25f884764653617/benchexec/containerexecutor.py#L947-L998
def _transfer_output_files(self, tool_output_dir, working_dir, output_dir, patterns): """Transfer files created by the tool in the container to the output directory. @param tool_output_dir: The directory under which all tool output files are created. @param working_dir: The absolute working dire...
[ "def", "_transfer_output_files", "(", "self", ",", "tool_output_dir", ",", "working_dir", ",", "output_dir", ",", "patterns", ")", ":", "assert", "output_dir", "and", "patterns", "if", "any", "(", "os", ".", "path", ".", "isabs", "(", "pattern", ")", "for", ...
Transfer files created by the tool in the container to the output directory. @param tool_output_dir: The directory under which all tool output files are created. @param working_dir: The absolute working directory of the tool in the container. @param output_dir: the directory where to write resul...
[ "Transfer", "files", "created", "by", "the", "tool", "in", "the", "container", "to", "the", "output", "directory", "." ]
python
train
55.788462
maweigert/gputools
gputools/fft/oclfft.py
https://github.com/maweigert/gputools/blob/6ab26efeb05dceef74cf13aadeeeb9b009b529dd/gputools/fft/oclfft.py#L41-L54
def fft_plan(shape, dtype=np.complex64, axes=None, fast_math=True): """returns an reikna plan/FFT obj of shape dshape """ # if not axes is None and any([a<0 for a in axes]): # raise NotImplementedError("indices of axes have to be non negative, but are: %s"%str(axes)) axes = _convert_axes_to_abs...
[ "def", "fft_plan", "(", "shape", ",", "dtype", "=", "np", ".", "complex64", ",", "axes", "=", "None", ",", "fast_math", "=", "True", ")", ":", "# if not axes is None and any([a<0 for a in axes]):", "# raise NotImplementedError(\"indices of axes have to be non negative, ...
returns an reikna plan/FFT obj of shape dshape
[ "returns", "an", "reikna", "plan", "/", "FFT", "obj", "of", "shape", "dshape" ]
python
train
39.857143
wonambi-python/wonambi
wonambi/attr/anat.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/anat.py#L224-L235
def surface_ras_shift(self): """Freesurfer uses two coordinate systems: one for volumes ("RAS") and one for surfaces ("tkReg", "tkRAS", and "Surface RAS"). To get from surface to volume coordinates, add this numbers. To get from volume to surface coordinates, substract this numbers. ...
[ "def", "surface_ras_shift", "(", "self", ")", ":", "T1_path", "=", "self", ".", "dir", "/", "'mri'", "/", "'T1.mgz'", "assert", "T1_path", ".", "exists", "(", ")", "T1", "=", "nload", "(", "str", "(", "T1_path", ")", ")", "return", "T1", ".", "header...
Freesurfer uses two coordinate systems: one for volumes ("RAS") and one for surfaces ("tkReg", "tkRAS", and "Surface RAS"). To get from surface to volume coordinates, add this numbers. To get from volume to surface coordinates, substract this numbers.
[ "Freesurfer", "uses", "two", "coordinate", "systems", ":", "one", "for", "volumes", "(", "RAS", ")", "and", "one", "for", "surfaces", "(", "tkReg", "tkRAS", "and", "Surface", "RAS", ")", ".", "To", "get", "from", "surface", "to", "volume", "coordinates", ...
python
train
38.666667
chinapnr/fishbase
fishbase/fish_common.py
https://github.com/chinapnr/fishbase/blob/23c5147a6bc0d8ed36409e55352ffb2c5b0edc82/fishbase/fish_common.py#L1021-L1054
def camelcase_to_underline(param_dict): """ 将驼峰命名的参数字典键转换为下划线参数 :param: * param_dict: (dict) 请求参数字典 :return: * temp_dict: (dict) 转换后的参数字典 举例如下:: print('--- transform_hump_to_underline demo---') hump_param_dict = {'firstName': 'Python', 'Second_Name': 'san', 'right...
[ "def", "camelcase_to_underline", "(", "param_dict", ")", ":", "temp_dict", "=", "copy", ".", "deepcopy", "(", "param_dict", ")", "# 正则", "hump_to_underline", "=", "re", ".", "compile", "(", "r'([a-z]|\\d)([A-Z])'", ")", "for", "key", "in", "list", "(", "param_...
将驼峰命名的参数字典键转换为下划线参数 :param: * param_dict: (dict) 请求参数字典 :return: * temp_dict: (dict) 转换后的参数字典 举例如下:: print('--- transform_hump_to_underline demo---') hump_param_dict = {'firstName': 'Python', 'Second_Name': 'san', 'right_name': 'name'} underline_param_dict = trans...
[ "将驼峰命名的参数字典键转换为下划线参数" ]
python
train
27
zyga/json-schema-validator
json_schema_validator/schema.py
https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L135-L142
def additionalProperties(self): """Schema for all additional properties, or False.""" value = self._schema.get("additionalProperties", {}) if not isinstance(value, dict) and value is not False: raise SchemaError( "additionalProperties value {0!r} is neither false nor"...
[ "def", "additionalProperties", "(", "self", ")", ":", "value", "=", "self", ".", "_schema", ".", "get", "(", "\"additionalProperties\"", ",", "{", "}", ")", "if", "not", "isinstance", "(", "value", ",", "dict", ")", "and", "value", "is", "not", "False", ...
Schema for all additional properties, or False.
[ "Schema", "for", "all", "additional", "properties", "or", "False", "." ]
python
train
47.25
genialis/resolwe
resolwe/elastic/viewsets.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/elastic/viewsets.py#L225-L242
def search(self): """Handle the search request.""" search = self.document_class().search() # pylint: disable=not-callable search = self.custom_filter(search) search = self.filter_search(search) search = self.order_search(search) search = self.filter_permissions(search)...
[ "def", "search", "(", "self", ")", ":", "search", "=", "self", ".", "document_class", "(", ")", ".", "search", "(", ")", "# pylint: disable=not-callable", "search", "=", "self", ".", "custom_filter", "(", "search", ")", "search", "=", "self", ".", "filter_...
Handle the search request.
[ "Handle", "the", "search", "request", "." ]
python
train
32.5
ultrabug/py3status
py3status/modules/dpms.py
https://github.com/ultrabug/py3status/blob/4c105f1b44f7384ca4f7da5f821a47e468c7dee2/py3status/modules/dpms.py#L62-L79
def dpms(self): """ Display a colorful state of DPMS. """ if "DPMS is Enabled" in self.py3.command_output("xset -q"): _format = self.icon_on color = self.color_on else: _format = self.icon_off color = self.color_off icon = ...
[ "def", "dpms", "(", "self", ")", ":", "if", "\"DPMS is Enabled\"", "in", "self", ".", "py3", ".", "command_output", "(", "\"xset -q\"", ")", ":", "_format", "=", "self", ".", "icon_on", "color", "=", "self", ".", "color_on", "else", ":", "_format", "=", ...
Display a colorful state of DPMS.
[ "Display", "a", "colorful", "state", "of", "DPMS", "." ]
python
train
29.444444
hollenstein/maspy
maspy/core.py
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L501-L510
def _writeCic(self, filelike, specfile, compress): """Writes the ``.cic`` container entry of the specified specfile to the ``mrc_cic`` format. For details see :func:`maspy.auxiliary.writeBinaryItemContainer()` :param filelike: path to a file (str) or a file-like object :param s...
[ "def", "_writeCic", "(", "self", ",", "filelike", ",", "specfile", ",", "compress", ")", ":", "aux", ".", "writeBinaryItemContainer", "(", "filelike", ",", "self", ".", "cic", "[", "specfile", "]", ",", "compress", ")" ]
Writes the ``.cic`` container entry of the specified specfile to the ``mrc_cic`` format. For details see :func:`maspy.auxiliary.writeBinaryItemContainer()` :param filelike: path to a file (str) or a file-like object :param specfile: name of an ms-run file present in ``self.info`` ...
[ "Writes", "the", ".", "cic", "container", "entry", "of", "the", "specified", "specfile", "to", "the", "mrc_cic", "format", ".", "For", "details", "see", ":", "func", ":", "maspy", ".", "auxiliary", ".", "writeBinaryItemContainer", "()" ]
python
train
52
nuagenetworks/monolithe
monolithe/generators/lang/go/converter.py
https://github.com/nuagenetworks/monolithe/blob/626011af3ff43f73b7bd8aa5e1f93fb5f1f0e181/monolithe/generators/lang/go/converter.py#L29-L52
def get_type_name(type_name, sub_type=None): """ Returns a go type according to a spec type """ if type_name in ("string", "enum"): return "string" if type_name == "float": return "float64" if type_name == "boolean": return "bool" if type_name == "list": st = ...
[ "def", "get_type_name", "(", "type_name", ",", "sub_type", "=", "None", ")", ":", "if", "type_name", "in", "(", "\"string\"", ",", "\"enum\"", ")", ":", "return", "\"string\"", "if", "type_name", "==", "\"float\"", ":", "return", "\"float64\"", "if", "type_n...
Returns a go type according to a spec type
[ "Returns", "a", "go", "type", "according", "to", "a", "spec", "type" ]
python
train
22.333333
LonamiWebs/Telethon
telethon/extensions/binaryreader.py
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/binaryreader.py#L55-L58
def read_large_int(self, bits, signed=True): """Reads a n-bits long integer value.""" return int.from_bytes( self.read(bits // 8), byteorder='little', signed=signed)
[ "def", "read_large_int", "(", "self", ",", "bits", ",", "signed", "=", "True", ")", ":", "return", "int", ".", "from_bytes", "(", "self", ".", "read", "(", "bits", "//", "8", ")", ",", "byteorder", "=", "'little'", ",", "signed", "=", "signed", ")" ]
Reads a n-bits long integer value.
[ "Reads", "a", "n", "-", "bits", "long", "integer", "value", "." ]
python
train
47.5
cimm-kzn/CGRtools
CGRtools/files/SDFrw.py
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/files/SDFrw.py#L166-L176
def write(self, data): """ write single molecule into file """ m = self._convert_structure(data) self._file.write(self._format_mol(*m)) self._file.write('M END\n') for k, v in data.meta.items(): self._file.write(f'> <{k}>\n{v}\n') self._file...
[ "def", "write", "(", "self", ",", "data", ")", ":", "m", "=", "self", ".", "_convert_structure", "(", "data", ")", "self", ".", "_file", ".", "write", "(", "self", ".", "_format_mol", "(", "*", "m", ")", ")", "self", ".", "_file", ".", "write", "...
write single molecule into file
[ "write", "single", "molecule", "into", "file" ]
python
train
29.636364
simpleai-team/simpleai
simpleai/search/local.py
https://github.com/simpleai-team/simpleai/blob/2836befa7e970013f62e0ee75562652aacac6f65/simpleai/search/local.py#L172-L195
def _create_simulated_annealing_expander(schedule): ''' Creates an expander that has a random chance to choose a node that is worse than the current (first) node, but that chance decreases with time. ''' def _expander(fringe, iteration, viewer): T = schedule(iteration) current = frin...
[ "def", "_create_simulated_annealing_expander", "(", "schedule", ")", ":", "def", "_expander", "(", "fringe", ",", "iteration", ",", "viewer", ")", ":", "T", "=", "schedule", "(", "iteration", ")", "current", "=", "fringe", "[", "0", "]", "neighbors", "=", ...
Creates an expander that has a random chance to choose a node that is worse than the current (first) node, but that chance decreases with time.
[ "Creates", "an", "expander", "that", "has", "a", "random", "chance", "to", "choose", "a", "node", "that", "is", "worse", "than", "the", "current", "(", "first", ")", "node", "but", "that", "chance", "decreases", "with", "time", "." ]
python
train
33.041667
PMEAL/OpenPNM
openpnm/topotools/topotools.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/topotools/topotools.py#L2340-L2388
def find_clusters(network, mask=[], t_labels=False): r""" Identify connected clusters of pores in the network. This method can also return a list of throat cluster numbers, which correspond to the cluster numbers of the pores to which the throat is connected. Either site and bond percolation can b...
[ "def", "find_clusters", "(", "network", ",", "mask", "=", "[", "]", ",", "t_labels", "=", "False", ")", ":", "# Parse the input arguments", "mask", "=", "sp", ".", "array", "(", "mask", ",", "ndmin", "=", "1", ")", "if", "mask", ".", "dtype", "!=", "...
r""" Identify connected clusters of pores in the network. This method can also return a list of throat cluster numbers, which correspond to the cluster numbers of the pores to which the throat is connected. Either site and bond percolation can be considered, see description of input arguments for ...
[ "r", "Identify", "connected", "clusters", "of", "pores", "in", "the", "network", ".", "This", "method", "can", "also", "return", "a", "list", "of", "throat", "cluster", "numbers", "which", "correspond", "to", "the", "cluster", "numbers", "of", "the", "pores"...
python
train
35.653061
frawau/aiolifx
aiolifx/aiolifx.py
https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L1224-L1234
def discover(self): """Method to send a discovery message """ if self.transport: if self.discovery_countdown <= 0: self.discovery_countdown = self.discovery_interval msg = GetService(BROADCAST_MAC, self.source_id, seq_num=0, payload={}, ack_requested=F...
[ "def", "discover", "(", "self", ")", ":", "if", "self", ".", "transport", ":", "if", "self", ".", "discovery_countdown", "<=", "0", ":", "self", ".", "discovery_countdown", "=", "self", ".", "discovery_interval", "msg", "=", "GetService", "(", "BROADCAST_MAC...
Method to send a discovery message
[ "Method", "to", "send", "a", "discovery", "message" ]
python
train
54.636364
xtrementl/focus
focus/daemon.py
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/daemon.py#L297-L316
def shutdown(self): """ Shuts down the daemon process. """ if not self._exited: self._exited = True # signal task runner to terminate via SIGTERM if self._task_runner.is_alive(): self._task_runner.terminate() # if command...
[ "def", "shutdown", "(", "self", ")", ":", "if", "not", "self", ".", "_exited", ":", "self", ".", "_exited", "=", "True", "# signal task runner to terminate via SIGTERM", "if", "self", ".", "_task_runner", ".", "is_alive", "(", ")", ":", "self", ".", "_task_r...
Shuts down the daemon process.
[ "Shuts", "down", "the", "daemon", "process", "." ]
python
train
34.25
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L3383-L3391
def newNsPropEatName(self, ns, name, value): """Create a new property tagged with a namespace and carried by a node. """ if ns is None: ns__o = None else: ns__o = ns._o ret = libxml2mod.xmlNewNsPropEatName(self._o, ns__o, name, value) if ret is None:raise treeError('xm...
[ "def", "newNsPropEatName", "(", "self", ",", "ns", ",", "name", ",", "value", ")", ":", "if", "ns", "is", "None", ":", "ns__o", "=", "None", "else", ":", "ns__o", "=", "ns", ".", "_o", "ret", "=", "libxml2mod", ".", "xmlNewNsPropEatName", "(", "self"...
Create a new property tagged with a namespace and carried by a node.
[ "Create", "a", "new", "property", "tagged", "with", "a", "namespace", "and", "carried", "by", "a", "node", "." ]
python
train
43.888889
Karaage-Cluster/karaage
karaage/datastores/__init__.py
https://github.com/Karaage-Cluster/karaage/blob/2f4c8b4e2d728b3fcbb151160c49000f1c04f5c9/karaage/datastores/__init__.py#L292-L298
def remove_accounts_from_project(accounts_query, project): """ Remove accounts from project. """ query = accounts_query.filter(date_deleted__isnull=True) for account in query: remove_account_from_project(account, project)
[ "def", "remove_accounts_from_project", "(", "accounts_query", ",", "project", ")", ":", "query", "=", "accounts_query", ".", "filter", "(", "date_deleted__isnull", "=", "True", ")", "for", "account", "in", "query", ":", "remove_account_from_project", "(", "account",...
Remove accounts from project.
[ "Remove", "accounts", "from", "project", "." ]
python
train
33.857143
CellProfiler/centrosome
centrosome/otsu.py
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/otsu.py#L5-L59
def otsu(data, min_threshold=None, max_threshold=None,bins=256): """Compute a threshold using Otsu's method data - an array of intensity values between zero and one min_threshold - only consider thresholds above this minimum value max_threshold - only consider thresholds below this maxi...
[ "def", "otsu", "(", "data", ",", "min_threshold", "=", "None", ",", "max_threshold", "=", "None", ",", "bins", "=", "256", ")", ":", "assert", "min_threshold", "is", "None", "or", "max_threshold", "is", "None", "or", "min_threshold", "<", "max_threshold", ...
Compute a threshold using Otsu's method data - an array of intensity values between zero and one min_threshold - only consider thresholds above this minimum value max_threshold - only consider thresholds below this maximum value bins - we bin the data into this many equally-sp...
[ "Compute", "a", "threshold", "using", "Otsu", "s", "method", "data", "-", "an", "array", "of", "intensity", "values", "between", "zero", "and", "one", "min_threshold", "-", "only", "consider", "thresholds", "above", "this", "minimum", "value", "max_threshold", ...
python
train
40.563636
tcalmant/ipopo
pelix/ipopo/decorators.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L96-L121
def get_factory_context(cls): # type: (type) -> FactoryContext """ Retrieves the factory context object associated to a factory. Creates it if needed :param cls: The factory class :return: The factory class context """ context = getattr(cls, constants.IPOPO_FACTORY_CONTEXT, None) i...
[ "def", "get_factory_context", "(", "cls", ")", ":", "# type: (type) -> FactoryContext", "context", "=", "getattr", "(", "cls", ",", "constants", ".", "IPOPO_FACTORY_CONTEXT", ",", "None", ")", "if", "context", "is", "None", ":", "# Class not yet manipulated", "conte...
Retrieves the factory context object associated to a factory. Creates it if needed :param cls: The factory class :return: The factory class context
[ "Retrieves", "the", "factory", "context", "object", "associated", "to", "a", "factory", ".", "Creates", "it", "if", "needed" ]
python
train
31.153846
sdispater/orator
orator/utils/url.py
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/utils/url.py#L144-L169
def translate_connect_args(self, names=[], **kw): """Translate url attributes into a dictionary of connection arguments. Returns attributes of this url (`host`, `database`, `username`, `password`, `port`) as a plain dictionary. The attribute names are used as the keys by default. Unse...
[ "def", "translate_connect_args", "(", "self", ",", "names", "=", "[", "]", ",", "*", "*", "kw", ")", ":", "translated", "=", "{", "}", "attribute_names", "=", "[", "\"host\"", ",", "\"database\"", ",", "\"username\"", ",", "\"password\"", ",", "\"port\"", ...
Translate url attributes into a dictionary of connection arguments. Returns attributes of this url (`host`, `database`, `username`, `password`, `port`) as a plain dictionary. The attribute names are used as the keys by default. Unset or false attributes are omitted from the final dict...
[ "Translate", "url", "attributes", "into", "a", "dictionary", "of", "connection", "arguments", "." ]
python
train
40.692308
benley/butcher
butcher/targets/base.py
https://github.com/benley/butcher/blob/8b18828ea040af56b7835beab5fd03eab23cc9ee/butcher/targets/base.py#L294-L301
def composed_deps(self): """Dependencies of this build target.""" if 'deps' in self.params: param_deps = self.params['deps'] or [] deps = [self.makeaddress(dep) for dep in param_deps] return deps else: return None
[ "def", "composed_deps", "(", "self", ")", ":", "if", "'deps'", "in", "self", ".", "params", ":", "param_deps", "=", "self", ".", "params", "[", "'deps'", "]", "or", "[", "]", "deps", "=", "[", "self", ".", "makeaddress", "(", "dep", ")", "for", "de...
Dependencies of this build target.
[ "Dependencies", "of", "this", "build", "target", "." ]
python
train
34.75
bcbio/bcbio-nextgen
bcbio/variation/gatkfilter.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/gatkfilter.py#L45-L51
def _cnn_filter(in_file, vrn_files, data): """Perform CNN filtering on input VCF using pre-trained models. """ #tensor_type = "reference" # 1D, reference sequence tensor_type = "read_tensor" # 2D, reads, flags, mapping quality score_file = _cnn_score_variants(in_file, tensor_type, data) return...
[ "def", "_cnn_filter", "(", "in_file", ",", "vrn_files", ",", "data", ")", ":", "#tensor_type = \"reference\" # 1D, reference sequence", "tensor_type", "=", "\"read_tensor\"", "# 2D, reads, flags, mapping quality", "score_file", "=", "_cnn_score_variants", "(", "in_file", ","...
Perform CNN filtering on input VCF using pre-trained models.
[ "Perform", "CNN", "filtering", "on", "input", "VCF", "using", "pre", "-", "trained", "models", "." ]
python
train
54
saltstack/salt
salt/modules/mac_xattr.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_xattr.py#L205-L229
def clear(path): ''' Causes the all attributes on the file/directory to be removed :param str path: The file(s) to get attributes from :return: True if successful, otherwise False :raises: CommandExecutionError on file not found or any other unknown error CLI Example: .. code-block:: ba...
[ "def", "clear", "(", "path", ")", ":", "cmd", "=", "'xattr -c \"{0}\"'", ".", "format", "(", "path", ")", "try", ":", "salt", ".", "utils", ".", "mac_utils", ".", "execute_return_success", "(", "cmd", ")", "except", "CommandExecutionError", "as", "exc", ":...
Causes the all attributes on the file/directory to be removed :param str path: The file(s) to get attributes from :return: True if successful, otherwise False :raises: CommandExecutionError on file not found or any other unknown error CLI Example: .. code-block:: bash salt '*' xattr.de...
[ "Causes", "the", "all", "attributes", "on", "the", "file", "/", "directory", "to", "be", "removed" ]
python
train
29.68
saltstack/salt
salt/modules/mac_timezone.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L78-L105
def set_date(date): ''' Set the current month, day, and year :param str date: The date to set. Valid date formats are: - %m:%d:%y - %m:%d:%Y - %m/%d/%y - %m/%d/%Y :return: True if successful, False if not :rtype: bool :raises: SaltInvocationError on Invalid Da...
[ "def", "set_date", "(", "date", ")", ":", "date_format", "=", "_get_date_time_format", "(", "date", ")", "dt_obj", "=", "datetime", ".", "strptime", "(", "date", ",", "date_format", ")", "cmd", "=", "'systemsetup -setdate {0}'", ".", "format", "(", "dt_obj", ...
Set the current month, day, and year :param str date: The date to set. Valid date formats are: - %m:%d:%y - %m:%d:%Y - %m/%d/%y - %m/%d/%Y :return: True if successful, False if not :rtype: bool :raises: SaltInvocationError on Invalid Date format :raises: CommandEx...
[ "Set", "the", "current", "month", "day", "and", "year" ]
python
train
24.142857
ryukinix/decorating
decorating/animation.py
https://github.com/ryukinix/decorating/blob/df78c3f87800205701704c0bc0fb9b6bb908ba7e/decorating/animation.py#L296-L315
def auto_message(self, args): """Try guess the message by the args passed args: a set of args passed on the wrapper __call__ in the definition above. if the object already have some message (defined in __init__), we don't change that. If the first arg is a function, so is...
[ "def", "auto_message", "(", "self", ",", "args", ")", ":", "if", "any", "(", "args", ")", "and", "callable", "(", "args", "[", "0", "]", ")", "and", "not", "self", ".", "message", ":", "return", "args", "[", "0", "]", ".", "__name__", "elif", "no...
Try guess the message by the args passed args: a set of args passed on the wrapper __call__ in the definition above. if the object already have some message (defined in __init__), we don't change that. If the first arg is a function, so is decorated without argument, use ...
[ "Try", "guess", "the", "message", "by", "the", "args", "passed" ]
python
train
36.5
chaimleib/intervaltree
intervaltree/intervaltree.py
https://github.com/chaimleib/intervaltree/blob/ffb2b1667f8b832e89324a75a175be8440504c9d/intervaltree/intervaltree.py#L904-L918
def print_structure(self, tostring=False): """ ## FOR DEBUGGING ONLY ## Pretty-prints the structure of the tree. If tostring is true, prints nothing and returns a string. :rtype: None or str """ if self.top_node: return self.top_node.print_structure(to...
[ "def", "print_structure", "(", "self", ",", "tostring", "=", "False", ")", ":", "if", "self", ".", "top_node", ":", "return", "self", ".", "top_node", ".", "print_structure", "(", "tostring", "=", "tostring", ")", "else", ":", "result", "=", "\"<empty Inte...
## FOR DEBUGGING ONLY ## Pretty-prints the structure of the tree. If tostring is true, prints nothing and returns a string. :rtype: None or str
[ "##", "FOR", "DEBUGGING", "ONLY", "##", "Pretty", "-", "prints", "the", "structure", "of", "the", "tree", ".", "If", "tostring", "is", "true", "prints", "nothing", "and", "returns", "a", "string", ".", ":", "rtype", ":", "None", "or", "str" ]
python
train
32.466667
moble/quaternion
__init__.py
https://github.com/moble/quaternion/blob/7a323e81b391d6892e2874073e495e0beb057e85/__init__.py#L507-L559
def from_spherical_coords(theta_phi, phi=None): """Return the quaternion corresponding to these spherical coordinates Assumes the spherical coordinates correspond to the quaternion R via R = exp(phi*z/2) * exp(theta*y/2) The angles naturally must be in radians for this to make any sense. Not...
[ "def", "from_spherical_coords", "(", "theta_phi", ",", "phi", "=", "None", ")", ":", "# Figure out the input angles from either type of input", "if", "phi", "is", "None", ":", "theta_phi", "=", "np", ".", "asarray", "(", "theta_phi", ",", "dtype", "=", "np", "."...
Return the quaternion corresponding to these spherical coordinates Assumes the spherical coordinates correspond to the quaternion R via R = exp(phi*z/2) * exp(theta*y/2) The angles naturally must be in radians for this to make any sense. Note that this quaternion rotates `z` onto the point with ...
[ "Return", "the", "quaternion", "corresponding", "to", "these", "spherical", "coordinates" ]
python
train
41.056604
StackStorm/pybind
pybind/nos/v6_0_2f/interface/port_channel/switchport/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/interface/port_channel/switchport/__init__.py#L254-L275
def _set_trunk_private_vlan_classification(self, v, load=False): """ Setter method for trunk_private_vlan_classification, mapped from YANG variable /interface/port_channel/switchport/trunk_private_vlan_classification (container) If this variable is read-only (config: false) in the source YANG file, then...
[ "def", "_set_trunk_private_vlan_classification", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(...
Setter method for trunk_private_vlan_classification, mapped from YANG variable /interface/port_channel/switchport/trunk_private_vlan_classification (container) If this variable is read-only (config: false) in the source YANG file, then _set_trunk_private_vlan_classification is considered as a private method...
[ "Setter", "method", "for", "trunk_private_vlan_classification", "mapped", "from", "YANG", "variable", "/", "interface", "/", "port_channel", "/", "switchport", "/", "trunk_private_vlan_classification", "(", "container", ")", "If", "this", "variable", "is", "read", "-"...
python
train
90.863636
lpantano/seqcluster
seqcluster/libs/thinkbayes.py
https://github.com/lpantano/seqcluster/blob/774e23add8cd4fdc83d626cea3bd1f458e7d060d/seqcluster/libs/thinkbayes.py#L881-L889
def Copy(self, name=None): """Returns a copy of this Cdf. Args: name: string name for the new Cdf """ if name is None: name = self.name return Cdf(list(self.xs), list(self.ps), name)
[ "def", "Copy", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "self", ".", "name", "return", "Cdf", "(", "list", "(", "self", ".", "xs", ")", ",", "list", "(", "self", ".", "ps", ")", ",", "name...
Returns a copy of this Cdf. Args: name: string name for the new Cdf
[ "Returns", "a", "copy", "of", "this", "Cdf", "." ]
python
train
26.555556
mitsei/dlkit
dlkit/json_/logging_/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L861-L876
def get_log_lookup_session(self, proxy): """Gets the ``OsidSession`` associated with the log lookup service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogLookupSession) - a ``LogLookupSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationF...
[ "def", "get_log_lookup_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_lookup", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "LogLookupSession", ...
Gets the ``OsidSession`` associated with the log lookup service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogLookupSession) - a ``LogLookupSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to complete request raise: U...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "log", "lookup", "service", "." ]
python
train
46
hugapi/hug
hug/types.py
https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/types.py#L168-L176
def accept(kind, doc=None, error_text=None, exception_handlers=empty.dict, accept_context=False): """Allows quick wrapping of any Python type cast function for use as a hug type annotation""" return create( doc, error_text, exception_handlers=exception_handlers, chain=False, ...
[ "def", "accept", "(", "kind", ",", "doc", "=", "None", ",", "error_text", "=", "None", ",", "exception_handlers", "=", "empty", ".", "dict", ",", "accept_context", "=", "False", ")", ":", "return", "create", "(", "doc", ",", "error_text", ",", "exception...
Allows quick wrapping of any Python type cast function for use as a hug type annotation
[ "Allows", "quick", "wrapping", "of", "any", "Python", "type", "cast", "function", "for", "use", "as", "a", "hug", "type", "annotation" ]
python
train
39.666667
fabioz/PyDev.Debugger
pydev_ipython/inputhookwx.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydev_ipython/inputhookwx.py#L78-L102
def inputhook_wx2(): """Run the wx event loop, polling for stdin. This version runs the wx eventloop for an undetermined amount of time, during which it periodically checks to see if anything is ready on stdin. If anything is ready on stdin, the event loop exits. The argument to elr.Run controls ...
[ "def", "inputhook_wx2", "(", ")", ":", "try", ":", "app", "=", "wx", ".", "GetApp", "(", ")", "# @UndefinedVariable", "if", "app", "is", "not", "None", ":", "assert", "wx", ".", "Thread_IsMain", "(", ")", "# @UndefinedVariable", "elr", "=", "EventLoopRunne...
Run the wx event loop, polling for stdin. This version runs the wx eventloop for an undetermined amount of time, during which it periodically checks to see if anything is ready on stdin. If anything is ready on stdin, the event loop exits. The argument to elr.Run controls how often the event loop loo...
[ "Run", "the", "wx", "event", "loop", "polling", "for", "stdin", "." ]
python
train
44.76
pandas-dev/pandas
pandas/core/series.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L2182-L2210
def cov(self, other, min_periods=None): """ Compute covariance with Series, excluding missing values. Parameters ---------- other : Series Series with which to compute the covariance. min_periods : int, optional Minimum number of observations need...
[ "def", "cov", "(", "self", ",", "other", ",", "min_periods", "=", "None", ")", ":", "this", ",", "other", "=", "self", ".", "align", "(", "other", ",", "join", "=", "'inner'", ",", "copy", "=", "False", ")", "if", "len", "(", "this", ")", "==", ...
Compute covariance with Series, excluding missing values. Parameters ---------- other : Series Series with which to compute the covariance. min_periods : int, optional Minimum number of observations needed to have a valid result. Returns ------- ...
[ "Compute", "covariance", "with", "Series", "excluding", "missing", "values", "." ]
python
train
31.827586
etingof/pyasn1
pyasn1/type/tag.py
https://github.com/etingof/pyasn1/blob/25cf116ef8d11bb0e08454c0f3635c9f4002c2d6/pyasn1/type/tag.py#L306-L325
def isSuperTagSetOf(self, tagSet): """Test type relationship against given *TagSet* The callee is considered to be a supertype of given *TagSet* tag-wise if all tags in *TagSet* are present in the callee and they are in the same order. Parameters ---------- tagS...
[ "def", "isSuperTagSetOf", "(", "self", ",", "tagSet", ")", ":", "if", "len", "(", "tagSet", ")", "<", "self", ".", "__lenOfSuperTags", ":", "return", "False", "return", "self", ".", "__superTags", "==", "tagSet", "[", ":", "self", ".", "__lenOfSuperTags", ...
Test type relationship against given *TagSet* The callee is considered to be a supertype of given *TagSet* tag-wise if all tags in *TagSet* are present in the callee and they are in the same order. Parameters ---------- tagSet: :class:`~pyasn1.type.tag.TagSet` ...
[ "Test", "type", "relationship", "against", "given", "*", "TagSet", "*" ]
python
train
33.15
sourcesimian/pyTelegramBotAPI
TelegramBotAPI/types/field.py
https://github.com/sourcesimian/pyTelegramBotAPI/blob/bf233ac7923cc97c2036a604922c8be57817db40/TelegramBotAPI/types/field.py#L24-L36
def setup_types(self): """ The Message object has a circular reference on itself, thus we have to allow Type referencing by name. Here we lookup any Types referenced by name and replace with the real class. """ def load(t): from TelegramBotAPI.types.type impor...
[ "def", "setup_types", "(", "self", ")", ":", "def", "load", "(", "t", ")", ":", "from", "TelegramBotAPI", ".", "types", ".", "type", "import", "Type", "if", "isinstance", "(", "t", ",", "str", ")", ":", "return", "Type", ".", "_type", "(", "t", ")"...
The Message object has a circular reference on itself, thus we have to allow Type referencing by name. Here we lookup any Types referenced by name and replace with the real class.
[ "The", "Message", "object", "has", "a", "circular", "reference", "on", "itself", "thus", "we", "have", "to", "allow", "Type", "referencing", "by", "name", ".", "Here", "we", "lookup", "any", "Types", "referenced", "by", "name", "and", "replace", "with", "t...
python
test
38.230769
StackStorm/pybind
pybind/slxos/v17r_1_01a/isis_state/interface_detail/isis_intf/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/isis_state/interface_detail/isis_intf/__init__.py#L800-L823
def _set_reverse_metric_info(self, v, load=False): """ Setter method for reverse_metric_info, mapped from YANG variable /isis_state/interface_detail/isis_intf/reverse_metric_info (container) If this variable is read-only (config: false) in the source YANG file, then _set_reverse_metric_info is considere...
[ "def", "_set_reverse_metric_info", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",...
Setter method for reverse_metric_info, mapped from YANG variable /isis_state/interface_detail/isis_intf/reverse_metric_info (container) If this variable is read-only (config: false) in the source YANG file, then _set_reverse_metric_info is considered as a private method. Backends looking to populate this va...
[ "Setter", "method", "for", "reverse_metric_info", "mapped", "from", "YANG", "variable", "/", "isis_state", "/", "interface_detail", "/", "isis_intf", "/", "reverse_metric_info", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "co...
python
train
81.166667
consbio/gis-metadata-parser
gis_metadata/utils.py
https://github.com/consbio/gis-metadata-parser/blob/59eefb2e51cd4d8cc3e94623a2167499ca9ef70f/gis_metadata/utils.py#L765-L771
def get_prop(self, prop): """ Calls the getter with no arguments and returns its value """ if self._parser is None: raise ConfigurationError('Cannot call ParserProperty."get_prop" with no parser configured') return self._parser(prop) if prop else self._parser()
[ "def", "get_prop", "(", "self", ",", "prop", ")", ":", "if", "self", ".", "_parser", "is", "None", ":", "raise", "ConfigurationError", "(", "'Cannot call ParserProperty.\"get_prop\" with no parser configured'", ")", "return", "self", ".", "_parser", "(", "prop", "...
Calls the getter with no arguments and returns its value
[ "Calls", "the", "getter", "with", "no", "arguments", "and", "returns", "its", "value" ]
python
train
41.857143
bcbio/bcbio-nextgen
bcbio/structural/prioritize.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/prioritize.py#L51-L60
def is_gene_list(bed_file): """Check if the file is only a list of genes, not a BED """ with utils.open_gzipsafe(bed_file) as in_handle: for line in in_handle: if not line.startswith("#"): if len(line.split()) == 1: return True else: ...
[ "def", "is_gene_list", "(", "bed_file", ")", ":", "with", "utils", ".", "open_gzipsafe", "(", "bed_file", ")", "as", "in_handle", ":", "for", "line", "in", "in_handle", ":", "if", "not", "line", ".", "startswith", "(", "\"#\"", ")", ":", "if", "len", "...
Check if the file is only a list of genes, not a BED
[ "Check", "if", "the", "file", "is", "only", "a", "list", "of", "genes", "not", "a", "BED" ]
python
train
34.1
beerfactory/hbmqtt
hbmqtt/broker.py
https://github.com/beerfactory/hbmqtt/blob/4aa6fe982141abc3c54e9f4d7b981ab3eba0a13c/hbmqtt/broker.py#L532-L562
def authenticate(self, session: Session, listener): """ This method call the authenticate method on registered plugins to test user authentication. User is considered authenticated if all plugins called returns True. Plugins authenticate() method are supposed to return : - True ...
[ "def", "authenticate", "(", "self", ",", "session", ":", "Session", ",", "listener", ")", ":", "auth_plugins", "=", "None", "auth_config", "=", "self", ".", "config", ".", "get", "(", "'auth'", ",", "None", ")", "if", "auth_config", ":", "auth_plugins", ...
This method call the authenticate method on registered plugins to test user authentication. User is considered authenticated if all plugins called returns True. Plugins authenticate() method are supposed to return : - True if user is authentication succeed - False if user authenticatio...
[ "This", "method", "call", "the", "authenticate", "method", "on", "registered", "plugins", "to", "test", "user", "authentication", ".", "User", "is", "considered", "authenticated", "if", "all", "plugins", "called", "returns", "True", ".", "Plugins", "authenticate",...
python
train
44.258065
rapidpro/dash
dash/orgs/models.py
https://github.com/rapidpro/dash/blob/e9dc05b31b86fe3fe72e956975d1ee0a275ac016/dash/orgs/models.py#L292-L298
def generate_random_string(cls, length): """ Generatesa a [length] characters alpha numeric secret """ # avoid things that could be mistaken ex: 'I' and '1' letters = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ" return "".join([random.choice(letters) for _ in range(length)])
[ "def", "generate_random_string", "(", "cls", ",", "length", ")", ":", "# avoid things that could be mistaken ex: 'I' and '1'", "letters", "=", "\"23456789ABCDEFGHJKLMNPQRSTUVWXYZ\"", "return", "\"\"", ".", "join", "(", "[", "random", ".", "choice", "(", "letters", ")", ...
Generatesa a [length] characters alpha numeric secret
[ "Generatesa", "a", "[", "length", "]", "characters", "alpha", "numeric", "secret" ]
python
train
43.857143
FactoryBoy/factory_boy
factory/base.py
https://github.com/FactoryBoy/factory_boy/blob/edaa7c7f5a14065b229927903bd7989cc93cd069/factory/base.py#L163-L176
def _build_default_options(self): """"Provide the default value for all allowed fields. Custom FactoryOptions classes should override this method to update() its return value. """ return [ OptionDefault('model', None, inherit=True), OptionDefault('abstrac...
[ "def", "_build_default_options", "(", "self", ")", ":", "return", "[", "OptionDefault", "(", "'model'", ",", "None", ",", "inherit", "=", "True", ")", ",", "OptionDefault", "(", "'abstract'", ",", "False", ",", "inherit", "=", "False", ")", ",", "OptionDef...
Provide the default value for all allowed fields. Custom FactoryOptions classes should override this method to update() its return value.
[ "Provide", "the", "default", "value", "for", "all", "allowed", "fields", "." ]
python
train
42.142857
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/query.py
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/query.py#L142-L145
def has_client_id(self, id): """Returns True if we have a client with a certain integer identifier""" return self.query(Client).filter(Client.id==id).count() != 0
[ "def", "has_client_id", "(", "self", ",", "id", ")", ":", "return", "self", ".", "query", "(", "Client", ")", ".", "filter", "(", "Client", ".", "id", "==", "id", ")", ".", "count", "(", ")", "!=", "0" ]
Returns True if we have a client with a certain integer identifier
[ "Returns", "True", "if", "we", "have", "a", "client", "with", "a", "certain", "integer", "identifier" ]
python
train
42
infothrill/python-dyndnsc
dyndnsc/detector/command.py
https://github.com/infothrill/python-dyndnsc/blob/2196d48aa6098da9835a7611fbdb0b5f0fbf51e4/dyndnsc/detector/command.py#L35-L46
def detect(self): """Detect and return the IP address.""" if PY3: # py23 import subprocess # noqa: S404 @UnresolvedImport pylint: disable=import-error else: import commands as subprocess # @UnresolvedImport pylint: disable=import-error try: theip = ...
[ "def", "detect", "(", "self", ")", ":", "if", "PY3", ":", "# py23", "import", "subprocess", "# noqa: S404 @UnresolvedImport pylint: disable=import-error", "else", ":", "import", "commands", "as", "subprocess", "# @UnresolvedImport pylint: disable=import-error", "try", ":", ...
Detect and return the IP address.
[ "Detect", "and", "return", "the", "IP", "address", "." ]
python
train
39.333333
CalebBell/thermo
thermo/utils.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/utils.py#L3160-L3197
def set_user_method(self, user_methods, forced=False): r'''Method to set the T, P, and composition dependent property methods desired for consideration by the user. Can be used to exclude certain methods which might have unacceptable accuracy. As a side effect, the previously selected...
[ "def", "set_user_method", "(", "self", ",", "user_methods", ",", "forced", "=", "False", ")", ":", "# Accept either a string or a list of methods, and whether", "# or not to only consider the false methods", "if", "isinstance", "(", "user_methods", ",", "str", ")", ":", "...
r'''Method to set the T, P, and composition dependent property methods desired for consideration by the user. Can be used to exclude certain methods which might have unacceptable accuracy. As a side effect, the previously selected method is removed when this method is called to ensure...
[ "r", "Method", "to", "set", "the", "T", "P", "and", "composition", "dependent", "property", "methods", "desired", "for", "consideration", "by", "the", "user", ".", "Can", "be", "used", "to", "exclude", "certain", "methods", "which", "might", "have", "unaccep...
python
valid
45.684211
pypa/pipenv
pipenv/vendor/yarg/client.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/client.py#L32-L54
def get(package_name, pypi_server="https://pypi.python.org/pypi/"): """ Constructs a request to the PyPI server and returns a :class:`yarg.package.Package`. :param package_name: case sensitive name of the package on the PyPI server. :param pypi_server: (option) URL to the PyPI server. >>> ...
[ "def", "get", "(", "package_name", ",", "pypi_server", "=", "\"https://pypi.python.org/pypi/\"", ")", ":", "if", "not", "pypi_server", ".", "endswith", "(", "\"/\"", ")", ":", "pypi_server", "=", "pypi_server", "+", "\"/\"", "response", "=", "requests", ".", "...
Constructs a request to the PyPI server and returns a :class:`yarg.package.Package`. :param package_name: case sensitive name of the package on the PyPI server. :param pypi_server: (option) URL to the PyPI server. >>> import yarg >>> package = yarg.get('yarg') <Package yarg>
[ "Constructs", "a", "request", "to", "the", "PyPI", "server", "and", "returns", "a", ":", "class", ":", "yarg", ".", "package", ".", "Package", "." ]
python
train
38.26087
saltstack/salt
salt/cli/salt.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L364-L380
def _output_ret(self, ret, out, retcode=0): ''' Print the output from a single return to the terminal ''' import salt.output # Handle special case commands if self.config['fun'] == 'sys.doc' and not isinstance(ret, Exception): self._print_docs(ret) els...
[ "def", "_output_ret", "(", "self", ",", "ret", ",", "out", ",", "retcode", "=", "0", ")", ":", "import", "salt", ".", "output", "# Handle special case commands", "if", "self", ".", "config", "[", "'fun'", "]", "==", "'sys.doc'", "and", "not", "isinstance",...
Print the output from a single return to the terminal
[ "Print", "the", "output", "from", "a", "single", "return", "to", "the", "terminal" ]
python
train
39.764706
richardkiss/pycoin
pycoin/networks/ParseAPI.py
https://github.com/richardkiss/pycoin/blob/1e8d0d9fe20ce0347b97847bb529cd1bd84c7442/pycoin/networks/ParseAPI.py#L307-L316
def secret(self, s): """ Parse text either a private key or a private hierarchical key. Return a subclass of :class:`Key <pycoin.key.Key>`, or None. """ s = parseable_str(s) for f in [self.private_key, self.hierarchical_key]: v = f(s) if v: ...
[ "def", "secret", "(", "self", ",", "s", ")", ":", "s", "=", "parseable_str", "(", "s", ")", "for", "f", "in", "[", "self", ".", "private_key", ",", "self", ".", "hierarchical_key", "]", ":", "v", "=", "f", "(", "s", ")", "if", "v", ":", "return...
Parse text either a private key or a private hierarchical key. Return a subclass of :class:`Key <pycoin.key.Key>`, or None.
[ "Parse", "text", "either", "a", "private", "key", "or", "a", "private", "hierarchical", "key", ".", "Return", "a", "subclass", "of", ":", "class", ":", "Key", "<pycoin", ".", "key", ".", "Key", ">", "or", "None", "." ]
python
train
32.8
tomi77/python-t77-date
t77_date/timedelta.py
https://github.com/tomi77/python-t77-date/blob/b4b12ce6a02884fb62460f6b9068e7fa28979fce/t77_date/timedelta.py#L15-L35
def timedelta_to_seconds(value, with_microseconds=False): """ Convert datetime.timedelta to seconds :param value: timedelta to convert :type value: datetime.timedelta :param with_microseconds: :type with_microseconds: bool :return: seconds/seconds with microseconds or None if val is None ...
[ "def", "timedelta_to_seconds", "(", "value", ",", "with_microseconds", "=", "False", ")", ":", "if", "value", "is", "None", ":", "return", "None", "if", "not", "isinstance", "(", "value", ",", "timedelta", ")", ":", "raise", "TypeError", "(", "'value must be...
Convert datetime.timedelta to seconds :param value: timedelta to convert :type value: datetime.timedelta :param with_microseconds: :type with_microseconds: bool :return: seconds/seconds with microseconds or None if val is None :rtype: int/float/None :raise: TypeError when val is not timedelt...
[ "Convert", "datetime", ".", "timedelta", "to", "seconds", ":", "param", "value", ":", "timedelta", "to", "convert", ":", "type", "value", ":", "datetime", ".", "timedelta", ":", "param", "with_microseconds", ":", ":", "type", "with_microseconds", ":", "bool", ...
python
train
33.571429
Spinmob/spinmob
egg/_gui.py
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1565-L1570
def update(self, dictionary=None, **kwargs): """ Adds/overwrites all the keys and values from the dictionary. """ if not dictionary == None: kwargs.update(dictionary) for k in list(kwargs.keys()): self[k] = kwargs[k]
[ "def", "update", "(", "self", ",", "dictionary", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "dictionary", "==", "None", ":", "kwargs", ".", "update", "(", "dictionary", ")", "for", "k", "in", "list", "(", "kwargs", ".", "keys", "(...
Adds/overwrites all the keys and values from the dictionary.
[ "Adds", "/", "overwrites", "all", "the", "keys", "and", "values", "from", "the", "dictionary", "." ]
python
train
41.833333
yunpian/yunpian-python-sdk
yunpian_python_sdk/ypclient.py
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L59-L64
def custom_conf(self, conf): '''custom apikey and http parameters''' if conf: for (key, val) in conf.items(): self.__conf[key] = val return self
[ "def", "custom_conf", "(", "self", ",", "conf", ")", ":", "if", "conf", ":", "for", "(", "key", ",", "val", ")", "in", "conf", ".", "items", "(", ")", ":", "self", ".", "__conf", "[", "key", "]", "=", "val", "return", "self" ]
custom apikey and http parameters
[ "custom", "apikey", "and", "http", "parameters" ]
python
train
31.833333
bigchaindb/bigchaindb
bigchaindb/lib.py
https://github.com/bigchaindb/bigchaindb/blob/835fdfcf598918f76139e3b88ee33dd157acaaa7/bigchaindb/lib.py#L76-L90
def post_transaction(self, transaction, mode): """Submit a valid transaction to the mempool.""" if not mode or mode not in self.mode_list: raise ValidationError('Mode must be one of the following {}.' .format(', '.join(self.mode_list))) tx_dict = tr...
[ "def", "post_transaction", "(", "self", ",", "transaction", ",", "mode", ")", ":", "if", "not", "mode", "or", "mode", "not", "in", "self", ".", "mode_list", ":", "raise", "ValidationError", "(", "'Mode must be one of the following {}.'", ".", "format", "(", "'...
Submit a valid transaction to the mempool.
[ "Submit", "a", "valid", "transaction", "to", "the", "mempool", "." ]
python
train
43
peri-source/peri
peri/opt/addsubtract.py
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L309-L425
def remove_bad_particles(st, min_rad='calc', max_rad='calc', min_edge_dist=2.0, check_rad_cutoff=[3.5, 15], check_outside_im=True, tries=50, im_change_frac=0.2, **kwargs): """ Removes improperly-featured particles from the state, based on a combination of pa...
[ "def", "remove_bad_particles", "(", "st", ",", "min_rad", "=", "'calc'", ",", "max_rad", "=", "'calc'", ",", "min_edge_dist", "=", "2.0", ",", "check_rad_cutoff", "=", "[", "3.5", ",", "15", "]", ",", "check_outside_im", "=", "True", ",", "tries", "=", "...
Removes improperly-featured particles from the state, based on a combination of particle size and the change in error on removal. Parameters ----------- st : :class:`peri.states.State` The state to remove bad particles from. min_rad : Float, optional All particles with radius below ...
[ "Removes", "improperly", "-", "featured", "particles", "from", "the", "state", "based", "on", "a", "combination", "of", "particle", "size", "and", "the", "change", "in", "error", "on", "removal", "." ]
python
valid
40.111111
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_trilloam.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_trilloam.py#L38-L49
def l2traceroute_input_vlan_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") l2traceroute = ET.Element("l2traceroute") config = l2traceroute input = ET.SubElement(l2traceroute, "input") vlan_id = ET.SubElement(input, "vlan-id") ...
[ "def", "l2traceroute_input_vlan_id", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "l2traceroute", "=", "ET", ".", "Element", "(", "\"l2traceroute\"", ")", "config", "=", "l2traceroute", "input",...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
36.333333
hobson/aima
aima/nlp.py
https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/nlp.py#L173-L178
def extender(self, edge): "See what edges can be extended by this edge." (j, k, B, _, _) = edge for (i, j, A, alpha, B1b) in self.chart[j]: if B1b and B == B1b[0]: self.add_edge([i, k, A, alpha + [edge], B1b[1:]])
[ "def", "extender", "(", "self", ",", "edge", ")", ":", "(", "j", ",", "k", ",", "B", ",", "_", ",", "_", ")", "=", "edge", "for", "(", "i", ",", "j", ",", "A", ",", "alpha", ",", "B1b", ")", "in", "self", ".", "chart", "[", "j", "]", ":...
See what edges can be extended by this edge.
[ "See", "what", "edges", "can", "be", "extended", "by", "this", "edge", "." ]
python
valid
43.333333
saltstack/salt
salt/modules/boto_iam.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iam.py#L677-L689
def list_instance_profiles(path_prefix='/', region=None, key=None, keyid=None, profile=None): ''' List all IAM instance profiles, starting at the optional path. .. versionadded:: 2016.11.0 CLI Example: salt-call boto_iam.list_instance_profiles ''' p = get_al...
[ "def", "list_instance_profiles", "(", "path_prefix", "=", "'/'", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "p", "=", "get_all_instance_profiles", "(", "path_prefix", ",", "region"...
List all IAM instance profiles, starting at the optional path. .. versionadded:: 2016.11.0 CLI Example: salt-call boto_iam.list_instance_profiles
[ "List", "all", "IAM", "instance", "profiles", "starting", "at", "the", "optional", "path", "." ]
python
train
32.307692
apache/incubator-mxnet
python/mxnet/ndarray/ndarray.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/ndarray/ndarray.py#L775-L838
def _get_nd_basic_indexing(self, key): """This function is called when key is a slice, or an integer, or a tuple of slices or integers""" shape = self.shape if isinstance(key, integer_types): if key > shape[0] - 1: raise IndexError( 'index ...
[ "def", "_get_nd_basic_indexing", "(", "self", ",", "key", ")", ":", "shape", "=", "self", ".", "shape", "if", "isinstance", "(", "key", ",", "integer_types", ")", ":", "if", "key", ">", "shape", "[", "0", "]", "-", "1", ":", "raise", "IndexError", "(...
This function is called when key is a slice, or an integer, or a tuple of slices or integers
[ "This", "function", "is", "called", "when", "key", "is", "a", "slice", "or", "an", "integer", "or", "a", "tuple", "of", "slices", "or", "integers" ]
python
train
47.578125
notpushkin/rock
rock_cli/cli/register.py
https://github.com/notpushkin/rock/blob/c1451a7604b462c19e4929f0eb171cbcf23e50ab/rock_cli/cli/register.py#L7-L27
def cmd_register(phone): """ Войти в приложение с помощью SMS. """ if phone is None: phone = click.prompt("Номер телефона") r = rocket.devices.register.post(data={"phone": phone}) r = handle_error(r) id = r.json()["sms_verification"]["id"] code = click.prompt("Введите код из SM...
[ "def", "cmd_register", "(", "phone", ")", ":", "if", "phone", "is", "None", ":", "phone", "=", "click", ".", "prompt", "(", "\"Номер телефона\")", "", "r", "=", "rocket", ".", "devices", ".", "register", ".", "post", "(", "data", "=", "{", "\"phone\"",...
Войти в приложение с помощью SMS.
[ "Войти", "в", "приложение", "с", "помощью", "SMS", "." ]
python
train
27.285714
azogue/dataweb
dataweb/classdataweb.py
https://github.com/azogue/dataweb/blob/085035855df7cef0fe7725bbe9a706832344d946/dataweb/classdataweb.py#L310-L329
def append_delta_index(self, ts_data=None, data_delta=None, key=KEY_DATA): """Append columns with ∆T between rows to data.""" reasign = False if data_delta is None: if self.data is not None: data_delta = self.data[key] else: self.printif('N...
[ "def", "append_delta_index", "(", "self", ",", "ts_data", "=", "None", ",", "data_delta", "=", "None", ",", "key", "=", "KEY_DATA", ")", ":", "reasign", "=", "False", "if", "data_delta", "is", "None", ":", "if", "self", ".", "data", "is", "not", "None"...
Append columns with ∆T between rows to data.
[ "Append", "columns", "with", "∆T", "between", "rows", "to", "data", "." ]
python
train
45.9
mitsei/dlkit
dlkit/records/osid/base_records.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1702-L1715
def get_files_map(self): """stub""" files_map = {} if self.has_files(): for label in self.my_osid_object._my_map['fileIds']: asset_content = self._get_asset_content( Id(self.my_osid_object._my_map['fileIds'][label]['assetId']), ...
[ "def", "get_files_map", "(", "self", ")", ":", "files_map", "=", "{", "}", "if", "self", ".", "has_files", "(", ")", ":", "for", "label", "in", "self", ".", "my_osid_object", ".", "_my_map", "[", "'fileIds'", "]", ":", "asset_content", "=", "self", "."...
stub
[ "stub" ]
python
train
47.642857
jobovy/galpy
galpy/util/bovy_ars.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/util/bovy_ars.py#L36-L83
def bovy_ars(domain,isDomainFinite,abcissae,hx,hpx,nsamples=1, hxparams=(),maxn=100): """bovy_ars: Implementation of the Adaptive-Rejection Sampling algorithm by Gilks & Wild (1992): Adaptive Rejection Sampling for Gibbs Sampling, Applied Statistics, 41, 337 Based on Wild & Gilks (1993), Al...
[ "def", "bovy_ars", "(", "domain", ",", "isDomainFinite", ",", "abcissae", ",", "hx", ",", "hpx", ",", "nsamples", "=", "1", ",", "hxparams", "=", "(", ")", ",", "maxn", "=", "100", ")", ":", "#First set-up the upper and lower hulls", "hull", "=", "setup_hu...
bovy_ars: Implementation of the Adaptive-Rejection Sampling algorithm by Gilks & Wild (1992): Adaptive Rejection Sampling for Gibbs Sampling, Applied Statistics, 41, 337 Based on Wild & Gilks (1993), Algorithm AS 287: Adaptive Rejection Sampling from Log-concave Density Functions, Applied Statistics, 42...
[ "bovy_ars", ":", "Implementation", "of", "the", "Adaptive", "-", "Rejection", "Sampling", "algorithm", "by", "Gilks", "&", "Wild", "(", "1992", ")", ":", "Adaptive", "Rejection", "Sampling", "for", "Gibbs", "Sampling", "Applied", "Statistics", "41", "337", "Ba...
python
train
34.291667
pandas-dev/pandas
pandas/core/series.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L4403-L4412
def valid(self, inplace=False, **kwargs): """ Return Series without null values. .. deprecated:: 0.23.0 Use :meth:`Series.dropna` instead. """ warnings.warn("Method .valid will be removed in a future version. " "Use .dropna instead.", FutureWarn...
[ "def", "valid", "(", "self", ",", "inplace", "=", "False", ",", "*", "*", "kwargs", ")", ":", "warnings", ".", "warn", "(", "\"Method .valid will be removed in a future version. \"", "\"Use .dropna instead.\"", ",", "FutureWarning", ",", "stacklevel", "=", "2", ")...
Return Series without null values. .. deprecated:: 0.23.0 Use :meth:`Series.dropna` instead.
[ "Return", "Series", "without", "null", "values", "." ]
python
train
38.3
skymill/automated-ebs-snapshots
automated_ebs_snapshots/config_file_parser.py
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/config_file_parser.py#L9-L37
def get_configuration(filename): """ Read configuration file :type filename: str :param filename: Path to the configuration file """ logger.debug('Reading configuration from {}'.format(filename)) conf = SafeConfigParser() conf.read(filename) if not conf: logger.error('Configura...
[ "def", "get_configuration", "(", "filename", ")", ":", "logger", ".", "debug", "(", "'Reading configuration from {}'", ".", "format", "(", "filename", ")", ")", "conf", "=", "SafeConfigParser", "(", ")", "conf", ".", "read", "(", "filename", ")", "if", "not"...
Read configuration file :type filename: str :param filename: Path to the configuration file
[ "Read", "configuration", "file" ]
python
train
29.551724
domainaware/parsedmarc
parsedmarc/__init__.py
https://github.com/domainaware/parsedmarc/blob/ecc9fd434c23d896ccd1f35795ccc047f946ed05/parsedmarc/__init__.py#L636-L676
def parsed_forensic_reports_to_csv(reports): """ Converts one or more parsed forensic reports to flat CSV format, including headers Args: reports: A parsed forensic report or list of parsed forensic reports Returns: str: Parsed forensic report data in flat CSV format, including hea...
[ "def", "parsed_forensic_reports_to_csv", "(", "reports", ")", ":", "fields", "=", "[", "\"feedback_type\"", ",", "\"user_agent\"", ",", "\"version\"", ",", "\"original_envelope_id\"", ",", "\"original_mail_from\"", ",", "\"original_rcpt_to\"", ",", "\"arrival_date\"", ","...
Converts one or more parsed forensic reports to flat CSV format, including headers Args: reports: A parsed forensic report or list of parsed forensic reports Returns: str: Parsed forensic report data in flat CSV format, including headers
[ "Converts", "one", "or", "more", "parsed", "forensic", "reports", "to", "flat", "CSV", "format", "including", "headers" ]
python
test
42.073171
ambitioninc/kmatch
kmatch/kmatch.py
https://github.com/ambitioninc/kmatch/blob/22bb5f0c1d86d0e4a69bdf18f092f095934ebb0d/kmatch/kmatch.py#L164-L194
def get_field_keys(self, pattern=None): """ Builds a set of all field keys used in the pattern including nested fields. :param pattern: The kmatch pattern to get field keys from or None to use self.pattern :type pattern: list or None :returns: A set object of all field keys used...
[ "def", "get_field_keys", "(", "self", ",", "pattern", "=", "None", ")", ":", "# Use own pattern or passed in argument for recursion", "pattern", "=", "pattern", "or", "self", ".", "pattern", "# Validate the pattern so we can make assumptions about the data", "self", ".", "_...
Builds a set of all field keys used in the pattern including nested fields. :param pattern: The kmatch pattern to get field keys from or None to use self.pattern :type pattern: list or None :returns: A set object of all field keys used in the pattern :rtype: set
[ "Builds", "a", "set", "of", "all", "field", "keys", "used", "in", "the", "pattern", "including", "nested", "fields", "." ]
python
train
39.354839
PlatformStories/geojsontools
geojsontools/geojsontools.py
https://github.com/PlatformStories/geojsontools/blob/80bf5cdde017a14338ee3962d1b59523ef2efdf1/geojsontools/geojsontools.py#L35-L59
def split(input_file, file_1, file_2, no_in_first_file): ''' Split a geojson in two separate files. Args: input_file (str): Input filename. file_1 (str): Output file name 1. file_2 (str): Output file name 2. no_features (int): Number of features in input_file to go to file_1...
[ "def", "split", "(", "input_file", ",", "file_1", ",", "file_2", ",", "no_in_first_file", ")", ":", "# get feature collection", "with", "open", "(", "input_file", ")", "as", "f", ":", "feat_collection", "=", "geojson", ".", "load", "(", "f", ")", "features",...
Split a geojson in two separate files. Args: input_file (str): Input filename. file_1 (str): Output file name 1. file_2 (str): Output file name 2. no_features (int): Number of features in input_file to go to file_1. output_file (str): Output file name.
[ "Split", "a", "geojson", "in", "two", "separate", "files", "." ]
python
train
32.44
cosven/feeluown-core
fuocore/library.py
https://github.com/cosven/feeluown-core/blob/62dc64638f62971b16be0a75c0b8c7ae2999869e/fuocore/library.py#L59-L112
def list_song_standby(self, song, onlyone=True): """try to list all valid standby Search a song in all providers. The typical usage scenario is when a song is not available in one provider, we can try to acquire it from other providers. Standby choosing strategy: search from al...
[ "def", "list_song_standby", "(", "self", ",", "song", ",", "onlyone", "=", "True", ")", ":", "def", "get_score", "(", "standby", ")", ":", "score", "=", "1", "# 分数占比关系:", "# title + album > artist", "# artist > title > album", "if", "song", ".", "artists_name", ...
try to list all valid standby Search a song in all providers. The typical usage scenario is when a song is not available in one provider, we can try to acquire it from other providers. Standby choosing strategy: search from all providers, select two song from each provide. Thos...
[ "try", "to", "list", "all", "valid", "standby" ]
python
train
36.722222
Kozea/pygal
pygal/graph/graph.py
https://github.com/Kozea/pygal/blob/5e25c98a59a0642eecd9fcc5dbfeeb2190fbb5e7/pygal/graph/graph.py#L610-L630
def _compute_secondary(self): """Compute secondary axis min max and label positions""" # secondary y axis support if self.secondary_series and self._y_labels: y_pos = list(zip(*self._y_labels))[1] if self.include_x_axis: ymin = min(self._secondary_min, 0) ...
[ "def", "_compute_secondary", "(", "self", ")", ":", "# secondary y axis support", "if", "self", ".", "secondary_series", "and", "self", ".", "_y_labels", ":", "y_pos", "=", "list", "(", "zip", "(", "*", "self", ".", "_y_labels", ")", ")", "[", "1", "]", ...
Compute secondary axis min max and label positions
[ "Compute", "secondary", "axis", "min", "max", "and", "label", "positions" ]
python
train
43.238095
materialsproject/pymatgen
pymatgen/io/abinit/pseudos.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L99-L106
def as_pseudo(cls, obj): """ Convert obj into a pseudo. Accepts: * Pseudo object. * string defining a valid path. """ return obj if isinstance(obj, cls) else cls.from_file(obj)
[ "def", "as_pseudo", "(", "cls", ",", "obj", ")", ":", "return", "obj", "if", "isinstance", "(", "obj", ",", "cls", ")", "else", "cls", ".", "from_file", "(", "obj", ")" ]
Convert obj into a pseudo. Accepts: * Pseudo object. * string defining a valid path.
[ "Convert", "obj", "into", "a", "pseudo", ".", "Accepts", ":" ]
python
train
28.25
wavefrontHQ/python-client
wavefront_api_client/api/search_api.py
https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/api/search_api.py#L3354-L3375
def search_registered_query_deleted_for_facet(self, facet, **kwargs): # noqa: E501 """Lists the values of a specific facet over the customer's deleted derived metric definitions # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronou...
[ "def", "search_registered_query_deleted_for_facet", "(", "self", ",", "facet", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "...
Lists the values of a specific facet over the customer's deleted derived metric definitions # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.search_registered_query_del...
[ "Lists", "the", "values", "of", "a", "specific", "facet", "over", "the", "customer", "s", "deleted", "derived", "metric", "definitions", "#", "noqa", ":", "E501" ]
python
train
49.636364
briancappello/flask-unchained
flask_mail.py
https://github.com/briancappello/flask-unchained/blob/4d536cb90e2cc4829c1c05f2c74d3e22901a1399/flask_mail.py#L228-L266
def send(self, message, envelope_from=None): """Verifies and sends message. :param message: Message instance. :param envelope_from: Email address to be used in MAIL FROM command. """ assert message.send_to, "No recipients have been added" assert message.sender, ( ...
[ "def", "send", "(", "self", ",", "message", ",", "envelope_from", "=", "None", ")", ":", "assert", "message", ".", "send_to", ",", "\"No recipients have been added\"", "assert", "message", ".", "sender", ",", "(", "\"The message does not specify a sender and a default...
Verifies and sends message. :param message: Message instance. :param envelope_from: Email address to be used in MAIL FROM command.
[ "Verifies", "and", "sends", "message", "." ]
python
train
31.25641
chimpler/pyhocon
pyhocon/converter.py
https://github.com/chimpler/pyhocon/blob/e5b22a8e74e8f88e43cf9e9140cca5f2cd0ab4a3/pyhocon/converter.py#L237-L257
def convert_from_file(cls, input_file=None, output_file=None, output_format='json', indent=2, compact=False): """Convert to json, properties or yaml :param input_file: input file, if not specified stdin :param output_file: output file, if not specified stdout :param output_format: json,...
[ "def", "convert_from_file", "(", "cls", ",", "input_file", "=", "None", ",", "output_file", "=", "None", ",", "output_format", "=", "'json'", ",", "indent", "=", "2", ",", "compact", "=", "False", ")", ":", "if", "input_file", "is", "None", ":", "content...
Convert to json, properties or yaml :param input_file: input file, if not specified stdin :param output_file: output file, if not specified stdout :param output_format: json, properties or yaml :return: json, properties or yaml string representation
[ "Convert", "to", "json", "properties", "or", "yaml" ]
python
train
38.47619
RedFantom/ttkwidgets
ttkwidgets/timeline.py
https://github.com/RedFantom/ttkwidgets/blob/02150322060f867b6e59a175522ef84b09168019/ttkwidgets/timeline.py#L669-L686
def _time_show(self): """Show the time marker window""" if not self._time_visible: self._time_visible = True self._time_window = tk.Toplevel(self) self._time_window.attributes("-topmost", True) self._time_window.overrideredirect(True) self._tim...
[ "def", "_time_show", "(", "self", ")", ":", "if", "not", "self", ".", "_time_visible", ":", "self", ".", "_time_visible", "=", "True", "self", ".", "_time_window", "=", "tk", ".", "Toplevel", "(", "self", ")", "self", ".", "_time_window", ".", "attribute...
Show the time marker window
[ "Show", "the", "time", "marker", "window" ]
python
train
44.333333
nugget/python-insteonplm
insteonplm/states/cover.py
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/cover.py#L108-L112
def open(self): """Turn the device ON.""" open_command = StandardSend(self._address, COMMAND_LIGHT_ON_0X11_NONE, cmd2=0xff) self._send_method(open_command, self._open_message_received)
[ "def", "open", "(", "self", ")", ":", "open_command", "=", "StandardSend", "(", "self", ".", "_address", ",", "COMMAND_LIGHT_ON_0X11_NONE", ",", "cmd2", "=", "0xff", ")", "self", ".", "_send_method", "(", "open_command", ",", "self", ".", "_open_message_receiv...
Turn the device ON.
[ "Turn", "the", "device", "ON", "." ]
python
train
48
asmodehn/filefinder2
filefinder2/_fileloader2.py
https://github.com/asmodehn/filefinder2/blob/3f0b211ce11a34562e2a2160e039ae5290b68d6b/filefinder2/_fileloader2.py#L423-L462
def load_module(self, name): """Load a module from a file. """ # Implementation inspired from pytest.rewrite and importlib # If there is an existing module object named 'name' in # sys.modules, the loader must use that existing module. (Otherwise, # the reload() builtin ...
[ "def", "load_module", "(", "self", ",", "name", ")", ":", "# Implementation inspired from pytest.rewrite and importlib", "# If there is an existing module object named 'name' in", "# sys.modules, the loader must use that existing module. (Otherwise,", "# the reload() builtin will not work corr...
Load a module from a file.
[ "Load", "a", "module", "from", "a", "file", "." ]
python
train
54.9
pyviz/holoviews
holoviews/plotting/mpl/util.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/util.py#L71-L98
def validate(style, value, vectorized=True): """ Validates a style and associated value. Arguments --------- style: str The style to validate (e.g. 'color', 'size' or 'marker') value: The style value to validate vectorized: bool Whether validator should allow vectorized...
[ "def", "validate", "(", "style", ",", "value", ",", "vectorized", "=", "True", ")", ":", "validator", "=", "get_validator", "(", "style", ")", "if", "validator", "is", "None", ":", "return", "None", "if", "isinstance", "(", "value", ",", "(", "np", "."...
Validates a style and associated value. Arguments --------- style: str The style to validate (e.g. 'color', 'size' or 'marker') value: The style value to validate vectorized: bool Whether validator should allow vectorized setting Returns ------- valid: boolean or N...
[ "Validates", "a", "style", "and", "associated", "value", "." ]
python
train
26.535714
aws/sagemaker-containers
src/sagemaker_containers/_env.py
https://github.com/aws/sagemaker-containers/blob/0030f07abbaf22a55d986d97274d7a8d1aa1f10c/src/sagemaker_containers/_env.py#L285-L297
def num_gpus(): # type: () -> int """The number of gpus available in the current container. Returns: int: number of gpus available in the current container. """ try: cmd = shlex.split('nvidia-smi --list-gpus') output = subprocess.check_output(cmd).decode('utf-8') return...
[ "def", "num_gpus", "(", ")", ":", "# type: () -> int", "try", ":", "cmd", "=", "shlex", ".", "split", "(", "'nvidia-smi --list-gpus'", ")", "output", "=", "subprocess", ".", "check_output", "(", "cmd", ")", ".", "decode", "(", "'utf-8'", ")", "return", "su...
The number of gpus available in the current container. Returns: int: number of gpus available in the current container.
[ "The", "number", "of", "gpus", "available", "in", "the", "current", "container", "." ]
python
train
39.153846
lambdalisue/e4u
e4u/__init__.py
https://github.com/lambdalisue/e4u/blob/108635c5ba37e7ae33001adbf07a95878f31fd50/e4u/__init__.py#L21-L29
def reload(filename=None, url=r"https://raw.githubusercontent.com/googlei18n/emoji4unicode/master/data/emoji4unicode.xml", loader_class=None): u"""reload google's `emoji4unicode` project's xml file. must call this method first to use `e4u` library.""" if loader_class is None: loader_clas...
[ "def", "reload", "(", "filename", "=", "None", ",", "url", "=", "r\"https://raw.githubusercontent.com/googlei18n/emoji4unicode/master/data/emoji4unicode.xml\"", ",", "loader_class", "=", "None", ")", ":", "if", "loader_class", "is", "None", ":", "loader_class", "=", "lo...
u"""reload google's `emoji4unicode` project's xml file. must call this method first to use `e4u` library.
[ "u", "reload", "google", "s", "emoji4unicode", "project", "s", "xml", "file", ".", "must", "call", "this", "method", "first", "to", "use", "e4u", "library", "." ]
python
train
45.444444
UCL-INGI/INGInious
inginious/frontend/cookieless_app.py
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/cookieless_app.py#L94-L104
def get_homepath(self, ignore_session=False, force_cookieless=False): """ :param ignore_session: Ignore the cookieless session_id that should be put in the URL :param force_cookieless: Force the cookieless session; the link will include the session_creator if needed. """ if not i...
[ "def", "get_homepath", "(", "self", ",", "ignore_session", "=", "False", ",", "force_cookieless", "=", "False", ")", ":", "if", "not", "ignore_session", "and", "self", ".", "_session", ".", "get", "(", "\"session_id\"", ")", "is", "not", "None", "and", "se...
:param ignore_session: Ignore the cookieless session_id that should be put in the URL :param force_cookieless: Force the cookieless session; the link will include the session_creator if needed.
[ ":", "param", "ignore_session", ":", "Ignore", "the", "cookieless", "session_id", "that", "should", "be", "put", "in", "the", "URL", ":", "param", "force_cookieless", ":", "Force", "the", "cookieless", "session", ";", "the", "link", "will", "include", "the", ...
python
train
58.727273
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1432-L1449
def getEndTag(self): ''' getEndTag - returns the end tag representation as HTML string @return - String of end tag ''' # If this is a self-closing tag, we have no end tag (opens and closes in the start) if self.isSelfClosing is True: return '' ...
[ "def", "getEndTag", "(", "self", ")", ":", "# If this is a self-closing tag, we have no end tag (opens and closes in the start)", "if", "self", ".", "isSelfClosing", "is", "True", ":", "return", "''", "tagName", "=", "self", ".", "tagName", "# Do not add any indentation to ...
getEndTag - returns the end tag representation as HTML string @return - String of end tag
[ "getEndTag", "-", "returns", "the", "end", "tag", "representation", "as", "HTML", "string" ]
python
train
33.055556
DataBiosphere/toil
src/toil/utils/toilStatus.py
https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/utils/toilStatus.py#L189-L220
def getStatus(jobStoreName): """ Determine the status of a workflow. If the jobstore does not exist, this returns 'QUEUED', assuming it has not been created yet. Checks for the existence of files created in the toil.Leader.run(). In toil.Leader.run(), if a workflow completes wi...
[ "def", "getStatus", "(", "jobStoreName", ")", ":", "try", ":", "jobstore", "=", "Toil", ".", "resumeJobStore", "(", "jobStoreName", ")", "except", "NoSuchJobStoreException", ":", "return", "'QUEUED'", "except", "NoSuchFileException", ":", "return", "'QUEUED'", "tr...
Determine the status of a workflow. If the jobstore does not exist, this returns 'QUEUED', assuming it has not been created yet. Checks for the existence of files created in the toil.Leader.run(). In toil.Leader.run(), if a workflow completes with failed jobs, 'failed.log' is created, otherwis...
[ "Determine", "the", "status", "of", "a", "workflow", "." ]
python
train
37.375
zhanglab/psamm
psamm/importers/sbml.py
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/importers/sbml.py#L119-L123
def import_model(self, source): """Import and return model instance.""" model = super(NonstrictImporter, self).import_model(source) sbml.convert_sbml_model(model) return model
[ "def", "import_model", "(", "self", ",", "source", ")", ":", "model", "=", "super", "(", "NonstrictImporter", ",", "self", ")", ".", "import_model", "(", "source", ")", "sbml", ".", "convert_sbml_model", "(", "model", ")", "return", "model" ]
Import and return model instance.
[ "Import", "and", "return", "model", "instance", "." ]
python
train
40.6
pudo/jsonmapping
jsonmapping/statements.py
https://github.com/pudo/jsonmapping/blob/4cf0a20a393ba82e00651c6fd39522a67a0155de/jsonmapping/statements.py#L53-L71
def triplify(self, data, parent=None): """ Recursively generate statements from the data supplied. """ if data is None: return if self.is_object: for res in self._triplify_object(data, parent): yield res elif self.is_array: for item in...
[ "def", "triplify", "(", "self", ",", "data", ",", "parent", "=", "None", ")", ":", "if", "data", "is", "None", ":", "return", "if", "self", ".", "is_object", ":", "for", "res", "in", "self", ".", "_triplify_object", "(", "data", ",", "parent", ")", ...
Recursively generate statements from the data supplied.
[ "Recursively", "generate", "statements", "from", "the", "data", "supplied", "." ]
python
train
37.368421
remind101/stacker_blueprints
stacker_blueprints/empire/policies.py
https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/empire/policies.py#L260-L275
def runlogs_policy(log_group_ref): """Policy needed for Empire -> Cloudwatch logs to record run output.""" p = Policy( Statement=[ Statement( Effect=Allow, Resource=[ Join('', [ 'arn:aws:logs:*:*:log-group:', ...
[ "def", "runlogs_policy", "(", "log_group_ref", ")", ":", "p", "=", "Policy", "(", "Statement", "=", "[", "Statement", "(", "Effect", "=", "Allow", ",", "Resource", "=", "[", "Join", "(", "''", ",", "[", "'arn:aws:logs:*:*:log-group:'", ",", "log_group_ref", ...
Policy needed for Empire -> Cloudwatch logs to record run output.
[ "Policy", "needed", "for", "Empire", "-", ">", "Cloudwatch", "logs", "to", "record", "run", "output", "." ]
python
train
32.5
pylast/pylast
src/pylast/__init__.py
https://github.com/pylast/pylast/blob/a52f66d316797fc819b5f1d186d77f18ba97b4ff/src/pylast/__init__.py#L2473-L2482
def get_tagged_tracks(self, tag, limit=None, cacheable=True): """Returns the tracks tagged by a user.""" params = self._get_params() params["tag"] = tag params["taggingtype"] = "track" if limit: params["limit"] = limit doc = self._request(self.ws_prefix + ".g...
[ "def", "get_tagged_tracks", "(", "self", ",", "tag", ",", "limit", "=", "None", ",", "cacheable", "=", "True", ")", ":", "params", "=", "self", ".", "_get_params", "(", ")", "params", "[", "\"tag\"", "]", "=", "tag", "params", "[", "\"taggingtype\"", "...
Returns the tracks tagged by a user.
[ "Returns", "the", "tracks", "tagged", "by", "a", "user", "." ]
python
train
39.6