repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
intuition-io/insights
insights/plugins/hipchat.py
Bot.message
def message(self, body, room_id, style='text'): ''' Send a message to the given room ''' # TODO Automatically detect body format ? path = 'rooms/message' data = { 'room_id': room_id, 'message': body, 'from': self.name, 'notify': 1, ...
python
def message(self, body, room_id, style='text'): ''' Send a message to the given room ''' # TODO Automatically detect body format ? path = 'rooms/message' data = { 'room_id': room_id, 'message': body, 'from': self.name, 'notify': 1, ...
[ "def", "message", "(", "self", ",", "body", ",", "room_id", ",", "style", "=", "'text'", ")", ":", "# TODO Automatically detect body format ?", "path", "=", "'rooms/message'", "data", "=", "{", "'room_id'", ":", "room_id", ",", "'message'", ":", "body", ",", ...
Send a message to the given room
[ "Send", "a", "message", "to", "the", "given", "room" ]
a4eae53a1886164db96751d2b0964aa2acb7c2d7
https://github.com/intuition-io/insights/blob/a4eae53a1886164db96751d2b0964aa2acb7c2d7/insights/plugins/hipchat.py#L53-L68
train
15,600
tethysplatform/condorpy
condorpy/job.py
Job.job_file
def job_file(self): """The path to the submit description file representing this job. """ job_file_name = '%s.job' % (self.name) job_file_path = os.path.join(self.initial_dir, job_file_name) self._job_file = job_file_path return self._job_file
python
def job_file(self): """The path to the submit description file representing this job. """ job_file_name = '%s.job' % (self.name) job_file_path = os.path.join(self.initial_dir, job_file_name) self._job_file = job_file_path return self._job_file
[ "def", "job_file", "(", "self", ")", ":", "job_file_name", "=", "'%s.job'", "%", "(", "self", ".", "name", ")", "job_file_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "initial_dir", ",", "job_file_name", ")", "self", ".", "_job_file", ...
The path to the submit description file representing this job.
[ "The", "path", "to", "the", "submit", "description", "file", "representing", "this", "job", "." ]
a5aaaef0d73198f7d9756dda7abe98b4e209f1f4
https://github.com/tethysplatform/condorpy/blob/a5aaaef0d73198f7d9756dda7abe98b4e209f1f4/condorpy/job.py#L173-L180
train
15,601
tethysplatform/condorpy
condorpy/job.py
Job.log_file
def log_file(self): """The path to the log file for this job. """ log_file = self.get('log') if not log_file: log_file = '%s.log' % (self.name) self.set('log', log_file) return os.path.join(self.initial_dir, self.get('log'))
python
def log_file(self): """The path to the log file for this job. """ log_file = self.get('log') if not log_file: log_file = '%s.log' % (self.name) self.set('log', log_file) return os.path.join(self.initial_dir, self.get('log'))
[ "def", "log_file", "(", "self", ")", ":", "log_file", "=", "self", ".", "get", "(", "'log'", ")", "if", "not", "log_file", ":", "log_file", "=", "'%s.log'", "%", "(", "self", ".", "name", ")", "self", ".", "set", "(", "'log'", ",", "log_file", ")",...
The path to the log file for this job.
[ "The", "path", "to", "the", "log", "file", "for", "this", "job", "." ]
a5aaaef0d73198f7d9756dda7abe98b4e209f1f4
https://github.com/tethysplatform/condorpy/blob/a5aaaef0d73198f7d9756dda7abe98b4e209f1f4/condorpy/job.py#L183-L191
train
15,602
tethysplatform/condorpy
condorpy/job.py
Job.initial_dir
def initial_dir(self): """The initial directory defined for the job. All input files, and log files are relative to this directory. Output files will be copied into this directory by default. This directory will be created if it doesn't already exist when the job is submitted. Note: ...
python
def initial_dir(self): """The initial directory defined for the job. All input files, and log files are relative to this directory. Output files will be copied into this directory by default. This directory will be created if it doesn't already exist when the job is submitted. Note: ...
[ "def", "initial_dir", "(", "self", ")", ":", "initial_dir", "=", "self", ".", "get", "(", "'initialdir'", ")", "if", "not", "initial_dir", ":", "initial_dir", "=", "os", ".", "curdir", "#TODO does this conflict with the working directory?", "if", "self", ".", "_...
The initial directory defined for the job. All input files, and log files are relative to this directory. Output files will be copied into this directory by default. This directory will be created if it doesn't already exist when the job is submitted. Note: The executable file is d...
[ "The", "initial", "directory", "defined", "for", "the", "job", "." ]
a5aaaef0d73198f7d9756dda7abe98b4e209f1f4
https://github.com/tethysplatform/condorpy/blob/a5aaaef0d73198f7d9756dda7abe98b4e209f1f4/condorpy/job.py#L194-L210
train
15,603
tethysplatform/condorpy
condorpy/job.py
Job.submit
def submit(self, queue=None, options=[]): """Submits the job either locally or to a remote server if it is defined. Args: queue (int, optional): The number of sub-jobs to run. This argmuent will set the num_jobs attribute of this object. Defaults to None, meaning the value o...
python
def submit(self, queue=None, options=[]): """Submits the job either locally or to a remote server if it is defined. Args: queue (int, optional): The number of sub-jobs to run. This argmuent will set the num_jobs attribute of this object. Defaults to None, meaning the value o...
[ "def", "submit", "(", "self", ",", "queue", "=", "None", ",", "options", "=", "[", "]", ")", ":", "if", "not", "self", ".", "executable", ":", "log", ".", "error", "(", "'Job %s was submitted with no executable'", ",", "self", ".", "name", ")", "raise", ...
Submits the job either locally or to a remote server if it is defined. Args: queue (int, optional): The number of sub-jobs to run. This argmuent will set the num_jobs attribute of this object. Defaults to None, meaning the value of num_jobs will be used. options (list of...
[ "Submits", "the", "job", "either", "locally", "or", "to", "a", "remote", "server", "if", "it", "is", "defined", "." ]
a5aaaef0d73198f7d9756dda7abe98b4e209f1f4
https://github.com/tethysplatform/condorpy/blob/a5aaaef0d73198f7d9756dda7abe98b4e209f1f4/condorpy/job.py#L212-L236
train
15,604
tethysplatform/condorpy
condorpy/job.py
Job.wait
def wait(self, options=[], sub_job_num=None): """Wait for the job, or a sub-job to complete. Args: options (list of str, optional): A list of command line options for the condor_wait command. For details on valid options see: http://research.cs.wisc.edu/htcondor/manual/curre...
python
def wait(self, options=[], sub_job_num=None): """Wait for the job, or a sub-job to complete. Args: options (list of str, optional): A list of command line options for the condor_wait command. For details on valid options see: http://research.cs.wisc.edu/htcondor/manual/curre...
[ "def", "wait", "(", "self", ",", "options", "=", "[", "]", ",", "sub_job_num", "=", "None", ")", ":", "args", "=", "[", "'condor_wait'", "]", "args", ".", "extend", "(", "options", ")", "job_id", "=", "'%s.%s'", "%", "(", "self", ".", "cluster_id", ...
Wait for the job, or a sub-job to complete. Args: options (list of str, optional): A list of command line options for the condor_wait command. For details on valid options see: http://research.cs.wisc.edu/htcondor/manual/current/condor_wait.html. Defaults to an empty...
[ "Wait", "for", "the", "job", "or", "a", "sub", "-", "job", "to", "complete", "." ]
a5aaaef0d73198f7d9756dda7abe98b4e209f1f4
https://github.com/tethysplatform/condorpy/blob/a5aaaef0d73198f7d9756dda7abe98b4e209f1f4/condorpy/job.py#L247-L265
train
15,605
tethysplatform/condorpy
condorpy/job.py
Job.get
def get(self, attr, value=None, resolve=True): """Get the value of an attribute from submit description file. Args: attr (str): The name of the attribute whose value should be returned. value (str, optional): A default value to return if 'attr' doesn't exist. Defaults to None. ...
python
def get(self, attr, value=None, resolve=True): """Get the value of an attribute from submit description file. Args: attr (str): The name of the attribute whose value should be returned. value (str, optional): A default value to return if 'attr' doesn't exist. Defaults to None. ...
[ "def", "get", "(", "self", ",", "attr", ",", "value", "=", "None", ",", "resolve", "=", "True", ")", ":", "try", ":", "if", "resolve", ":", "value", "=", "self", ".", "_resolve_attribute", "(", "attr", ")", "else", ":", "value", "=", "self", ".", ...
Get the value of an attribute from submit description file. Args: attr (str): The name of the attribute whose value should be returned. value (str, optional): A default value to return if 'attr' doesn't exist. Defaults to None. resolve (bool, optional): If True then resolve ...
[ "Get", "the", "value", "of", "an", "attribute", "from", "submit", "description", "file", "." ]
a5aaaef0d73198f7d9756dda7abe98b4e209f1f4
https://github.com/tethysplatform/condorpy/blob/a5aaaef0d73198f7d9756dda7abe98b4e209f1f4/condorpy/job.py#L267-L286
train
15,606
tethysplatform/condorpy
condorpy/job.py
Job.set
def set(self, attr, value): """Set the value of an attribute in the submit description file. The value can be passed in as a Python type (i.e. a list, a tuple or a Python boolean). The Python values will be reformatted into strings based on the standards described in the HTCondor manual...
python
def set(self, attr, value): """Set the value of an attribute in the submit description file. The value can be passed in as a Python type (i.e. a list, a tuple or a Python boolean). The Python values will be reformatted into strings based on the standards described in the HTCondor manual...
[ "def", "set", "(", "self", ",", "attr", ",", "value", ")", ":", "def", "escape_new_syntax", "(", "value", ",", "double_quote_escape", "=", "'\"'", ")", ":", "value", "=", "str", "(", "value", ")", "value", "=", "value", ".", "replace", "(", "\"'\"", ...
Set the value of an attribute in the submit description file. The value can be passed in as a Python type (i.e. a list, a tuple or a Python boolean). The Python values will be reformatted into strings based on the standards described in the HTCondor manual: http://research.cs.wisc.edu/htcondor/...
[ "Set", "the", "value", "of", "an", "attribute", "in", "the", "submit", "description", "file", "." ]
a5aaaef0d73198f7d9756dda7abe98b4e209f1f4
https://github.com/tethysplatform/condorpy/blob/a5aaaef0d73198f7d9756dda7abe98b4e209f1f4/condorpy/job.py#L288-L339
train
15,607
tethysplatform/condorpy
condorpy/job.py
Job._update_status
def _update_status(self, sub_job_num=None): """Gets the job status. Return: str: The current status of the job """ job_id = '%s.%s' % (self.cluster_id, sub_job_num) if sub_job_num else str(self.cluster_id) format = ['-format', '"%d"', 'JobStatus'] cmd = 'con...
python
def _update_status(self, sub_job_num=None): """Gets the job status. Return: str: The current status of the job """ job_id = '%s.%s' % (self.cluster_id, sub_job_num) if sub_job_num else str(self.cluster_id) format = ['-format', '"%d"', 'JobStatus'] cmd = 'con...
[ "def", "_update_status", "(", "self", ",", "sub_job_num", "=", "None", ")", ":", "job_id", "=", "'%s.%s'", "%", "(", "self", ".", "cluster_id", ",", "sub_job_num", ")", "if", "sub_job_num", "else", "str", "(", "self", ".", "cluster_id", ")", "format", "=...
Gets the job status. Return: str: The current status of the job
[ "Gets", "the", "job", "status", "." ]
a5aaaef0d73198f7d9756dda7abe98b4e209f1f4
https://github.com/tethysplatform/condorpy/blob/a5aaaef0d73198f7d9756dda7abe98b4e209f1f4/condorpy/job.py#L350-L394
train
15,608
tethysplatform/condorpy
condorpy/job.py
Job._resolve_attribute
def _resolve_attribute(self, attribute): """Recursively replaces references to other attributes with their value. Args: attribute (str): The name of the attribute to resolve. Returns: str: The resolved value of 'attribute'. """ value = self.attributes[a...
python
def _resolve_attribute(self, attribute): """Recursively replaces references to other attributes with their value. Args: attribute (str): The name of the attribute to resolve. Returns: str: The resolved value of 'attribute'. """ value = self.attributes[a...
[ "def", "_resolve_attribute", "(", "self", ",", "attribute", ")", ":", "value", "=", "self", ".", "attributes", "[", "attribute", "]", "if", "not", "value", ":", "return", "None", "resolved_value", "=", "re", ".", "sub", "(", "'\\$\\((.*?)\\)'", ",", "self"...
Recursively replaces references to other attributes with their value. Args: attribute (str): The name of the attribute to resolve. Returns: str: The resolved value of 'attribute'.
[ "Recursively", "replaces", "references", "to", "other", "attributes", "with", "their", "value", "." ]
a5aaaef0d73198f7d9756dda7abe98b4e209f1f4
https://github.com/tethysplatform/condorpy/blob/a5aaaef0d73198f7d9756dda7abe98b4e209f1f4/condorpy/job.py#L417-L431
train
15,609
tethysplatform/condorpy
condorpy/job.py
Job._resolve_attribute_match
def _resolve_attribute_match(self, match): """Replaces a reference to an attribute with the value of the attribute. Args: match (re.match object): A match object containing a match to a reference to an attribute. """ if match.group(1) == 'cluster': return str(se...
python
def _resolve_attribute_match(self, match): """Replaces a reference to an attribute with the value of the attribute. Args: match (re.match object): A match object containing a match to a reference to an attribute. """ if match.group(1) == 'cluster': return str(se...
[ "def", "_resolve_attribute_match", "(", "self", ",", "match", ")", ":", "if", "match", ".", "group", "(", "1", ")", "==", "'cluster'", ":", "return", "str", "(", "self", ".", "cluster_id", ")", "return", "self", ".", "get", "(", "match", ".", "group", ...
Replaces a reference to an attribute with the value of the attribute. Args: match (re.match object): A match object containing a match to a reference to an attribute.
[ "Replaces", "a", "reference", "to", "an", "attribute", "with", "the", "value", "of", "the", "attribute", "." ]
a5aaaef0d73198f7d9756dda7abe98b4e209f1f4
https://github.com/tethysplatform/condorpy/blob/a5aaaef0d73198f7d9756dda7abe98b4e209f1f4/condorpy/job.py#L433-L443
train
15,610
ktdreyer/txkoji
txkoji/channel.py
Channel.total_capacity
def total_capacity(self): """ Find the total task capacity available for this channel. Query all the enabled hosts for this channel and sum up all the capacities. Each task has a "weight". Each task will be in "FREE" state until there is enough capacity for the task's "...
python
def total_capacity(self): """ Find the total task capacity available for this channel. Query all the enabled hosts for this channel and sum up all the capacities. Each task has a "weight". Each task will be in "FREE" state until there is enough capacity for the task's "...
[ "def", "total_capacity", "(", "self", ")", ":", "# Ensure this task's channel has spare capacity for this task.", "total_capacity", "=", "0", "hosts", "=", "yield", "self", ".", "hosts", "(", "enabled", "=", "True", ")", "for", "host", "in", "hosts", ":", "total_c...
Find the total task capacity available for this channel. Query all the enabled hosts for this channel and sum up all the capacities. Each task has a "weight". Each task will be in "FREE" state until there is enough capacity for the task's "weight" on a host. :returns: deferred...
[ "Find", "the", "total", "task", "capacity", "available", "for", "this", "channel", "." ]
a7de380f29f745bf11730b27217208f6d4da7733
https://github.com/ktdreyer/txkoji/blob/a7de380f29f745bf11730b27217208f6d4da7733/txkoji/channel.py#L33-L51
train
15,611
tjcsl/cslbot
cslbot/commands/google.py
cmd
def cmd(send, msg, args): """Googles something. Syntax: {command} <term> """ if not msg: send("Google what?") return key = args['config']['api']['googleapikey'] cx = args['config']['api']['googlesearchid'] data = get('https://www.googleapis.com/customsearch/v1', params={'ke...
python
def cmd(send, msg, args): """Googles something. Syntax: {command} <term> """ if not msg: send("Google what?") return key = args['config']['api']['googleapikey'] cx = args['config']['api']['googlesearchid'] data = get('https://www.googleapis.com/customsearch/v1', params={'ke...
[ "def", "cmd", "(", "send", ",", "msg", ",", "args", ")", ":", "if", "not", "msg", ":", "send", "(", "\"Google what?\"", ")", "return", "key", "=", "args", "[", "'config'", "]", "[", "'api'", "]", "[", "'googleapikey'", "]", "cx", "=", "args", "[", ...
Googles something. Syntax: {command} <term>
[ "Googles", "something", "." ]
aebe07be47141f61d7c180706bddfb707f19b2b5
https://github.com/tjcsl/cslbot/blob/aebe07be47141f61d7c180706bddfb707f19b2b5/cslbot/commands/google.py#L24-L40
train
15,612
rraadd88/rohan
rohan/dandage/__init__.py
get_deps
def get_deps(cfg=None,deps=[]): """ Installs conda dependencies. :param cfg: configuration dict """ if not cfg is None: if not 'deps' in cfg: cfg['deps']=deps else: deps=cfg['deps'] if not len(deps)==0: for dep in deps: if not dep in c...
python
def get_deps(cfg=None,deps=[]): """ Installs conda dependencies. :param cfg: configuration dict """ if not cfg is None: if not 'deps' in cfg: cfg['deps']=deps else: deps=cfg['deps'] if not len(deps)==0: for dep in deps: if not dep in c...
[ "def", "get_deps", "(", "cfg", "=", "None", ",", "deps", "=", "[", "]", ")", ":", "if", "not", "cfg", "is", "None", ":", "if", "not", "'deps'", "in", "cfg", ":", "cfg", "[", "'deps'", "]", "=", "deps", "else", ":", "deps", "=", "cfg", "[", "'...
Installs conda dependencies. :param cfg: configuration dict
[ "Installs", "conda", "dependencies", "." ]
b0643a3582a2fffc0165ace69fb80880d92bfb10
https://github.com/rraadd88/rohan/blob/b0643a3582a2fffc0165ace69fb80880d92bfb10/rohan/dandage/__init__.py#L7-L24
train
15,613
Syndace/python-xeddsa
xeddsa/xeddsa.py
XEdDSA.mont_pub_from_mont_priv
def mont_pub_from_mont_priv(cls, mont_priv): """ Restore the Montgomery public key from a Montgomery private key. :param mont_priv: A bytes-like object encoding the private key with length MONT_PRIV_KEY_SIZE. :returns: A bytes-like object encoding the public key with length ...
python
def mont_pub_from_mont_priv(cls, mont_priv): """ Restore the Montgomery public key from a Montgomery private key. :param mont_priv: A bytes-like object encoding the private key with length MONT_PRIV_KEY_SIZE. :returns: A bytes-like object encoding the public key with length ...
[ "def", "mont_pub_from_mont_priv", "(", "cls", ",", "mont_priv", ")", ":", "if", "not", "isinstance", "(", "mont_priv", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"Wrong type passed for the mont_priv parameter.\"", ")", "if", "len", "(", "mont_priv", ")",...
Restore the Montgomery public key from a Montgomery private key. :param mont_priv: A bytes-like object encoding the private key with length MONT_PRIV_KEY_SIZE. :returns: A bytes-like object encoding the public key with length MONT_PUB_KEY_SIZE.
[ "Restore", "the", "Montgomery", "public", "key", "from", "a", "Montgomery", "private", "key", "." ]
a11721524c96ce354cca3628e003c6fcf7ce3e42
https://github.com/Syndace/python-xeddsa/blob/a11721524c96ce354cca3628e003c6fcf7ce3e42/xeddsa/xeddsa.py#L85-L101
train
15,614
Syndace/python-xeddsa
xeddsa/xeddsa.py
XEdDSA.mont_priv_to_ed_pair
def mont_priv_to_ed_pair(cls, mont_priv): """ Derive a Twisted Edwards key pair from given Montgomery private key. :param mont_priv: A bytes-like object encoding the private key with length MONT_PRIV_KEY_SIZE. :returns: A tuple of bytes-like objects encoding the private key ...
python
def mont_priv_to_ed_pair(cls, mont_priv): """ Derive a Twisted Edwards key pair from given Montgomery private key. :param mont_priv: A bytes-like object encoding the private key with length MONT_PRIV_KEY_SIZE. :returns: A tuple of bytes-like objects encoding the private key ...
[ "def", "mont_priv_to_ed_pair", "(", "cls", ",", "mont_priv", ")", ":", "if", "not", "isinstance", "(", "mont_priv", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"Wrong type passed for the mont_priv parameter.\"", ")", "if", "len", "(", "mont_priv", ")", ...
Derive a Twisted Edwards key pair from given Montgomery private key. :param mont_priv: A bytes-like object encoding the private key with length MONT_PRIV_KEY_SIZE. :returns: A tuple of bytes-like objects encoding the private key with length ED_PRIV_KEY_SIZE and the public key wi...
[ "Derive", "a", "Twisted", "Edwards", "key", "pair", "from", "given", "Montgomery", "private", "key", "." ]
a11721524c96ce354cca3628e003c6fcf7ce3e42
https://github.com/Syndace/python-xeddsa/blob/a11721524c96ce354cca3628e003c6fcf7ce3e42/xeddsa/xeddsa.py#L116-L134
train
15,615
Syndace/python-xeddsa
xeddsa/xeddsa.py
XEdDSA.mont_pub_to_ed_pub
def mont_pub_to_ed_pub(cls, mont_pub): """ Derive a Twisted Edwards public key from given Montgomery public key. :param mont_pub: A bytes-like object encoding the public key with length MONT_PUB_KEY_SIZE. :returns: A bytes-like object encoding the public key with length ED_P...
python
def mont_pub_to_ed_pub(cls, mont_pub): """ Derive a Twisted Edwards public key from given Montgomery public key. :param mont_pub: A bytes-like object encoding the public key with length MONT_PUB_KEY_SIZE. :returns: A bytes-like object encoding the public key with length ED_P...
[ "def", "mont_pub_to_ed_pub", "(", "cls", ",", "mont_pub", ")", ":", "if", "not", "isinstance", "(", "mont_pub", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"Wrong type passed for the mont_pub parameter.\"", ")", "if", "len", "(", "mont_pub", ")", "!=", ...
Derive a Twisted Edwards public key from given Montgomery public key. :param mont_pub: A bytes-like object encoding the public key with length MONT_PUB_KEY_SIZE. :returns: A bytes-like object encoding the public key with length ED_PUB_KEY_SIZE.
[ "Derive", "a", "Twisted", "Edwards", "public", "key", "from", "given", "Montgomery", "public", "key", "." ]
a11721524c96ce354cca3628e003c6fcf7ce3e42
https://github.com/Syndace/python-xeddsa/blob/a11721524c96ce354cca3628e003c6fcf7ce3e42/xeddsa/xeddsa.py#L150-L165
train
15,616
Syndace/python-xeddsa
xeddsa/xeddsa.py
XEdDSA.sign
def sign(self, data, nonce = None): """ Sign data using the Montgomery private key stored by this XEdDSA instance. :param data: A bytes-like object containing the data to sign. :param nonce: A bytes-like object with length 64 or None. :returns: A bytes-like object encoding the s...
python
def sign(self, data, nonce = None): """ Sign data using the Montgomery private key stored by this XEdDSA instance. :param data: A bytes-like object containing the data to sign. :param nonce: A bytes-like object with length 64 or None. :returns: A bytes-like object encoding the s...
[ "def", "sign", "(", "self", ",", "data", ",", "nonce", "=", "None", ")", ":", "cls", "=", "self", ".", "__class__", "if", "not", "self", ".", "__mont_priv", ":", "raise", "MissingKeyException", "(", "\"Cannot sign using this XEdDSA instance, Montgomery private key...
Sign data using the Montgomery private key stored by this XEdDSA instance. :param data: A bytes-like object containing the data to sign. :param nonce: A bytes-like object with length 64 or None. :returns: A bytes-like object encoding the signature with length SIGNATURE_SIZE. If the non...
[ "Sign", "data", "using", "the", "Montgomery", "private", "key", "stored", "by", "this", "XEdDSA", "instance", "." ]
a11721524c96ce354cca3628e003c6fcf7ce3e42
https://github.com/Syndace/python-xeddsa/blob/a11721524c96ce354cca3628e003c6fcf7ce3e42/xeddsa/xeddsa.py#L179-L218
train
15,617
Syndace/python-xeddsa
xeddsa/xeddsa.py
XEdDSA.verify
def verify(self, data, signature): """ Verify signed data using the Montgomery public key stored by this XEdDSA instance. :param data: A bytes-like object containing the data that was signed. :param signature: A bytes-like object encoding the signature with length SIGNATURE_...
python
def verify(self, data, signature): """ Verify signed data using the Montgomery public key stored by this XEdDSA instance. :param data: A bytes-like object containing the data that was signed. :param signature: A bytes-like object encoding the signature with length SIGNATURE_...
[ "def", "verify", "(", "self", ",", "data", ",", "signature", ")", ":", "cls", "=", "self", ".", "__class__", "if", "not", "isinstance", "(", "data", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"The data parameter must be a bytes-like object.\"", ")", ...
Verify signed data using the Montgomery public key stored by this XEdDSA instance. :param data: A bytes-like object containing the data that was signed. :param signature: A bytes-like object encoding the signature with length SIGNATURE_SIZE. :returns: A boolean indicating whether th...
[ "Verify", "signed", "data", "using", "the", "Montgomery", "public", "key", "stored", "by", "this", "XEdDSA", "instance", "." ]
a11721524c96ce354cca3628e003c6fcf7ce3e42
https://github.com/Syndace/python-xeddsa/blob/a11721524c96ce354cca3628e003c6fcf7ce3e42/xeddsa/xeddsa.py#L234-L259
train
15,618
ZanderBrown/nudatus
nudatus.py
mangle
def mangle(text): """ Takes a script and mangles it TokenError is thrown when encountering bad syntax """ text_bytes = text.encode('utf-8') # Wrap the input script as a byte stream buff = BytesIO(text_bytes) # Byte stream for the mangled script mangled = BytesIO() last_tok = ...
python
def mangle(text): """ Takes a script and mangles it TokenError is thrown when encountering bad syntax """ text_bytes = text.encode('utf-8') # Wrap the input script as a byte stream buff = BytesIO(text_bytes) # Byte stream for the mangled script mangled = BytesIO() last_tok = ...
[ "def", "mangle", "(", "text", ")", ":", "text_bytes", "=", "text", ".", "encode", "(", "'utf-8'", ")", "# Wrap the input script as a byte stream", "buff", "=", "BytesIO", "(", "text_bytes", ")", "# Byte stream for the mangled script", "mangled", "=", "BytesIO", "(",...
Takes a script and mangles it TokenError is thrown when encountering bad syntax
[ "Takes", "a", "script", "and", "mangles", "it" ]
29a9627b09c3498fb6f9370f6e6d1c9a876453d8
https://github.com/ZanderBrown/nudatus/blob/29a9627b09c3498fb6f9370f6e6d1c9a876453d8/nudatus.py#L36-L115
train
15,619
ZanderBrown/nudatus
nudatus.py
main
def main(argv=None): """ Command line entry point """ if not argv: argv = sys.argv[1:] parser = argparse.ArgumentParser(description=_HELP_TEXT) parser.add_argument('input', nargs='?', default=None) parser.add_argument('output', nargs='?', default=None) parser.add_argument('--ver...
python
def main(argv=None): """ Command line entry point """ if not argv: argv = sys.argv[1:] parser = argparse.ArgumentParser(description=_HELP_TEXT) parser.add_argument('input', nargs='?', default=None) parser.add_argument('output', nargs='?', default=None) parser.add_argument('--ver...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "if", "not", "argv", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "_HELP_TEXT", ")", "parser", ".", "add_argume...
Command line entry point
[ "Command", "line", "entry", "point" ]
29a9627b09c3498fb6f9370f6e6d1c9a876453d8
https://github.com/ZanderBrown/nudatus/blob/29a9627b09c3498fb6f9370f6e6d1c9a876453d8/nudatus.py#L127-L156
train
15,620
raymondEhlers/pachyderm
pachyderm/histogram.py
get_histograms_in_list
def get_histograms_in_list(filename: str, list_name: str = None) -> Dict[str, Any]: """ Get histograms from the file and make them available in a dict. Lists are recursively explored, with all lists converted to dictionaries, such that the return dictionaries which only contains hists and dictionaries of h...
python
def get_histograms_in_list(filename: str, list_name: str = None) -> Dict[str, Any]: """ Get histograms from the file and make them available in a dict. Lists are recursively explored, with all lists converted to dictionaries, such that the return dictionaries which only contains hists and dictionaries of h...
[ "def", "get_histograms_in_list", "(", "filename", ":", "str", ",", "list_name", ":", "str", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "hists", ":", "dict", "=", "{", "}", "with", "RootOpen", "(", "filename", "=", "filename", "...
Get histograms from the file and make them available in a dict. Lists are recursively explored, with all lists converted to dictionaries, such that the return dictionaries which only contains hists and dictionaries of hists (ie there are no ROOT ``TCollection`` derived objects). Args: filename...
[ "Get", "histograms", "from", "the", "file", "and", "make", "them", "available", "in", "a", "dict", "." ]
aaa1d8374fd871246290ce76f1796f2f7582b01d
https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/histogram.py#L52-L86
train
15,621
raymondEhlers/pachyderm
pachyderm/histogram.py
_retrieve_object
def _retrieve_object(output_dict: Dict[str, Any], obj: Any) -> None: """ Function to recursively retrieve histograms from a list in a ROOT file. ``SetDirectory(True)`` is applied to TH1 derived hists and python is explicitly given ownership of the retrieved objects. Args: output_dict (dict): D...
python
def _retrieve_object(output_dict: Dict[str, Any], obj: Any) -> None: """ Function to recursively retrieve histograms from a list in a ROOT file. ``SetDirectory(True)`` is applied to TH1 derived hists and python is explicitly given ownership of the retrieved objects. Args: output_dict (dict): D...
[ "def", "_retrieve_object", "(", "output_dict", ":", "Dict", "[", "str", ",", "Any", "]", ",", "obj", ":", "Any", ")", "->", "None", ":", "import", "ROOT", "# Store TH1 or THn", "if", "isinstance", "(", "obj", ",", "ROOT", ".", "TH1", ")", "or", "isinst...
Function to recursively retrieve histograms from a list in a ROOT file. ``SetDirectory(True)`` is applied to TH1 derived hists and python is explicitly given ownership of the retrieved objects. Args: output_dict (dict): Dict under which hists should be stored. obj (ROOT.TObject derived): O...
[ "Function", "to", "recursively", "retrieve", "histograms", "from", "a", "list", "in", "a", "ROOT", "file", "." ]
aaa1d8374fd871246290ce76f1796f2f7582b01d
https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/histogram.py#L88-L124
train
15,622
raymondEhlers/pachyderm
pachyderm/histogram.py
get_array_from_hist2D
def get_array_from_hist2D(hist: Hist, set_zero_to_NaN: bool = True, return_bin_edges: bool = False) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: """ Extract x, y, and bin values from a 2D ROOT histogram. Converts the histogram into a numpy array, and suitably processes it for a surface plot by removing 0s...
python
def get_array_from_hist2D(hist: Hist, set_zero_to_NaN: bool = True, return_bin_edges: bool = False) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: """ Extract x, y, and bin values from a 2D ROOT histogram. Converts the histogram into a numpy array, and suitably processes it for a surface plot by removing 0s...
[ "def", "get_array_from_hist2D", "(", "hist", ":", "Hist", ",", "set_zero_to_NaN", ":", "bool", "=", "True", ",", "return_bin_edges", ":", "bool", "=", "False", ")", "->", "Tuple", "[", "np", ".", "ndarray", ",", "np", ".", "ndarray", ",", "np", ".", "n...
Extract x, y, and bin values from a 2D ROOT histogram. Converts the histogram into a numpy array, and suitably processes it for a surface plot by removing 0s (which can cause problems when taking logs), and returning a set of (x, y) mesh values utilziing either the bin edges or bin centers. Note: ...
[ "Extract", "x", "y", "and", "bin", "values", "from", "a", "2D", "ROOT", "histogram", "." ]
aaa1d8374fd871246290ce76f1796f2f7582b01d
https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/histogram.py#L527-L600
train
15,623
raymondEhlers/pachyderm
pachyderm/histogram.py
get_bin_edges_from_axis
def get_bin_edges_from_axis(axis) -> np.ndarray: """ Get bin edges from a ROOT hist axis. Note: Doesn't include over- or underflow bins! Args: axis (ROOT.TAxis): Axis from which the bin edges should be extracted. Returns: Array containing the bin edges. """ # Don't incl...
python
def get_bin_edges_from_axis(axis) -> np.ndarray: """ Get bin edges from a ROOT hist axis. Note: Doesn't include over- or underflow bins! Args: axis (ROOT.TAxis): Axis from which the bin edges should be extracted. Returns: Array containing the bin edges. """ # Don't incl...
[ "def", "get_bin_edges_from_axis", "(", "axis", ")", "->", "np", ".", "ndarray", ":", "# Don't include over- or underflow bins", "bins", "=", "range", "(", "1", ",", "axis", ".", "GetNbins", "(", ")", "+", "1", ")", "# Bin edges", "bin_edges", "=", "np", ".",...
Get bin edges from a ROOT hist axis. Note: Doesn't include over- or underflow bins! Args: axis (ROOT.TAxis): Axis from which the bin edges should be extracted. Returns: Array containing the bin edges.
[ "Get", "bin", "edges", "from", "a", "ROOT", "hist", "axis", "." ]
aaa1d8374fd871246290ce76f1796f2f7582b01d
https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/histogram.py#L602-L620
train
15,624
lowandrew/OLCTools
spadespipeline/sistr.py
Sistr.sistr
def sistr(self): """Perform sistr analyses on Salmonella""" logging.info('Performing sistr analyses') with progressbar(self.metadata) as bar: for sample in bar: # Create the analysis-type specific attribute setattr(sample, self.analysistype, GenObject(...
python
def sistr(self): """Perform sistr analyses on Salmonella""" logging.info('Performing sistr analyses') with progressbar(self.metadata) as bar: for sample in bar: # Create the analysis-type specific attribute setattr(sample, self.analysistype, GenObject(...
[ "def", "sistr", "(", "self", ")", ":", "logging", ".", "info", "(", "'Performing sistr analyses'", ")", "with", "progressbar", "(", "self", ".", "metadata", ")", "as", "bar", ":", "for", "sample", "in", "bar", ":", "# Create the analysis-type specific attribute"...
Perform sistr analyses on Salmonella
[ "Perform", "sistr", "analyses", "on", "Salmonella" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/sistr.py#L18-L57
train
15,625
lowandrew/OLCTools
spadespipeline/sistr.py
Sistr.report
def report(self): """Creates sistr reports""" # Initialise strings to store report data header = '\t'.join(self.headers) + '\n' data = '' for sample in self.metadata: if sample.general.bestassemblyfile != 'NA': # Each strain is a fresh row ...
python
def report(self): """Creates sistr reports""" # Initialise strings to store report data header = '\t'.join(self.headers) + '\n' data = '' for sample in self.metadata: if sample.general.bestassemblyfile != 'NA': # Each strain is a fresh row ...
[ "def", "report", "(", "self", ")", ":", "# Initialise strings to store report data", "header", "=", "'\\t'", ".", "join", "(", "self", ".", "headers", ")", "+", "'\\n'", "data", "=", "''", "for", "sample", "in", "self", ".", "metadata", ":", "if", "sample"...
Creates sistr reports
[ "Creates", "sistr", "reports" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/sistr.py#L59-L95
train
15,626
portfors-lab/sparkle
sparkle/gui/stim/abstract_editor.py
AbstractEditorWidget.purgeDeletedWidgets
def purgeDeletedWidgets(): """Finds old references to stashed fields and deletes them""" toremove = [] for field in AbstractEditorWidget.funit_fields: if sip.isdeleted(field): toremove.append(field) for field in toremove: AbstractEditorWidget.funit...
python
def purgeDeletedWidgets(): """Finds old references to stashed fields and deletes them""" toremove = [] for field in AbstractEditorWidget.funit_fields: if sip.isdeleted(field): toremove.append(field) for field in toremove: AbstractEditorWidget.funit...
[ "def", "purgeDeletedWidgets", "(", ")", ":", "toremove", "=", "[", "]", "for", "field", "in", "AbstractEditorWidget", ".", "funit_fields", ":", "if", "sip", ".", "isdeleted", "(", "field", ")", ":", "toremove", ".", "append", "(", "field", ")", "for", "f...
Finds old references to stashed fields and deletes them
[ "Finds", "old", "references", "to", "stashed", "fields", "and", "deletes", "them" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/abstract_editor.py#L22-L36
train
15,627
lowandrew/OLCTools
spadespipeline/fastqmover.py
FastqMover.movefastq
def movefastq(self): """Find .fastq files for each sample and move them to an appropriately named folder""" logging.info('Moving FASTQ files') # Iterate through each sample for sample in self.metadata.runmetadata.samples: # Retrieve the output directory outputdir ...
python
def movefastq(self): """Find .fastq files for each sample and move them to an appropriately named folder""" logging.info('Moving FASTQ files') # Iterate through each sample for sample in self.metadata.runmetadata.samples: # Retrieve the output directory outputdir ...
[ "def", "movefastq", "(", "self", ")", ":", "logging", ".", "info", "(", "'Moving FASTQ files'", ")", "# Iterate through each sample", "for", "sample", "in", "self", ".", "metadata", ".", "runmetadata", ".", "samples", ":", "# Retrieve the output directory", "outputd...
Find .fastq files for each sample and move them to an appropriately named folder
[ "Find", ".", "fastq", "files", "for", "each", "sample", "and", "move", "them", "to", "an", "appropriately", "named", "folder" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/fastqmover.py#L11-L44
train
15,628
oracal/cineworld
cineworld/cineworld.py
CW.get_list
def get_list(self, datatype, url, **kwargs): """base function for connecting to API""" search_url = [url, '?'] kwargs.update({'key': self.api_key}) search_url.append(urlencode(kwargs)) data = json.loads(urlopen(''.join(search_url)).read()) return data[datatype]
python
def get_list(self, datatype, url, **kwargs): """base function for connecting to API""" search_url = [url, '?'] kwargs.update({'key': self.api_key}) search_url.append(urlencode(kwargs)) data = json.loads(urlopen(''.join(search_url)).read()) return data[datatype]
[ "def", "get_list", "(", "self", ",", "datatype", ",", "url", ",", "*", "*", "kwargs", ")", ":", "search_url", "=", "[", "url", ",", "'?'", "]", "kwargs", ".", "update", "(", "{", "'key'", ":", "self", ".", "api_key", "}", ")", "search_url", ".", ...
base function for connecting to API
[ "base", "function", "for", "connecting", "to", "API" ]
073b18ce4f3acf4c44b26a5af1cc0d3c71b8b5d5
https://github.com/oracal/cineworld/blob/073b18ce4f3acf4c44b26a5af1cc0d3c71b8b5d5/cineworld/cineworld.py#L40-L46
train
15,629
oracal/cineworld
cineworld/cineworld.py
CW.film_search
def film_search(self, title): """film search using fuzzy matching""" films = [] #check for cache or update if not hasattr(self, 'film_list'): self.get_film_list() #iterate over films and check for fuzzy string match for film in self.film_list: ...
python
def film_search(self, title): """film search using fuzzy matching""" films = [] #check for cache or update if not hasattr(self, 'film_list'): self.get_film_list() #iterate over films and check for fuzzy string match for film in self.film_list: ...
[ "def", "film_search", "(", "self", ",", "title", ")", ":", "films", "=", "[", "]", "#check for cache or update", "if", "not", "hasattr", "(", "self", ",", "'film_list'", ")", ":", "self", ".", "get_film_list", "(", ")", "#iterate over films and check for fuzzy s...
film search using fuzzy matching
[ "film", "search", "using", "fuzzy", "matching" ]
073b18ce4f3acf4c44b26a5af1cc0d3c71b8b5d5
https://github.com/oracal/cineworld/blob/073b18ce4f3acf4c44b26a5af1cc0d3c71b8b5d5/cineworld/cineworld.py#L81-L95
train
15,630
oracal/cineworld
cineworld/cineworld.py
CW.get_film_id
def get_film_id(self, title, three_dimensional=False): """get the film id using the title in conjunction with the searching function""" films = self.film_search(title) for film in films: if (film['title'].find('3D') is - 1) is not three_dimensional: return film['edi']...
python
def get_film_id(self, title, three_dimensional=False): """get the film id using the title in conjunction with the searching function""" films = self.film_search(title) for film in films: if (film['title'].find('3D') is - 1) is not three_dimensional: return film['edi']...
[ "def", "get_film_id", "(", "self", ",", "title", ",", "three_dimensional", "=", "False", ")", ":", "films", "=", "self", ".", "film_search", "(", "title", ")", "for", "film", "in", "films", ":", "if", "(", "film", "[", "'title'", "]", ".", "find", "(...
get the film id using the title in conjunction with the searching function
[ "get", "the", "film", "id", "using", "the", "title", "in", "conjunction", "with", "the", "searching", "function" ]
073b18ce4f3acf4c44b26a5af1cc0d3c71b8b5d5
https://github.com/oracal/cineworld/blob/073b18ce4f3acf4c44b26a5af1cc0d3c71b8b5d5/cineworld/cineworld.py#L97-L103
train
15,631
portfors-lab/sparkle
sparkle/run/search_runner.py
SearchRunner.set_current_stim_parameter
def set_current_stim_parameter(self, param, val): """Sets a parameter on the current stimulus :param param: name of the parameter of the stimulus to set :type param: str :param val: new value to set the parameter to """ component = self._stimulus.component(0,1) c...
python
def set_current_stim_parameter(self, param, val): """Sets a parameter on the current stimulus :param param: name of the parameter of the stimulus to set :type param: str :param val: new value to set the parameter to """ component = self._stimulus.component(0,1) c...
[ "def", "set_current_stim_parameter", "(", "self", ",", "param", ",", "val", ")", ":", "component", "=", "self", ".", "_stimulus", ".", "component", "(", "0", ",", "1", ")", "component", ".", "set", "(", "param", ",", "val", ")" ]
Sets a parameter on the current stimulus :param param: name of the parameter of the stimulus to set :type param: str :param val: new value to set the parameter to
[ "Sets", "a", "parameter", "on", "the", "current", "stimulus" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/search_runner.py#L74-L82
train
15,632
portfors-lab/sparkle
sparkle/run/search_runner.py
SearchRunner.save_to_file
def save_to_file(self, data, stamp): """Saves data to current dataset. :param data: data to save to file :type data: numpy.ndarray :param stamp: time stamp of when the data was acquired :type stamp: str """ self.datafile.append(self.current_dataset_name, data) ...
python
def save_to_file(self, data, stamp): """Saves data to current dataset. :param data: data to save to file :type data: numpy.ndarray :param stamp: time stamp of when the data was acquired :type stamp: str """ self.datafile.append(self.current_dataset_name, data) ...
[ "def", "save_to_file", "(", "self", ",", "data", ",", "stamp", ")", ":", "self", ".", "datafile", ".", "append", "(", "self", ".", "current_dataset_name", ",", "data", ")", "# save stimulu info", "info", "=", "dict", "(", "self", ".", "_stimulus", ".", "...
Saves data to current dataset. :param data: data to save to file :type data: numpy.ndarray :param stamp: time stamp of when the data was acquired :type stamp: str
[ "Saves", "data", "to", "current", "dataset", "." ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/search_runner.py#L181-L195
train
15,633
lsst-sqre/sqre-codekit
codekit/progressbar.py
countdown_timer
def countdown_timer(seconds=10): """Show a simple countdown progress bar Parameters ---------- seconds Period of time the progress bar takes to reach zero. """ tick = 0.1 # seconds n_ticks = int(seconds / tick) widgets = ['Pause for panic: ', progressbar.ETA(), ' ', progressb...
python
def countdown_timer(seconds=10): """Show a simple countdown progress bar Parameters ---------- seconds Period of time the progress bar takes to reach zero. """ tick = 0.1 # seconds n_ticks = int(seconds / tick) widgets = ['Pause for panic: ', progressbar.ETA(), ' ', progressb...
[ "def", "countdown_timer", "(", "seconds", "=", "10", ")", ":", "tick", "=", "0.1", "# seconds", "n_ticks", "=", "int", "(", "seconds", "/", "tick", ")", "widgets", "=", "[", "'Pause for panic: '", ",", "progressbar", ".", "ETA", "(", ")", ",", "' '", "...
Show a simple countdown progress bar Parameters ---------- seconds Period of time the progress bar takes to reach zero.
[ "Show", "a", "simple", "countdown", "progress", "bar" ]
98122404cd9065d4d1d570867fe518042669126c
https://github.com/lsst-sqre/sqre-codekit/blob/98122404cd9065d4d1d570867fe518042669126c/codekit/progressbar.py#L19-L40
train
15,634
sirfoga/pyhal
hal/files/save_as.py
FileSaver.write_dicts_to_csv
def write_dicts_to_csv(self, dicts): """Saves .csv file with posts data :param dicts: Dictionaries with same values """ csv_headers = sorted(dicts[0].keys()) with open(self.path, "w") as out_file: # write to file dict_writer = csv.DictWriter( out_fil...
python
def write_dicts_to_csv(self, dicts): """Saves .csv file with posts data :param dicts: Dictionaries with same values """ csv_headers = sorted(dicts[0].keys()) with open(self.path, "w") as out_file: # write to file dict_writer = csv.DictWriter( out_fil...
[ "def", "write_dicts_to_csv", "(", "self", ",", "dicts", ")", ":", "csv_headers", "=", "sorted", "(", "dicts", "[", "0", "]", ".", "keys", "(", ")", ")", "with", "open", "(", "self", ".", "path", ",", "\"w\"", ")", "as", "out_file", ":", "# write to f...
Saves .csv file with posts data :param dicts: Dictionaries with same values
[ "Saves", ".", "csv", "file", "with", "posts", "data" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/files/save_as.py#L18-L29
train
15,635
sirfoga/pyhal
hal/files/save_as.py
FileSaver.write_matrix_to_csv
def write_matrix_to_csv(self, headers, data): """Saves .csv file with data :param headers: column names :param data: Data """ with open(self.path, "w") as out_file: # write to file data_writer = csv.writer(out_file, delimiter=",") data_writer.writerow(he...
python
def write_matrix_to_csv(self, headers, data): """Saves .csv file with data :param headers: column names :param data: Data """ with open(self.path, "w") as out_file: # write to file data_writer = csv.writer(out_file, delimiter=",") data_writer.writerow(he...
[ "def", "write_matrix_to_csv", "(", "self", ",", "headers", ",", "data", ")", ":", "with", "open", "(", "self", ".", "path", ",", "\"w\"", ")", "as", "out_file", ":", "# write to file", "data_writer", "=", "csv", ".", "writer", "(", "out_file", ",", "deli...
Saves .csv file with data :param headers: column names :param data: Data
[ "Saves", ".", "csv", "file", "with", "data" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/files/save_as.py#L31-L40
train
15,636
sirfoga/pyhal
hal/files/save_as.py
FileSaver.write_dicts_to_json
def write_dicts_to_json(self, data): """Saves .json file with data :param data: Data """ with open(self.path, "w") as out: json.dump( data, # data out, # file handler indent=4, sort_keys=True # pretty print )
python
def write_dicts_to_json(self, data): """Saves .json file with data :param data: Data """ with open(self.path, "w") as out: json.dump( data, # data out, # file handler indent=4, sort_keys=True # pretty print )
[ "def", "write_dicts_to_json", "(", "self", ",", "data", ")", ":", "with", "open", "(", "self", ".", "path", ",", "\"w\"", ")", "as", "out", ":", "json", ".", "dump", "(", "data", ",", "# data", "out", ",", "# file handler", "indent", "=", "4", ",", ...
Saves .json file with data :param data: Data
[ "Saves", ".", "json", "file", "with", "data" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/files/save_as.py#L42-L52
train
15,637
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.start_listening
def start_listening(self): """Start listener threads for acquistion callback queues""" self._qlisten() self._halt_threads = False for t in self.queue_threads: t.start()
python
def start_listening(self): """Start listener threads for acquistion callback queues""" self._qlisten() self._halt_threads = False for t in self.queue_threads: t.start()
[ "def", "start_listening", "(", "self", ")", ":", "self", ".", "_qlisten", "(", ")", "self", ".", "_halt_threads", "=", "False", "for", "t", "in", "self", ".", "queue_threads", ":", "t", ".", "start", "(", ")" ]
Start listener threads for acquistion callback queues
[ "Start", "listener", "threads", "for", "acquistion", "callback", "queues" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L87-L92
train
15,638
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.stop_listening
def stop_listening(self): """Stop listener threads for acquistion queues""" self._halt_threads = True # wake them up so that they can die for name, queue_waker in self.recieved_signals.items(): q, wake_event = queue_waker wake_event.set()
python
def stop_listening(self): """Stop listener threads for acquistion queues""" self._halt_threads = True # wake them up so that they can die for name, queue_waker in self.recieved_signals.items(): q, wake_event = queue_waker wake_event.set()
[ "def", "stop_listening", "(", "self", ")", ":", "self", ".", "_halt_threads", "=", "True", "# wake them up so that they can die", "for", "name", ",", "queue_waker", "in", "self", ".", "recieved_signals", ".", "items", "(", ")", ":", "q", ",", "wake_event", "="...
Stop listener threads for acquistion queues
[ "Stop", "listener", "threads", "for", "acquistion", "queues" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L94-L100
train
15,639
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.set_queue_callback
def set_queue_callback(self, name, func): """Sets a function to execute when the named acquistion queue has data placed in it. :param name: name of the queue to pull data from :type name: str :param func: function reference to execute, expects queue contents as argument(s) ...
python
def set_queue_callback(self, name, func): """Sets a function to execute when the named acquistion queue has data placed in it. :param name: name of the queue to pull data from :type name: str :param func: function reference to execute, expects queue contents as argument(s) ...
[ "def", "set_queue_callback", "(", "self", ",", "name", ",", "func", ")", ":", "if", "name", "in", "self", ".", "acquisition_hooks", ":", "self", ".", "acquisition_hooks", "[", "name", "]", ".", "append", "(", "func", ")", "else", ":", "self", ".", "acq...
Sets a function to execute when the named acquistion queue has data placed in it. :param name: name of the queue to pull data from :type name: str :param func: function reference to execute, expects queue contents as argument(s) :type func: callable
[ "Sets", "a", "function", "to", "execute", "when", "the", "named", "acquistion", "queue", "has", "data", "placed", "in", "it", "." ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L102-L114
train
15,640
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.set_calibration
def set_calibration(self, datakey, calf=None, frange=None): """Sets a calibration for all of the acquisition operations, from an already gathered calibration data set. :param datakey: name of the calibration to set. This key must be present in the current data file. A value of ``None`` clears c...
python
def set_calibration(self, datakey, calf=None, frange=None): """Sets a calibration for all of the acquisition operations, from an already gathered calibration data set. :param datakey: name of the calibration to set. This key must be present in the current data file. A value of ``None`` clears c...
[ "def", "set_calibration", "(", "self", ",", "datakey", ",", "calf", "=", "None", ",", "frange", "=", "None", ")", ":", "if", "datakey", "is", "None", ":", "calibration_vector", ",", "calibration_freqs", "=", "None", ",", "None", "else", ":", "if", "calf"...
Sets a calibration for all of the acquisition operations, from an already gathered calibration data set. :param datakey: name of the calibration to set. This key must be present in the current data file. A value of ``None`` clears calibration. :type datakey: str :param calf: Calibration...
[ "Sets", "a", "calibration", "for", "all", "of", "the", "acquisition", "operations", "from", "an", "already", "gathered", "calibration", "data", "set", "." ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L127-L162
train
15,641
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.set_calibration_duration
def set_calibration_duration(self, dur): """Sets the stimulus duration for the calibration stimulus. Sets for calibration chirp, test tone, and calibration curve tones :param dur: Duration (seconds) of output signal :type dur: float """ self.bs_calibrator.set_duration(dur) ...
python
def set_calibration_duration(self, dur): """Sets the stimulus duration for the calibration stimulus. Sets for calibration chirp, test tone, and calibration curve tones :param dur: Duration (seconds) of output signal :type dur: float """ self.bs_calibrator.set_duration(dur) ...
[ "def", "set_calibration_duration", "(", "self", ",", "dur", ")", ":", "self", ".", "bs_calibrator", ".", "set_duration", "(", "dur", ")", "self", ".", "tone_calibrator", ".", "set_duration", "(", "dur", ")" ]
Sets the stimulus duration for the calibration stimulus. Sets for calibration chirp, test tone, and calibration curve tones :param dur: Duration (seconds) of output signal :type dur: float
[ "Sets", "the", "stimulus", "duration", "for", "the", "calibration", "stimulus", ".", "Sets", "for", "calibration", "chirp", "test", "tone", "and", "calibration", "curve", "tones" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L171-L178
train
15,642
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.set_calibration_reps
def set_calibration_reps(self, reps): """Sets the number of repetitions for calibration stimuli :param reps: Number of times a unique stimulus is presented in calibration operations :type reps: int """ self.bs_calibrator.set_reps(reps) self.tone_calibrator.set_reps(reps)
python
def set_calibration_reps(self, reps): """Sets the number of repetitions for calibration stimuli :param reps: Number of times a unique stimulus is presented in calibration operations :type reps: int """ self.bs_calibrator.set_reps(reps) self.tone_calibrator.set_reps(reps)
[ "def", "set_calibration_reps", "(", "self", ",", "reps", ")", ":", "self", ".", "bs_calibrator", ".", "set_reps", "(", "reps", ")", "self", ".", "tone_calibrator", ".", "set_reps", "(", "reps", ")" ]
Sets the number of repetitions for calibration stimuli :param reps: Number of times a unique stimulus is presented in calibration operations :type reps: int
[ "Sets", "the", "number", "of", "repetitions", "for", "calibration", "stimuli" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L180-L187
train
15,643
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.load_data_file
def load_data_file(self, fname, filemode='a'): """Opens an existing data file to append to :param fname: File path of the location for the data file to open :type fname: str """ self.close_data() self.datafile = open_acqdata(fname, filemode=filemode) self.explor...
python
def load_data_file(self, fname, filemode='a'): """Opens an existing data file to append to :param fname: File path of the location for the data file to open :type fname: str """ self.close_data() self.datafile = open_acqdata(fname, filemode=filemode) self.explor...
[ "def", "load_data_file", "(", "self", ",", "fname", ",", "filemode", "=", "'a'", ")", ":", "self", ".", "close_data", "(", ")", "self", ".", "datafile", "=", "open_acqdata", "(", "fname", ",", "filemode", "=", "filemode", ")", "self", ".", "explorer", ...
Opens an existing data file to append to :param fname: File path of the location for the data file to open :type fname: str
[ "Opens", "an", "existing", "data", "file", "to", "append", "to" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L189-L205
train
15,644
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.set_threshold
def set_threshold(self, threshold): """Sets spike detection threshold :param threshold: electrical potential to determine spikes (V) :type threshold: float """ self.explorer.set_threshold(threshold) self.protocoler.set_threshold(threshold)
python
def set_threshold(self, threshold): """Sets spike detection threshold :param threshold: electrical potential to determine spikes (V) :type threshold: float """ self.explorer.set_threshold(threshold) self.protocoler.set_threshold(threshold)
[ "def", "set_threshold", "(", "self", ",", "threshold", ")", ":", "self", ".", "explorer", ".", "set_threshold", "(", "threshold", ")", "self", ".", "protocoler", ".", "set_threshold", "(", "threshold", ")" ]
Sets spike detection threshold :param threshold: electrical potential to determine spikes (V) :type threshold: float
[ "Sets", "spike", "detection", "threshold" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L214-L221
train
15,645
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.set
def set(self, **kwargs): """Sets acquisition parameters for all acquisition types See :meth:`AbstractAcquisitionRunner<sparkle.run.abstract_acquisition.AbstractAcquisitionRunner.set>` """ self.explorer.set(**kwargs) self.protocoler.set(**kwargs) self.tone_calibrator.set(...
python
def set(self, **kwargs): """Sets acquisition parameters for all acquisition types See :meth:`AbstractAcquisitionRunner<sparkle.run.abstract_acquisition.AbstractAcquisitionRunner.set>` """ self.explorer.set(**kwargs) self.protocoler.set(**kwargs) self.tone_calibrator.set(...
[ "def", "set", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "explorer", ".", "set", "(", "*", "*", "kwargs", ")", "self", ".", "protocoler", ".", "set", "(", "*", "*", "kwargs", ")", "self", ".", "tone_calibrator", ".", "set", "(",...
Sets acquisition parameters for all acquisition types See :meth:`AbstractAcquisitionRunner<sparkle.run.abstract_acquisition.AbstractAcquisitionRunner.set>`
[ "Sets", "acquisition", "parameters", "for", "all", "acquisition", "types" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L223-L233
train
15,646
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.set_mphone_calibration
def set_mphone_calibration(self, sens, db): """Sets the microphone calibration, for the purpose of calculating recorded dB levels :param sens: microphone sensitivity (V) :type sens: float :param db: dB SPL that the calibration was measured at :type db: int """ se...
python
def set_mphone_calibration(self, sens, db): """Sets the microphone calibration, for the purpose of calculating recorded dB levels :param sens: microphone sensitivity (V) :type sens: float :param db: dB SPL that the calibration was measured at :type db: int """ se...
[ "def", "set_mphone_calibration", "(", "self", ",", "sens", ",", "db", ")", ":", "self", ".", "bs_calibrator", ".", "set_mphone_calibration", "(", "sens", ",", "db", ")", "self", ".", "tone_calibrator", ".", "set_mphone_calibration", "(", "sens", ",", "db", "...
Sets the microphone calibration, for the purpose of calculating recorded dB levels :param sens: microphone sensitivity (V) :type sens: float :param db: dB SPL that the calibration was measured at :type db: int
[ "Sets", "the", "microphone", "calibration", "for", "the", "purpose", "of", "calculating", "recorded", "dB", "levels" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L276-L285
train
15,647
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.run_chart_protocol
def run_chart_protocol(self, interval): """Runs the stimuli presentation during a chart acquisition :param interval: The repetition interval between stimuli presentations (seconds) :type interval: float :returns: :py:class:`threading.Thread` -- the acquisition thread """ ...
python
def run_chart_protocol(self, interval): """Runs the stimuli presentation during a chart acquisition :param interval: The repetition interval between stimuli presentations (seconds) :type interval: float :returns: :py:class:`threading.Thread` -- the acquisition thread """ ...
[ "def", "run_chart_protocol", "(", "self", ",", "interval", ")", ":", "self", ".", "charter", ".", "setup", "(", "interval", ")", "return", "self", ".", "charter", ".", "run", "(", ")" ]
Runs the stimuli presentation during a chart acquisition :param interval: The repetition interval between stimuli presentations (seconds) :type interval: float :returns: :py:class:`threading.Thread` -- the acquisition thread
[ "Runs", "the", "stimuli", "presentation", "during", "a", "chart", "acquisition" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L332-L340
train
15,648
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.process_calibration
def process_calibration(self, save=True, calf=20000): """Processes a completed calibration :param save: Wether to save this calibration to file :type save: bool :param calf: Frequency for which to reference attenuation curve from :type calf: int :returns: str -- name of ...
python
def process_calibration(self, save=True, calf=20000): """Processes a completed calibration :param save: Wether to save this calibration to file :type save: bool :param calf: Frequency for which to reference attenuation curve from :type calf: int :returns: str -- name of ...
[ "def", "process_calibration", "(", "self", ",", "save", "=", "True", ",", "calf", "=", "20000", ")", ":", "if", "self", ".", "selected_calibration_index", "==", "2", ":", "raise", "Exception", "(", "\"Calibration curve processing not currently supported\"", ")", "...
Processes a completed calibration :param save: Wether to save this calibration to file :type save: bool :param calf: Frequency for which to reference attenuation curve from :type calf: int :returns: str -- name of a saved calibration
[ "Processes", "a", "completed", "calibration" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L342-L355
train
15,649
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.close_data
def close_data(self): """Closes the current data file""" # save the total number of cells to make re-loading convient if self.datafile is not None: if self.datafile.filemode != 'r': self.datafile.set_metadata('', {'total cells': self.current_cellid}) self....
python
def close_data(self): """Closes the current data file""" # save the total number of cells to make re-loading convient if self.datafile is not None: if self.datafile.filemode != 'r': self.datafile.set_metadata('', {'total cells': self.current_cellid}) self....
[ "def", "close_data", "(", "self", ")", ":", "# save the total number of cells to make re-loading convient", "if", "self", ".", "datafile", "is", "not", "None", ":", "if", "self", ".", "datafile", ".", "filemode", "!=", "'r'", ":", "self", ".", "datafile", ".", ...
Closes the current data file
[ "Closes", "the", "current", "data", "file" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L369-L376
train
15,650
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.calibration_stimulus
def calibration_stimulus(self, mode): """Gets the stimulus model for calibration :param mode: Type of stimulus to get: tone or noise :type mode: str :returns: :class:`StimulusModel<sparkle.stim.stimulus_model.StimulusModel>` """ if mode == 'tone': return self...
python
def calibration_stimulus(self, mode): """Gets the stimulus model for calibration :param mode: Type of stimulus to get: tone or noise :type mode: str :returns: :class:`StimulusModel<sparkle.stim.stimulus_model.StimulusModel>` """ if mode == 'tone': return self...
[ "def", "calibration_stimulus", "(", "self", ",", "mode", ")", ":", "if", "mode", "==", "'tone'", ":", "return", "self", ".", "tone_calibrator", ".", "stimulus", "elif", "mode", "==", "'noise'", ":", "return", "self", ".", "bs_calibrator", ".", "stimulus" ]
Gets the stimulus model for calibration :param mode: Type of stimulus to get: tone or noise :type mode: str :returns: :class:`StimulusModel<sparkle.stim.stimulus_model.StimulusModel>`
[ "Gets", "the", "stimulus", "model", "for", "calibration" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L388-L398
train
15,651
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.calibration_template
def calibration_template(self): """Gets the template documentation for the both the tone curve calibration and noise calibration :returns: dict -- all information necessary to recreate calibration objects """ temp = {} temp['tone_doc'] = self.tone_calibrator.stimulus.templateDoc...
python
def calibration_template(self): """Gets the template documentation for the both the tone curve calibration and noise calibration :returns: dict -- all information necessary to recreate calibration objects """ temp = {} temp['tone_doc'] = self.tone_calibrator.stimulus.templateDoc...
[ "def", "calibration_template", "(", "self", ")", ":", "temp", "=", "{", "}", "temp", "[", "'tone_doc'", "]", "=", "self", ".", "tone_calibrator", ".", "stimulus", ".", "templateDoc", "(", ")", "comp_doc", "=", "[", "]", "for", "calstim", "in", "self", ...
Gets the template documentation for the both the tone curve calibration and noise calibration :returns: dict -- all information necessary to recreate calibration objects
[ "Gets", "the", "template", "documentation", "for", "the", "both", "the", "tone", "curve", "calibration", "and", "noise", "calibration" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L421-L432
train
15,652
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.load_calibration_template
def load_calibration_template(self, template): """Reloads calibration settings from saved template doc :param template: Values for calibration stimuli (see calibration_template function) :type template: dict """ self.tone_calibrator.stimulus.clearComponents() self.tone_c...
python
def load_calibration_template(self, template): """Reloads calibration settings from saved template doc :param template: Values for calibration stimuli (see calibration_template function) :type template: dict """ self.tone_calibrator.stimulus.clearComponents() self.tone_c...
[ "def", "load_calibration_template", "(", "self", ",", "template", ")", ":", "self", ".", "tone_calibrator", ".", "stimulus", ".", "clearComponents", "(", ")", "self", ".", "tone_calibrator", ".", "stimulus", ".", "loadFromTemplate", "(", "template", "[", "'tone_...
Reloads calibration settings from saved template doc :param template: Values for calibration stimuli (see calibration_template function) :type template: dict
[ "Reloads", "calibration", "settings", "from", "saved", "template", "doc" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L434-L444
train
15,653
portfors-lab/sparkle
sparkle/run/acquisition_manager.py
AcquisitionManager.attenuator_connection
def attenuator_connection(self, connect=True): """Checks the connection to the attenuator, and attempts to connect if not connected. Will also set an appropriate ouput minimum for stimuli, if connection successful :returns: bool - whether there is a connection """ # all or none...
python
def attenuator_connection(self, connect=True): """Checks the connection to the attenuator, and attempts to connect if not connected. Will also set an appropriate ouput minimum for stimuli, if connection successful :returns: bool - whether there is a connection """ # all or none...
[ "def", "attenuator_connection", "(", "self", ",", "connect", "=", "True", ")", ":", "# all or none will be connected", "acquisition_modules", "=", "[", "self", ".", "explorer", ",", "self", ".", "protocoler", ",", "self", ".", "bs_calibrator", ",", "self", ".", ...
Checks the connection to the attenuator, and attempts to connect if not connected. Will also set an appropriate ouput minimum for stimuli, if connection successful :returns: bool - whether there is a connection
[ "Checks", "the", "connection", "to", "the", "attenuator", "and", "attempts", "to", "connect", "if", "not", "connected", ".", "Will", "also", "set", "an", "appropriate", "ouput", "minimum", "for", "stimuli", "if", "connection", "successful" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/acquisition_manager.py#L456-L482
train
15,654
agramian/subprocess-manager
subprocess_manager/nbstream_readerwriter.py
NonBlockingStreamReaderWriter.readline
def readline(self, timeout = 0.1): """Try to read a line from the stream queue. """ try: return self._q.get(block = timeout is not None, timeout = timeout) except Empty: return None
python
def readline(self, timeout = 0.1): """Try to read a line from the stream queue. """ try: return self._q.get(block = timeout is not None, timeout = timeout) except Empty: return None
[ "def", "readline", "(", "self", ",", "timeout", "=", "0.1", ")", ":", "try", ":", "return", "self", ".", "_q", ".", "get", "(", "block", "=", "timeout", "is", "not", "None", ",", "timeout", "=", "timeout", ")", "except", "Empty", ":", "return", "No...
Try to read a line from the stream queue.
[ "Try", "to", "read", "a", "line", "from", "the", "stream", "queue", "." ]
fff9ff2ddab644a86f96e1ccf5df142c482a8247
https://github.com/agramian/subprocess-manager/blob/fff9ff2ddab644a86f96e1ccf5df142c482a8247/subprocess_manager/nbstream_readerwriter.py#L54-L61
train
15,655
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
CommandHistory.verification_events
def verification_events(self): """ Events related to command verification. :type: List[:class:`.CommandHistoryEvent`] """ queued = self._assemble_event('Verifier_Queued') started = self._assemble_event('Verifier_Started') return [x for x in [queued, started] if x...
python
def verification_events(self): """ Events related to command verification. :type: List[:class:`.CommandHistoryEvent`] """ queued = self._assemble_event('Verifier_Queued') started = self._assemble_event('Verifier_Started') return [x for x in [queued, started] if x...
[ "def", "verification_events", "(", "self", ")", ":", "queued", "=", "self", ".", "_assemble_event", "(", "'Verifier_Queued'", ")", "started", "=", "self", ".", "_assemble_event", "(", "'Verifier_Started'", ")", "return", "[", "x", "for", "x", "in", "[", "que...
Events related to command verification. :type: List[:class:`.CommandHistoryEvent`]
[ "Events", "related", "to", "command", "verification", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L122-L130
train
15,656
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
CommandHistory.events
def events(self): """ All events. :type: List[:class:`.CommandHistoryEvent`] """ events = [self.acknowledge_event] + self.verification_events return [x for x in events if x]
python
def events(self): """ All events. :type: List[:class:`.CommandHistoryEvent`] """ events = [self.acknowledge_event] + self.verification_events return [x for x in events if x]
[ "def", "events", "(", "self", ")", ":", "events", "=", "[", "self", ".", "acknowledge_event", "]", "+", "self", ".", "verification_events", "return", "[", "x", "for", "x", "in", "events", "if", "x", "]" ]
All events. :type: List[:class:`.CommandHistoryEvent`]
[ "All", "events", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L133-L140
train
15,657
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
IssuedCommand.generation_time
def generation_time(self): """ The generation time as set by Yamcs. :type: :class:`~datetime.datetime` """ entry = self._proto.commandQueueEntry if entry.HasField('generationTimeUTC'): return parse_isostring(entry.generationTimeUTC) return None
python
def generation_time(self): """ The generation time as set by Yamcs. :type: :class:`~datetime.datetime` """ entry = self._proto.commandQueueEntry if entry.HasField('generationTimeUTC'): return parse_isostring(entry.generationTimeUTC) return None
[ "def", "generation_time", "(", "self", ")", ":", "entry", "=", "self", ".", "_proto", ".", "commandQueueEntry", "if", "entry", ".", "HasField", "(", "'generationTimeUTC'", ")", ":", "return", "parse_isostring", "(", "entry", ".", "generationTimeUTC", ")", "ret...
The generation time as set by Yamcs. :type: :class:`~datetime.datetime`
[ "The", "generation", "time", "as", "set", "by", "Yamcs", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L173-L182
train
15,658
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
IssuedCommand.username
def username(self): """The username of the issuer.""" entry = self._proto.commandQueueEntry if entry.HasField('username'): return entry.username return None
python
def username(self): """The username of the issuer.""" entry = self._proto.commandQueueEntry if entry.HasField('username'): return entry.username return None
[ "def", "username", "(", "self", ")", ":", "entry", "=", "self", ".", "_proto", ".", "commandQueueEntry", "if", "entry", ".", "HasField", "(", "'username'", ")", ":", "return", "entry", ".", "username", "return", "None" ]
The username of the issuer.
[ "The", "username", "of", "the", "issuer", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L185-L190
train
15,659
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
IssuedCommand.queue
def queue(self): """The name of the queue that this command was assigned to.""" entry = self._proto.commandQueueEntry if entry.HasField('queueName'): return entry.queueName return None
python
def queue(self): """The name of the queue that this command was assigned to.""" entry = self._proto.commandQueueEntry if entry.HasField('queueName'): return entry.queueName return None
[ "def", "queue", "(", "self", ")", ":", "entry", "=", "self", ".", "_proto", ".", "commandQueueEntry", "if", "entry", ".", "HasField", "(", "'queueName'", ")", ":", "return", "entry", ".", "queueName", "return", "None" ]
The name of the queue that this command was assigned to.
[ "The", "name", "of", "the", "queue", "that", "this", "command", "was", "assigned", "to", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L193-L198
train
15,660
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
IssuedCommand.origin
def origin(self): """ The origin of this command. This is often empty, but may also be a hostname. """ entry = self._proto.commandQueueEntry if entry.cmdId.HasField('origin'): return entry.cmdId.origin return None
python
def origin(self): """ The origin of this command. This is often empty, but may also be a hostname. """ entry = self._proto.commandQueueEntry if entry.cmdId.HasField('origin'): return entry.cmdId.origin return None
[ "def", "origin", "(", "self", ")", ":", "entry", "=", "self", ".", "_proto", ".", "commandQueueEntry", "if", "entry", ".", "cmdId", ".", "HasField", "(", "'origin'", ")", ":", "return", "entry", ".", "cmdId", ".", "origin", "return", "None" ]
The origin of this command. This is often empty, but may also be a hostname.
[ "The", "origin", "of", "this", "command", ".", "This", "is", "often", "empty", "but", "may", "also", "be", "a", "hostname", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L201-L209
train
15,661
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
IssuedCommand.sequence_number
def sequence_number(self): """ The sequence number of this command. This is the sequence number assigned by the issuing client. """ entry = self._proto.commandQueueEntry if entry.cmdId.HasField('sequenceNumber'): return entry.cmdId.sequenceNumber retur...
python
def sequence_number(self): """ The sequence number of this command. This is the sequence number assigned by the issuing client. """ entry = self._proto.commandQueueEntry if entry.cmdId.HasField('sequenceNumber'): return entry.cmdId.sequenceNumber retur...
[ "def", "sequence_number", "(", "self", ")", ":", "entry", "=", "self", ".", "_proto", ".", "commandQueueEntry", "if", "entry", ".", "cmdId", ".", "HasField", "(", "'sequenceNumber'", ")", ":", "return", "entry", ".", "cmdId", ".", "sequenceNumber", "return",...
The sequence number of this command. This is the sequence number assigned by the issuing client.
[ "The", "sequence", "number", "of", "this", "command", ".", "This", "is", "the", "sequence", "number", "assigned", "by", "the", "issuing", "client", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L212-L220
train
15,662
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
IssuedCommand.create_command_history_subscription
def create_command_history_subscription(self, on_data=None, timeout=60): """ Create a new command history subscription for this command. :param on_data: Function that gets called with :class:`.CommandHistory` updates. :param float timeout: The amount of seconds ...
python
def create_command_history_subscription(self, on_data=None, timeout=60): """ Create a new command history subscription for this command. :param on_data: Function that gets called with :class:`.CommandHistory` updates. :param float timeout: The amount of seconds ...
[ "def", "create_command_history_subscription", "(", "self", ",", "on_data", "=", "None", ",", "timeout", "=", "60", ")", ":", "return", "self", ".", "_client", ".", "create_command_history_subscription", "(", "issued_command", "=", "self", ",", "on_data", "=", "o...
Create a new command history subscription for this command. :param on_data: Function that gets called with :class:`.CommandHistory` updates. :param float timeout: The amount of seconds to wait for the request to complete. :return: Future th...
[ "Create", "a", "new", "command", "history", "subscription", "for", "this", "command", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L243-L256
train
15,663
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
Alarm.acknowledged_by
def acknowledged_by(self): """Username of the acknowledger.""" if (self.is_acknowledged and self._proto.acknowledgeInfo.HasField('acknowledgedBy')): return self._proto.acknowledgeInfo.acknowledgedBy return None
python
def acknowledged_by(self): """Username of the acknowledger.""" if (self.is_acknowledged and self._proto.acknowledgeInfo.HasField('acknowledgedBy')): return self._proto.acknowledgeInfo.acknowledgedBy return None
[ "def", "acknowledged_by", "(", "self", ")", ":", "if", "(", "self", ".", "is_acknowledged", "and", "self", ".", "_proto", ".", "acknowledgeInfo", ".", "HasField", "(", "'acknowledgedBy'", ")", ")", ":", "return", "self", ".", "_proto", ".", "acknowledgeInfo"...
Username of the acknowledger.
[ "Username", "of", "the", "acknowledger", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L315-L320
train
15,664
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
Alarm.acknowledge_message
def acknowledge_message(self): """Comment provided when acknowledging the alarm.""" if (self.is_acknowledged and self._proto.acknowledgeInfo.HasField('acknowledgeMessage')): return self._proto.acknowledgeInfo.acknowledgeMessage return None
python
def acknowledge_message(self): """Comment provided when acknowledging the alarm.""" if (self.is_acknowledged and self._proto.acknowledgeInfo.HasField('acknowledgeMessage')): return self._proto.acknowledgeInfo.acknowledgeMessage return None
[ "def", "acknowledge_message", "(", "self", ")", ":", "if", "(", "self", ".", "is_acknowledged", "and", "self", ".", "_proto", ".", "acknowledgeInfo", ".", "HasField", "(", "'acknowledgeMessage'", ")", ")", ":", "return", "self", ".", "_proto", ".", "acknowle...
Comment provided when acknowledging the alarm.
[ "Comment", "provided", "when", "acknowledging", "the", "alarm", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L323-L328
train
15,665
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
Alarm.acknowledge_time
def acknowledge_time(self): """ Processor time when the alarm was acknowledged. :type: :class:`~datetime.datetime` """ if (self.is_acknowledged and self._proto.acknowledgeInfo.HasField('acknowledgeTime')): return parse_isostring(self._proto.acknowledg...
python
def acknowledge_time(self): """ Processor time when the alarm was acknowledged. :type: :class:`~datetime.datetime` """ if (self.is_acknowledged and self._proto.acknowledgeInfo.HasField('acknowledgeTime')): return parse_isostring(self._proto.acknowledg...
[ "def", "acknowledge_time", "(", "self", ")", ":", "if", "(", "self", ".", "is_acknowledged", "and", "self", ".", "_proto", ".", "acknowledgeInfo", ".", "HasField", "(", "'acknowledgeTime'", ")", ")", ":", "return", "parse_isostring", "(", "self", ".", "_prot...
Processor time when the alarm was acknowledged. :type: :class:`~datetime.datetime`
[ "Processor", "time", "when", "the", "alarm", "was", "acknowledged", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L331-L340
train
15,666
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
ParameterValue.name
def name(self): """ An identifying name for the parameter value. Typically this is the fully-qualified XTCE name, but it may also be an alias depending on how the parameter update was requested. """ if self._proto.id.namespace: return self._proto.id.namespace ...
python
def name(self): """ An identifying name for the parameter value. Typically this is the fully-qualified XTCE name, but it may also be an alias depending on how the parameter update was requested. """ if self._proto.id.namespace: return self._proto.id.namespace ...
[ "def", "name", "(", "self", ")", ":", "if", "self", ".", "_proto", ".", "id", ".", "namespace", ":", "return", "self", ".", "_proto", ".", "id", ".", "namespace", "+", "'/'", "+", "self", ".", "_proto", ".", "id", ".", "name", "return", "self", "...
An identifying name for the parameter value. Typically this is the fully-qualified XTCE name, but it may also be an alias depending on how the parameter update was requested.
[ "An", "identifying", "name", "for", "the", "parameter", "value", ".", "Typically", "this", "is", "the", "fully", "-", "qualified", "XTCE", "name", "but", "it", "may", "also", "be", "an", "alias", "depending", "on", "how", "the", "parameter", "update", "was...
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L410-L418
train
15,667
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
ParameterValue.validity_duration
def validity_duration(self): """ How long this parameter value is valid. .. note: There is also an option when subscribing to get updated when the parameter values expire. :type: :class:`~datetime.timedelta` """ if self._proto.HasField('expireMillis'): ...
python
def validity_duration(self): """ How long this parameter value is valid. .. note: There is also an option when subscribing to get updated when the parameter values expire. :type: :class:`~datetime.timedelta` """ if self._proto.HasField('expireMillis'): ...
[ "def", "validity_duration", "(", "self", ")", ":", "if", "self", ".", "_proto", ".", "HasField", "(", "'expireMillis'", ")", ":", "return", "timedelta", "(", "milliseconds", "=", "self", ".", "_proto", ".", "expireMillis", ")", "return", "None" ]
How long this parameter value is valid. .. note: There is also an option when subscribing to get updated when the parameter values expire. :type: :class:`~datetime.timedelta`
[ "How", "long", "this", "parameter", "value", "is", "valid", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L444-L455
train
15,668
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/model.py
ParameterValue.range_condition
def range_condition(self): """ If the value is out of limits, this indicates ``LOW`` or ``HIGH``. """ if self._proto.HasField('rangeCondition'): return pvalue_pb2.RangeCondition.Name(self._proto.rangeCondition) return None
python
def range_condition(self): """ If the value is out of limits, this indicates ``LOW`` or ``HIGH``. """ if self._proto.HasField('rangeCondition'): return pvalue_pb2.RangeCondition.Name(self._proto.rangeCondition) return None
[ "def", "range_condition", "(", "self", ")", ":", "if", "self", ".", "_proto", ".", "HasField", "(", "'rangeCondition'", ")", ":", "return", "pvalue_pb2", ".", "RangeCondition", ".", "Name", "(", "self", ".", "_proto", ".", "rangeCondition", ")", "return", ...
If the value is out of limits, this indicates ``LOW`` or ``HIGH``.
[ "If", "the", "value", "is", "out", "of", "limits", "this", "indicates", "LOW", "or", "HIGH", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/model.py#L482-L488
train
15,669
lowandrew/OLCTools
sipprCommon/sippingmethods.py
Sippr.reversebait
def reversebait(self, maskmiddle='f', k=19): """ Use the freshly-baited FASTQ files to bait out sequence from the original target files. This will reduce the number of possibly targets against which the baited reads must be aligned """ logging.info('Performing reverse kmer baitin...
python
def reversebait(self, maskmiddle='f', k=19): """ Use the freshly-baited FASTQ files to bait out sequence from the original target files. This will reduce the number of possibly targets against which the baited reads must be aligned """ logging.info('Performing reverse kmer baitin...
[ "def", "reversebait", "(", "self", ",", "maskmiddle", "=", "'f'", ",", "k", "=", "19", ")", ":", "logging", ".", "info", "(", "'Performing reverse kmer baiting of targets with FASTQ files'", ")", "if", "self", ".", "kmer_size", "is", "None", ":", "kmer", "=", ...
Use the freshly-baited FASTQ files to bait out sequence from the original target files. This will reduce the number of possibly targets against which the baited reads must be aligned
[ "Use", "the", "freshly", "-", "baited", "FASTQ", "files", "to", "bait", "out", "sequence", "from", "the", "original", "target", "files", ".", "This", "will", "reduce", "the", "number", "of", "possibly", "targets", "against", "which", "the", "baited", "reads"...
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/sipprCommon/sippingmethods.py#L193-L230
train
15,670
lowandrew/OLCTools
sipprCommon/sippingmethods.py
Sippr.clipper
def clipper(self): """ Filter out results based on the presence of cigar features such as internal soft-clipping """ for sample in self.runmetadata: # Create a dictionary to store all the samples that do not have features replacementresults = dict() tr...
python
def clipper(self): """ Filter out results based on the presence of cigar features such as internal soft-clipping """ for sample in self.runmetadata: # Create a dictionary to store all the samples that do not have features replacementresults = dict() tr...
[ "def", "clipper", "(", "self", ")", ":", "for", "sample", "in", "self", ".", "runmetadata", ":", "# Create a dictionary to store all the samples that do not have features", "replacementresults", "=", "dict", "(", ")", "try", ":", "# SixteenS analyses seem to fail if results...
Filter out results based on the presence of cigar features such as internal soft-clipping
[ "Filter", "out", "results", "based", "on", "the", "presence", "of", "cigar", "features", "such", "as", "internal", "soft", "-", "clipping" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/sipprCommon/sippingmethods.py#L739-L777
train
15,671
sirfoga/pyhal
hal/help.py
main
def main(): """Pretty-print the bug information as JSON""" reporter = BugReporter() print("JSON report:") print(reporter.as_json()) print() print("Markdown report:") print(reporter.as_markdown()) print("SQL report:") print(reporter.as_sql()) print("Choose the appropriate for...
python
def main(): """Pretty-print the bug information as JSON""" reporter = BugReporter() print("JSON report:") print(reporter.as_json()) print() print("Markdown report:") print(reporter.as_markdown()) print("SQL report:") print(reporter.as_sql()) print("Choose the appropriate for...
[ "def", "main", "(", ")", ":", "reporter", "=", "BugReporter", "(", ")", "print", "(", "\"JSON report:\"", ")", "print", "(", "reporter", ".", "as_json", "(", ")", ")", "print", "(", ")", "print", "(", "\"Markdown report:\"", ")", "print", "(", "reporter"...
Pretty-print the bug information as JSON
[ "Pretty", "-", "print", "the", "bug", "information", "as", "JSON" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/help.py#L97-L113
train
15,672
sirfoga/pyhal
hal/help.py
BugReporter.get_platform_info
def get_platform_info(): """Gets platform info :return: platform info """ try: system_name = platform.system() release_name = platform.release() except: system_name = "Unknown" release_name = "Unknown" return { ...
python
def get_platform_info(): """Gets platform info :return: platform info """ try: system_name = platform.system() release_name = platform.release() except: system_name = "Unknown" release_name = "Unknown" return { ...
[ "def", "get_platform_info", "(", ")", ":", "try", ":", "system_name", "=", "platform", ".", "system", "(", ")", "release_name", "=", "platform", ".", "release", "(", ")", "except", ":", "system_name", "=", "\"Unknown\"", "release_name", "=", "\"Unknown\"", "...
Gets platform info :return: platform info
[ "Gets", "platform", "info" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/help.py#L20-L36
train
15,673
sirfoga/pyhal
hal/help.py
BugReporter.get_bug_report
def get_bug_report(): """Generate information for a bug report :return: information for bug report """ platform_info = BugReporter.get_platform_info() module_info = { 'version': hal_version.__version__, 'build': hal_version.__build__ } re...
python
def get_bug_report(): """Generate information for a bug report :return: information for bug report """ platform_info = BugReporter.get_platform_info() module_info = { 'version': hal_version.__version__, 'build': hal_version.__build__ } re...
[ "def", "get_bug_report", "(", ")", ":", "platform_info", "=", "BugReporter", ".", "get_platform_info", "(", ")", "module_info", "=", "{", "'version'", ":", "hal_version", ".", "__version__", ",", "'build'", ":", "hal_version", ".", "__build__", "}", "return", ...
Generate information for a bug report :return: information for bug report
[ "Generate", "information", "for", "a", "bug", "report" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/help.py#L39-L53
train
15,674
yamcs/yamcs-python
yamcs-client/yamcs/core/helpers.py
to_isostring
def to_isostring(dt): """ Converts the given datetime to an ISO String. This assumes the datetime is UTC. """ if dt.tzinfo is not None and dt.tzinfo.utcoffset(dt) > timedelta(0): logging.warn('Warning: aware datetimes are interpreted as if they were naive') # -3 to change microseconds t...
python
def to_isostring(dt): """ Converts the given datetime to an ISO String. This assumes the datetime is UTC. """ if dt.tzinfo is not None and dt.tzinfo.utcoffset(dt) > timedelta(0): logging.warn('Warning: aware datetimes are interpreted as if they were naive') # -3 to change microseconds t...
[ "def", "to_isostring", "(", "dt", ")", ":", "if", "dt", ".", "tzinfo", "is", "not", "None", "and", "dt", ".", "tzinfo", ".", "utcoffset", "(", "dt", ")", ">", "timedelta", "(", "0", ")", ":", "logging", ".", "warn", "(", "'Warning: aware datetimes are ...
Converts the given datetime to an ISO String. This assumes the datetime is UTC.
[ "Converts", "the", "given", "datetime", "to", "an", "ISO", "String", ".", "This", "assumes", "the", "datetime", "is", "UTC", "." ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/core/helpers.py#L8-L17
train
15,675
yamcs/yamcs-python
yamcs-client/yamcs/core/helpers.py
parse_value
def parse_value(proto): """ Convers a Protobuf `Value` from the API into a python native value """ if proto.HasField('floatValue'): return proto.floatValue elif proto.HasField('doubleValue'): return proto.doubleValue elif proto.HasField('sint32Value'): return proto.sint32...
python
def parse_value(proto): """ Convers a Protobuf `Value` from the API into a python native value """ if proto.HasField('floatValue'): return proto.floatValue elif proto.HasField('doubleValue'): return proto.doubleValue elif proto.HasField('sint32Value'): return proto.sint32...
[ "def", "parse_value", "(", "proto", ")", ":", "if", "proto", ".", "HasField", "(", "'floatValue'", ")", ":", "return", "proto", ".", "floatValue", "elif", "proto", ".", "HasField", "(", "'doubleValue'", ")", ":", "return", "proto", ".", "doubleValue", "eli...
Convers a Protobuf `Value` from the API into a python native value
[ "Convers", "a", "Protobuf", "Value", "from", "the", "API", "into", "a", "python", "native", "value" ]
1082fee8a299010cc44416bbb7518fac0ef08b48
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/core/helpers.py#L30-L63
train
15,676
sirfoga/pyhal
hal/charts/correlation.py
create_correlation_matrix_plot
def create_correlation_matrix_plot(correlation_matrix, title, feature_list): """Creates plot for correlation matrix :param correlation_matrix: Correlation matrix of features :param title: Title of plot :param feature_list: List of names of features :return: Shows the given correlation matrix as ima...
python
def create_correlation_matrix_plot(correlation_matrix, title, feature_list): """Creates plot for correlation matrix :param correlation_matrix: Correlation matrix of features :param title: Title of plot :param feature_list: List of names of features :return: Shows the given correlation matrix as ima...
[ "def", "create_correlation_matrix_plot", "(", "correlation_matrix", ",", "title", ",", "feature_list", ")", ":", "chart", "=", "SimpleChart", "(", "title", ")", "ax1", "=", "chart", ".", "get_ax", "(", ")", "ax1", ".", "set_xticks", "(", "list", "(", "range"...
Creates plot for correlation matrix :param correlation_matrix: Correlation matrix of features :param title: Title of plot :param feature_list: List of names of features :return: Shows the given correlation matrix as image
[ "Creates", "plot", "for", "correlation", "matrix" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/charts/correlation.py#L11-L31
train
15,677
IS-ENES-Data/esgf-pid
esgfpid/utils/logutils.py
log_every_x_times
def log_every_x_times(logger, counter, x, msg, *args, **kwargs): ''' Works like logdebug, but only prints first and and every xth message. ''' if counter==1 or counter % x == 0: #msg = msg + (' (counter %i)' % counter) logdebug(logger, msg, *args, **kwargs)
python
def log_every_x_times(logger, counter, x, msg, *args, **kwargs): ''' Works like logdebug, but only prints first and and every xth message. ''' if counter==1 or counter % x == 0: #msg = msg + (' (counter %i)' % counter) logdebug(logger, msg, *args, **kwargs)
[ "def", "log_every_x_times", "(", "logger", ",", "counter", ",", "x", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "counter", "==", "1", "or", "counter", "%", "x", "==", "0", ":", "#msg = msg + (' (counter %i)' % counter)", "logd...
Works like logdebug, but only prints first and and every xth message.
[ "Works", "like", "logdebug", "but", "only", "prints", "first", "and", "and", "every", "xth", "message", "." ]
2f4909bb3ff79c0b6ed2932e0dd8b3bb6aec5e41
https://github.com/IS-ENES-Data/esgf-pid/blob/2f4909bb3ff79c0b6ed2932e0dd8b3bb6aec5e41/esgfpid/utils/logutils.py#L47-L54
train
15,678
mpds-io/python-api-client
mpds_client/retrieve_MPDS.py
MPDSDataRetrieval.get_dataframe
def get_dataframe(self, *args, **kwargs): """ Retrieve data as a Pandas dataframe. Args: search: (dict) Search query like {"categ_A": "val_A", "categ_B": "val_B"}, documented at https://developer.mpds.io/#Categories phases: (list) Phase IDs, according to ...
python
def get_dataframe(self, *args, **kwargs): """ Retrieve data as a Pandas dataframe. Args: search: (dict) Search query like {"categ_A": "val_A", "categ_B": "val_B"}, documented at https://developer.mpds.io/#Categories phases: (list) Phase IDs, according to ...
[ "def", "get_dataframe", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "columns", "=", "kwargs", ".", "get", "(", "'columns'", ")", "if", "columns", ":", "del", "kwargs", "[", "'columns'", "]", "else", ":", "columns", "=", "self", ...
Retrieve data as a Pandas dataframe. Args: search: (dict) Search query like {"categ_A": "val_A", "categ_B": "val_B"}, documented at https://developer.mpds.io/#Categories phases: (list) Phase IDs, according to the MPDS distinct phases concept fields: (dict) Da...
[ "Retrieve", "data", "as", "a", "Pandas", "dataframe", "." ]
edfdd79c6aac44d0a5f7f785e252a88acc95b6fe
https://github.com/mpds-io/python-api-client/blob/edfdd79c6aac44d0a5f7f785e252a88acc95b6fe/mpds_client/retrieve_MPDS.py#L319-L340
train
15,679
portfors-lab/sparkle
sparkle/gui/stim/auto_parameter_view.py
AutoParameterTableView.grabImage
def grabImage(self, index): """Returns an image of the parameter row. Re-implemented from :meth:`AbstractDragView<sparkle.gui.abstract_drag_view.AbstractDragView.grabImage>` """ # grab an image of the cell we are moving # assume all rows same height row_height = self.row...
python
def grabImage(self, index): """Returns an image of the parameter row. Re-implemented from :meth:`AbstractDragView<sparkle.gui.abstract_drag_view.AbstractDragView.grabImage>` """ # grab an image of the cell we are moving # assume all rows same height row_height = self.row...
[ "def", "grabImage", "(", "self", ",", "index", ")", ":", "# grab an image of the cell we are moving", "# assume all rows same height", "row_height", "=", "self", ".", "rowHeight", "(", "0", ")", "# -5 becuase it a a little off", "y", "=", "(", "row_height", "*", "inde...
Returns an image of the parameter row. Re-implemented from :meth:`AbstractDragView<sparkle.gui.abstract_drag_view.AbstractDragView.grabImage>`
[ "Returns", "an", "image", "of", "the", "parameter", "row", "." ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/auto_parameter_view.py#L37-L51
train
15,680
portfors-lab/sparkle
sparkle/gui/stim/auto_parameter_view.py
AutoParameterTableView.mousePressEvent
def mousePressEvent(self, event): """Begins edit on cell clicked, if allowed, and passes event to super class""" index = self.indexAt(event.pos()) if index.isValid(): self.selectRow(index.row()) # selecting the row sets the current index to 0,0 for tab # order...
python
def mousePressEvent(self, event): """Begins edit on cell clicked, if allowed, and passes event to super class""" index = self.indexAt(event.pos()) if index.isValid(): self.selectRow(index.row()) # selecting the row sets the current index to 0,0 for tab # order...
[ "def", "mousePressEvent", "(", "self", ",", "event", ")", ":", "index", "=", "self", ".", "indexAt", "(", "event", ".", "pos", "(", ")", ")", "if", "index", ".", "isValid", "(", ")", ":", "self", ".", "selectRow", "(", "index", ".", "row", "(", "...
Begins edit on cell clicked, if allowed, and passes event to super class
[ "Begins", "edit", "on", "cell", "clicked", "if", "allowed", "and", "passes", "event", "to", "super", "class" ]
5fad1cf2bec58ec6b15d91da20f6236a74826110
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/auto_parameter_view.py#L53-L63
train
15,681
outini/python-pylls
pylls/client.py
CachetAPIClient.request
def request(self, path, method, data=None, **kwargs): """Handle requests to API :param str path: API endpoint's path to request :param str method: HTTP method to use :param dict data: Data to send (optional) :return: Parsed json response as :class:`dict` Additional name...
python
def request(self, path, method, data=None, **kwargs): """Handle requests to API :param str path: API endpoint's path to request :param str method: HTTP method to use :param dict data: Data to send (optional) :return: Parsed json response as :class:`dict` Additional name...
[ "def", "request", "(", "self", ",", "path", ",", "method", ",", "data", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "api_token", ":", "self", ".", "request_headers", "[", "'X-Cachet-Token'", "]", "=", "self", ".", "api_token", ...
Handle requests to API :param str path: API endpoint's path to request :param str method: HTTP method to use :param dict data: Data to send (optional) :return: Parsed json response as :class:`dict` Additional named argument may be passed and are directly transmitted to ...
[ "Handle", "requests", "to", "API" ]
f9fa220594bc1974469097d9bad690a42d0d0f0f
https://github.com/outini/python-pylls/blob/f9fa220594bc1974469097d9bad690a42d0d0f0f/pylls/client.py#L86-L121
train
15,682
outini/python-pylls
pylls/client.py
CachetAPIClient.paginate_request
def paginate_request(self, path, method, data=None, **kwargs): """Handle paginated requests to API :param str path: API endpoint's path to request :param str method: HTTP method to use :param dict data: Data to send (optional) :return: Response data items (:class:`Generator`) ...
python
def paginate_request(self, path, method, data=None, **kwargs): """Handle paginated requests to API :param str path: API endpoint's path to request :param str method: HTTP method to use :param dict data: Data to send (optional) :return: Response data items (:class:`Generator`) ...
[ "def", "paginate_request", "(", "self", ",", "path", ",", "method", ",", "data", "=", "None", ",", "*", "*", "kwargs", ")", ":", "next_page", "=", "path", "while", "next_page", ":", "response", "=", "self", ".", "request", "(", "next_page", ",", "metho...
Handle paginated requests to API :param str path: API endpoint's path to request :param str method: HTTP method to use :param dict data: Data to send (optional) :return: Response data items (:class:`Generator`) Cachet pagination is handled and next pages requested on demand. ...
[ "Handle", "paginated", "requests", "to", "API" ]
f9fa220594bc1974469097d9bad690a42d0d0f0f
https://github.com/outini/python-pylls/blob/f9fa220594bc1974469097d9bad690a42d0d0f0f/pylls/client.py#L123-L152
train
15,683
etal/biocma
biocma/sugar.py
maybe_open
def maybe_open(infile, mode='r'): """Take a file name or a handle, and return a handle. Simplifies creating functions that automagically accept either a file name or an already opened file handle. """ # ENH: Exception safety? if isinstance(infile, basestring): handle = open(infile, mode...
python
def maybe_open(infile, mode='r'): """Take a file name or a handle, and return a handle. Simplifies creating functions that automagically accept either a file name or an already opened file handle. """ # ENH: Exception safety? if isinstance(infile, basestring): handle = open(infile, mode...
[ "def", "maybe_open", "(", "infile", ",", "mode", "=", "'r'", ")", ":", "# ENH: Exception safety?", "if", "isinstance", "(", "infile", ",", "basestring", ")", ":", "handle", "=", "open", "(", "infile", ",", "mode", ")", "do_close", "=", "True", "else", ":...
Take a file name or a handle, and return a handle. Simplifies creating functions that automagically accept either a file name or an already opened file handle.
[ "Take", "a", "file", "name", "or", "a", "handle", "and", "return", "a", "handle", "." ]
eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7
https://github.com/etal/biocma/blob/eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7/biocma/sugar.py#L26-L41
train
15,684
sirfoga/pyhal
hal/internet/parser.py
HtmlTable._get_row_tag
def _get_row_tag(row, tag): """Parses row and gets columns matching tag :param row: HTML row :param tag: tag to get :return: list of labels in row """ is_empty = True data = [] for column_label in row.find_all(tag): # cycle through all labels ...
python
def _get_row_tag(row, tag): """Parses row and gets columns matching tag :param row: HTML row :param tag: tag to get :return: list of labels in row """ is_empty = True data = [] for column_label in row.find_all(tag): # cycle through all labels ...
[ "def", "_get_row_tag", "(", "row", ",", "tag", ")", ":", "is_empty", "=", "True", "data", "=", "[", "]", "for", "column_label", "in", "row", ".", "find_all", "(", "tag", ")", ":", "# cycle through all labels", "data", ".", "append", "(", "String", "(", ...
Parses row and gets columns matching tag :param row: HTML row :param tag: tag to get :return: list of labels in row
[ "Parses", "row", "and", "gets", "columns", "matching", "tag" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/internet/parser.py#L22-L42
train
15,685
sirfoga/pyhal
hal/internet/parser.py
HtmlTable._parse_row
def _parse_row(row): """Parses HTML row :param row: HTML row :return: list of values in row """ data = [] labels = HtmlTable._get_row_tag(row, "th") if labels: data += labels columns = HtmlTable._get_row_tag(row, "td") if columns: ...
python
def _parse_row(row): """Parses HTML row :param row: HTML row :return: list of values in row """ data = [] labels = HtmlTable._get_row_tag(row, "th") if labels: data += labels columns = HtmlTable._get_row_tag(row, "td") if columns: ...
[ "def", "_parse_row", "(", "row", ")", ":", "data", "=", "[", "]", "labels", "=", "HtmlTable", ".", "_get_row_tag", "(", "row", ",", "\"th\"", ")", "if", "labels", ":", "data", "+=", "labels", "columns", "=", "HtmlTable", ".", "_get_row_tag", "(", "row"...
Parses HTML row :param row: HTML row :return: list of values in row
[ "Parses", "HTML", "row" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/internet/parser.py#L45-L62
train
15,686
sirfoga/pyhal
hal/internet/parser.py
HtmlTable.parse
def parse(self): """Parses data in table :return: List of list of values in table """ data = [] # add name of section for row in self.soup.find_all("tr"): # cycle through all rows parsed = self._parse_row(row) if parsed: data.append(par...
python
def parse(self): """Parses data in table :return: List of list of values in table """ data = [] # add name of section for row in self.soup.find_all("tr"): # cycle through all rows parsed = self._parse_row(row) if parsed: data.append(par...
[ "def", "parse", "(", "self", ")", ":", "data", "=", "[", "]", "# add name of section", "for", "row", "in", "self", ".", "soup", ".", "find_all", "(", "\"tr\"", ")", ":", "# cycle through all rows", "parsed", "=", "self", ".", "_parse_row", "(", "row", ")...
Parses data in table :return: List of list of values in table
[ "Parses", "data", "in", "table" ]
4394d8a1f7e45bea28a255ec390f4962ee64d33a
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/internet/parser.py#L64-L76
train
15,687
moin18/utilspie
utilspie/importutils/import_utils.py
delete_module
def delete_module(modname): """ Delete module and sub-modules from `sys.module` """ try: _ = sys.modules[modname] except KeyError: raise ValueError("Module not found in sys.modules: '{}'".format(modname)) for module in list(sys.modules.keys()): if module and module.start...
python
def delete_module(modname): """ Delete module and sub-modules from `sys.module` """ try: _ = sys.modules[modname] except KeyError: raise ValueError("Module not found in sys.modules: '{}'".format(modname)) for module in list(sys.modules.keys()): if module and module.start...
[ "def", "delete_module", "(", "modname", ")", ":", "try", ":", "_", "=", "sys", ".", "modules", "[", "modname", "]", "except", "KeyError", ":", "raise", "ValueError", "(", "\"Module not found in sys.modules: '{}'\"", ".", "format", "(", "modname", ")", ")", "...
Delete module and sub-modules from `sys.module`
[ "Delete", "module", "and", "sub", "-", "modules", "from", "sys", ".", "module" ]
ea96860b93fd058019a829847258e39323fef31f
https://github.com/moin18/utilspie/blob/ea96860b93fd058019a829847258e39323fef31f/utilspie/importutils/import_utils.py#L8-L19
train
15,688
moin18/utilspie
utilspie/importutils/import_utils.py
reload_module
def reload_module(module): """ Reload the Python module """ try: # For Python 2.x reload(module) except (ImportError, NameError): # For <= Python3.3: import imp imp.reload(module) except (ImportError, NameError): # For >= Python3.4 import i...
python
def reload_module(module): """ Reload the Python module """ try: # For Python 2.x reload(module) except (ImportError, NameError): # For <= Python3.3: import imp imp.reload(module) except (ImportError, NameError): # For >= Python3.4 import i...
[ "def", "reload_module", "(", "module", ")", ":", "try", ":", "# For Python 2.x", "reload", "(", "module", ")", "except", "(", "ImportError", ",", "NameError", ")", ":", "# For <= Python3.3:", "import", "imp", "imp", ".", "reload", "(", "module", ")", "except...
Reload the Python module
[ "Reload", "the", "Python", "module" ]
ea96860b93fd058019a829847258e39323fef31f
https://github.com/moin18/utilspie/blob/ea96860b93fd058019a829847258e39323fef31f/utilspie/importutils/import_utils.py#L22-L36
train
15,689
moin18/utilspie
utilspie/importutils/import_utils.py
lazy_load_modules
def lazy_load_modules(*modules): """ Decorator to load module to perform related operation for specific function and delete the module from imports once the task is done. GC frees the memory related to module during clean-up. """ def decorator(function): def wrapper(*args, **kwargs): ...
python
def lazy_load_modules(*modules): """ Decorator to load module to perform related operation for specific function and delete the module from imports once the task is done. GC frees the memory related to module during clean-up. """ def decorator(function): def wrapper(*args, **kwargs): ...
[ "def", "lazy_load_modules", "(", "*", "modules", ")", ":", "def", "decorator", "(", "function", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "module_dict", "=", "{", "}", "for", "module_string", "in", "modules", ":",...
Decorator to load module to perform related operation for specific function and delete the module from imports once the task is done. GC frees the memory related to module during clean-up.
[ "Decorator", "to", "load", "module", "to", "perform", "related", "operation", "for", "specific", "function", "and", "delete", "the", "module", "from", "imports", "once", "the", "task", "is", "done", ".", "GC", "frees", "the", "memory", "related", "to", "modu...
ea96860b93fd058019a829847258e39323fef31f
https://github.com/moin18/utilspie/blob/ea96860b93fd058019a829847258e39323fef31f/utilspie/importutils/import_utils.py#L39-L68
train
15,690
NoviceLive/intellicoder
intellicoder/init.py
LevelFormatter.format
def format(self, record): """ Format the record using the corresponding formatter. """ if record.levelno == DEBUG: return self.debug_formatter.format(record) if record.levelno == INFO: return self.info_formatter.format(record) if record.levelno == ...
python
def format(self, record): """ Format the record using the corresponding formatter. """ if record.levelno == DEBUG: return self.debug_formatter.format(record) if record.levelno == INFO: return self.info_formatter.format(record) if record.levelno == ...
[ "def", "format", "(", "self", ",", "record", ")", ":", "if", "record", ".", "levelno", "==", "DEBUG", ":", "return", "self", ".", "debug_formatter", ".", "format", "(", "record", ")", "if", "record", ".", "levelno", "==", "INFO", ":", "return", "self",...
Format the record using the corresponding formatter.
[ "Format", "the", "record", "using", "the", "corresponding", "formatter", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/init.py#L85-L98
train
15,691
dalloriam/engel
engel/widgets/structure.py
Head.load_stylesheet
def load_stylesheet(self, id, path): """ Proper way to dynamically inject a stylesheet in a page. :param path: Path of the stylesheet to inject. """ self.add_child(HeadLink(id=id, link_type="stylesheet", path=path))
python
def load_stylesheet(self, id, path): """ Proper way to dynamically inject a stylesheet in a page. :param path: Path of the stylesheet to inject. """ self.add_child(HeadLink(id=id, link_type="stylesheet", path=path))
[ "def", "load_stylesheet", "(", "self", ",", "id", ",", "path", ")", ":", "self", ".", "add_child", "(", "HeadLink", "(", "id", "=", "id", ",", "link_type", "=", "\"stylesheet\"", ",", "path", "=", "path", ")", ")" ]
Proper way to dynamically inject a stylesheet in a page. :param path: Path of the stylesheet to inject.
[ "Proper", "way", "to", "dynamically", "inject", "a", "stylesheet", "in", "a", "page", "." ]
f3477cd546e885bc53e755b3eb1452ce43ef5697
https://github.com/dalloriam/engel/blob/f3477cd546e885bc53e755b3eb1452ce43ef5697/engel/widgets/structure.py#L31-L37
train
15,692
dalloriam/engel
engel/widgets/structure.py
List.add_child
def add_child(self, widget): """ Append a widget to the list. :param widget: Object inheriting :class:`~.widgets.base.BaseElement` """ li_itm = _li(id=self.id + str(self._count)) li_itm.add_child(widget) super(List, self).add_child(li_itm) self._items.ap...
python
def add_child(self, widget): """ Append a widget to the list. :param widget: Object inheriting :class:`~.widgets.base.BaseElement` """ li_itm = _li(id=self.id + str(self._count)) li_itm.add_child(widget) super(List, self).add_child(li_itm) self._items.ap...
[ "def", "add_child", "(", "self", ",", "widget", ")", ":", "li_itm", "=", "_li", "(", "id", "=", "self", ".", "id", "+", "str", "(", "self", ".", "_count", ")", ")", "li_itm", ".", "add_child", "(", "widget", ")", "super", "(", "List", ",", "self"...
Append a widget to the list. :param widget: Object inheriting :class:`~.widgets.base.BaseElement`
[ "Append", "a", "widget", "to", "the", "list", "." ]
f3477cd546e885bc53e755b3eb1452ce43ef5697
https://github.com/dalloriam/engel/blob/f3477cd546e885bc53e755b3eb1452ce43ef5697/engel/widgets/structure.py#L70-L81
train
15,693
dalloriam/engel
engel/widgets/structure.py
List.remove_child
def remove_child(self, widget): """ Remove a widget from the list. :param widget: Object inheriting :class:`~.widgets.base.BaseElement` """ raw = list(filter(lambda x: x[0] == widget, self._items)) if raw: itm, wrapped = raw[0] self._items.remove(...
python
def remove_child(self, widget): """ Remove a widget from the list. :param widget: Object inheriting :class:`~.widgets.base.BaseElement` """ raw = list(filter(lambda x: x[0] == widget, self._items)) if raw: itm, wrapped = raw[0] self._items.remove(...
[ "def", "remove_child", "(", "self", ",", "widget", ")", ":", "raw", "=", "list", "(", "filter", "(", "lambda", "x", ":", "x", "[", "0", "]", "==", "widget", ",", "self", ".", "_items", ")", ")", "if", "raw", ":", "itm", ",", "wrapped", "=", "ra...
Remove a widget from the list. :param widget: Object inheriting :class:`~.widgets.base.BaseElement`
[ "Remove", "a", "widget", "from", "the", "list", "." ]
f3477cd546e885bc53e755b3eb1452ce43ef5697
https://github.com/dalloriam/engel/blob/f3477cd546e885bc53e755b3eb1452ce43ef5697/engel/widgets/structure.py#L83-L95
train
15,694
ArabellaTech/django-basic-cms
basic_cms/admin/views.py
move_page
def move_page(request, page_id, extra_context=None): """Move the page to the requested target, at the given position.""" page = Page.objects.get(pk=page_id) target = request.POST.get('target', None) position = request.POST.get('position', None) if target is not None and position is not None: ...
python
def move_page(request, page_id, extra_context=None): """Move the page to the requested target, at the given position.""" page = Page.objects.get(pk=page_id) target = request.POST.get('target', None) position = request.POST.get('position', None) if target is not None and position is not None: ...
[ "def", "move_page", "(", "request", ",", "page_id", ",", "extra_context", "=", "None", ")", ":", "page", "=", "Page", ".", "objects", ".", "get", "(", "pk", "=", "page_id", ")", "target", "=", "request", ".", "POST", ".", "get", "(", "'target'", ",",...
Move the page to the requested target, at the given position.
[ "Move", "the", "page", "to", "the", "requested", "target", "at", "the", "given", "position", "." ]
863f3c6098606f663994930cd8e7723ad0c07caf
https://github.com/ArabellaTech/django-basic-cms/blob/863f3c6098606f663994930cd8e7723ad0c07caf/basic_cms/admin/views.py#L113-L138
train
15,695
NoviceLive/intellicoder
intellicoder/sources.py
reloc_var
def reloc_var(var_name, reloc_delta, pointer, var_type): """ Build C source code to relocate a variable. """ template = '{0} {3}{1} = RELOC_VAR(_{1}, {2}, {0});\n' return template.format( var_type, var_name, reloc_delta, '*' if pointer else '' )
python
def reloc_var(var_name, reloc_delta, pointer, var_type): """ Build C source code to relocate a variable. """ template = '{0} {3}{1} = RELOC_VAR(_{1}, {2}, {0});\n' return template.format( var_type, var_name, reloc_delta, '*' if pointer else '' )
[ "def", "reloc_var", "(", "var_name", ",", "reloc_delta", ",", "pointer", ",", "var_type", ")", ":", "template", "=", "'{0} {3}{1} = RELOC_VAR(_{1}, {2}, {0});\\n'", "return", "template", ".", "format", "(", "var_type", ",", "var_name", ",", "reloc_delta", ",", "'*...
Build C source code to relocate a variable.
[ "Build", "C", "source", "code", "to", "relocate", "a", "variable", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/sources.py#L138-L146
train
15,696
NoviceLive/intellicoder
intellicoder/sources.py
make_c_args
def make_c_args(arg_pairs): """ Build a C argument list from return type and arguments pairs. """ logging.debug(arg_pairs) c_args = [ '{} {}'.format(arg_type, arg_name) if arg_name else arg_type for dummy_number, arg_type, arg_name in sorted(arg_pairs) ] return ', '.join(c_ar...
python
def make_c_args(arg_pairs): """ Build a C argument list from return type and arguments pairs. """ logging.debug(arg_pairs) c_args = [ '{} {}'.format(arg_type, arg_name) if arg_name else arg_type for dummy_number, arg_type, arg_name in sorted(arg_pairs) ] return ', '.join(c_ar...
[ "def", "make_c_args", "(", "arg_pairs", ")", ":", "logging", ".", "debug", "(", "arg_pairs", ")", "c_args", "=", "[", "'{} {}'", ".", "format", "(", "arg_type", ",", "arg_name", ")", "if", "arg_name", "else", "arg_type", "for", "dummy_number", ",", "arg_ty...
Build a C argument list from return type and arguments pairs.
[ "Build", "a", "C", "argument", "list", "from", "return", "type", "and", "arguments", "pairs", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/sources.py#L166-L175
train
15,697
lowandrew/OLCTools
spadespipeline/phix.py
PhiX.interop_parse
def interop_parse(self): """ Use interop to parse the files in the InterOp folder to extract the number of reads mapping to PhiX as well as the error rate """ # Parse the files and load the data try: run_metrics = py_interop_run_metrics.run_metrics() ...
python
def interop_parse(self): """ Use interop to parse the files in the InterOp folder to extract the number of reads mapping to PhiX as well as the error rate """ # Parse the files and load the data try: run_metrics = py_interop_run_metrics.run_metrics() ...
[ "def", "interop_parse", "(", "self", ")", ":", "# Parse the files and load the data", "try", ":", "run_metrics", "=", "py_interop_run_metrics", ".", "run_metrics", "(", ")", "valid_to_load", "=", "py_interop_run", ".", "uchar_vector", "(", "py_interop_run", ".", "Metr...
Use interop to parse the files in the InterOp folder to extract the number of reads mapping to PhiX as well as the error rate
[ "Use", "interop", "to", "parse", "the", "files", "in", "the", "InterOp", "folder", "to", "extract", "the", "number", "of", "reads", "mapping", "to", "PhiX", "as", "well", "as", "the", "error", "rate" ]
88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/phix.py#L31-L55
train
15,698
NoviceLive/intellicoder
intellicoder/msbuild/builders.py
Builder.make_inc
def make_inc(incs): """ Make include directory for link.exe. """ inc_args = [['/I', inc] for inc in incs] return list(chain.from_iterable(inc_args))
python
def make_inc(incs): """ Make include directory for link.exe. """ inc_args = [['/I', inc] for inc in incs] return list(chain.from_iterable(inc_args))
[ "def", "make_inc", "(", "incs", ")", ":", "inc_args", "=", "[", "[", "'/I'", ",", "inc", "]", "for", "inc", "in", "incs", "]", "return", "list", "(", "chain", ".", "from_iterable", "(", "inc_args", ")", ")" ]
Make include directory for link.exe.
[ "Make", "include", "directory", "for", "link", ".", "exe", "." ]
6cac5ebfce65c370dbebe47756a1789b120ef982
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/msbuild/builders.py#L113-L118
train
15,699