repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
mitsei/dlkit
dlkit/json_/assessment/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L305-L325
def has_previous_assessment_section(self, assessment_section_id): """Tests if there is a previous assessment section in the assessment following the given assessment section ``Id``. arg: assessment_section_id (osid.id.Id): ``Id`` of the ``AssessmentSection`` return: (boolean)...
[ "def", "has_previous_assessment_section", "(", "self", ",", "assessment_section_id", ")", ":", "try", ":", "self", ".", "get_previous_assessment_section", "(", "assessment_section_id", ")", "except", "errors", ".", "IllegalState", ":", "return", "False", "else", ":", ...
Tests if there is a previous assessment section in the assessment following the given assessment section ``Id``. arg: assessment_section_id (osid.id.Id): ``Id`` of the ``AssessmentSection`` return: (boolean) - ``true`` if there is a previous assessment section, ``fals...
[ "Tests", "if", "there", "is", "a", "previous", "assessment", "section", "in", "the", "assessment", "following", "the", "given", "assessment", "section", "Id", "." ]
python
train
rahul13ramesh/hidden_markov
hidden_markov/hmm_class.py
https://github.com/rahul13ramesh/hidden_markov/blob/6ba6012665f9e09c980ff70901604d051ba57dcc/hidden_markov/hmm_class.py#L513-L555
def log_prob(self,observations_list, quantities): """ Finds Weighted log probability of a list of observation sequences **Arguments**: :param observation_list: A nested list, or a list of lists :type observation_list: Contains a list multiple observation sequences. :param ...
[ "def", "log_prob", "(", "self", ",", "observations_list", ",", "quantities", ")", ":", "prob", "=", "0", "for", "q", ",", "obs", "in", "enumerate", "(", "observations_list", ")", ":", "temp", ",", "c_scale", "=", "self", ".", "_alpha_cal", "(", "obs", ...
Finds Weighted log probability of a list of observation sequences **Arguments**: :param observation_list: A nested list, or a list of lists :type observation_list: Contains a list multiple observation sequences. :param quantities: Number of times, each corresponding item in 'obser...
[ "Finds", "Weighted", "log", "probability", "of", "a", "list", "of", "observation", "sequences" ]
python
train
pypa/bandersnatch
src/bandersnatch/verify.py
https://github.com/pypa/bandersnatch/blob/8b702c3bc128c5a1cbdd18890adede2f7f17fad4/src/bandersnatch/verify.py#L197-L226
async def metadata_verify(config, args) -> int: """ Crawl all saved JSON metadata or online to check we have all packages if delete - generate a diff of unowned files """ all_package_files = [] # type: List[Path] loop = asyncio.get_event_loop() mirror_base = config.get("mirror", "directory") ...
[ "async", "def", "metadata_verify", "(", "config", ",", "args", ")", "->", "int", ":", "all_package_files", "=", "[", "]", "# type: List[Path]", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "mirror_base", "=", "config", ".", "get", "(", "\"mirror\...
Crawl all saved JSON metadata or online to check we have all packages if delete - generate a diff of unowned files
[ "Crawl", "all", "saved", "JSON", "metadata", "or", "online", "to", "check", "we", "have", "all", "packages", "if", "delete", "-", "generate", "a", "diff", "of", "unowned", "files" ]
python
train
keenlabs/KeenClient-Python
keen/client.py
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/client.py#L651-L675
def funnel(self, steps, timeframe=None, timezone=None, max_age=None, all_keys=False): """ Performs a Funnel query Returns an object containing the results for each step of the funnel. :param steps: array of dictionaries, one for each step. example: [{"event_collection":"signup","actor_...
[ "def", "funnel", "(", "self", ",", "steps", ",", "timeframe", "=", "None", ",", "timezone", "=", "None", ",", "max_age", "=", "None", ",", "all_keys", "=", "False", ")", ":", "params", "=", "self", ".", "get_params", "(", "steps", "=", "steps", ",", ...
Performs a Funnel query Returns an object containing the results for each step of the funnel. :param steps: array of dictionaries, one for each step. example: [{"event_collection":"signup","actor_property":"user.id"}, {"event_collection":"purchase","actor_property:"user.id"}] :...
[ "Performs", "a", "Funnel", "query" ]
python
train
Neurita/boyle
boyle/dicom/comparison.py
https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/dicom/comparison.py#L560-L593
def get_unique_field_values_per_group(self, field_name, field_to_use_as_key=None): """Return a dictionary where the key is the group key file path and the values are sets of unique values of the field name of all DICOM files in the group. Parame...
[ "def", "get_unique_field_values_per_group", "(", "self", ",", "field_name", ",", "field_to_use_as_key", "=", "None", ")", ":", "unique_vals", "=", "DefaultOrderedDict", "(", "set", ")", "for", "dcmg", "in", "self", ".", "dicom_groups", ":", "for", "f", "in", "...
Return a dictionary where the key is the group key file path and the values are sets of unique values of the field name of all DICOM files in the group. Parameters ---------- field_name: str Name of the field to read from all files field_to_use_as_key: str ...
[ "Return", "a", "dictionary", "where", "the", "key", "is", "the", "group", "key", "file", "path", "and", "the", "values", "are", "sets", "of", "unique", "values", "of", "the", "field", "name", "of", "all", "DICOM", "files", "in", "the", "group", "." ]
python
valid
jxtech/wechatpy
wechatpy/pay/api/jsapi.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/jsapi.py#L13-L32
def get_jsapi_signature(self, prepay_id, timestamp=None, nonce_str=None): """ 获取 JSAPI 签名 :param prepay_id: 统一下单接口返回的 prepay_id 参数值 :param timestamp: 可选,时间戳,默认为当前时间戳 :param nonce_str: 可选,随机字符串,默认自动生成 :return: 签名 """ data = { 'appId': self.sub_...
[ "def", "get_jsapi_signature", "(", "self", ",", "prepay_id", ",", "timestamp", "=", "None", ",", "nonce_str", "=", "None", ")", ":", "data", "=", "{", "'appId'", ":", "self", ".", "sub_appid", "or", "self", ".", "appid", ",", "'timeStamp'", ":", "timesta...
获取 JSAPI 签名 :param prepay_id: 统一下单接口返回的 prepay_id 参数值 :param timestamp: 可选,时间戳,默认为当前时间戳 :param nonce_str: 可选,随机字符串,默认自动生成 :return: 签名
[ "获取", "JSAPI", "签名" ]
python
train
materialsproject/pymatgen
pymatgen/analysis/gb/grain.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L670-L726
def get_ratio(self, max_denominator=5, index_none=None): """ find the axial ratio needed for GB generator input. Args: max_denominator (int): the maximum denominator for the computed ratio, default to be 5. index_none (int): specify the irrational axis. ...
[ "def", "get_ratio", "(", "self", ",", "max_denominator", "=", "5", ",", "index_none", "=", "None", ")", ":", "structure", "=", "self", ".", "initial_structure", "lat_type", "=", "self", ".", "lat_type", "if", "lat_type", "==", "'t'", "or", "lat_type", "=="...
find the axial ratio needed for GB generator input. Args: max_denominator (int): the maximum denominator for the computed ratio, default to be 5. index_none (int): specify the irrational axis. 0-a, 1-b, 2-c. Only may be needed for orthorombic system. ...
[ "find", "the", "axial", "ratio", "needed", "for", "GB", "generator", "input", ".", "Args", ":", "max_denominator", "(", "int", ")", ":", "the", "maximum", "denominator", "for", "the", "computed", "ratio", "default", "to", "be", "5", ".", "index_none", "(",...
python
train
wmayner/pyphi
pyphi/models/fmt.py
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/models/fmt.py#L321-L360
def fmt_ria(ria, verbose=True, mip=False): """Format a |RepertoireIrreducibilityAnalysis|.""" if verbose: mechanism = 'Mechanism: {}\n'.format( fmt_mechanism(ria.mechanism, ria.node_labels)) direction = '\nDirection: {}'.format(ria.direction) else: mechanism = '' ...
[ "def", "fmt_ria", "(", "ria", ",", "verbose", "=", "True", ",", "mip", "=", "False", ")", ":", "if", "verbose", ":", "mechanism", "=", "'Mechanism: {}\\n'", ".", "format", "(", "fmt_mechanism", "(", "ria", ".", "mechanism", ",", "ria", ".", "node_labels"...
Format a |RepertoireIrreducibilityAnalysis|.
[ "Format", "a", "|RepertoireIrreducibilityAnalysis|", "." ]
python
train
getsentry/raven-python
raven/utils/stacks.py
https://github.com/getsentry/raven-python/blob/d891c20f0f930153f508e9d698d9de42e910face/raven/utils/stacks.py#L167-L215
def slim_frame_data(frames, frame_allowance=25): """ Removes various excess metadata from middle frames which go beyond ``frame_allowance``. Returns ``frames``. """ frames_len = 0 app_frames = [] system_frames = [] for frame in frames: frames_len += 1 if frame.get('i...
[ "def", "slim_frame_data", "(", "frames", ",", "frame_allowance", "=", "25", ")", ":", "frames_len", "=", "0", "app_frames", "=", "[", "]", "system_frames", "=", "[", "]", "for", "frame", "in", "frames", ":", "frames_len", "+=", "1", "if", "frame", ".", ...
Removes various excess metadata from middle frames which go beyond ``frame_allowance``. Returns ``frames``.
[ "Removes", "various", "excess", "metadata", "from", "middle", "frames", "which", "go", "beyond", "frame_allowance", "." ]
python
train
juju/charm-helpers
charmhelpers/contrib/openstack/amulet/utils.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1086-L1099
def get_ceph_df(self, sentry_unit): """Return dict of ceph df json output, including ceph pool state. :param sentry_unit: Pointer to amulet sentry instance (juju unit) :returns: Dict of ceph df output """ cmd = 'sudo ceph df --format=json' output, code = sentry_unit.run(...
[ "def", "get_ceph_df", "(", "self", ",", "sentry_unit", ")", ":", "cmd", "=", "'sudo ceph df --format=json'", "output", ",", "code", "=", "sentry_unit", ".", "run", "(", "cmd", ")", "if", "code", "!=", "0", ":", "msg", "=", "(", "'{} `{}` returned {} '", "'...
Return dict of ceph df json output, including ceph pool state. :param sentry_unit: Pointer to amulet sentry instance (juju unit) :returns: Dict of ceph df output
[ "Return", "dict", "of", "ceph", "df", "json", "output", "including", "ceph", "pool", "state", "." ]
python
train
pytroll/satpy
satpy/readers/nwcsaf_nc.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/nwcsaf_nc.py#L97-L104
def remove_timedim(self, var): """Remove time dimension from dataset""" if self.pps and var.dims[0] == 'time': data = var[0, :, :] data.attrs = var.attrs var = data return var
[ "def", "remove_timedim", "(", "self", ",", "var", ")", ":", "if", "self", ".", "pps", "and", "var", ".", "dims", "[", "0", "]", "==", "'time'", ":", "data", "=", "var", "[", "0", ",", ":", ",", ":", "]", "data", ".", "attrs", "=", "var", ".",...
Remove time dimension from dataset
[ "Remove", "time", "dimension", "from", "dataset" ]
python
train
jason-weirather/py-seq-tools
seqtools/structure/gene.py
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/structure/gene.py#L91-L97
def get_transcripts(self): """ a list of the transcripts in the locus""" txs = [] for pays in [x.payload for x in self.g.get_nodes()]: for pay in pays: txs.append(pay) return txs
[ "def", "get_transcripts", "(", "self", ")", ":", "txs", "=", "[", "]", "for", "pays", "in", "[", "x", ".", "payload", "for", "x", "in", "self", ".", "g", ".", "get_nodes", "(", ")", "]", ":", "for", "pay", "in", "pays", ":", "txs", ".", "append...
a list of the transcripts in the locus
[ "a", "list", "of", "the", "transcripts", "in", "the", "locus" ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_nsh.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_nsh.py#L50-L68
def send(self, line): '''send some bytes''' line = line.strip() if line == ".": self.stop() return mav = self.master.mav if line != '+++': line += "\r\n" buf = [ord(x) for x in line] buf.extend([0]*(70-len(buf))) flags ...
[ "def", "send", "(", "self", ",", "line", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "if", "line", "==", "\".\"", ":", "self", ".", "stop", "(", ")", "return", "mav", "=", "self", ".", "master", ".", "mav", "if", "line", "!=", "'+++'...
send some bytes
[ "send", "some", "bytes" ]
python
train
conchoecia/gloTK
gloTK/scripts/glotk_project.py
https://github.com/conchoecia/gloTK/blob/58abee663fcfbbd09f4863c3ca3ae054e33184a8/gloTK/scripts/glotk_project.py#L91-L129
def main(): """ 1. Reads in a meraculous config file and outputs glotk project files """ parser = CommandLine() #this block from here: http://stackoverflow.com/a/4042861/5843327 if len(sys.argv)==1: parser.parser.print_help() sys.exit(1) parser.parse() myArgs = parser.arg...
[ "def", "main", "(", ")", ":", "parser", "=", "CommandLine", "(", ")", "#this block from here: http://stackoverflow.com/a/4042861/5843327", "if", "len", "(", "sys", ".", "argv", ")", "==", "1", ":", "parser", ".", "parser", ".", "print_help", "(", ")", "sys", ...
1. Reads in a meraculous config file and outputs glotk project files
[ "1", ".", "Reads", "in", "a", "meraculous", "config", "file", "and", "outputs", "glotk", "project", "files" ]
python
train
madedotcom/photon-pump
photonpump/connection.py
https://github.com/madedotcom/photon-pump/blob/ff0736c9cacd43c1f783c9668eefb53d03a3a93e/photonpump/connection.py#L726-L786
async def get( self, stream: str, direction: msg.StreamDirection = msg.StreamDirection.Forward, from_event: int = 0, max_count: int = 100, resolve_links: bool = True, require_master: bool = False, correlation_id: uuid.UUID = None, ): """ ...
[ "async", "def", "get", "(", "self", ",", "stream", ":", "str", ",", "direction", ":", "msg", ".", "StreamDirection", "=", "msg", ".", "StreamDirection", ".", "Forward", ",", "from_event", ":", "int", "=", "0", ",", "max_count", ":", "int", "=", "100", ...
Read a range of events from a stream. Args: stream: The name of the stream to read direction (optional): Controls whether to read events forward or backward. defaults to Forward. from_event (optional): The first event to read. defaults to the begi...
[ "Read", "a", "range", "of", "events", "from", "a", "stream", "." ]
python
train
swistakm/python-gmaps
src/gmaps/directions.py
https://github.com/swistakm/python-gmaps/blob/ef3bdea6f02277200f21a09f99d4e2aebad762b9/src/gmaps/directions.py#L8-L61
def directions(self, origin, destination, mode=None, alternatives=None, waypoints=None, optimize_waypoints=False, avoid=None, language=None, units=None, region=None, departure_time=None, arrival_time=None, sensor=None): """Get direction...
[ "def", "directions", "(", "self", ",", "origin", ",", "destination", ",", "mode", "=", "None", ",", "alternatives", "=", "None", ",", "waypoints", "=", "None", ",", "optimize_waypoints", "=", "False", ",", "avoid", "=", "None", ",", "language", "=", "Non...
Get directions between locations :param origin: Origin location - string address; (latitude, longitude) two-tuple, dict with ("lat", "lon") keys or object with (lat, lon) attributes :param destination: Destination location - type same as origin :param mode: Travel mode a...
[ "Get", "directions", "between", "locations" ]
python
train
iotile/coretools
iotilesensorgraph/iotile/sg/engine/in_memory.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/engine/in_memory.py#L38-L50
def restore(self, state): """Restore the state of this InMemoryStorageEngine from a dict.""" storage_data = state.get(u'storage_data', []) streaming_data = state.get(u'streaming_data', []) if len(storage_data) > self.storage_length or len(streaming_data) > self.streaming_length: ...
[ "def", "restore", "(", "self", ",", "state", ")", ":", "storage_data", "=", "state", ".", "get", "(", "u'storage_data'", ",", "[", "]", ")", "streaming_data", "=", "state", ".", "get", "(", "u'streaming_data'", ",", "[", "]", ")", "if", "len", "(", "...
Restore the state of this InMemoryStorageEngine from a dict.
[ "Restore", "the", "state", "of", "this", "InMemoryStorageEngine", "from", "a", "dict", "." ]
python
train
openstax/cnx-litezip
litezip/main.py
https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/main.py#L94-L113
def parse_module(path, excludes=None): """Parse the file structure to a data structure given the path to a module directory. """ file = path / MODULE_FILENAME if not file.exists(): raise MissingFile(file) id = _parse_document_id(etree.parse(file.open())) excludes = excludes or [] ...
[ "def", "parse_module", "(", "path", ",", "excludes", "=", "None", ")", ":", "file", "=", "path", "/", "MODULE_FILENAME", "if", "not", "file", ".", "exists", "(", ")", ":", "raise", "MissingFile", "(", "file", ")", "id", "=", "_parse_document_id", "(", ...
Parse the file structure to a data structure given the path to a module directory.
[ "Parse", "the", "file", "structure", "to", "a", "data", "structure", "given", "the", "path", "to", "a", "module", "directory", "." ]
python
valid
BD2KGenomics/toil-scripts
src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L82-L92
def parse_sra(path_to_config): """ Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ] Returns duplicate of ids to follow UUID/URL standard. """ samples = [] with open(path_to_config, 'r') as f: for line in f.readlines(): if not line.iss...
[ "def", "parse_sra", "(", "path_to_config", ")", ":", "samples", "=", "[", "]", "with", "open", "(", "path_to_config", ",", "'r'", ")", "as", "f", ":", "for", "line", "in", "f", ".", "readlines", "(", ")", ":", "if", "not", "line", ".", "isspace", "...
Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ] Returns duplicate of ids to follow UUID/URL standard.
[ "Parses", "genetorrent", "config", "file", ".", "Returns", "list", "of", "samples", ":", "[", "[", "id1", "id1", "]", "[", "id2", "id2", "]", "...", "]", "Returns", "duplicate", "of", "ids", "to", "follow", "UUID", "/", "URL", "standard", "." ]
python
train
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_executor.py
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_executor.py#L38-L45
def _MakeExecutable(self, metadata_script): """Add executable permissions to a file. Args: metadata_script: string, the path to the executable file. """ mode = os.stat(metadata_script).st_mode os.chmod(metadata_script, mode | stat.S_IEXEC)
[ "def", "_MakeExecutable", "(", "self", ",", "metadata_script", ")", ":", "mode", "=", "os", ".", "stat", "(", "metadata_script", ")", ".", "st_mode", "os", ".", "chmod", "(", "metadata_script", ",", "mode", "|", "stat", ".", "S_IEXEC", ")" ]
Add executable permissions to a file. Args: metadata_script: string, the path to the executable file.
[ "Add", "executable", "permissions", "to", "a", "file", "." ]
python
train
nabetama/slacky
slacky/rest/rest.py
https://github.com/nabetama/slacky/blob/dde62ce49af9b8f581729c36d2ac790310b570e4/slacky/rest/rest.py#L98-L102
def create(self, name): """ https://api.slack.com/methods/channels.create """ self.params.update({'name': name}) return FromUrl('https://slack.com/api/channels.create', self._requests)(data=self.params).post()
[ "def", "create", "(", "self", ",", "name", ")", ":", "self", ".", "params", ".", "update", "(", "{", "'name'", ":", "name", "}", ")", "return", "FromUrl", "(", "'https://slack.com/api/channels.create'", ",", "self", ".", "_requests", ")", "(", "data", "=...
https://api.slack.com/methods/channels.create
[ "https", ":", "//", "api", ".", "slack", ".", "com", "/", "methods", "/", "channels", ".", "create" ]
python
train
SatelliteQE/nailgun
nailgun/entities.py
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/entities.py#L7140-L7163
def refresh_manifest(self, synchronous=True, **kwargs): """Refresh previously imported manifest for Red Hat provider. :param synchronous: What should happen if the server returns an HTTP 202 (accepted) status code? Wait for the task to complete if ``True``. Immediately return th...
[ "def", "refresh_manifest", "(", "self", ",", "synchronous", "=", "True", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "kwargs", ".", "copy", "(", ")", "# shadow the passed-in kwargs", "kwargs", ".", "update", "(", "self", ".", "_server_config", ".", "...
Refresh previously imported manifest for Red Hat provider. :param synchronous: What should happen if the server returns an HTTP 202 (accepted) status code? Wait for the task to complete if ``True``. Immediately return the server's response otherwise. :param kwargs: Arguments to ...
[ "Refresh", "previously", "imported", "manifest", "for", "Red", "Hat", "provider", "." ]
python
train
johnnoone/aioconsul
aioconsul/encoders/__init__.py
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/encoders/__init__.py#L8-L16
def encode_value(value, flags=None, base64=False): """Mostly used by payloads """ if flags: # still a no-operation logger.debug("Flag %s encoding not implemented yet" % flags) if not isinstance(value, bytes): raise ValueError("value must be bytes") return b64encode(value) if ...
[ "def", "encode_value", "(", "value", ",", "flags", "=", "None", ",", "base64", "=", "False", ")", ":", "if", "flags", ":", "# still a no-operation", "logger", ".", "debug", "(", "\"Flag %s encoding not implemented yet\"", "%", "flags", ")", "if", "not", "isins...
Mostly used by payloads
[ "Mostly", "used", "by", "payloads" ]
python
train
mdickinson/bigfloat
bigfloat/core.py
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1870-L1880
def coth(x, context=None): """ Return the hyperbolic cotangent of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_coth, (BigFloat._implicit_convert(x),), context, )
[ "def", "coth", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_coth", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", ",", ...
Return the hyperbolic cotangent of x.
[ "Return", "the", "hyperbolic", "cotangent", "of", "x", "." ]
python
train
KnowledgeLinks/rdfframework
rdfframework/utilities/codetimer.py
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/utilities/codetimer.py#L55-L66
def code_timer(reset=False): '''Sets a global variable for tracking the timer accross multiple files ''' global CODE_TIMER if reset: CODE_TIMER = CodeTimer() else: if CODE_TIMER is None: return CodeTimer() else: return CODE_TIMER
[ "def", "code_timer", "(", "reset", "=", "False", ")", ":", "global", "CODE_TIMER", "if", "reset", ":", "CODE_TIMER", "=", "CodeTimer", "(", ")", "else", ":", "if", "CODE_TIMER", "is", "None", ":", "return", "CodeTimer", "(", ")", "else", ":", "return", ...
Sets a global variable for tracking the timer accross multiple files
[ "Sets", "a", "global", "variable", "for", "tracking", "the", "timer", "accross", "multiple", "files" ]
python
train
pandas-dev/pandas
pandas/core/algorithms.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/algorithms.py#L1551-L1666
def take_nd(arr, indexer, axis=0, out=None, fill_value=np.nan, mask_info=None, allow_fill=True): """ Specialized Cython take which sets NaN values in one pass This dispatches to ``take`` defined on ExtensionArrays. It does not currently dispatch to ``SparseArray.take`` for sparse ``arr``. ...
[ "def", "take_nd", "(", "arr", ",", "indexer", ",", "axis", "=", "0", ",", "out", "=", "None", ",", "fill_value", "=", "np", ".", "nan", ",", "mask_info", "=", "None", ",", "allow_fill", "=", "True", ")", ":", "# TODO(EA): Remove these if / elifs as datetim...
Specialized Cython take which sets NaN values in one pass This dispatches to ``take`` defined on ExtensionArrays. It does not currently dispatch to ``SparseArray.take`` for sparse ``arr``. Parameters ---------- arr : array-like Input array. indexer : ndarray 1-D array of indice...
[ "Specialized", "Cython", "take", "which", "sets", "NaN", "values", "in", "one", "pass" ]
python
train
pyroscope/pyrocore
src/pyrocore/torrent/watch.py
https://github.com/pyroscope/pyrocore/blob/89ad01346a570943d20311a0b488440975876612/src/pyrocore/torrent/watch.py#L140-L199
def load(self): """ Load metafile into client. """ if not self.ns.info_hash and not self.parse(): return self.addinfo() # TODO: dry_run try: # TODO: Scrub metafile if requested # Determine target state start_it = self.job...
[ "def", "load", "(", "self", ")", ":", "if", "not", "self", ".", "ns", ".", "info_hash", "and", "not", "self", ".", "parse", "(", ")", ":", "return", "self", ".", "addinfo", "(", ")", "# TODO: dry_run", "try", ":", "# TODO: Scrub metafile if requested", "...
Load metafile into client.
[ "Load", "metafile", "into", "client", "." ]
python
train
hearsaycorp/normalize
normalize/diff.py
https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/diff.py#L359-L484
def compare_record_iter(a, b, fs_a=None, fs_b=None, options=None): """This generator function compares a record, slot by slot, and yields differences found as ``DiffInfo`` objects. args: ``a=``\ *Record* The base object ``b=``\ *Record*\ \|\ *object* The 'other' ob...
[ "def", "compare_record_iter", "(", "a", ",", "b", ",", "fs_a", "=", "None", ",", "fs_b", "=", "None", ",", "options", "=", "None", ")", ":", "if", "not", "options", ":", "options", "=", "DiffOptions", "(", ")", "if", "not", "options", ".", "duck_type...
This generator function compares a record, slot by slot, and yields differences found as ``DiffInfo`` objects. args: ``a=``\ *Record* The base object ``b=``\ *Record*\ \|\ *object* The 'other' object, which must be the same type as ``a``, unless ``options.d...
[ "This", "generator", "function", "compares", "a", "record", "slot", "by", "slot", "and", "yields", "differences", "found", "as", "DiffInfo", "objects", "." ]
python
train
apache/incubator-heron
third_party/python/cpplint/cpplint.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L6092-L6185
def ProcessConfigOverrides(filename): """ Loads the configuration files and processes the config overrides. Args: filename: The name of the file being processed by the linter. Returns: False if the current |filename| should not be processed further. """ abs_filename = os.path.abspath(filename) cf...
[ "def", "ProcessConfigOverrides", "(", "filename", ")", ":", "abs_filename", "=", "os", ".", "path", ".", "abspath", "(", "filename", ")", "cfg_filters", "=", "[", "]", "keep_looking", "=", "True", "while", "keep_looking", ":", "abs_path", ",", "base_name", "...
Loads the configuration files and processes the config overrides. Args: filename: The name of the file being processed by the linter. Returns: False if the current |filename| should not be processed further.
[ "Loads", "the", "configuration", "files", "and", "processes", "the", "config", "overrides", "." ]
python
valid
networks-lab/metaknowledge
metaknowledge/recordCollection.py
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/recordCollection.py#L216-L245
def writeFile(self, fname = None): """Writes the `RecordCollection` to a file, the written file's format is identical to those download from WOS. The order of `Records` written is random. # Parameters _fname_ : `optional [str]` > Default `None`, if given the output file will written t...
[ "def", "writeFile", "(", "self", ",", "fname", "=", "None", ")", ":", "if", "len", "(", "self", ".", "_collectedTypes", ")", "<", "2", ":", "recEncoding", "=", "self", ".", "peek", "(", ")", ".", "encoding", "(", ")", "else", ":", "recEncoding", "=...
Writes the `RecordCollection` to a file, the written file's format is identical to those download from WOS. The order of `Records` written is random. # Parameters _fname_ : `optional [str]` > Default `None`, if given the output file will written to _fanme_, if `None` the `RecordCollection`'s ...
[ "Writes", "the", "RecordCollection", "to", "a", "file", "the", "written", "file", "s", "format", "is", "identical", "to", "those", "download", "from", "WOS", ".", "The", "order", "of", "Records", "written", "is", "random", "." ]
python
train
bitcraze/crazyflie-lib-python
cflib/crazyflie/log.py
https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L254-L267
def start(self): """Start the logging for this entry""" if (self.cf.link is not None): if (self._added is False): self.create() logger.debug('First time block is started, add block') else: logger.debug('Block already registered, sta...
[ "def", "start", "(", "self", ")", ":", "if", "(", "self", ".", "cf", ".", "link", "is", "not", "None", ")", ":", "if", "(", "self", ".", "_added", "is", "False", ")", ":", "self", ".", "create", "(", ")", "logger", ".", "debug", "(", "'First ti...
Start the logging for this entry
[ "Start", "the", "logging", "for", "this", "entry" ]
python
train
madprime/vcf2clinvar
vcf2clinvar/common.py
https://github.com/madprime/vcf2clinvar/blob/d5bbf6df2902c6cabe9ef1894cfac527e90fa32a/vcf2clinvar/common.py#L149-L163
def get_pos(vcf_line): """ Very lightweight parsing of a vcf line to get position. Returns a dict containing: 'chrom': index of chromosome (int), indicates sort order 'pos': position on chromosome (int) """ if not vcf_line: return None vcf_dat...
[ "def", "get_pos", "(", "vcf_line", ")", ":", "if", "not", "vcf_line", ":", "return", "None", "vcf_data", "=", "vcf_line", ".", "strip", "(", ")", ".", "split", "(", "'\\t'", ")", "return_data", "=", "dict", "(", ")", "return_data", "[", "'chrom'", "]",...
Very lightweight parsing of a vcf line to get position. Returns a dict containing: 'chrom': index of chromosome (int), indicates sort order 'pos': position on chromosome (int)
[ "Very", "lightweight", "parsing", "of", "a", "vcf", "line", "to", "get", "position", "." ]
python
valid
DocNow/twarc
twarc/client.py
https://github.com/DocNow/twarc/blob/47dd87d0c00592a4d583412c9d660ba574fc6f26/twarc/client.py#L514-L530
def trends_place(self, woeid, exclude=None): """ Returns recent Twitter trends for the specified WOEID. If exclude == 'hashtags', Twitter will remove hashtag trends from the response. """ url = 'https://api.twitter.com/1.1/trends/place.json' params = {'id': woeid}...
[ "def", "trends_place", "(", "self", ",", "woeid", ",", "exclude", "=", "None", ")", ":", "url", "=", "'https://api.twitter.com/1.1/trends/place.json'", "params", "=", "{", "'id'", ":", "woeid", "}", "if", "exclude", ":", "params", "[", "'exclude'", "]", "=",...
Returns recent Twitter trends for the specified WOEID. If exclude == 'hashtags', Twitter will remove hashtag trends from the response.
[ "Returns", "recent", "Twitter", "trends", "for", "the", "specified", "WOEID", ".", "If", "exclude", "==", "hashtags", "Twitter", "will", "remove", "hashtag", "trends", "from", "the", "response", "." ]
python
train
tanghaibao/jcvi
jcvi/utils/brewer2mpl.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/utils/brewer2mpl.py#L240-L297
def get_map(name, map_type, number, reverse=False): """ Return a `BrewerMap` representation of the specified color map. Parameters ---------- name : str Name of color map. Use `print_maps` to see available color maps. map_type : {'Sequential', 'Diverging', 'Qualitative'} Select ...
[ "def", "get_map", "(", "name", ",", "map_type", ",", "number", ",", "reverse", "=", "False", ")", ":", "number", "=", "str", "(", "number", ")", "map_type", "=", "map_type", ".", "lower", "(", ")", ".", "capitalize", "(", ")", "# check for valid type", ...
Return a `BrewerMap` representation of the specified color map. Parameters ---------- name : str Name of color map. Use `print_maps` to see available color maps. map_type : {'Sequential', 'Diverging', 'Qualitative'} Select color map type. number : int Number of defined color...
[ "Return", "a", "BrewerMap", "representation", "of", "the", "specified", "color", "map", "." ]
python
train
mbj4668/pyang
pyang/util.py
https://github.com/mbj4668/pyang/blob/f2a5cc3142162e5b9ee4e18d154568d939ff63dd/pyang/util.py#L76-L79
def listsdelete(x, xs): """Return a new list with x removed from xs""" i = xs.index(x) return xs[:i] + xs[(i+1):]
[ "def", "listsdelete", "(", "x", ",", "xs", ")", ":", "i", "=", "xs", ".", "index", "(", "x", ")", "return", "xs", "[", ":", "i", "]", "+", "xs", "[", "(", "i", "+", "1", ")", ":", "]" ]
Return a new list with x removed from xs
[ "Return", "a", "new", "list", "with", "x", "removed", "from", "xs" ]
python
train
nicolargo/glances
glances/plugins/glances_percpu.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_percpu.py#L75-L117
def msg_curse(self, args=None, max_width=None): """Return the dict to display in the curse interface.""" # Init the return message ret = [] # Only process if stats exist... if not self.stats or not self.args.percpu or self.is_disable(): return ret # Build th...
[ "def", "msg_curse", "(", "self", ",", "args", "=", "None", ",", "max_width", "=", "None", ")", ":", "# Init the return message", "ret", "=", "[", "]", "# Only process if stats exist...", "if", "not", "self", ".", "stats", "or", "not", "self", ".", "args", ...
Return the dict to display in the curse interface.
[ "Return", "the", "dict", "to", "display", "in", "the", "curse", "interface", "." ]
python
train
rwl/pylon
pylon/opf.py
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/opf.py#L79-L110
def solve(self, solver_klass=None): """ Solves an optimal power flow and returns a results dictionary. """ # Start the clock. t0 = time() # Build an OPF model with variables and constraints. om = self._construct_opf_model(self.case) if om is None: ret...
[ "def", "solve", "(", "self", ",", "solver_klass", "=", "None", ")", ":", "# Start the clock.", "t0", "=", "time", "(", ")", "# Build an OPF model with variables and constraints.", "om", "=", "self", ".", "_construct_opf_model", "(", "self", ".", "case", ")", "if...
Solves an optimal power flow and returns a results dictionary.
[ "Solves", "an", "optimal", "power", "flow", "and", "returns", "a", "results", "dictionary", "." ]
python
train
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_ha.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_ha.py#L38-L49
def redundancy_output_rd_mesg(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") redundancy = ET.Element("redundancy") config = redundancy output = ET.SubElement(redundancy, "output") rd_mesg = ET.SubElement(output, "rd_mesg") rd_mes...
[ "def", "redundancy_output_rd_mesg", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "redundancy", "=", "ET", ".", "Element", "(", "\"redundancy\"", ")", "config", "=", "redundancy", "output", "="...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
CiscoUcs/UcsPythonSDK
src/UcsSdk/UcsBase.py
https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L293-L317
def WriteXml(self, w, option, elementName=None): """ Method writes the xml representation of the managed object. """ if (option == WriteXmlOption.Dirty and not self.IsDirty()): return if elementName == None: x = w.createElement(self.propMoMeta.xmlAttribute) else: x = w.createElement(elementName) if U...
[ "def", "WriteXml", "(", "self", ",", "w", ",", "option", ",", "elementName", "=", "None", ")", ":", "if", "(", "option", "==", "WriteXmlOption", ".", "Dirty", "and", "not", "self", ".", "IsDirty", "(", ")", ")", ":", "return", "if", "elementName", "=...
Method writes the xml representation of the managed object.
[ "Method", "writes", "the", "xml", "representation", "of", "the", "managed", "object", "." ]
python
train
slackapi/python-slackclient
slack/web/client.py
https://github.com/slackapi/python-slackclient/blob/901341c0284fd81e6d2719d6a0502308760d83e4/slack/web/client.py#L976-L986
def reactions_add(self, *, name: str, **kwargs) -> SlackResponse: """Adds a reaction to an item. Args: name (str): Reaction (emoji) name. e.g. 'thumbsup' channel (str): Channel where the message to add reaction to was posted. e.g. 'C1234567890' timest...
[ "def", "reactions_add", "(", "self", ",", "*", ",", "name", ":", "str", ",", "*", "*", "kwargs", ")", "->", "SlackResponse", ":", "kwargs", ".", "update", "(", "{", "\"name\"", ":", "name", "}", ")", "return", "self", ".", "api_call", "(", "\"reactio...
Adds a reaction to an item. Args: name (str): Reaction (emoji) name. e.g. 'thumbsup' channel (str): Channel where the message to add reaction to was posted. e.g. 'C1234567890' timestamp (str): Timestamp of the message to add reaction to. e.g. '1234567890.1234...
[ "Adds", "a", "reaction", "to", "an", "item", "." ]
python
train
LonamiWebs/Telethon
telethon/tl/custom/inlineresult.py
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlineresult.py#L90-L98
def document(self): """ Returns either the :tl:`WebDocument` content for normal results or the :tl:`Document` for media results. """ if isinstance(self.result, types.BotInlineResult): return self.result.content elif isinstance(self.result, types.BotInlineMedia...
[ "def", "document", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "result", ",", "types", ".", "BotInlineResult", ")", ":", "return", "self", ".", "result", ".", "content", "elif", "isinstance", "(", "self", ".", "result", ",", "types", "...
Returns either the :tl:`WebDocument` content for normal results or the :tl:`Document` for media results.
[ "Returns", "either", "the", ":", "tl", ":", "WebDocument", "content", "for", "normal", "results", "or", "the", ":", "tl", ":", "Document", "for", "media", "results", "." ]
python
train
alvations/lazyme
lazyme/string.py
https://github.com/alvations/lazyme/blob/961a8282198588ff72e15643f725ce895e51d06d/lazyme/string.py#L90-L105
def color_print(s, color=None, highlight=None, end='\n', file=sys.stdout, **kwargs): """ From http://stackoverflow.com/a/287944/610569 See also https://gist.github.com/Sheljohn/68ca3be74139f66dbc6127784f638920 """ if color in palette and color != 'default': s = palette[color]...
[ "def", "color_print", "(", "s", ",", "color", "=", "None", ",", "highlight", "=", "None", ",", "end", "=", "'\\n'", ",", "file", "=", "sys", ".", "stdout", ",", "*", "*", "kwargs", ")", ":", "if", "color", "in", "palette", "and", "color", "!=", "...
From http://stackoverflow.com/a/287944/610569 See also https://gist.github.com/Sheljohn/68ca3be74139f66dbc6127784f638920
[ "From", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "287944", "/", "610569", "See", "also", "https", ":", "//", "gist", ".", "github", ".", "com", "/", "Sheljohn", "/", "68ca3be74139f66dbc6127784f638920" ]
python
train
attm2x/m2x-python
m2x/v2/devices.py
https://github.com/attm2x/m2x-python/blob/df83f590114692b1f96577148b7ba260065905bb/m2x/v2/devices.py#L37-L48
def create_stream(self, name, **params): """ Method for `Create/Update Data Stream <https://m2x.att.com/developer/documentation/v2/device#Create-Update-Data-Stream>`_ endpoint. :param name: Name of the stream to be created :param params: Query parameters passed as keyword arguments. View M2X AP...
[ "def", "create_stream", "(", "self", ",", "name", ",", "*", "*", "params", ")", ":", "return", "Stream", ".", "create", "(", "self", ".", "api", ",", "self", ",", "name", ",", "*", "*", "params", ")" ]
Method for `Create/Update Data Stream <https://m2x.att.com/developer/documentation/v2/device#Create-Update-Data-Stream>`_ endpoint. :param name: Name of the stream to be created :param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters. ...
[ "Method", "for", "Create", "/", "Update", "Data", "Stream", "<https", ":", "//", "m2x", ".", "att", ".", "com", "/", "developer", "/", "documentation", "/", "v2", "/", "device#Create", "-", "Update", "-", "Data", "-", "Stream", ">", "_", "endpoint", "....
python
test
Workiva/furious
example/batcher/__init__.py
https://github.com/Workiva/furious/blob/c29823ec8b98549e7439d7273aa064d1e5830632/example/batcher/__init__.py#L204-L220
def set_stats(stats, value): """Updates the stats with the value passed in. :param stats: :class: `dict` :param value: :class: `int` """ stats["total_count"] += 1 stats["value"] += value stats["average"] = stats["value"] / stats["total_count"] # this is just a basic example and not the...
[ "def", "set_stats", "(", "stats", ",", "value", ")", ":", "stats", "[", "\"total_count\"", "]", "+=", "1", "stats", "[", "\"value\"", "]", "+=", "value", "stats", "[", "\"average\"", "]", "=", "stats", "[", "\"value\"", "]", "/", "stats", "[", "\"total...
Updates the stats with the value passed in. :param stats: :class: `dict` :param value: :class: `int`
[ "Updates", "the", "stats", "with", "the", "value", "passed", "in", "." ]
python
train
project-rig/rig
rig/machine_control/machine_controller.py
https://github.com/project-rig/rig/blob/3a3e053d3214899b6d68758685835de0afd5542b/rig/machine_control/machine_controller.py#L2172-L2184
def links(self): """Generate the coordinates of all working links. Yields ------ (x, y, :py:class:`rig.links.Links`) A working link leaving a chip from the perspective of the chip. For example ``(0, 0, Links.north)`` would be the link going north from ...
[ "def", "links", "(", "self", ")", ":", "for", "(", "x", ",", "y", ")", ",", "chip_info", "in", "iteritems", "(", "self", ")", ":", "for", "link", "in", "chip_info", ".", "working_links", ":", "yield", "(", "x", ",", "y", ",", "link", ")" ]
Generate the coordinates of all working links. Yields ------ (x, y, :py:class:`rig.links.Links`) A working link leaving a chip from the perspective of the chip. For example ``(0, 0, Links.north)`` would be the link going north from chip (0, 0) to chip (0, 1).
[ "Generate", "the", "coordinates", "of", "all", "working", "links", "." ]
python
train
googleapis/google-cloud-python
trace/google/cloud/trace_v1/gapic/trace_service_client.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/trace/google/cloud/trace_v1/gapic/trace_service_client.py#L177-L254
def patch_traces( self, project_id, traces, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a t...
[ "def", "patch_traces", "(", "self", ",", "project_id", ",", "traces", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFA...
Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you send matches that of an existing trace, any fields in the existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If t...
[ "Sends", "new", "traces", "to", "Stackdriver", "Trace", "or", "updates", "existing", "traces", ".", "If", "the", "ID", "of", "a", "trace", "that", "you", "send", "matches", "that", "of", "an", "existing", "trace", "any", "fields", "in", "the", "existing", ...
python
train
inveniosoftware/invenio-queues
invenio_queues/queue.py
https://github.com/inveniosoftware/invenio-queues/blob/1dd9112d7c5fe72a428c86f21f6d02cdb0595921/invenio_queues/queue.py#L114-L117
def create_consumer(self): """Context manager that yields an instance of ``Consumer``.""" with self.connection_pool.acquire(block=True) as conn: yield self.consumer(conn)
[ "def", "create_consumer", "(", "self", ")", ":", "with", "self", ".", "connection_pool", ".", "acquire", "(", "block", "=", "True", ")", "as", "conn", ":", "yield", "self", ".", "consumer", "(", "conn", ")" ]
Context manager that yields an instance of ``Consumer``.
[ "Context", "manager", "that", "yields", "an", "instance", "of", "Consumer", "." ]
python
train
mass-project/mass_api_client
mass_api_client/resources/analysis_system_instance.py
https://github.com/mass-project/mass_api_client/blob/b200c32c93608bf3b2707fbf0e83a2228702e2c8/mass_api_client/resources/analysis_system_instance.py#L34-L41
def get_scheduled_analyses(self): """ Retrieve all scheduled analyses for this instance. :return: A list of :class:`.ScheduledAnalysis` objects. """ url = '{}scheduled_analyses/'.format(self.url) return ScheduledAnalysis._get_list_from_url(url, append_base_url=False)
[ "def", "get_scheduled_analyses", "(", "self", ")", ":", "url", "=", "'{}scheduled_analyses/'", ".", "format", "(", "self", ".", "url", ")", "return", "ScheduledAnalysis", ".", "_get_list_from_url", "(", "url", ",", "append_base_url", "=", "False", ")" ]
Retrieve all scheduled analyses for this instance. :return: A list of :class:`.ScheduledAnalysis` objects.
[ "Retrieve", "all", "scheduled", "analyses", "for", "this", "instance", "." ]
python
train
mattja/nsim
nsim/nsim.py
https://github.com/mattja/nsim/blob/ed62c41cd56b918fd97e09f7ad73c12c76a8c3e0/nsim/nsim.py#L1362-L1369
def timeseries(self): """Simulated time series""" if self._timeseries is None: self.compute() if isinstance(self.system, NetworkModel): return self.system._reshape_timeseries(self._timeseries) else: return self._timeseries
[ "def", "timeseries", "(", "self", ")", ":", "if", "self", ".", "_timeseries", "is", "None", ":", "self", ".", "compute", "(", ")", "if", "isinstance", "(", "self", ".", "system", ",", "NetworkModel", ")", ":", "return", "self", ".", "system", ".", "_...
Simulated time series
[ "Simulated", "time", "series" ]
python
train
orb-framework/orb
orb/core/connection_types/sql/mysql/mysqlconnection.py
https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/mysql/mysqlconnection.py#L107-L130
def _open(self, db, writeAccess=False): """ Handles simple, SQL specific connection creation. This will not have to manage thread information as it is already managed within the main open method for the SQLBase class. :param db | <orb.Database> :return <varian...
[ "def", "_open", "(", "self", ",", "db", ",", "writeAccess", "=", "False", ")", ":", "if", "not", "pymysql", ":", "raise", "orb", ".", "errors", ".", "BackendNotFound", "(", "'psycopg2 is not installed.'", ")", "# create the python connection", "try", ":", "ret...
Handles simple, SQL specific connection creation. This will not have to manage thread information as it is already managed within the main open method for the SQLBase class. :param db | <orb.Database> :return <variant> | backend specific database connection
[ "Handles", "simple", "SQL", "specific", "connection", "creation", ".", "This", "will", "not", "have", "to", "manage", "thread", "information", "as", "it", "is", "already", "managed", "within", "the", "main", "open", "method", "for", "the", "SQLBase", "class", ...
python
train
chemlab/chemlab
chemlab/core/spacegroup/spacegroup.py
https://github.com/chemlab/chemlab/blob/c8730966316d101e24f39ac3b96b51282aba0abe/chemlab/core/spacegroup/spacegroup.py#L541-L570
def _read_datafile_entry(spg, no, symbol, setting, f): """Read space group data from f to spg.""" spg._no = no spg._symbol = symbol.strip() spg._setting = setting spg._centrosymmetric = bool(int(f.readline().split()[1])) # primitive vectors f.readline() spg._scaled_primitive_cell = np.ar...
[ "def", "_read_datafile_entry", "(", "spg", ",", "no", ",", "symbol", ",", "setting", ",", "f", ")", ":", "spg", ".", "_no", "=", "no", "spg", ".", "_symbol", "=", "symbol", ".", "strip", "(", ")", "spg", ".", "_setting", "=", "setting", "spg", ".",...
Read space group data from f to spg.
[ "Read", "space", "group", "data", "from", "f", "to", "spg", "." ]
python
train
MKLab-ITI/reveal-graph-embedding
reveal_graph_embedding/datautil/asu_datautil/asu_read_data.py
https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/datautil/asu_datautil/asu_read_data.py#L9-L53
def read_adjacency_matrix(file_path, separator): """ Reads an edge list in csv format and returns the adjacency matrix in SciPy Sparse COOrdinate format. Inputs: - file_path: The path where the adjacency matrix is stored. - separator: The delimiter among values (e.g. ",", "\t", " ") Outp...
[ "def", "read_adjacency_matrix", "(", "file_path", ",", "separator", ")", ":", "# Open file", "file_row_generator", "=", "get_file_row_generator", "(", "file_path", ",", "separator", ")", "# Initialize lists for row and column sparse matrix arguments", "row", "=", "list", "(...
Reads an edge list in csv format and returns the adjacency matrix in SciPy Sparse COOrdinate format. Inputs: - file_path: The path where the adjacency matrix is stored. - separator: The delimiter among values (e.g. ",", "\t", " ") Outputs: - adjacency_matrix: The adjacency matrix in SciPy Sparse...
[ "Reads", "an", "edge", "list", "in", "csv", "format", "and", "returns", "the", "adjacency", "matrix", "in", "SciPy", "Sparse", "COOrdinate", "format", "." ]
python
train
kejbaly2/metrique
metrique/core_api.py
https://github.com/kejbaly2/metrique/blob/a10b076097441b7dde687949139f702f5c1e1b35/metrique/core_api.py#L85-L131
def metrique_object(_oid, _id=None, _hash=None, _start=None, _end=None, _e=None, _v=None, id=None, __v__=None, **kwargs): ''' Function which takes a dictionary (Mapping) object as input and returns return back a metrique object. Special meta property are added to each object:: ...
[ "def", "metrique_object", "(", "_oid", ",", "_id", "=", "None", ",", "_hash", "=", "None", ",", "_start", "=", "None", ",", "_end", "=", "None", ",", "_e", "=", "None", ",", "_v", "=", "None", ",", "id", "=", "None", ",", "__v__", "=", "None", ...
Function which takes a dictionary (Mapping) object as input and returns return back a metrique object. Special meta property are added to each object:: _oid: ... _start: ... ... FIXME
[ "Function", "which", "takes", "a", "dictionary", "(", "Mapping", ")", "object", "as", "input", "and", "returns", "return", "back", "a", "metrique", "object", "." ]
python
train
LuqueDaniel/pybooru
pybooru/api_danbooru.py
https://github.com/LuqueDaniel/pybooru/blob/60cd5254684d293b308f0b11b8f4ac2dce101479/pybooru/api_danbooru.py#L431-L438
def favorite_remove(self, post_id): """Remove a post from favorites (Requires login). Parameters: post_id (int): Where post_id is the post id. """ return self._get('favorites/{0}.json'.format(post_id), method='DELETE', auth=True)
[ "def", "favorite_remove", "(", "self", ",", "post_id", ")", ":", "return", "self", ".", "_get", "(", "'favorites/{0}.json'", ".", "format", "(", "post_id", ")", ",", "method", "=", "'DELETE'", ",", "auth", "=", "True", ")" ]
Remove a post from favorites (Requires login). Parameters: post_id (int): Where post_id is the post id.
[ "Remove", "a", "post", "from", "favorites", "(", "Requires", "login", ")", "." ]
python
train
twilio/twilio-python
twilio/rest/messaging/v1/session/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/messaging/v1/session/__init__.py#L324-L333
def messages(self): """ Access the messages :returns: twilio.rest.messaging.v1.session.message.MessageList :rtype: twilio.rest.messaging.v1.session.message.MessageList """ if self._messages is None: self._messages = MessageList(self._version, session_sid=self...
[ "def", "messages", "(", "self", ")", ":", "if", "self", ".", "_messages", "is", "None", ":", "self", ".", "_messages", "=", "MessageList", "(", "self", ".", "_version", ",", "session_sid", "=", "self", ".", "_solution", "[", "'sid'", "]", ",", ")", "...
Access the messages :returns: twilio.rest.messaging.v1.session.message.MessageList :rtype: twilio.rest.messaging.v1.session.message.MessageList
[ "Access", "the", "messages" ]
python
train
facundobatista/yaswfp
yaswfp/swfparser.py
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L729-L734
def _handle_tag_removeobject(self): """Handle the RemoveObject tag.""" obj = _make_object("RemoveObject") obj.CharacterId = unpack_ui16(self._src) obj.Depth = unpack_ui16(self._src) return obj
[ "def", "_handle_tag_removeobject", "(", "self", ")", ":", "obj", "=", "_make_object", "(", "\"RemoveObject\"", ")", "obj", ".", "CharacterId", "=", "unpack_ui16", "(", "self", ".", "_src", ")", "obj", ".", "Depth", "=", "unpack_ui16", "(", "self", ".", "_s...
Handle the RemoveObject tag.
[ "Handle", "the", "RemoveObject", "tag", "." ]
python
train
blockstack/blockstack-core
blockstack/lib/nameset/namedb.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1326-L1336
def is_name_expired( self, name, block_number ): """ Given a name and block number, determine if it is expired at that block. * names in revealed but not ready namespaces are never expired, unless the namespace itself is expired; * names in ready namespaces expire once max(ready_block, r...
[ "def", "is_name_expired", "(", "self", ",", "name", ",", "block_number", ")", ":", "cur", "=", "self", ".", "db", ".", "cursor", "(", ")", "return", "namedb_get_name", "(", "cur", ",", "name", ",", "block_number", ")", "is", "None" ]
Given a name and block number, determine if it is expired at that block. * names in revealed but not ready namespaces are never expired, unless the namespace itself is expired; * names in ready namespaces expire once max(ready_block, renew_block) + lifetime blocks passes Return True if so ...
[ "Given", "a", "name", "and", "block", "number", "determine", "if", "it", "is", "expired", "at", "that", "block", ".", "*", "names", "in", "revealed", "but", "not", "ready", "namespaces", "are", "never", "expired", "unless", "the", "namespace", "itself", "i...
python
train
arviz-devs/arviz
arviz/data/io_cmdstan.py
https://github.com/arviz-devs/arviz/blob/d04d8da07f029fd2931f48d2f7f324cf393e5277/arviz/data/io_cmdstan.py#L179-L231
def sample_stats_to_xarray(self): """Extract sample_stats from fit.""" dtypes = {"divergent__": bool, "n_leapfrog__": np.int64, "treedepth__": np.int64} # copy dims and coords dims = deepcopy(self.dims) if self.dims is not None else {} coords = deepcopy(self.coords) if self.coor...
[ "def", "sample_stats_to_xarray", "(", "self", ")", ":", "dtypes", "=", "{", "\"divergent__\"", ":", "bool", ",", "\"n_leapfrog__\"", ":", "np", ".", "int64", ",", "\"treedepth__\"", ":", "np", ".", "int64", "}", "# copy dims and coords", "dims", "=", "deepcopy...
Extract sample_stats from fit.
[ "Extract", "sample_stats", "from", "fit", "." ]
python
train
jvarho/pylibscrypt
pylibscrypt/pypyscrypt_inline.py
https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/pypyscrypt_inline.py#L138-L152
def blockmix_salsa8(BY, Yi, r): """Blockmix; Used by SMix""" start = (2 * r - 1) * 16 X = BY[start:start+16] # BlockMix - 1 tmp = [0]*16 for i in xrange(2 * r): # BlockMix - 2 #blockxor(BY, i * 16, X, 0, 16) # BlockMix -...
[ "def", "blockmix_salsa8", "(", "BY", ",", "Yi", ",", "r", ")", ":", "start", "=", "(", "2", "*", "r", "-", "1", ")", "*", "16", "X", "=", "BY", "[", "start", ":", "start", "+", "16", "]", "# BlockMix - 1", "tmp", "=", "[", "0", "]", "*", "1...
Blockmix; Used by SMix
[ "Blockmix", ";", "Used", "by", "SMix" ]
python
train
echonest/pyechonest
pyechonest/track.py
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/track.py#L314-L331
def track_from_md5(md5, timeout=DEFAULT_ASYNC_TIMEOUT): """ Create a track object from an md5 hash. NOTE: Does not create the detailed analysis for the Track. Call Track.get_analysis() for that. Args: md5: A string 32 characters long giving the md5 checksum of a track already analyzed. ...
[ "def", "track_from_md5", "(", "md5", ",", "timeout", "=", "DEFAULT_ASYNC_TIMEOUT", ")", ":", "param_dict", "=", "dict", "(", "md5", "=", "md5", ")", "return", "_profile", "(", "param_dict", ",", "timeout", ")" ]
Create a track object from an md5 hash. NOTE: Does not create the detailed analysis for the Track. Call Track.get_analysis() for that. Args: md5: A string 32 characters long giving the md5 checksum of a track already analyzed. Example: >>> t = track.track_from_md5('b8abf85746ab3416ada...
[ "Create", "a", "track", "object", "from", "an", "md5", "hash", "." ]
python
train
cggh/scikit-allel
allel/model/ndarray.py
https://github.com/cggh/scikit-allel/blob/3c979a57a100240ba959dd13f98839349530f215/allel/model/ndarray.py#L1995-L2034
def compress(self, condition, axis=0, out=None): """Return selected slices of an array along given axis. Parameters ---------- condition : array_like, bool Array that selects which entries to return. N.B., if len(condition) is less than the size of the given axis...
[ "def", "compress", "(", "self", ",", "condition", ",", "axis", "=", "0", ",", "out", "=", "None", ")", ":", "return", "compress_haplotype_array", "(", "self", ",", "condition", ",", "axis", "=", "axis", ",", "cls", "=", "type", "(", "self", ")", ",",...
Return selected slices of an array along given axis. Parameters ---------- condition : array_like, bool Array that selects which entries to return. N.B., if len(condition) is less than the size of the given axis, then output is truncated to the length of the ...
[ "Return", "selected", "slices", "of", "an", "array", "along", "given", "axis", "." ]
python
train
geophysics-ubonn/crtomo_tools
lib/crtomo/tdManager.py
https://github.com/geophysics-ubonn/crtomo_tools/blob/27c3e21a557f8df1c12455b96c4c2e00e08a5b4a/lib/crtomo/tdManager.py#L1218-L1258
def _read_eps_ctr(tomodir): """Parse a CRTomo eps.ctr file. TODO: change parameters to only provide eps.ctr file Parameters ---------- tomodir: string Path to directory path Returns ------- """ epsctr_file = tomodir + os.sep + 'inv...
[ "def", "_read_eps_ctr", "(", "tomodir", ")", ":", "epsctr_file", "=", "tomodir", "+", "os", ".", "sep", "+", "'inv'", "+", "os", ".", "sep", "+", "'eps.ctr'", "if", "not", "os", ".", "path", ".", "isfile", "(", "epsctr_file", ")", ":", "print", "(", ...
Parse a CRTomo eps.ctr file. TODO: change parameters to only provide eps.ctr file Parameters ---------- tomodir: string Path to directory path Returns -------
[ "Parse", "a", "CRTomo", "eps", ".", "ctr", "file", "." ]
python
train
Jaymon/dump
dump/interface/postgres.py
https://github.com/Jaymon/dump/blob/40045669e07cc2676a9fa92afcf5ef18f10f2fcc/dump/interface/postgres.py#L92-L116
def table_dump(self, table): """dump all the rows of the given table name""" if not table: raise ValueError("no table") cmds = [] logger.info('------- dumping table {}'.format(table)) cmd = self._get_args( "pg_dump", "--table={}".format(table), ...
[ "def", "table_dump", "(", "self", ",", "table", ")", ":", "if", "not", "table", ":", "raise", "ValueError", "(", "\"no table\"", ")", "cmds", "=", "[", "]", "logger", ".", "info", "(", "'------- dumping table {}'", ".", "format", "(", "table", ")", ")", ...
dump all the rows of the given table name
[ "dump", "all", "the", "rows", "of", "the", "given", "table", "name" ]
python
train
Clinical-Genomics/scout
scout/adapter/mongo/case.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/case.py#L215-L239
def case(self, case_id=None, institute_id=None, display_name=None): """Fetches a single case from database Use either the _id or combination of institute_id and display_name Args: case_id(str): _id for a caes institute_id(str): display_name(str) Yie...
[ "def", "case", "(", "self", ",", "case_id", "=", "None", ",", "institute_id", "=", "None", ",", "display_name", "=", "None", ")", ":", "query", "=", "{", "}", "if", "case_id", ":", "query", "[", "'_id'", "]", "=", "case_id", "LOG", ".", "info", "("...
Fetches a single case from database Use either the _id or combination of institute_id and display_name Args: case_id(str): _id for a caes institute_id(str): display_name(str) Yields: A single Case
[ "Fetches", "a", "single", "case", "from", "database" ]
python
test
jedie/DragonPy
PyDC/PyDC/utils.py
https://github.com/jedie/DragonPy/blob/6659e5b5133aab26979a498ee7453495773a4f6c/PyDC/PyDC/utils.py#L466-L478
def codepoints2bitstream(codepoints): """ >>> list(codepoints2bitstream([0x48,0x45])) [0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0] >>> list(codepoints2bitstream(0x48)) [0, 0, 0, 1, 0, 0, 1, 0] """ if isinstance(codepoints, int): codepoints = [codepoints] for codepoint in code...
[ "def", "codepoints2bitstream", "(", "codepoints", ")", ":", "if", "isinstance", "(", "codepoints", ",", "int", ")", ":", "codepoints", "=", "[", "codepoints", "]", "for", "codepoint", "in", "codepoints", ":", "bit_string", "=", "byte2bit_string", "(", "codepoi...
>>> list(codepoints2bitstream([0x48,0x45])) [0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0] >>> list(codepoints2bitstream(0x48)) [0, 0, 0, 1, 0, 0, 1, 0]
[ ">>>", "list", "(", "codepoints2bitstream", "(", "[", "0x48", "0x45", "]", "))", "[", "0", "0", "0", "1", "0", "0", "1", "0", "1", "0", "1", "0", "0", "0", "1", "0", "]", ">>>", "list", "(", "codepoints2bitstream", "(", "0x48", "))", "[", "0", ...
python
train
LonamiWebs/Telethon
telethon/entitycache.py
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/entitycache.py#L10-L30
def add(self, entities): """ Adds the given entities to the cache, if they weren't saved before. """ if not utils.is_list_like(entities): # Invariant: all "chats" and "users" are always iterables, # and "user" never is (so we wrap it inside a list). en...
[ "def", "add", "(", "self", ",", "entities", ")", ":", "if", "not", "utils", ".", "is_list_like", "(", "entities", ")", ":", "# Invariant: all \"chats\" and \"users\" are always iterables,", "# and \"user\" never is (so we wrap it inside a list).", "entities", "=", "itertool...
Adds the given entities to the cache, if they weren't saved before.
[ "Adds", "the", "given", "entities", "to", "the", "cache", "if", "they", "weren", "t", "saved", "before", "." ]
python
train
fermiPy/fermipy
fermipy/stats_utils.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L14-L16
def norm(x, mu, sigma=1.0): """ Scipy norm function """ return stats.norm(loc=mu, scale=sigma).pdf(x)
[ "def", "norm", "(", "x", ",", "mu", ",", "sigma", "=", "1.0", ")", ":", "return", "stats", ".", "norm", "(", "loc", "=", "mu", ",", "scale", "=", "sigma", ")", ".", "pdf", "(", "x", ")" ]
Scipy norm function
[ "Scipy", "norm", "function" ]
python
train
avelino/bottle-auth
bottle_auth/core/auth.py
https://github.com/avelino/bottle-auth/blob/db07e526864aeac05ee68444b47e5db29540ce18/bottle_auth/core/auth.py#L202-L214
def async_callback(self, callback, *args, **kwargs): """Obsolete - catches exceptions from the wrapped function. This function is unnecessary since Tornado 1.1. """ if callback is None: return None if args or kwargs: callback = functools.partial(callback,...
[ "def", "async_callback", "(", "self", ",", "callback", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "callback", "is", "None", ":", "return", "None", "if", "args", "or", "kwargs", ":", "callback", "=", "functools", ".", "partial", "(", "...
Obsolete - catches exceptions from the wrapped function. This function is unnecessary since Tornado 1.1.
[ "Obsolete", "-", "catches", "exceptions", "from", "the", "wrapped", "function", "." ]
python
test
ethereum/eth-abi
eth_abi/base.py
https://github.com/ethereum/eth-abi/blob/0a5cab0bdeae30b77efa667379427581784f1707/eth_abi/base.py#L80-L110
def parse_tuple_type_str(old_from_type_str): """ Used by BaseCoder subclasses as a convenience for implementing the ``from_type_str`` method required by ``ABIRegistry``. Useful if normalizing then parsing a tuple type string is required in that method. """ @functools.wraps(old_from_type_str) ...
[ "def", "parse_tuple_type_str", "(", "old_from_type_str", ")", ":", "@", "functools", ".", "wraps", "(", "old_from_type_str", ")", "def", "new_from_type_str", "(", "cls", ",", "type_str", ",", "registry", ")", ":", "normalized_type_str", "=", "normalize", "(", "t...
Used by BaseCoder subclasses as a convenience for implementing the ``from_type_str`` method required by ``ABIRegistry``. Useful if normalizing then parsing a tuple type string is required in that method.
[ "Used", "by", "BaseCoder", "subclasses", "as", "a", "convenience", "for", "implementing", "the", "from_type_str", "method", "required", "by", "ABIRegistry", ".", "Useful", "if", "normalizing", "then", "parsing", "a", "tuple", "type", "string", "is", "required", ...
python
train
glomex/gcdt
gcdt/iam.py
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L113-L136
def build_policy_bucket(self, bucket, name, statements): """ Generate bucket policy for S3 bucket :param bucket: The bucket to attach policy to :param name: The name of the bucket (to generate policy name from it) :param statements: The "rules" the policy should have :ret...
[ "def", "build_policy_bucket", "(", "self", ",", "bucket", ",", "name", ",", "statements", ")", ":", "policy", "=", "self", ".", "__template", ".", "add_resource", "(", "BucketPolicy", "(", "self", ".", "name_strip", "(", "name", ",", "True", ",", "False", ...
Generate bucket policy for S3 bucket :param bucket: The bucket to attach policy to :param name: The name of the bucket (to generate policy name from it) :param statements: The "rules" the policy should have :return: Ref to new policy
[ "Generate", "bucket", "policy", "for", "S3", "bucket", ":", "param", "bucket", ":", "The", "bucket", "to", "attach", "policy", "to", ":", "param", "name", ":", "The", "name", "of", "the", "bucket", "(", "to", "generate", "policy", "name", "from", "it", ...
python
train
pantsbuild/pex
pex/interpreter_constraints.py
https://github.com/pantsbuild/pex/blob/87b2129d860250d3b9edce75b9cb62f9789ee521/pex/interpreter_constraints.py#L24-L38
def matched_interpreters(interpreters, constraints): """Given some filters, yield any interpreter that matches at least one of them. :param interpreters: a list of PythonInterpreter objects for filtering :param constraints: A sequence of strings that constrain the interpreter compatibility for this pex. Each...
[ "def", "matched_interpreters", "(", "interpreters", ",", "constraints", ")", ":", "for", "interpreter", "in", "interpreters", ":", "if", "any", "(", "interpreter", ".", "identity", ".", "matches", "(", "filt", ")", "for", "filt", "in", "constraints", ")", ":...
Given some filters, yield any interpreter that matches at least one of them. :param interpreters: a list of PythonInterpreter objects for filtering :param constraints: A sequence of strings that constrain the interpreter compatibility for this pex. Each string uses the Requirement-style format, e.g. 'CPython>=...
[ "Given", "some", "filters", "yield", "any", "interpreter", "that", "matches", "at", "least", "one", "of", "them", "." ]
python
train
rameshg87/pyremotevbox
pyremotevbox/ZSI/address.py
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/address.py#L107-L124
def _getWSAddressTypeCodes(self, **kw): '''kw -- namespaceURI keys with sequence of element names. ''' typecodes = [] try: for nsuri,elements in kw.items(): for el in elements: typecode = GED(nsuri, el) if typecode is No...
[ "def", "_getWSAddressTypeCodes", "(", "self", ",", "*", "*", "kw", ")", ":", "typecodes", "=", "[", "]", "try", ":", "for", "nsuri", ",", "elements", "in", "kw", ".", "items", "(", ")", ":", "for", "el", "in", "elements", ":", "typecode", "=", "GED...
kw -- namespaceURI keys with sequence of element names.
[ "kw", "--", "namespaceURI", "keys", "with", "sequence", "of", "element", "names", "." ]
python
train
quodlibet/mutagen
mutagen/_util.py
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/_util.py#L100-L110
def fileobj_name(fileobj): """ Returns: text: A potential filename for a file object. Always a valid path type, but might be empty or non-existent. """ value = getattr(fileobj, "name", u"") if not isinstance(value, (text_type, bytes)): value = text_type(value) return...
[ "def", "fileobj_name", "(", "fileobj", ")", ":", "value", "=", "getattr", "(", "fileobj", ",", "\"name\"", ",", "u\"\"", ")", "if", "not", "isinstance", "(", "value", ",", "(", "text_type", ",", "bytes", ")", ")", ":", "value", "=", "text_type", "(", ...
Returns: text: A potential filename for a file object. Always a valid path type, but might be empty or non-existent.
[ "Returns", ":", "text", ":", "A", "potential", "filename", "for", "a", "file", "object", ".", "Always", "a", "valid", "path", "type", "but", "might", "be", "empty", "or", "non", "-", "existent", "." ]
python
train
tensorlayer/tensorlayer
tensorlayer/activation.py
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/activation.py#L91-L134
def leaky_relu6(x, alpha=0.2, name="leaky_relu6"): """:func:`leaky_relu6` can be used through its shortcut: :func:`tl.act.lrelu6`. This activation function is a modified version :func:`leaky_relu` introduced by the following paper: `Rectifier Nonlinearities Improve Neural Network Acoustic Models [A. L. Maa...
[ "def", "leaky_relu6", "(", "x", ",", "alpha", "=", "0.2", ",", "name", "=", "\"leaky_relu6\"", ")", ":", "if", "not", "isinstance", "(", "alpha", ",", "tf", ".", "Tensor", ")", "and", "not", "(", "0", "<", "alpha", "<=", "1", ")", ":", "raise", "...
:func:`leaky_relu6` can be used through its shortcut: :func:`tl.act.lrelu6`. This activation function is a modified version :func:`leaky_relu` introduced by the following paper: `Rectifier Nonlinearities Improve Neural Network Acoustic Models [A. L. Maas et al., 2013] <https://ai.stanford.edu/~amaas/papers/rel...
[ ":", "func", ":", "leaky_relu6", "can", "be", "used", "through", "its", "shortcut", ":", ":", "func", ":", "tl", ".", "act", ".", "lrelu6", "." ]
python
valid
joshspeagle/dynesty
priors.py
https://github.com/joshspeagle/dynesty/blob/9e482aafeb5cf84bedb896fa6f07a761d917983e/priors.py#L118-L133
def unit_transform(self, x, **kwargs): """Go from a value of the CDF (between 0 and 1) to the corresponding parameter value. :param x: A scalar or vector of same length as the Prior with values between zero and one corresponding to the value of the CDF. :returns...
[ "def", "unit_transform", "(", "self", ",", "x", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "kwargs", ")", ">", "0", ":", "self", ".", "update", "(", "*", "*", "kwargs", ")", "return", "self", ".", "distribution", ".", "ppf", "(", "x", ...
Go from a value of the CDF (between 0 and 1) to the corresponding parameter value. :param x: A scalar or vector of same length as the Prior with values between zero and one corresponding to the value of the CDF. :returns theta: The parameter value correspond...
[ "Go", "from", "a", "value", "of", "the", "CDF", "(", "between", "0", "and", "1", ")", "to", "the", "corresponding", "parameter", "value", "." ]
python
train
gem/oq-engine
openquake/calculators/views.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/calculators/views.py#L759-L769
def view_mean_disagg(token, dstore): """ Display mean quantities for the disaggregation. Useful for checking differences between two calculations. """ tbl = [] for key, dset in sorted(dstore['disagg'].items()): vals = [ds.value.mean() for k, ds in sorted(dset.items())] tbl.append...
[ "def", "view_mean_disagg", "(", "token", ",", "dstore", ")", ":", "tbl", "=", "[", "]", "for", "key", ",", "dset", "in", "sorted", "(", "dstore", "[", "'disagg'", "]", ".", "items", "(", ")", ")", ":", "vals", "=", "[", "ds", ".", "value", ".", ...
Display mean quantities for the disaggregation. Useful for checking differences between two calculations.
[ "Display", "mean", "quantities", "for", "the", "disaggregation", ".", "Useful", "for", "checking", "differences", "between", "two", "calculations", "." ]
python
train
rbarrois/aionotify
aionotify/aioutils.py
https://github.com/rbarrois/aionotify/blob/6cfa35b26a2660f77f29a92d3efb7d1dde685b43/aionotify/aioutils.py#L37-L58
def _read_ready(self): """Called by the event loop whenever the fd is ready for reading.""" try: data = os.read(self._fileno, self.max_size) except InterruptedError: # No worries ;) pass except OSError as exc: # Some OS-level problem, cras...
[ "def", "_read_ready", "(", "self", ")", ":", "try", ":", "data", "=", "os", ".", "read", "(", "self", ".", "_fileno", ",", "self", ".", "max_size", ")", "except", "InterruptedError", ":", "# No worries ;)", "pass", "except", "OSError", "as", "exc", ":", ...
Called by the event loop whenever the fd is ready for reading.
[ "Called", "by", "the", "event", "loop", "whenever", "the", "fd", "is", "ready", "for", "reading", "." ]
python
test
tobami/littlechef
littlechef/lib.py
https://github.com/tobami/littlechef/blob/aab8c94081b38100a69cc100bc4278ae7419c58e/littlechef/lib.py#L116-L129
def get_nodes(environment=None): """Gets all nodes found in the nodes/ directory""" if not os.path.exists('nodes'): return [] nodes = [] for filename in sorted( [f for f in os.listdir('nodes') if (not os.path.isdir(f) and f.endswith(".json") and not f.st...
[ "def", "get_nodes", "(", "environment", "=", "None", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "'nodes'", ")", ":", "return", "[", "]", "nodes", "=", "[", "]", "for", "filename", "in", "sorted", "(", "[", "f", "for", "f", "in"...
Gets all nodes found in the nodes/ directory
[ "Gets", "all", "nodes", "found", "in", "the", "nodes", "/", "directory" ]
python
train
CamDavidsonPilon/lifelines
lifelines/utils/__init__.py
https://github.com/CamDavidsonPilon/lifelines/blob/bdf6be6f1d10eea4c46365ee0ee6a47d8c30edf8/lifelines/utils/__init__.py#L262-L361
def survival_table_from_events( death_times, event_observed, birth_times=None, columns=["removed", "observed", "censored", "entrance", "at_risk"], weights=None, collapse=False, intervals=None, ): # pylint: disable=dangerous-default-value,too-many-locals """ Parameters ----------...
[ "def", "survival_table_from_events", "(", "death_times", ",", "event_observed", ",", "birth_times", "=", "None", ",", "columns", "=", "[", "\"removed\"", ",", "\"observed\"", ",", "\"censored\"", ",", "\"entrance\"", ",", "\"at_risk\"", "]", ",", "weights", "=", ...
Parameters ---------- death_times: (n,) array represent the event times event_observed: (n,) array 1 if observed event, 0 is censored event. birth_times: a (n,) array, optional representing when the subject was first observed. A subject's death event is then at [birth times + duration ...
[ "Parameters", "----------", "death_times", ":", "(", "n", ")", "array", "represent", "the", "event", "times", "event_observed", ":", "(", "n", ")", "array", "1", "if", "observed", "event", "0", "is", "censored", "event", ".", "birth_times", ":", "a", "(", ...
python
train
openstack/networking-cisco
networking_cisco/plugins/cisco/device_manager/config.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/config.py#L202-L219
def uuidify(val): """Takes an integer and transforms it to a UUID format. returns: UUID formatted version of input. """ if uuidutils.is_uuid_like(val): return val else: try: int_val = int(val, 16) except ValueError: with excutils.save_and_reraise_exce...
[ "def", "uuidify", "(", "val", ")", ":", "if", "uuidutils", ".", "is_uuid_like", "(", "val", ")", ":", "return", "val", "else", ":", "try", ":", "int_val", "=", "int", "(", "val", ",", "16", ")", "except", "ValueError", ":", "with", "excutils", ".", ...
Takes an integer and transforms it to a UUID format. returns: UUID formatted version of input.
[ "Takes", "an", "integer", "and", "transforms", "it", "to", "a", "UUID", "format", "." ]
python
train
inspirehep/inspire-dojson
inspire_dojson/hep/rules/bd5xx.py
https://github.com/inspirehep/inspire-dojson/blob/17f3789cd3d5ae58efa1190dc0eea9efb9c8ca59/inspire_dojson/hep/rules/bd5xx.py#L249-L256
def license2marc(self, key, value): """Populate the ``540`` MARC field.""" return { 'a': value.get('license'), 'b': value.get('imposing'), 'u': value.get('url'), '3': value.get('material'), }
[ "def", "license2marc", "(", "self", ",", "key", ",", "value", ")", ":", "return", "{", "'a'", ":", "value", ".", "get", "(", "'license'", ")", ",", "'b'", ":", "value", ".", "get", "(", "'imposing'", ")", ",", "'u'", ":", "value", ".", "get", "("...
Populate the ``540`` MARC field.
[ "Populate", "the", "540", "MARC", "field", "." ]
python
train
AmesCornish/buttersink
buttersink/SSHStore.py
https://github.com/AmesCornish/buttersink/blob/5cc37e30d9f8071fcf3497dca8b8a91b910321ea/buttersink/SSHStore.py#L577-L583
def version(self): """ Return kernel and btrfs version. """ return dict( buttersink=theVersion, btrfs=self.butterStore.butter.btrfsVersion, linux=platform.platform(), )
[ "def", "version", "(", "self", ")", ":", "return", "dict", "(", "buttersink", "=", "theVersion", ",", "btrfs", "=", "self", ".", "butterStore", ".", "butter", ".", "btrfsVersion", ",", "linux", "=", "platform", ".", "platform", "(", ")", ",", ")" ]
Return kernel and btrfs version.
[ "Return", "kernel", "and", "btrfs", "version", "." ]
python
train
gwpy/gwpy
gwpy/types/series.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/types/series.py#L456-L461
def step(self, **kwargs): """Create a step plot of this series """ kwargs.setdefault('linestyle', kwargs.pop('where', 'steps-post')) data = self.append(self.value[-1:], inplace=False) return data.plot(**kwargs)
[ "def", "step", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'linestyle'", ",", "kwargs", ".", "pop", "(", "'where'", ",", "'steps-post'", ")", ")", "data", "=", "self", ".", "append", "(", "self", ".", "value", ...
Create a step plot of this series
[ "Create", "a", "step", "plot", "of", "this", "series" ]
python
train
faucamp/python-gsmmodem
gsmmodem/util.py
https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/util.py#L30-L45
def parseTextModeTimeStr(timeStr): """ Parses the specified SMS text mode time string The time stamp format is "yy/MM/dd,hh:mm:ss±zz" (yy = year, MM = month, dd = day, hh = hour, mm = minute, ss = second, zz = time zone [Note: the unit of time zone is a quarter of an hour]) :param timeStr:...
[ "def", "parseTextModeTimeStr", "(", "timeStr", ")", ":", "msgTime", "=", "timeStr", "[", ":", "-", "3", "]", "tzOffsetHours", "=", "int", "(", "int", "(", "timeStr", "[", "-", "3", ":", "]", ")", "*", "0.25", ")", "return", "datetime", ".", "strptime...
Parses the specified SMS text mode time string The time stamp format is "yy/MM/dd,hh:mm:ss±zz" (yy = year, MM = month, dd = day, hh = hour, mm = minute, ss = second, zz = time zone [Note: the unit of time zone is a quarter of an hour]) :param timeStr: The time string to parse :type timeStr...
[ "Parses", "the", "specified", "SMS", "text", "mode", "time", "string", "The", "time", "stamp", "format", "is", "yy", "/", "MM", "/", "dd", "hh", ":", "mm", ":", "ss±zz", "(", "yy", "=", "year", "MM", "=", "month", "dd", "=", "day", "hh", "=", "ho...
python
train
SheffieldML/GPy
GPy/inference/latent_function_inference/var_dtc.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/var_dtc.py#L51-L61
def _get_YYTfactor(self, Y): """ find a matrix L which satisfies LLT = YYT. Note that L may have fewer columns than Y. """ N, D = Y.shape if (N>=D): return Y.view(np.ndarray) else: return jitchol(tdot(Y))
[ "def", "_get_YYTfactor", "(", "self", ",", "Y", ")", ":", "N", ",", "D", "=", "Y", ".", "shape", "if", "(", "N", ">=", "D", ")", ":", "return", "Y", ".", "view", "(", "np", ".", "ndarray", ")", "else", ":", "return", "jitchol", "(", "tdot", "...
find a matrix L which satisfies LLT = YYT. Note that L may have fewer columns than Y.
[ "find", "a", "matrix", "L", "which", "satisfies", "LLT", "=", "YYT", "." ]
python
train
ismms-himc/clustergrammer2
clustergrammer2/clustergrammer_fun/__init__.py
https://github.com/ismms-himc/clustergrammer2/blob/5acea9bff7eda546cf0647b9e3647f631eb6f5f5/clustergrammer2/clustergrammer_fun/__init__.py#L297-L307
def filter_threshold(self, inst_rc, threshold, num_occur=1): ''' Filter the matrix rows or columns based on num_occur values being above a threshold (in absolute value). ''' inst_df = self.dat_to_df() inst_df = run_filter.filter_threshold(inst_df, inst_rc, threshold, num_occur) self....
[ "def", "filter_threshold", "(", "self", ",", "inst_rc", ",", "threshold", ",", "num_occur", "=", "1", ")", ":", "inst_df", "=", "self", ".", "dat_to_df", "(", ")", "inst_df", "=", "run_filter", ".", "filter_threshold", "(", "inst_df", ",", "inst_rc", ",", ...
Filter the matrix rows or columns based on num_occur values being above a threshold (in absolute value).
[ "Filter", "the", "matrix", "rows", "or", "columns", "based", "on", "num_occur", "values", "being", "above", "a", "threshold", "(", "in", "absolute", "value", ")", "." ]
python
train
klen/python-scss
scss/parser.py
https://github.com/klen/python-scss/blob/34fe985e6b43caa9f9b9bcd0dc433be4b2a1fdec/scss/parser.py#L351-L382
def load(self, f, precache=None): """ Compile scss from file. File is string path of file object. """ precache = precache or self.get_opt('cache') or False nodes = None if isinstance(f, file_): path = os.path.abspath(f.name) else: path...
[ "def", "load", "(", "self", ",", "f", ",", "precache", "=", "None", ")", ":", "precache", "=", "precache", "or", "self", ".", "get_opt", "(", "'cache'", ")", "or", "False", "nodes", "=", "None", "if", "isinstance", "(", "f", ",", "file_", ")", ":",...
Compile scss from file. File is string path of file object.
[ "Compile", "scss", "from", "file", ".", "File", "is", "string", "path", "of", "file", "object", "." ]
python
train
rGunti/CarPi-OBDDaemon
obddaemon/custom/Obd2DataParser.py
https://github.com/rGunti/CarPi-OBDDaemon/blob/6831c477b2a00617a0d2ea98b28f3bc5c1ba8e5f/obddaemon/custom/Obd2DataParser.py#L145-L164
def parse_0101(v): """ Parses the DTC status and returns two elements. https://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_1_PID_01 :param v: :return bool, int: """ tv = trim_obd_value(v) mil_status = None # type: bool num_dtc = None # type: int try: byte_a = int(v[:2], 16)...
[ "def", "parse_0101", "(", "v", ")", ":", "tv", "=", "trim_obd_value", "(", "v", ")", "mil_status", "=", "None", "# type: bool", "num_dtc", "=", "None", "# type: int", "try", ":", "byte_a", "=", "int", "(", "v", "[", ":", "2", "]", ",", "16", ")", "...
Parses the DTC status and returns two elements. https://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_1_PID_01 :param v: :return bool, int:
[ "Parses", "the", "DTC", "status", "and", "returns", "two", "elements", ".", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "OBD", "-", "II_PIDs#Mode_1_PID_01", ":", "param", "v", ":", ":", "return", "bool", "int", ":" ]
python
train
annoviko/pyclustering
pyclustering/cluster/cure.py
https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/cure.py#L417-L471
def __merge_clusters(self, cluster1, cluster2): """! @brief Merges two clusters and returns new merged cluster. Representation points and mean points are calculated for the new cluster. @param[in] cluster1 (cure_cluster): Cluster that should be merged. @param[in] cluster2 (...
[ "def", "__merge_clusters", "(", "self", ",", "cluster1", ",", "cluster2", ")", ":", "merged_cluster", "=", "cure_cluster", "(", "None", ",", "None", ")", "merged_cluster", ".", "points", "=", "cluster1", ".", "points", "+", "cluster2", ".", "points", "merged...
! @brief Merges two clusters and returns new merged cluster. Representation points and mean points are calculated for the new cluster. @param[in] cluster1 (cure_cluster): Cluster that should be merged. @param[in] cluster2 (cure_cluster): Cluster that should be merged. ...
[ "!" ]
python
valid
has2k1/plydata
plydata/utils.py
https://github.com/has2k1/plydata/blob/d8ca85ff70eee621e96f7c74034e90fec16e8b61/plydata/utils.py#L16-L36
def temporary_key(d, key, value): """ Context manager that removes key from dictionary on closing The dictionary will hold the key for the duration of the context. Parameters ---------- d : dict-like Dictionary in which to insert a temporary key. key : hashable Location...
[ "def", "temporary_key", "(", "d", ",", "key", ",", "value", ")", ":", "d", "[", "key", "]", "=", "value", "try", ":", "yield", "d", "finally", ":", "del", "d", "[", "key", "]" ]
Context manager that removes key from dictionary on closing The dictionary will hold the key for the duration of the context. Parameters ---------- d : dict-like Dictionary in which to insert a temporary key. key : hashable Location at which to insert ``value``. value : obj...
[ "Context", "manager", "that", "removes", "key", "from", "dictionary", "on", "closing" ]
python
train
pycampers/zproc
zproc/state/state.py
https://github.com/pycampers/zproc/blob/352a3c7166e2ccc3597c28385a8354b5a22afdc2/zproc/state/state.py#L505-L511
def when_available(self, key: Hashable, **when_kwargs) -> StateWatcher: """ Block until ``key in state``, and then return a copy of the state. .. include:: /api/state/get_when_equality.rst """ return self.when(lambda snapshot: key in snapshot, **when_kwargs)
[ "def", "when_available", "(", "self", ",", "key", ":", "Hashable", ",", "*", "*", "when_kwargs", ")", "->", "StateWatcher", ":", "return", "self", ".", "when", "(", "lambda", "snapshot", ":", "key", "in", "snapshot", ",", "*", "*", "when_kwargs", ")" ]
Block until ``key in state``, and then return a copy of the state. .. include:: /api/state/get_when_equality.rst
[ "Block", "until", "key", "in", "state", "and", "then", "return", "a", "copy", "of", "the", "state", "." ]
python
train
pymupdf/PyMuPDF
fitz/utils.py
https://github.com/pymupdf/PyMuPDF/blob/917f2d83482510e26ba0ff01fd2392c26f3a8e90/fitz/utils.py#L1253-L1270
def drawSector(page, center, point, beta, color=None, fill=None, dashes=None, fullSector=True, morph=None, width=1, closePath=False, roundCap=False, overlay=True): """ Draw a circle sector given circle center, one arc end point and the angle of the arc. Parameters: cente...
[ "def", "drawSector", "(", "page", ",", "center", ",", "point", ",", "beta", ",", "color", "=", "None", ",", "fill", "=", "None", ",", "dashes", "=", "None", ",", "fullSector", "=", "True", ",", "morph", "=", "None", ",", "width", "=", "1", ",", "...
Draw a circle sector given circle center, one arc end point and the angle of the arc. Parameters: center -- center of circle point -- arc end point beta -- angle of arc (degrees) fullSector -- connect arc ends with center
[ "Draw", "a", "circle", "sector", "given", "circle", "center", "one", "arc", "end", "point", "and", "the", "angle", "of", "the", "arc", ".", "Parameters", ":", "center", "--", "center", "of", "circle", "point", "--", "arc", "end", "point", "beta", "--", ...
python
train
nkavaldj/myhdl_lib
myhdl_lib/simulation/_DUTer.py
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/simulation/_DUTer.py#L101-L113
def _enableTracesVerilog(self, verilogFile): ''' Enables traces in a Verilog file''' fname, _ = os.path.splitext(verilogFile) inserted = False for _, line in enumerate(fileinput.input(verilogFile, inplace = 1)): sys.stdout.write(line) if line.startswith("end") and...
[ "def", "_enableTracesVerilog", "(", "self", ",", "verilogFile", ")", ":", "fname", ",", "_", "=", "os", ".", "path", ".", "splitext", "(", "verilogFile", ")", "inserted", "=", "False", "for", "_", ",", "line", "in", "enumerate", "(", "fileinput", ".", ...
Enables traces in a Verilog file
[ "Enables", "traces", "in", "a", "Verilog", "file" ]
python
train
apple/turicreate
deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L336-L342
def __with_argument(node, value): """Modifies the flags in value if the node contains an Argument.""" arguments = node.getElementsByTagName('Argument') if arguments: logging.debug('Found argument within %s', value['name']) value['flags'] = vsflags(VSFlags.UserValueIgnored, VSFlags.Continue)
[ "def", "__with_argument", "(", "node", ",", "value", ")", ":", "arguments", "=", "node", ".", "getElementsByTagName", "(", "'Argument'", ")", "if", "arguments", ":", "logging", ".", "debug", "(", "'Found argument within %s'", ",", "value", "[", "'name'", "]", ...
Modifies the flags in value if the node contains an Argument.
[ "Modifies", "the", "flags", "in", "value", "if", "the", "node", "contains", "an", "Argument", "." ]
python
train
CivicSpleen/ambry
ambry/metadata/proptree.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L446-L466
def update_config(self): """ Updates or creates config of that group. Requires tree bound to db. """ dataset = self._top._config.dataset session = object_session(self._top._config) logger.debug( 'Updating group config. dataset: {}, type: {}, key: {}'.format(dataset.vid, self....
[ "def", "update_config", "(", "self", ")", ":", "dataset", "=", "self", ".", "_top", ".", "_config", ".", "dataset", "session", "=", "object_session", "(", "self", ".", "_top", ".", "_config", ")", "logger", ".", "debug", "(", "'Updating group config. dataset...
Updates or creates config of that group. Requires tree bound to db.
[ "Updates", "or", "creates", "config", "of", "that", "group", ".", "Requires", "tree", "bound", "to", "db", "." ]
python
train
singularityhub/sregistry-cli
sregistry/main/docker/api.py
https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/docker/api.py#L391-L433
def get_config(self, key="Entrypoint", delim=None): '''get_config returns a particular key (default is Entrypoint) from a VERSION 1 manifest obtained with get_manifest. Parameters ========== key: the key to return from the manifest config delim: Given a list, the delim to us...
[ "def", "get_config", "(", "self", ",", "key", "=", "\"Entrypoint\"", ",", "delim", "=", "None", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'manifests'", ")", ":", "bot", ".", "error", "(", "'Please retrieve manifests for an image first.'", ")", "sy...
get_config returns a particular key (default is Entrypoint) from a VERSION 1 manifest obtained with get_manifest. Parameters ========== key: the key to return from the manifest config delim: Given a list, the delim to use to join the entries. Default is newline
[ "get_config", "returns", "a", "particular", "key", "(", "default", "is", "Entrypoint", ")", "from", "a", "VERSION", "1", "manifest", "obtained", "with", "get_manifest", "." ]
python
test
ktbyers/netmiko
netmiko/base_connection.py
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/base_connection.py#L950-L967
def select_delay_factor(self, delay_factor): """ Choose the greater of delay_factor or self.global_delay_factor (default). In fast_cli choose the lesser of delay_factor of self.global_delay_factor. :param delay_factor: See __init__: global_delay_factor :type delay_factor: int ...
[ "def", "select_delay_factor", "(", "self", ",", "delay_factor", ")", ":", "if", "self", ".", "fast_cli", ":", "if", "delay_factor", "<=", "self", ".", "global_delay_factor", ":", "return", "delay_factor", "else", ":", "return", "self", ".", "global_delay_factor"...
Choose the greater of delay_factor or self.global_delay_factor (default). In fast_cli choose the lesser of delay_factor of self.global_delay_factor. :param delay_factor: See __init__: global_delay_factor :type delay_factor: int
[ "Choose", "the", "greater", "of", "delay_factor", "or", "self", ".", "global_delay_factor", "(", "default", ")", ".", "In", "fast_cli", "choose", "the", "lesser", "of", "delay_factor", "of", "self", ".", "global_delay_factor", "." ]
python
train
feliphebueno/Rinzler
rinzler/core/route_mapping.py
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/core/route_mapping.py#L32-L38
def put(self, route: str(), callback: object()): """ Binds a PUT route with the given callback :rtype: object """ self.__set_route('put', {route: callback}) return RouteMapping
[ "def", "put", "(", "self", ",", "route", ":", "str", "(", ")", ",", "callback", ":", "object", "(", ")", ")", ":", "self", ".", "__set_route", "(", "'put'", ",", "{", "route", ":", "callback", "}", ")", "return", "RouteMapping" ]
Binds a PUT route with the given callback :rtype: object
[ "Binds", "a", "PUT", "route", "with", "the", "given", "callback", ":", "rtype", ":", "object" ]
python
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L453-L465
def delete_enrollment(session, enrollment): """Remove an enrollment from the session. This function removes from the session the given enrollment. :param session: database session :param enrollment: enrollment to remove """ uidentity = enrollment.uidentity uidentity.last_modified = datetim...
[ "def", "delete_enrollment", "(", "session", ",", "enrollment", ")", ":", "uidentity", "=", "enrollment", ".", "uidentity", "uidentity", ".", "last_modified", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "session", ".", "delete", "(", "enrollment"...
Remove an enrollment from the session. This function removes from the session the given enrollment. :param session: database session :param enrollment: enrollment to remove
[ "Remove", "an", "enrollment", "from", "the", "session", "." ]
python
train
jhorman/pledge
pledge/__init__.py
https://github.com/jhorman/pledge/blob/062ba5b788aeb15e68c85a329374a50b4618544d/pledge/__init__.py#L105-L153
def takes(*type_list): """ Decorates a function with type checks. Examples @takes(int): take an int as the first param @takes(int, str): take and int as first, string as 2nd @takes(int, (int, None)): take an int as first, and an int or None as second """ def inner(f): if enabled: ...
[ "def", "takes", "(", "*", "type_list", ")", ":", "def", "inner", "(", "f", ")", ":", "if", "enabled", ":", "# deal with the real function, not a wrapper", "f", "=", "getattr", "(", "f", ",", "'wrapped_fn'", ",", "f", ")", "# need to check if 'self' is the first ...
Decorates a function with type checks. Examples @takes(int): take an int as the first param @takes(int, str): take and int as first, string as 2nd @takes(int, (int, None)): take an int as first, and an int or None as second
[ "Decorates", "a", "function", "with", "type", "checks", ".", "Examples" ]
python
train