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
codenerix/django-codenerix-invoicing
codenerix_invoicing/models_sales_original.py
GenLineProduct.create_invoice_from_ticket
def create_invoice_from_ticket(pk, list_lines): """ la pk y list_lines son de ticket, necesitamos la info de las lineas de pedidos """ context = {} if list_lines: new_list_lines = [x[0] for x in SalesLineTicket.objects.values_list('line_order__pk').filter(pk__in=[int(...
python
def create_invoice_from_ticket(pk, list_lines): """ la pk y list_lines son de ticket, necesitamos la info de las lineas de pedidos """ context = {} if list_lines: new_list_lines = [x[0] for x in SalesLineTicket.objects.values_list('line_order__pk').filter(pk__in=[int(...
[ "def", "create_invoice_from_ticket", "(", "pk", ",", "list_lines", ")", ":", "context", "=", "{", "}", "if", "list_lines", ":", "new_list_lines", "=", "[", "x", "[", "0", "]", "for", "x", "in", "SalesLineTicket", ".", "objects", ".", "values_list", "(", ...
la pk y list_lines son de ticket, necesitamos la info de las lineas de pedidos
[ "la", "pk", "y", "list_lines", "son", "de", "ticket", "necesitamos", "la", "info", "de", "las", "lineas", "de", "pedidos" ]
7db5c62f335f9215a8b308603848625208b48698
https://github.com/codenerix/django-codenerix-invoicing/blob/7db5c62f335f9215a8b308603848625208b48698/codenerix_invoicing/models_sales_original.py#L1230-L1249
train
55,900
xtream1101/cutil
cutil/database.py
_check_values
def _check_values(in_values): """ Check if values need to be converted before they get mogrify'd """ out_values = [] for value in in_values: # if isinstance(value, (dict, list)): # out_values.append(json.dumps(value)) # else: out_values...
python
def _check_values(in_values): """ Check if values need to be converted before they get mogrify'd """ out_values = [] for value in in_values: # if isinstance(value, (dict, list)): # out_values.append(json.dumps(value)) # else: out_values...
[ "def", "_check_values", "(", "in_values", ")", ":", "out_values", "=", "[", "]", "for", "value", "in", "in_values", ":", "# if isinstance(value, (dict, list)):", "# out_values.append(json.dumps(value))", "# else:", "out_values", ".", "append", "(", "value", ")", "...
Check if values need to be converted before they get mogrify'd
[ "Check", "if", "values", "need", "to", "be", "converted", "before", "they", "get", "mogrify", "d" ]
2e4d1f00e66154b44d4ccffb9b1db3f37e87f2e8
https://github.com/xtream1101/cutil/blob/2e4d1f00e66154b44d4ccffb9b1db3f37e87f2e8/cutil/database.py#L10-L20
train
55,901
ScottDuckworth/python-anyvcs
anyvcs/__init__.py
clone
def clone(srcpath, destpath, vcs=None): """Clone an existing repository. :param str srcpath: Path to an existing repository :param str destpath: Desired path of new repository :param str vcs: Either ``git``, ``hg``, or ``svn`` :returns VCSRepo: The newly cloned repository If ``vcs`` is not giv...
python
def clone(srcpath, destpath, vcs=None): """Clone an existing repository. :param str srcpath: Path to an existing repository :param str destpath: Desired path of new repository :param str vcs: Either ``git``, ``hg``, or ``svn`` :returns VCSRepo: The newly cloned repository If ``vcs`` is not giv...
[ "def", "clone", "(", "srcpath", ",", "destpath", ",", "vcs", "=", "None", ")", ":", "vcs", "=", "vcs", "or", "probe", "(", "srcpath", ")", "cls", "=", "_get_repo_class", "(", "vcs", ")", "return", "cls", ".", "clone", "(", "srcpath", ",", "destpath",...
Clone an existing repository. :param str srcpath: Path to an existing repository :param str destpath: Desired path of new repository :param str vcs: Either ``git``, ``hg``, or ``svn`` :returns VCSRepo: The newly cloned repository If ``vcs`` is not given, then the repository type is discovered from...
[ "Clone", "an", "existing", "repository", "." ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/__init__.py#L32-L46
train
55,902
ScottDuckworth/python-anyvcs
anyvcs/__init__.py
probe
def probe(path): """Probe a repository for its type. :param str path: The path of the repository :raises UnknownVCSType: if the repository type couldn't be inferred :returns str: either ``git``, ``hg``, or ``svn`` This function employs some heuristics to guess the type of the repository. """ ...
python
def probe(path): """Probe a repository for its type. :param str path: The path of the repository :raises UnknownVCSType: if the repository type couldn't be inferred :returns str: either ``git``, ``hg``, or ``svn`` This function employs some heuristics to guess the type of the repository. """ ...
[ "def", "probe", "(", "path", ")", ":", "import", "os", "from", ".", "common", "import", "UnknownVCSType", "if", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "path", ",", "'.git'", ")", ")", ":", "return", "'git'", "eli...
Probe a repository for its type. :param str path: The path of the repository :raises UnknownVCSType: if the repository type couldn't be inferred :returns str: either ``git``, ``hg``, or ``svn`` This function employs some heuristics to guess the type of the repository.
[ "Probe", "a", "repository", "for", "its", "type", "." ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/__init__.py#L60-L91
train
55,903
ScottDuckworth/python-anyvcs
anyvcs/__init__.py
open
def open(path, vcs=None): """Open an existing repository :param str path: The path of the repository :param vcs: If specified, assume the given repository type to avoid auto-detection. Either ``git``, ``hg``, or ``svn``. :raises UnknownVCSType: if the repository type couldn't be inferre...
python
def open(path, vcs=None): """Open an existing repository :param str path: The path of the repository :param vcs: If specified, assume the given repository type to avoid auto-detection. Either ``git``, ``hg``, or ``svn``. :raises UnknownVCSType: if the repository type couldn't be inferre...
[ "def", "open", "(", "path", ",", "vcs", "=", "None", ")", ":", "import", "os", "assert", "os", ".", "path", ".", "isdir", "(", "path", ")", ",", "path", "+", "' is not a directory'", "vcs", "=", "vcs", "or", "probe", "(", "path", ")", "cls", "=", ...
Open an existing repository :param str path: The path of the repository :param vcs: If specified, assume the given repository type to avoid auto-detection. Either ``git``, ``hg``, or ``svn``. :raises UnknownVCSType: if the repository type couldn't be inferred If ``vcs`` is not specifie...
[ "Open", "an", "existing", "repository" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/__init__.py#L94-L109
train
55,904
ProjetPP/PPP-datamodel-Python
ppp_datamodel/utils/attributesholder.py
AttributesHolder._check_attributes
def _check_attributes(self, attributes, extra=None): """Check if attributes given to the constructor can be used to instanciate a valid node.""" extra = extra or () unknown_keys = set(attributes) - set(self._possible_attributes) - set(extra) if unknown_keys: logger.wa...
python
def _check_attributes(self, attributes, extra=None): """Check if attributes given to the constructor can be used to instanciate a valid node.""" extra = extra or () unknown_keys = set(attributes) - set(self._possible_attributes) - set(extra) if unknown_keys: logger.wa...
[ "def", "_check_attributes", "(", "self", ",", "attributes", ",", "extra", "=", "None", ")", ":", "extra", "=", "extra", "or", "(", ")", "unknown_keys", "=", "set", "(", "attributes", ")", "-", "set", "(", "self", ".", "_possible_attributes", ")", "-", ...
Check if attributes given to the constructor can be used to instanciate a valid node.
[ "Check", "if", "attributes", "given", "to", "the", "constructor", "can", "be", "used", "to", "instanciate", "a", "valid", "node", "." ]
0c7958fb4df75468fd3137240a5065925c239776
https://github.com/ProjetPP/PPP-datamodel-Python/blob/0c7958fb4df75468fd3137240a5065925c239776/ppp_datamodel/utils/attributesholder.py#L13-L20
train
55,905
standage/tag
tag/__main__.py
main
def main(args=None): """ Entry point for the tag CLI. Isolated as a method so that the CLI can be called by other Python code (e.g. for testing), in which case the arguments are passed to the function. If no arguments are passed to the function, parse them from the command line. """ if ...
python
def main(args=None): """ Entry point for the tag CLI. Isolated as a method so that the CLI can be called by other Python code (e.g. for testing), in which case the arguments are passed to the function. If no arguments are passed to the function, parse them from the command line. """ if ...
[ "def", "main", "(", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "tag", ".", "cli", ".", "parser", "(", ")", ".", "parse_args", "(", ")", "assert", "args", ".", "cmd", "in", "mains", "mainmethod", "=", "mains", "["...
Entry point for the tag CLI. Isolated as a method so that the CLI can be called by other Python code (e.g. for testing), in which case the arguments are passed to the function. If no arguments are passed to the function, parse them from the command line.
[ "Entry", "point", "for", "the", "tag", "CLI", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/__main__.py#L22-L36
train
55,906
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
_build_request
def _build_request(request): """Build message to transfer over the socket from a request.""" msg = bytes([request['cmd']]) if 'dest' in request: msg += bytes([request['dest']]) else: msg += b'\0' if 'sha' in request: msg += request['sha'] else: for dummy in range(...
python
def _build_request(request): """Build message to transfer over the socket from a request.""" msg = bytes([request['cmd']]) if 'dest' in request: msg += bytes([request['dest']]) else: msg += b'\0' if 'sha' in request: msg += request['sha'] else: for dummy in range(...
[ "def", "_build_request", "(", "request", ")", ":", "msg", "=", "bytes", "(", "[", "request", "[", "'cmd'", "]", "]", ")", "if", "'dest'", "in", "request", ":", "msg", "+=", "bytes", "(", "[", "request", "[", "'dest'", "]", "]", ")", "else", ":", ...
Build message to transfer over the socket from a request.
[ "Build", "message", "to", "transfer", "over", "the", "socket", "from", "a", "request", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L28-L41
train
55,907
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
main
def main(): """Show example using the API.""" __async__ = True logging.basicConfig(format="%(levelname)-10s %(message)s", level=logging.DEBUG) if len(sys.argv) != 2: logging.error("Must specify configuration file") sys.exit() config = configparser.ConfigParse...
python
def main(): """Show example using the API.""" __async__ = True logging.basicConfig(format="%(levelname)-10s %(message)s", level=logging.DEBUG) if len(sys.argv) != 2: logging.error("Must specify configuration file") sys.exit() config = configparser.ConfigParse...
[ "def", "main", "(", ")", ":", "__async__", "=", "True", "logging", ".", "basicConfig", "(", "format", "=", "\"%(levelname)-10s %(message)s\"", ",", "level", "=", "logging", ".", "DEBUG", ")", "if", "len", "(", "sys", ".", "argv", ")", "!=", "2", ":", "...
Show example using the API.
[ "Show", "example", "using", "the", "API", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L242-L267
train
55,908
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client.start
def start(self): """Start thread.""" if not self._thread: logging.info("Starting asterisk mbox thread") # Ensure signal queue is empty try: while True: self.signal.get(False) except queue.Empty: pass ...
python
def start(self): """Start thread.""" if not self._thread: logging.info("Starting asterisk mbox thread") # Ensure signal queue is empty try: while True: self.signal.get(False) except queue.Empty: pass ...
[ "def", "start", "(", "self", ")", ":", "if", "not", "self", ".", "_thread", ":", "logging", ".", "info", "(", "\"Starting asterisk mbox thread\"", ")", "# Ensure signal queue is empty", "try", ":", "while", "True", ":", "self", ".", "signal", ".", "get", "("...
Start thread.
[ "Start", "thread", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L73-L85
train
55,909
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client.stop
def stop(self): """Stop thread.""" if self._thread: self.signal.put("Stop") self._thread.join() if self._soc: self._soc.shutdown() self._soc.close() self._thread = None
python
def stop(self): """Stop thread.""" if self._thread: self.signal.put("Stop") self._thread.join() if self._soc: self._soc.shutdown() self._soc.close() self._thread = None
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "_thread", ":", "self", ".", "signal", ".", "put", "(", "\"Stop\"", ")", "self", ".", "_thread", ".", "join", "(", ")", "if", "self", ".", "_soc", ":", "self", ".", "_soc", ".", "shutdown",...
Stop thread.
[ "Stop", "thread", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L87-L95
train
55,910
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client._recv_msg
def _recv_msg(self): """Read a message from the server.""" command = ord(recv_blocking(self._soc, 1)) msglen = recv_blocking(self._soc, 4) msglen = ((msglen[0] << 24) + (msglen[1] << 16) + (msglen[2] << 8) + msglen[3]) msg = recv_blocking(self._soc, msglen) ...
python
def _recv_msg(self): """Read a message from the server.""" command = ord(recv_blocking(self._soc, 1)) msglen = recv_blocking(self._soc, 4) msglen = ((msglen[0] << 24) + (msglen[1] << 16) + (msglen[2] << 8) + msglen[3]) msg = recv_blocking(self._soc, msglen) ...
[ "def", "_recv_msg", "(", "self", ")", ":", "command", "=", "ord", "(", "recv_blocking", "(", "self", ".", "_soc", ",", "1", ")", ")", "msglen", "=", "recv_blocking", "(", "self", ".", "_soc", ",", "4", ")", "msglen", "=", "(", "(", "msglen", "[", ...
Read a message from the server.
[ "Read", "a", "message", "from", "the", "server", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L104-L111
train
55,911
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client._loop
def _loop(self): """Handle data.""" request = {} connected = False while True: timeout = None sockets = [self.request_queue, self.signal] if not connected: try: self._clear_request(request) self._...
python
def _loop(self): """Handle data.""" request = {} connected = False while True: timeout = None sockets = [self.request_queue, self.signal] if not connected: try: self._clear_request(request) self._...
[ "def", "_loop", "(", "self", ")", ":", "request", "=", "{", "}", "connected", "=", "False", "while", "True", ":", "timeout", "=", "None", "sockets", "=", "[", "self", ".", "request_queue", ",", "self", ".", "signal", "]", "if", "not", "connected", ":...
Handle data.
[ "Handle", "data", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L146-L196
train
55,912
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client.mp3
def mp3(self, sha, **kwargs): """Get raw MP3 of a message.""" return self._queue_msg({'cmd': cmd.CMD_MESSAGE_MP3, 'sha': _get_bytes(sha)}, **kwargs)
python
def mp3(self, sha, **kwargs): """Get raw MP3 of a message.""" return self._queue_msg({'cmd': cmd.CMD_MESSAGE_MP3, 'sha': _get_bytes(sha)}, **kwargs)
[ "def", "mp3", "(", "self", ",", "sha", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_queue_msg", "(", "{", "'cmd'", ":", "cmd", ".", "CMD_MESSAGE_MP3", ",", "'sha'", ":", "_get_bytes", "(", "sha", ")", "}", ",", "*", "*", "kwargs", ...
Get raw MP3 of a message.
[ "Get", "raw", "MP3", "of", "a", "message", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L216-L219
train
55,913
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client.delete
def delete(self, sha, **kwargs): """Delete a message.""" return self._queue_msg({'cmd': cmd.CMD_MESSAGE_DELETE, 'sha': _get_bytes(sha)}, **kwargs)
python
def delete(self, sha, **kwargs): """Delete a message.""" return self._queue_msg({'cmd': cmd.CMD_MESSAGE_DELETE, 'sha': _get_bytes(sha)}, **kwargs)
[ "def", "delete", "(", "self", ",", "sha", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_queue_msg", "(", "{", "'cmd'", ":", "cmd", ".", "CMD_MESSAGE_DELETE", ",", "'sha'", ":", "_get_bytes", "(", "sha", ")", "}", ",", "*", "*", "kwarg...
Delete a message.
[ "Delete", "a", "message", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L221-L224
train
55,914
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client.get_cdr
def get_cdr(self, start=0, count=-1, **kwargs): """Request range of CDR messages""" sha = encode_to_sha("{:d},{:d}".format(start, count)) return self._queue_msg({'cmd': cmd.CMD_MESSAGE_CDR, 'sha': sha}, **kwargs)
python
def get_cdr(self, start=0, count=-1, **kwargs): """Request range of CDR messages""" sha = encode_to_sha("{:d},{:d}".format(start, count)) return self._queue_msg({'cmd': cmd.CMD_MESSAGE_CDR, 'sha': sha}, **kwargs)
[ "def", "get_cdr", "(", "self", ",", "start", "=", "0", ",", "count", "=", "-", "1", ",", "*", "*", "kwargs", ")", ":", "sha", "=", "encode_to_sha", "(", "\"{:d},{:d}\"", ".", "format", "(", "start", ",", "count", ")", ")", "return", "self", ".", ...
Request range of CDR messages
[ "Request", "range", "of", "CDR", "messages" ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L231-L235
train
55,915
chrizzFTD/naming
naming/__init__.py
File.path
def path(self) -> Path: """A Path for this name object joining field names from `self.get_path_pattern_list` with this object's name""" args = list(self._iter_translated_field_names(self.get_path_pattern_list())) args.append(self.get_name()) return Path(*args)
python
def path(self) -> Path: """A Path for this name object joining field names from `self.get_path_pattern_list` with this object's name""" args = list(self._iter_translated_field_names(self.get_path_pattern_list())) args.append(self.get_name()) return Path(*args)
[ "def", "path", "(", "self", ")", "->", "Path", ":", "args", "=", "list", "(", "self", ".", "_iter_translated_field_names", "(", "self", ".", "get_path_pattern_list", "(", ")", ")", ")", "args", ".", "append", "(", "self", ".", "get_name", "(", ")", ")"...
A Path for this name object joining field names from `self.get_path_pattern_list` with this object's name
[ "A", "Path", "for", "this", "name", "object", "joining", "field", "names", "from", "self", ".", "get_path_pattern_list", "with", "this", "object", "s", "name" ]
ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c
https://github.com/chrizzFTD/naming/blob/ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c/naming/__init__.py#L103-L107
train
55,916
ProjetPP/PPP-datamodel-Python
ppp_datamodel/nodes/abstractnode.py
AbstractNode.fold
def fold(self, predicate): """Takes a predicate and applies it to each node starting from the leaves and making the return value propagate.""" childs = {x:y.fold(predicate) for (x,y) in self._attributes.items() if isinstance(y, SerializableTypedAttributesHolder)} return...
python
def fold(self, predicate): """Takes a predicate and applies it to each node starting from the leaves and making the return value propagate.""" childs = {x:y.fold(predicate) for (x,y) in self._attributes.items() if isinstance(y, SerializableTypedAttributesHolder)} return...
[ "def", "fold", "(", "self", ",", "predicate", ")", ":", "childs", "=", "{", "x", ":", "y", ".", "fold", "(", "predicate", ")", "for", "(", "x", ",", "y", ")", "in", "self", ".", "_attributes", ".", "items", "(", ")", "if", "isinstance", "(", "y...
Takes a predicate and applies it to each node starting from the leaves and making the return value propagate.
[ "Takes", "a", "predicate", "and", "applies", "it", "to", "each", "node", "starting", "from", "the", "leaves", "and", "making", "the", "return", "value", "propagate", "." ]
0c7958fb4df75468fd3137240a5065925c239776
https://github.com/ProjetPP/PPP-datamodel-Python/blob/0c7958fb4df75468fd3137240a5065925c239776/ppp_datamodel/nodes/abstractnode.py#L41-L46
train
55,917
edx/help-tokens
help_tokens/core.py
HelpUrlExpert.the_one
def the_one(cls): """Get the single global HelpUrlExpert object.""" if cls.THE_ONE is None: cls.THE_ONE = cls(settings.HELP_TOKENS_INI_FILE) return cls.THE_ONE
python
def the_one(cls): """Get the single global HelpUrlExpert object.""" if cls.THE_ONE is None: cls.THE_ONE = cls(settings.HELP_TOKENS_INI_FILE) return cls.THE_ONE
[ "def", "the_one", "(", "cls", ")", ":", "if", "cls", ".", "THE_ONE", "is", "None", ":", "cls", ".", "THE_ONE", "=", "cls", "(", "settings", ".", "HELP_TOKENS_INI_FILE", ")", "return", "cls", ".", "THE_ONE" ]
Get the single global HelpUrlExpert object.
[ "Get", "the", "single", "global", "HelpUrlExpert", "object", "." ]
b77d102bbf1e9c9e10d8a6300f4df87fe2263048
https://github.com/edx/help-tokens/blob/b77d102bbf1e9c9e10d8a6300f4df87fe2263048/help_tokens/core.py#L28-L32
train
55,918
edx/help-tokens
help_tokens/core.py
HelpUrlExpert.get_config_value
def get_config_value(self, section_name, option, default_option="default"): """ Read a value from the configuration, with a default. Args: section_name (str): name of the section in the configuration from which the option should be found. option (str): na...
python
def get_config_value(self, section_name, option, default_option="default"): """ Read a value from the configuration, with a default. Args: section_name (str): name of the section in the configuration from which the option should be found. option (str): na...
[ "def", "get_config_value", "(", "self", ",", "section_name", ",", "option", ",", "default_option", "=", "\"default\"", ")", ":", "if", "self", ".", "config", "is", "None", ":", "self", ".", "config", "=", "configparser", ".", "ConfigParser", "(", ")", "sel...
Read a value from the configuration, with a default. Args: section_name (str): name of the section in the configuration from which the option should be found. option (str): name of the configuration option. default_option (str): name of the default configurat...
[ "Read", "a", "value", "from", "the", "configuration", "with", "a", "default", "." ]
b77d102bbf1e9c9e10d8a6300f4df87fe2263048
https://github.com/edx/help-tokens/blob/b77d102bbf1e9c9e10d8a6300f4df87fe2263048/help_tokens/core.py#L34-L62
train
55,919
edx/help-tokens
help_tokens/core.py
HelpUrlExpert.url_for_token
def url_for_token(self, token): """Find the full URL for a help token.""" book_url = self.get_config_value("pages", token) book, _, url_tail = book_url.partition(':') book_base = settings.HELP_TOKENS_BOOKS[book] url = book_base lang = getattr(settings, "HELP_TOKENS_LANG...
python
def url_for_token(self, token): """Find the full URL for a help token.""" book_url = self.get_config_value("pages", token) book, _, url_tail = book_url.partition(':') book_base = settings.HELP_TOKENS_BOOKS[book] url = book_base lang = getattr(settings, "HELP_TOKENS_LANG...
[ "def", "url_for_token", "(", "self", ",", "token", ")", ":", "book_url", "=", "self", ".", "get_config_value", "(", "\"pages\"", ",", "token", ")", "book", ",", "_", ",", "url_tail", "=", "book_url", ".", "partition", "(", "':'", ")", "book_base", "=", ...
Find the full URL for a help token.
[ "Find", "the", "full", "URL", "for", "a", "help", "token", "." ]
b77d102bbf1e9c9e10d8a6300f4df87fe2263048
https://github.com/edx/help-tokens/blob/b77d102bbf1e9c9e10d8a6300f4df87fe2263048/help_tokens/core.py#L64-L82
train
55,920
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
multi_load_data_custom
def multi_load_data_custom(Channel, TraceTitle, RunNos, directoryPath='.', calcPSD=True, NPerSegmentPSD=1000000): """ Lets you load multiple datasets named with the LeCroy's custom naming scheme at once. Parameters ---------- Channel : int The channel you want to load TraceTitle : strin...
python
def multi_load_data_custom(Channel, TraceTitle, RunNos, directoryPath='.', calcPSD=True, NPerSegmentPSD=1000000): """ Lets you load multiple datasets named with the LeCroy's custom naming scheme at once. Parameters ---------- Channel : int The channel you want to load TraceTitle : strin...
[ "def", "multi_load_data_custom", "(", "Channel", ",", "TraceTitle", ",", "RunNos", ",", "directoryPath", "=", "'.'", ",", "calcPSD", "=", "True", ",", "NPerSegmentPSD", "=", "1000000", ")", ":", "# files = glob('{}/*'.format(directoryPath))", "# files_CorrectChann...
Lets you load multiple datasets named with the LeCroy's custom naming scheme at once. Parameters ---------- Channel : int The channel you want to load TraceTitle : string The custom trace title of the files. RunNos : sequence Sequence of run numbers you want to load Rep...
[ "Lets", "you", "load", "multiple", "datasets", "named", "with", "the", "LeCroy", "s", "custom", "naming", "scheme", "at", "once", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1514-L1559
train
55,921
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
search_data_custom
def search_data_custom(Channel, TraceTitle, RunNos, directoryPath='.'): """ Lets you create a list with full file paths of the files named with the LeCroy's custom naming scheme. Parameters ---------- Channel : int The channel you want to load TraceTitle : string The custom ...
python
def search_data_custom(Channel, TraceTitle, RunNos, directoryPath='.'): """ Lets you create a list with full file paths of the files named with the LeCroy's custom naming scheme. Parameters ---------- Channel : int The channel you want to load TraceTitle : string The custom ...
[ "def", "search_data_custom", "(", "Channel", ",", "TraceTitle", ",", "RunNos", ",", "directoryPath", "=", "'.'", ")", ":", "files", "=", "glob", "(", "'{}/*'", ".", "format", "(", "directoryPath", ")", ")", "files_CorrectChannel", "=", "[", "]", "for", "fi...
Lets you create a list with full file paths of the files named with the LeCroy's custom naming scheme. Parameters ---------- Channel : int The channel you want to load TraceTitle : string The custom trace title of the files. RunNos : sequence Sequence of run numbers you...
[ "Lets", "you", "create", "a", "list", "with", "full", "file", "paths", "of", "the", "files", "named", "with", "the", "LeCroy", "s", "custom", "naming", "scheme", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1561-L1598
train
55,922
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_temp
def calc_temp(Data_ref, Data): """ Calculates the temperature of a data set relative to a reference. The reference is assumed to be at 300K. Parameters ---------- Data_ref : DataObject Reference data set, assumed to be 300K Data : DataObject Data object to have the temperatu...
python
def calc_temp(Data_ref, Data): """ Calculates the temperature of a data set relative to a reference. The reference is assumed to be at 300K. Parameters ---------- Data_ref : DataObject Reference data set, assumed to be 300K Data : DataObject Data object to have the temperatu...
[ "def", "calc_temp", "(", "Data_ref", ",", "Data", ")", ":", "T", "=", "300", "*", "(", "(", "Data", ".", "A", "*", "Data_ref", ".", "Gamma", ")", "/", "(", "Data_ref", ".", "A", "*", "Data", ".", "Gamma", ")", ")", "Data", ".", "T", "=", "T",...
Calculates the temperature of a data set relative to a reference. The reference is assumed to be at 300K. Parameters ---------- Data_ref : DataObject Reference data set, assumed to be 300K Data : DataObject Data object to have the temperature calculated for Returns ------- ...
[ "Calculates", "the", "temperature", "of", "a", "data", "set", "relative", "to", "a", "reference", ".", "The", "reference", "is", "assumed", "to", "be", "at", "300K", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1601-L1620
train
55,923
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
fit_curvefit
def fit_curvefit(p0, datax, datay, function, **kwargs): """ Fits the data to a function using scipy.optimise.curve_fit Parameters ---------- p0 : array_like initial parameters to use for fitting datax : array_like x data to use for fitting datay : array_like y data t...
python
def fit_curvefit(p0, datax, datay, function, **kwargs): """ Fits the data to a function using scipy.optimise.curve_fit Parameters ---------- p0 : array_like initial parameters to use for fitting datax : array_like x data to use for fitting datay : array_like y data t...
[ "def", "fit_curvefit", "(", "p0", ",", "datax", ",", "datay", ",", "function", ",", "*", "*", "kwargs", ")", ":", "pfit", ",", "pcov", "=", "_curve_fit", "(", "function", ",", "datax", ",", "datay", ",", "p0", "=", "p0", ",", "epsfcn", "=", "0.0001...
Fits the data to a function using scipy.optimise.curve_fit Parameters ---------- p0 : array_like initial parameters to use for fitting datax : array_like x data to use for fitting datay : array_like y data to use for fitting function : function funcion to be fit ...
[ "Fits", "the", "data", "to", "a", "function", "using", "scipy", ".", "optimise", ".", "curve_fit" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1656-L1693
train
55,924
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
moving_average
def moving_average(array, n=3): """ Calculates the moving average of an array. Parameters ---------- array : array The array to have the moving average taken of n : int The number of points of moving average to take Returns ------- MovingAverageArray : array ...
python
def moving_average(array, n=3): """ Calculates the moving average of an array. Parameters ---------- array : array The array to have the moving average taken of n : int The number of points of moving average to take Returns ------- MovingAverageArray : array ...
[ "def", "moving_average", "(", "array", ",", "n", "=", "3", ")", ":", "ret", "=", "_np", ".", "cumsum", "(", "array", ",", "dtype", "=", "float", ")", "ret", "[", "n", ":", "]", "=", "ret", "[", "n", ":", "]", "-", "ret", "[", ":", "-", "n",...
Calculates the moving average of an array. Parameters ---------- array : array The array to have the moving average taken of n : int The number of points of moving average to take Returns ------- MovingAverageArray : array The n-point moving average of the input...
[ "Calculates", "the", "moving", "average", "of", "an", "array", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1696-L1714
train
55,925
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
fit_autocorrelation
def fit_autocorrelation(autocorrelation, time, GammaGuess, TrapFreqGuess=None, method='energy', MakeFig=True, show_fig=True): """ Fits exponential relaxation theory to data. Parameters ---------- autocorrelation : array array containing autocorrelation to be fitted time : array ...
python
def fit_autocorrelation(autocorrelation, time, GammaGuess, TrapFreqGuess=None, method='energy', MakeFig=True, show_fig=True): """ Fits exponential relaxation theory to data. Parameters ---------- autocorrelation : array array containing autocorrelation to be fitted time : array ...
[ "def", "fit_autocorrelation", "(", "autocorrelation", ",", "time", ",", "GammaGuess", ",", "TrapFreqGuess", "=", "None", ",", "method", "=", "'energy'", ",", "MakeFig", "=", "True", ",", "show_fig", "=", "True", ")", ":", "datax", "=", "time", "datay", "="...
Fits exponential relaxation theory to data. Parameters ---------- autocorrelation : array array containing autocorrelation to be fitted time : array array containing the time of each point the autocorrelation was evaluated GammaGuess : float The approximate Big Gamma...
[ "Fits", "exponential", "relaxation", "theory", "to", "data", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1794-L1880
train
55,926
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
IFFT_filter
def IFFT_filter(Signal, SampleFreq, lowerFreq, upperFreq, PyCUDA = False): """ Filters data using fft -> zeroing out fft bins -> ifft Parameters ---------- Signal : ndarray Signal to be filtered SampleFreq : float Sample frequency of signal lowerFreq : float Lower fr...
python
def IFFT_filter(Signal, SampleFreq, lowerFreq, upperFreq, PyCUDA = False): """ Filters data using fft -> zeroing out fft bins -> ifft Parameters ---------- Signal : ndarray Signal to be filtered SampleFreq : float Sample frequency of signal lowerFreq : float Lower fr...
[ "def", "IFFT_filter", "(", "Signal", ",", "SampleFreq", ",", "lowerFreq", ",", "upperFreq", ",", "PyCUDA", "=", "False", ")", ":", "if", "PyCUDA", "==", "True", ":", "Signalfft", "=", "calc_fft_with_PyCUDA", "(", "Signal", ")", "else", ":", "print", "(", ...
Filters data using fft -> zeroing out fft bins -> ifft Parameters ---------- Signal : ndarray Signal to be filtered SampleFreq : float Sample frequency of signal lowerFreq : float Lower frequency of bandpass to allow through filter upperFreq : float Upper frequenc...
[ "Filters", "data", "using", "fft", "-", ">", "zeroing", "out", "fft", "bins", "-", ">", "ifft" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2693-L2734
train
55,927
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_fft_with_PyCUDA
def calc_fft_with_PyCUDA(Signal): """ Calculates the FFT of the passed signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signal : ndarray Signal to be transformed into Fourier space Returns ------- Signalfft : ndarray Array containi...
python
def calc_fft_with_PyCUDA(Signal): """ Calculates the FFT of the passed signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signal : ndarray Signal to be transformed into Fourier space Returns ------- Signalfft : ndarray Array containi...
[ "def", "calc_fft_with_PyCUDA", "(", "Signal", ")", ":", "print", "(", "\"starting fft\"", ")", "Signal", "=", "Signal", ".", "astype", "(", "_np", ".", "float32", ")", "Signal_gpu", "=", "_gpuarray", ".", "to_gpu", "(", "Signal", ")", "Signalfft_gpu", "=", ...
Calculates the FFT of the passed signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signal : ndarray Signal to be transformed into Fourier space Returns ------- Signalfft : ndarray Array containing the signal's FFT
[ "Calculates", "the", "FFT", "of", "the", "passed", "signal", "by", "using", "the", "scikit", "-", "cuda", "libary", "which", "relies", "on", "PyCUDA" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2736-L2760
train
55,928
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_ifft_with_PyCUDA
def calc_ifft_with_PyCUDA(Signalfft): """ Calculates the inverse-FFT of the passed FFT-signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signalfft : ndarray FFT-Signal to be transformed into Real space Returns ------- Signal : ndarray ...
python
def calc_ifft_with_PyCUDA(Signalfft): """ Calculates the inverse-FFT of the passed FFT-signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signalfft : ndarray FFT-Signal to be transformed into Real space Returns ------- Signal : ndarray ...
[ "def", "calc_ifft_with_PyCUDA", "(", "Signalfft", ")", ":", "print", "(", "\"starting ifft\"", ")", "Signalfft", "=", "Signalfft", ".", "astype", "(", "_np", ".", "complex64", ")", "Signalfft_gpu", "=", "_gpuarray", ".", "to_gpu", "(", "Signalfft", "[", "0", ...
Calculates the inverse-FFT of the passed FFT-signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signalfft : ndarray FFT-Signal to be transformed into Real space Returns ------- Signal : ndarray Array containing the ifft signal
[ "Calculates", "the", "inverse", "-", "FFT", "of", "the", "passed", "FFT", "-", "signal", "by", "using", "the", "scikit", "-", "cuda", "libary", "which", "relies", "on", "PyCUDA" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2762-L2785
train
55,929
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
make_butterworth_b_a
def make_butterworth_b_a(lowcut, highcut, SampleFreq, order=5, btype='band'): """ Generates the b and a coefficients for a butterworth IIR filter. Parameters ---------- lowcut : float frequency of lower bandpass limit highcut : float frequency of higher bandpass limit Sample...
python
def make_butterworth_b_a(lowcut, highcut, SampleFreq, order=5, btype='band'): """ Generates the b and a coefficients for a butterworth IIR filter. Parameters ---------- lowcut : float frequency of lower bandpass limit highcut : float frequency of higher bandpass limit Sample...
[ "def", "make_butterworth_b_a", "(", "lowcut", ",", "highcut", ",", "SampleFreq", ",", "order", "=", "5", ",", "btype", "=", "'band'", ")", ":", "nyq", "=", "0.5", "*", "SampleFreq", "low", "=", "lowcut", "/", "nyq", "high", "=", "highcut", "/", "nyq", ...
Generates the b and a coefficients for a butterworth IIR filter. Parameters ---------- lowcut : float frequency of lower bandpass limit highcut : float frequency of higher bandpass limit SampleFreq : float Sample frequency of filter order : int, optional order of...
[ "Generates", "the", "b", "and", "a", "coefficients", "for", "a", "butterworth", "IIR", "filter", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2815-L2850
train
55,930
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
make_butterworth_bandpass_b_a
def make_butterworth_bandpass_b_a(CenterFreq, bandwidth, SampleFreq, order=5, btype='band'): """ Generates the b and a coefficients for a butterworth bandpass IIR filter. Parameters ---------- CenterFreq : float central frequency of bandpass bandwidth : float width of the bandpa...
python
def make_butterworth_bandpass_b_a(CenterFreq, bandwidth, SampleFreq, order=5, btype='band'): """ Generates the b and a coefficients for a butterworth bandpass IIR filter. Parameters ---------- CenterFreq : float central frequency of bandpass bandwidth : float width of the bandpa...
[ "def", "make_butterworth_bandpass_b_a", "(", "CenterFreq", ",", "bandwidth", ",", "SampleFreq", ",", "order", "=", "5", ",", "btype", "=", "'band'", ")", ":", "lowcut", "=", "CenterFreq", "-", "bandwidth", "/", "2", "highcut", "=", "CenterFreq", "+", "bandwi...
Generates the b and a coefficients for a butterworth bandpass IIR filter. Parameters ---------- CenterFreq : float central frequency of bandpass bandwidth : float width of the bandpass from centre to edge SampleFreq : float Sample frequency of filter order : int, optiona...
[ "Generates", "the", "b", "and", "a", "coefficients", "for", "a", "butterworth", "bandpass", "IIR", "filter", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2851-L2878
train
55,931
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
get_freq_response
def get_freq_response(a, b, show_fig=True, SampleFreq=(2 * pi), NumOfFreqs=500, whole=False): """ This function takes an array of coefficients and finds the frequency response of the filter using scipy.signal.freqz. show_fig sets if the response should be plotted Parameters ---------- b : a...
python
def get_freq_response(a, b, show_fig=True, SampleFreq=(2 * pi), NumOfFreqs=500, whole=False): """ This function takes an array of coefficients and finds the frequency response of the filter using scipy.signal.freqz. show_fig sets if the response should be plotted Parameters ---------- b : a...
[ "def", "get_freq_response", "(", "a", ",", "b", ",", "show_fig", "=", "True", ",", "SampleFreq", "=", "(", "2", "*", "pi", ")", ",", "NumOfFreqs", "=", "500", ",", "whole", "=", "False", ")", ":", "w", ",", "h", "=", "scipy", ".", "signal", ".", ...
This function takes an array of coefficients and finds the frequency response of the filter using scipy.signal.freqz. show_fig sets if the response should be plotted Parameters ---------- b : array_like Coefficients multiplying the x values (inputs of the filter) a : array_like ...
[ "This", "function", "takes", "an", "array", "of", "coefficients", "and", "finds", "the", "frequency", "response", "of", "the", "filter", "using", "scipy", ".", "signal", ".", "freqz", ".", "show_fig", "sets", "if", "the", "response", "should", "be", "plotted...
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2926-L3002
train
55,932
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
multi_plot_PSD
def multi_plot_PSD(DataArray, xlim=[0, 500], units="kHz", LabelArray=[], ColorArray=[], alphaArray=[], show_fig=True): """ plot the pulse spectral density for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plo...
python
def multi_plot_PSD(DataArray, xlim=[0, 500], units="kHz", LabelArray=[], ColorArray=[], alphaArray=[], show_fig=True): """ plot the pulse spectral density for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plo...
[ "def", "multi_plot_PSD", "(", "DataArray", ",", "xlim", "=", "[", "0", ",", "500", "]", ",", "units", "=", "\"kHz\"", ",", "LabelArray", "=", "[", "]", ",", "ColorArray", "=", "[", "]", ",", "alphaArray", "=", "[", "]", ",", "show_fig", "=", "True"...
plot the pulse spectral density for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs xlim : array-like, optional 2 element array specifying the lower and upper x limit for which to plot...
[ "plot", "the", "pulse", "spectral", "density", "for", "multiple", "data", "sets", "on", "the", "same", "axes", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3005-L3071
train
55,933
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
multi_plot_time
def multi_plot_time(DataArray, SubSampleN=1, units='s', xlim=None, ylim=None, LabelArray=[], show_fig=True): """ plot the time trace for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN ...
python
def multi_plot_time(DataArray, SubSampleN=1, units='s', xlim=None, ylim=None, LabelArray=[], show_fig=True): """ plot the time trace for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN ...
[ "def", "multi_plot_time", "(", "DataArray", ",", "SubSampleN", "=", "1", ",", "units", "=", "'s'", ",", "xlim", "=", "None", ",", "ylim", "=", "None", ",", "LabelArray", "=", "[", "]", ",", "show_fig", "=", "True", ")", ":", "unit_prefix", "=", "unit...
plot the time trace for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN : int, optional Number of intervals between points to remove (to sub-sample data so that you effectively ...
[ "plot", "the", "time", "trace", "for", "multiple", "data", "sets", "on", "the", "same", "axes", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3074-L3127
train
55,934
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
multi_subplots_time
def multi_subplots_time(DataArray, SubSampleN=1, units='s', xlim=None, ylim=None, LabelArray=[], show_fig=True): """ plot the time trace on multiple axes Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN : int, optional ...
python
def multi_subplots_time(DataArray, SubSampleN=1, units='s', xlim=None, ylim=None, LabelArray=[], show_fig=True): """ plot the time trace on multiple axes Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN : int, optional ...
[ "def", "multi_subplots_time", "(", "DataArray", ",", "SubSampleN", "=", "1", ",", "units", "=", "'s'", ",", "xlim", "=", "None", ",", "ylim", "=", "None", ",", "LabelArray", "=", "[", "]", ",", "show_fig", "=", "True", ")", ":", "unit_prefix", "=", "...
plot the time trace on multiple axes Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN : int, optional Number of intervals between points to remove (to sub-sample data so that you effectively have lower sample rate t...
[ "plot", "the", "time", "trace", "on", "multiple", "axes" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3130-L3181
train
55,935
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_autocorrelation
def calc_autocorrelation(Signal, FFT=False, PyCUDA=False): """ Calculates the autocorrelation from a given Signal via using Parameters ---------- Signal : array-like Array containing the signal to have the autocorrelation calculated for FFT : optional, bool Uses FFT to acce...
python
def calc_autocorrelation(Signal, FFT=False, PyCUDA=False): """ Calculates the autocorrelation from a given Signal via using Parameters ---------- Signal : array-like Array containing the signal to have the autocorrelation calculated for FFT : optional, bool Uses FFT to acce...
[ "def", "calc_autocorrelation", "(", "Signal", ",", "FFT", "=", "False", ",", "PyCUDA", "=", "False", ")", ":", "if", "FFT", "==", "True", ":", "Signal_padded", "=", "scipy", ".", "fftpack", ".", "ifftshift", "(", "(", "Signal", "-", "_np", ".", "averag...
Calculates the autocorrelation from a given Signal via using Parameters ---------- Signal : array-like Array containing the signal to have the autocorrelation calculated for FFT : optional, bool Uses FFT to accelerate autocorrelation calculation, but assumes certain certain...
[ "Calculates", "the", "autocorrelation", "from", "a", "given", "Signal", "via", "using" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3267-L3309
train
55,936
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
_GetRealImagArray
def _GetRealImagArray(Array): """ Returns the real and imaginary components of each element in an array and returns them in 2 resulting arrays. Parameters ---------- Array : ndarray Input array Returns ------- RealArray : ndarray The real components of the input array ...
python
def _GetRealImagArray(Array): """ Returns the real and imaginary components of each element in an array and returns them in 2 resulting arrays. Parameters ---------- Array : ndarray Input array Returns ------- RealArray : ndarray The real components of the input array ...
[ "def", "_GetRealImagArray", "(", "Array", ")", ":", "ImagArray", "=", "_np", ".", "array", "(", "[", "num", ".", "imag", "for", "num", "in", "Array", "]", ")", "RealArray", "=", "_np", ".", "array", "(", "[", "num", ".", "real", "for", "num", "in",...
Returns the real and imaginary components of each element in an array and returns them in 2 resulting arrays. Parameters ---------- Array : ndarray Input array Returns ------- RealArray : ndarray The real components of the input array ImagArray : ndarray The imagina...
[ "Returns", "the", "real", "and", "imaginary", "components", "of", "each", "element", "in", "an", "array", "and", "returns", "them", "in", "2", "resulting", "arrays", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3311-L3329
train
55,937
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
_GetComplexConjugateArray
def _GetComplexConjugateArray(Array): """ Calculates the complex conjugate of each element in an array and returns the resulting array. Parameters ---------- Array : ndarray Input array Returns ------- ConjArray : ndarray The complex conjugate of the input array. ""...
python
def _GetComplexConjugateArray(Array): """ Calculates the complex conjugate of each element in an array and returns the resulting array. Parameters ---------- Array : ndarray Input array Returns ------- ConjArray : ndarray The complex conjugate of the input array. ""...
[ "def", "_GetComplexConjugateArray", "(", "Array", ")", ":", "ConjArray", "=", "_np", ".", "array", "(", "[", "num", ".", "conj", "(", ")", "for", "num", "in", "Array", "]", ")", "return", "ConjArray" ]
Calculates the complex conjugate of each element in an array and returns the resulting array. Parameters ---------- Array : ndarray Input array Returns ------- ConjArray : ndarray The complex conjugate of the input array.
[ "Calculates", "the", "complex", "conjugate", "of", "each", "element", "in", "an", "array", "and", "returns", "the", "resulting", "array", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3332-L3347
train
55,938
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
fm_discriminator
def fm_discriminator(Signal): """ Calculates the digital FM discriminator from a real-valued time signal. Parameters ---------- Signal : array-like A real-valued time signal Returns ------- fmDiscriminator : array-like The digital FM discriminator of the argument signal...
python
def fm_discriminator(Signal): """ Calculates the digital FM discriminator from a real-valued time signal. Parameters ---------- Signal : array-like A real-valued time signal Returns ------- fmDiscriminator : array-like The digital FM discriminator of the argument signal...
[ "def", "fm_discriminator", "(", "Signal", ")", ":", "S_analytic", "=", "_hilbert", "(", "Signal", ")", "S_analytic_star", "=", "_GetComplexConjugateArray", "(", "S_analytic", ")", "S_analytic_hat", "=", "S_analytic", "[", "1", ":", "]", "*", "S_analytic_star", "...
Calculates the digital FM discriminator from a real-valued time signal. Parameters ---------- Signal : array-like A real-valued time signal Returns ------- fmDiscriminator : array-like The digital FM discriminator of the argument signal
[ "Calculates", "the", "digital", "FM", "discriminator", "from", "a", "real", "-", "valued", "time", "signal", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3350-L3369
train
55,939
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
find_collisions
def find_collisions(Signal, tolerance=50): """ Finds collision events in the signal from the shift in phase of the signal. Parameters ---------- Signal : array_like Array containing the values of the signal of interest containing a single frequency. tolerance : float Percentage ...
python
def find_collisions(Signal, tolerance=50): """ Finds collision events in the signal from the shift in phase of the signal. Parameters ---------- Signal : array_like Array containing the values of the signal of interest containing a single frequency. tolerance : float Percentage ...
[ "def", "find_collisions", "(", "Signal", ",", "tolerance", "=", "50", ")", ":", "fmd", "=", "fm_discriminator", "(", "Signal", ")", "mean_fmd", "=", "_np", ".", "mean", "(", "fmd", ")", "Collisions", "=", "[", "_is_this_a_collision", "(", "[", "value", "...
Finds collision events in the signal from the shift in phase of the signal. Parameters ---------- Signal : array_like Array containing the values of the signal of interest containing a single frequency. tolerance : float Percentage tolerance, if the value of the FM Discriminator varies ...
[ "Finds", "collision", "events", "in", "the", "signal", "from", "the", "shift", "in", "phase", "of", "the", "signal", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3416-L3439
train
55,940
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
count_collisions
def count_collisions(Collisions): """ Counts the number of unique collisions and gets the collision index. Parameters ---------- Collisions : array_like Array of booleans, containing true if during a collision event, false otherwise. Returns ------- CollisionCount : int ...
python
def count_collisions(Collisions): """ Counts the number of unique collisions and gets the collision index. Parameters ---------- Collisions : array_like Array of booleans, containing true if during a collision event, false otherwise. Returns ------- CollisionCount : int ...
[ "def", "count_collisions", "(", "Collisions", ")", ":", "CollisionCount", "=", "0", "CollisionIndicies", "=", "[", "]", "lastval", "=", "True", "for", "i", ",", "val", "in", "enumerate", "(", "Collisions", ")", ":", "if", "val", "==", "True", "and", "las...
Counts the number of unique collisions and gets the collision index. Parameters ---------- Collisions : array_like Array of booleans, containing true if during a collision event, false otherwise. Returns ------- CollisionCount : int Number of unique collisions CollisionIndi...
[ "Counts", "the", "number", "of", "unique", "collisions", "and", "gets", "the", "collision", "index", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3442-L3466
train
55,941
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
steady_state_potential
def steady_state_potential(xdata,HistBins=100): """ Calculates the steady state potential. Used in fit_radius_from_potentials. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. N...
python
def steady_state_potential(xdata,HistBins=100): """ Calculates the steady state potential. Used in fit_radius_from_potentials. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. N...
[ "def", "steady_state_potential", "(", "xdata", ",", "HistBins", "=", "100", ")", ":", "import", "numpy", "as", "_np", "pops", "=", "_np", ".", "histogram", "(", "xdata", ",", "HistBins", ")", "[", "0", "]", "bins", "=", "_np", ".", "histogram", "(", ...
Calculates the steady state potential. Used in fit_radius_from_potentials. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. Number of position points at which the potential is ca...
[ "Calculates", "the", "steady", "state", "potential", ".", "Used", "in", "fit_radius_from_potentials", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3693-L3726
train
55,942
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_z0_and_conv_factor_from_ratio_of_harmonics
def calc_z0_and_conv_factor_from_ratio_of_harmonics(z, z2, NA=0.999): """ Calculates the Conversion Factor and physical amplitude of motion in nms by comparison of the ratio of the heights of the z signal and second harmonic of z. Parameters ---------- z : ndarray array containing...
python
def calc_z0_and_conv_factor_from_ratio_of_harmonics(z, z2, NA=0.999): """ Calculates the Conversion Factor and physical amplitude of motion in nms by comparison of the ratio of the heights of the z signal and second harmonic of z. Parameters ---------- z : ndarray array containing...
[ "def", "calc_z0_and_conv_factor_from_ratio_of_harmonics", "(", "z", ",", "z2", ",", "NA", "=", "0.999", ")", ":", "V1", "=", "calc_mean_amp", "(", "z", ")", "V2", "=", "calc_mean_amp", "(", "z2", ")", "ratio", "=", "V2", "/", "V1", "beta", "=", "4", "*...
Calculates the Conversion Factor and physical amplitude of motion in nms by comparison of the ratio of the heights of the z signal and second harmonic of z. Parameters ---------- z : ndarray array containing z signal in volts z2 : ndarray array containing second harmonic of z ...
[ "Calculates", "the", "Conversion", "Factor", "and", "physical", "amplitude", "of", "motion", "in", "nms", "by", "comparison", "of", "the", "ratio", "of", "the", "heights", "of", "the", "z", "signal", "and", "second", "harmonic", "of", "z", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3909-L3942
train
55,943
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_mass_from_z0
def calc_mass_from_z0(z0, w0): """ Calculates the mass of the particle using the equipartition from the angular frequency of the z signal and the average amplitude of the z signal in nms. Parameters ---------- z0 : float Physical average amplitude of motion in nms w0 : float ...
python
def calc_mass_from_z0(z0, w0): """ Calculates the mass of the particle using the equipartition from the angular frequency of the z signal and the average amplitude of the z signal in nms. Parameters ---------- z0 : float Physical average amplitude of motion in nms w0 : float ...
[ "def", "calc_mass_from_z0", "(", "z0", ",", "w0", ")", ":", "T0", "=", "300", "mFromEquipartition", "=", "Boltzmann", "*", "T0", "/", "(", "w0", "**", "2", "*", "z0", "**", "2", ")", "return", "mFromEquipartition" ]
Calculates the mass of the particle using the equipartition from the angular frequency of the z signal and the average amplitude of the z signal in nms. Parameters ---------- z0 : float Physical average amplitude of motion in nms w0 : float Angular Frequency of z motion Ret...
[ "Calculates", "the", "mass", "of", "the", "particle", "using", "the", "equipartition", "from", "the", "angular", "frequency", "of", "the", "z", "signal", "and", "the", "average", "amplitude", "of", "the", "z", "signal", "in", "nms", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3944-L3964
train
55,944
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_mass_from_fit_and_conv_factor
def calc_mass_from_fit_and_conv_factor(A, Damping, ConvFactor): """ Calculates mass from the A parameter from fitting, the damping from fitting in angular units and the Conversion factor calculated from comparing the ratio of the z signal and first harmonic of z. Parameters ---------- A :...
python
def calc_mass_from_fit_and_conv_factor(A, Damping, ConvFactor): """ Calculates mass from the A parameter from fitting, the damping from fitting in angular units and the Conversion factor calculated from comparing the ratio of the z signal and first harmonic of z. Parameters ---------- A :...
[ "def", "calc_mass_from_fit_and_conv_factor", "(", "A", ",", "Damping", ",", "ConvFactor", ")", ":", "T0", "=", "300", "mFromA", "=", "2", "*", "Boltzmann", "*", "T0", "/", "(", "pi", "*", "A", ")", "*", "ConvFactor", "**", "2", "*", "Damping", "return"...
Calculates mass from the A parameter from fitting, the damping from fitting in angular units and the Conversion factor calculated from comparing the ratio of the z signal and first harmonic of z. Parameters ---------- A : float A factor calculated from fitting Damping : float ...
[ "Calculates", "mass", "from", "the", "A", "parameter", "from", "fitting", "the", "damping", "from", "fitting", "in", "angular", "units", "and", "the", "Conversion", "factor", "calculated", "from", "comparing", "the", "ratio", "of", "the", "z", "signal", "and",...
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3966-L3988
train
55,945
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
unit_conversion
def unit_conversion(array, unit_prefix, current_prefix=""): """ Converts an array or value to of a certain unit scale to another unit scale. Accepted units are: E - exa - 1e18 P - peta - 1e15 T - tera - 1e12 G - giga - 1e9 M - mega - 1e6 k - kilo - 1e3 m - milli - 1e-3 ...
python
def unit_conversion(array, unit_prefix, current_prefix=""): """ Converts an array or value to of a certain unit scale to another unit scale. Accepted units are: E - exa - 1e18 P - peta - 1e15 T - tera - 1e12 G - giga - 1e9 M - mega - 1e6 k - kilo - 1e3 m - milli - 1e-3 ...
[ "def", "unit_conversion", "(", "array", ",", "unit_prefix", ",", "current_prefix", "=", "\"\"", ")", ":", "UnitDict", "=", "{", "'E'", ":", "1e18", ",", "'P'", ":", "1e15", ",", "'T'", ":", "1e12", ",", "'G'", ":", "1e9", ",", "'M'", ":", "1e6", ",...
Converts an array or value to of a certain unit scale to another unit scale. Accepted units are: E - exa - 1e18 P - peta - 1e15 T - tera - 1e12 G - giga - 1e9 M - mega - 1e6 k - kilo - 1e3 m - milli - 1e-3 u - micro - 1e-6 n - nano - 1e-9 p - pico - 1e-12 f - femto ...
[ "Converts", "an", "array", "or", "value", "to", "of", "a", "certain", "unit", "scale", "to", "another", "unit", "scale", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L4062-L4121
train
55,946
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
get_wigner
def get_wigner(z, freq, sample_freq, histbins=200, show_plot=False): """ Calculates an approximation to the wigner quasi-probability distribution by splitting the z position array into slices of the length of one period of the motion. This slice is then associated with phase from -180 to 180 degrees...
python
def get_wigner(z, freq, sample_freq, histbins=200, show_plot=False): """ Calculates an approximation to the wigner quasi-probability distribution by splitting the z position array into slices of the length of one period of the motion. This slice is then associated with phase from -180 to 180 degrees...
[ "def", "get_wigner", "(", "z", ",", "freq", ",", "sample_freq", ",", "histbins", "=", "200", ",", "show_plot", "=", "False", ")", ":", "phase", ",", "phase_slices", "=", "extract_slices", "(", "z", ",", "freq", ",", "sample_freq", ",", "show_plot", "=", ...
Calculates an approximation to the wigner quasi-probability distribution by splitting the z position array into slices of the length of one period of the motion. This slice is then associated with phase from -180 to 180 degrees. These slices are then histogramed in order to get a distribution of counts ...
[ "Calculates", "an", "approximation", "to", "the", "wigner", "quasi", "-", "probability", "distribution", "by", "splitting", "the", "z", "position", "array", "into", "slices", "of", "the", "length", "of", "one", "period", "of", "the", "motion", ".", "This", "...
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L4233-L4278
train
55,947
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
plot_wigner3d
def plot_wigner3d(iradon_output, bin_centres, bin_centre_units="", cmap=_cm.cubehelix_r, view=(10, -45), figsize=(10, 10)): """ Plots the wigner space representation as a 3D surface plot. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ...
python
def plot_wigner3d(iradon_output, bin_centres, bin_centre_units="", cmap=_cm.cubehelix_r, view=(10, -45), figsize=(10, 10)): """ Plots the wigner space representation as a 3D surface plot. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ...
[ "def", "plot_wigner3d", "(", "iradon_output", ",", "bin_centres", ",", "bin_centre_units", "=", "\"\"", ",", "cmap", "=", "_cm", ".", "cubehelix_r", ",", "view", "=", "(", "10", ",", "-", "45", ")", ",", "figsize", "=", "(", "10", ",", "10", ")", ")"...
Plots the wigner space representation as a 3D surface plot. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ndarray positions of the bin centres bin_centre_units : string, optional (default="") Units in which the bin_centres...
[ "Plots", "the", "wigner", "space", "representation", "as", "a", "3D", "surface", "plot", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L4280-L4340
train
55,948
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
plot_wigner2d
def plot_wigner2d(iradon_output, bin_centres, cmap=_cm.cubehelix_r, figsize=(6, 6)): """ Plots the wigner space representation as a 2D heatmap. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ndarray positions of the bin centres...
python
def plot_wigner2d(iradon_output, bin_centres, cmap=_cm.cubehelix_r, figsize=(6, 6)): """ Plots the wigner space representation as a 2D heatmap. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ndarray positions of the bin centres...
[ "def", "plot_wigner2d", "(", "iradon_output", ",", "bin_centres", ",", "cmap", "=", "_cm", ".", "cubehelix_r", ",", "figsize", "=", "(", "6", ",", "6", ")", ")", ":", "xx", ",", "yy", "=", "_np", ".", "meshgrid", "(", "bin_centres", ",", "bin_centres",...
Plots the wigner space representation as a 2D heatmap. Parameters ---------- iradon_output : ndarray 2d array of size (histbins x histbins) bin_centres : ndarray positions of the bin centres cmap : matplotlib.cm.cmap, optional (default=cm.cubehelix_r) color map to use for Wi...
[ "Plots", "the", "wigner", "space", "representation", "as", "a", "2D", "heatmap", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L4343-L4412
train
55,949
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.get_time_data
def get_time_data(self, timeStart=None, timeEnd=None): """ Gets the time and voltage data. Parameters ---------- timeStart : float, optional The time get data from. By default it uses the first time point timeEnd : float, optional The ...
python
def get_time_data(self, timeStart=None, timeEnd=None): """ Gets the time and voltage data. Parameters ---------- timeStart : float, optional The time get data from. By default it uses the first time point timeEnd : float, optional The ...
[ "def", "get_time_data", "(", "self", ",", "timeStart", "=", "None", ",", "timeEnd", "=", "None", ")", ":", "if", "timeStart", "==", "None", ":", "timeStart", "=", "self", ".", "timeStart", "if", "timeEnd", "==", "None", ":", "timeEnd", "=", "self", "."...
Gets the time and voltage data. Parameters ---------- timeStart : float, optional The time get data from. By default it uses the first time point timeEnd : float, optional The time to finish getting data from. By default it uses the last t...
[ "Gets", "the", "time", "and", "voltage", "data", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L248-L283
train
55,950
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.plot_time_data
def plot_time_data(self, timeStart=None, timeEnd=None, units='s', show_fig=True): """ plot time data against voltage data. Parameters ---------- timeStart : float, optional The time to start plotting from. By default it uses the first time point t...
python
def plot_time_data(self, timeStart=None, timeEnd=None, units='s', show_fig=True): """ plot time data against voltage data. Parameters ---------- timeStart : float, optional The time to start plotting from. By default it uses the first time point t...
[ "def", "plot_time_data", "(", "self", ",", "timeStart", "=", "None", ",", "timeEnd", "=", "None", ",", "units", "=", "'s'", ",", "show_fig", "=", "True", ")", ":", "unit_prefix", "=", "units", "[", ":", "-", "1", "]", "# removed the last char", "if", "...
plot time data against voltage data. Parameters ---------- timeStart : float, optional The time to start plotting from. By default it uses the first time point timeEnd : float, optional The time to finish plotting at. By default it uses th...
[ "plot", "time", "data", "against", "voltage", "data", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L285-L331
train
55,951
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.plot_PSD
def plot_PSD(self, xlim=None, units="kHz", show_fig=True, timeStart=None, timeEnd=None, *args, **kwargs): """ plot the pulse spectral density. Parameters ---------- xlim : array_like, optional The x limits of the plotted PSD [LowerLimit, UpperLimit] Defau...
python
def plot_PSD(self, xlim=None, units="kHz", show_fig=True, timeStart=None, timeEnd=None, *args, **kwargs): """ plot the pulse spectral density. Parameters ---------- xlim : array_like, optional The x limits of the plotted PSD [LowerLimit, UpperLimit] Defau...
[ "def", "plot_PSD", "(", "self", ",", "xlim", "=", "None", ",", "units", "=", "\"kHz\"", ",", "show_fig", "=", "True", ",", "timeStart", "=", "None", ",", "timeEnd", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# self.get_...
plot the pulse spectral density. Parameters ---------- xlim : array_like, optional The x limits of the plotted PSD [LowerLimit, UpperLimit] Default value is [0, SampleFreq/2] units : string, optional Units of frequency to plot on the x axis - defaults...
[ "plot", "the", "pulse", "spectral", "density", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L383-L425
train
55,952
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.calc_area_under_PSD
def calc_area_under_PSD(self, lowerFreq, upperFreq): """ Sums the area under the PSD from lowerFreq to upperFreq. Parameters ---------- lowerFreq : float The lower limit of frequency to sum from upperFreq : float The upper limit of frequency to su...
python
def calc_area_under_PSD(self, lowerFreq, upperFreq): """ Sums the area under the PSD from lowerFreq to upperFreq. Parameters ---------- lowerFreq : float The lower limit of frequency to sum from upperFreq : float The upper limit of frequency to su...
[ "def", "calc_area_under_PSD", "(", "self", ",", "lowerFreq", ",", "upperFreq", ")", ":", "Freq_startAreaPSD", "=", "take_closest", "(", "self", ".", "freqs", ",", "lowerFreq", ")", "index_startAreaPSD", "=", "int", "(", "_np", ".", "where", "(", "self", ".",...
Sums the area under the PSD from lowerFreq to upperFreq. Parameters ---------- lowerFreq : float The lower limit of frequency to sum from upperFreq : float The upper limit of frequency to sum to Returns ------- AreaUnderPSD : float ...
[ "Sums", "the", "area", "under", "the", "PSD", "from", "lowerFreq", "to", "upperFreq", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L427-L448
train
55,953
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.get_fit_auto
def get_fit_auto(self, CentralFreq, MaxWidth=15000, MinWidth=500, WidthIntervals=500, MakeFig=True, show_fig=True, silent=False): """ Tries a range of regions to search for peaks and runs the one with the least error and returns the parameters with the least errors. Parameters -...
python
def get_fit_auto(self, CentralFreq, MaxWidth=15000, MinWidth=500, WidthIntervals=500, MakeFig=True, show_fig=True, silent=False): """ Tries a range of regions to search for peaks and runs the one with the least error and returns the parameters with the least errors. Parameters -...
[ "def", "get_fit_auto", "(", "self", ",", "CentralFreq", ",", "MaxWidth", "=", "15000", ",", "MinWidth", "=", "500", ",", "WidthIntervals", "=", "500", ",", "MakeFig", "=", "True", ",", "show_fig", "=", "True", ",", "silent", "=", "False", ")", ":", "Mi...
Tries a range of regions to search for peaks and runs the one with the least error and returns the parameters with the least errors. Parameters ---------- CentralFreq : float The central frequency to use for the fittings. MaxWidth : float, optional The ma...
[ "Tries", "a", "range", "of", "regions", "to", "search", "for", "peaks", "and", "runs", "the", "one", "with", "the", "least", "error", "and", "returns", "the", "parameters", "with", "the", "least", "errors", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L627-L699
train
55,954
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.calc_gamma_from_variance_autocorrelation_fit
def calc_gamma_from_variance_autocorrelation_fit(self, NumberOfOscillations, GammaGuess=None, silent=False, MakeFig=True, show_fig=True): """ Calculates the total damping, i.e. Gamma, by splitting the time trace into chunks of NumberOfOscillations oscillations and calculated the variance...
python
def calc_gamma_from_variance_autocorrelation_fit(self, NumberOfOscillations, GammaGuess=None, silent=False, MakeFig=True, show_fig=True): """ Calculates the total damping, i.e. Gamma, by splitting the time trace into chunks of NumberOfOscillations oscillations and calculated the variance...
[ "def", "calc_gamma_from_variance_autocorrelation_fit", "(", "self", ",", "NumberOfOscillations", ",", "GammaGuess", "=", "None", ",", "silent", "=", "False", ",", "MakeFig", "=", "True", ",", "show_fig", "=", "True", ")", ":", "try", ":", "SplittedArraySize", "=...
Calculates the total damping, i.e. Gamma, by splitting the time trace into chunks of NumberOfOscillations oscillations and calculated the variance of each of these chunks. This array of varainces is then used for the autocorrleation. The autocorrelation is fitted with an exponential rel...
[ "Calculates", "the", "total", "damping", "i", ".", "e", ".", "Gamma", "by", "splitting", "the", "time", "trace", "into", "chunks", "of", "NumberOfOscillations", "oscillations", "and", "calculated", "the", "variance", "of", "each", "of", "these", "chunks", ".",...
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L701-L768
train
55,955
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.calc_gamma_from_energy_autocorrelation_fit
def calc_gamma_from_energy_autocorrelation_fit(self, GammaGuess=None, silent=False, MakeFig=True, show_fig=True): """ Calculates the total damping, i.e. Gamma, by calculating the energy each point in time. This energy array is then used for the autocorrleation. The autocorrelation is f...
python
def calc_gamma_from_energy_autocorrelation_fit(self, GammaGuess=None, silent=False, MakeFig=True, show_fig=True): """ Calculates the total damping, i.e. Gamma, by calculating the energy each point in time. This energy array is then used for the autocorrleation. The autocorrelation is f...
[ "def", "calc_gamma_from_energy_autocorrelation_fit", "(", "self", ",", "GammaGuess", "=", "None", ",", "silent", "=", "False", ",", "MakeFig", "=", "True", ",", "show_fig", "=", "True", ")", ":", "autocorrelation", "=", "calc_autocorrelation", "(", "self", ".", ...
Calculates the total damping, i.e. Gamma, by calculating the energy each point in time. This energy array is then used for the autocorrleation. The autocorrelation is fitted with an exponential relaxation function and the function returns the parameters with errors. Parameters ...
[ "Calculates", "the", "total", "damping", "i", ".", "e", ".", "Gamma", "by", "calculating", "the", "energy", "each", "point", "in", "time", ".", "This", "energy", "array", "is", "then", "used", "for", "the", "autocorrleation", ".", "The", "autocorrelation", ...
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L770-L827
train
55,956
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
DataObject.extract_parameters
def extract_parameters(self, P_mbar, P_Error, method="chang"): """ Extracts the Radius, mass and Conversion factor for a particle. Parameters ---------- P_mbar : float The pressure in mbar when the data was taken. P_Error : float The error in the...
python
def extract_parameters(self, P_mbar, P_Error, method="chang"): """ Extracts the Radius, mass and Conversion factor for a particle. Parameters ---------- P_mbar : float The pressure in mbar when the data was taken. P_Error : float The error in the...
[ "def", "extract_parameters", "(", "self", ",", "P_mbar", ",", "P_Error", ",", "method", "=", "\"chang\"", ")", ":", "[", "R", ",", "M", ",", "ConvFactor", "]", ",", "[", "RErr", ",", "MErr", ",", "ConvFactorErr", "]", "=", "extract_parameters", "(", "P...
Extracts the Radius, mass and Conversion factor for a particle. Parameters ---------- P_mbar : float The pressure in mbar when the data was taken. P_Error : float The error in the pressure value (as a decimal e.g. 15% = 0.15) Returns ---...
[ "Extracts", "the", "Radius", "mass", "and", "Conversion", "factor", "for", "a", "particle", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L900-L931
train
55,957
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
ORGTableData.get_value
def get_value(self, ColumnName, RunNo): """ Retreives the value of the collumn named ColumnName associated with a particular run number. Parameters ---------- ColumnName : string The name of the desired org-mode table's collumn RunNo : int ...
python
def get_value(self, ColumnName, RunNo): """ Retreives the value of the collumn named ColumnName associated with a particular run number. Parameters ---------- ColumnName : string The name of the desired org-mode table's collumn RunNo : int ...
[ "def", "get_value", "(", "self", ",", "ColumnName", ",", "RunNo", ")", ":", "Value", "=", "float", "(", "self", ".", "ORGTableData", "[", "self", ".", "ORGTableData", ".", "RunNo", "==", "'{}'", ".", "format", "(", "RunNo", ")", "]", "[", "ColumnName",...
Retreives the value of the collumn named ColumnName associated with a particular run number. Parameters ---------- ColumnName : string The name of the desired org-mode table's collumn RunNo : int The run number for which to retreive the pressure value ...
[ "Retreives", "the", "value", "of", "the", "collumn", "named", "ColumnName", "associated", "with", "a", "particular", "run", "number", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1327-L1348
train
55,958
AshleySetter/optoanalysis
PotentialComparisonMass.py
steady_state_potential
def steady_state_potential(xdata,HistBins=100): """ Calculates the steady state potential. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. Number of position points at which...
python
def steady_state_potential(xdata,HistBins=100): """ Calculates the steady state potential. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. Number of position points at which...
[ "def", "steady_state_potential", "(", "xdata", ",", "HistBins", "=", "100", ")", ":", "import", "numpy", "as", "np", "pops", "=", "np", ".", "histogram", "(", "xdata", ",", "HistBins", ")", "[", "0", "]", "bins", "=", "np", ".", "histogram", "(", "xd...
Calculates the steady state potential. Parameters ---------- xdata : ndarray Position data for a degree of freedom HistBins : int Number of bins to use for histogram of xdata. Number of position points at which the potential is calculated. Returns ------- po...
[ "Calculates", "the", "steady", "state", "potential", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/PotentialComparisonMass.py#L5-L37
train
55,959
MacHu-GWU/crawlib-project
crawlib/pipeline/mongodb/query_builder.py
finished
def finished(finished_status, update_interval, status_key, edit_at_key): """ Create dict query for pymongo that getting all finished task. :param finished_status: int, status code that greater or equal than this will be considered as finished. :param updat...
python
def finished(finished_status, update_interval, status_key, edit_at_key): """ Create dict query for pymongo that getting all finished task. :param finished_status: int, status code that greater or equal than this will be considered as finished. :param updat...
[ "def", "finished", "(", "finished_status", ",", "update_interval", ",", "status_key", ",", "edit_at_key", ")", ":", "return", "{", "status_key", ":", "{", "\"$gte\"", ":", "finished_status", "}", ",", "edit_at_key", ":", "{", "\"$gte\"", ":", "x_seconds_before_n...
Create dict query for pymongo that getting all finished task. :param finished_status: int, status code that greater or equal than this will be considered as finished. :param update_interval: int, the record will be updated every x seconds. :param status_key: status code field key, support dot notat...
[ "Create", "dict", "query", "for", "pymongo", "that", "getting", "all", "finished", "task", "." ]
241516f2a7a0a32c692f7af35a1f44064e8ce1ab
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/pipeline/mongodb/query_builder.py#L18-L42
train
55,960
MacHu-GWU/crawlib-project
crawlib/pipeline/mongodb/query_builder.py
unfinished
def unfinished(finished_status, update_interval, status_key, edit_at_key): """ Create dict query for pymongo that getting all unfinished task. :param finished_status: int, status code that less than this will be considered as unfinished. :param updat...
python
def unfinished(finished_status, update_interval, status_key, edit_at_key): """ Create dict query for pymongo that getting all unfinished task. :param finished_status: int, status code that less than this will be considered as unfinished. :param updat...
[ "def", "unfinished", "(", "finished_status", ",", "update_interval", ",", "status_key", ",", "edit_at_key", ")", ":", "return", "{", "\"$or\"", ":", "[", "{", "status_key", ":", "{", "\"$lt\"", ":", "finished_status", "}", "}", ",", "{", "edit_at_key", ":", ...
Create dict query for pymongo that getting all unfinished task. :param finished_status: int, status code that less than this will be considered as unfinished. :param update_interval: int, the record will be updated every x seconds. :param status_key: status code field key, support dot notation. ...
[ "Create", "dict", "query", "for", "pymongo", "that", "getting", "all", "unfinished", "task", "." ]
241516f2a7a0a32c692f7af35a1f44064e8ce1ab
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/pipeline/mongodb/query_builder.py#L52-L77
train
55,961
sporsh/carnifex
carnifex/ssh/command.py
SSHCommand.getCommandLine
def getCommandLine(self): """Insert the precursor and change directory commands """ commandLine = self.precursor + self.sep if self.precursor else '' commandLine += self.cd + ' ' + self.path + self.sep if self.path else '' commandLine += PosixCommand.getCommandLine(self) ...
python
def getCommandLine(self): """Insert the precursor and change directory commands """ commandLine = self.precursor + self.sep if self.precursor else '' commandLine += self.cd + ' ' + self.path + self.sep if self.path else '' commandLine += PosixCommand.getCommandLine(self) ...
[ "def", "getCommandLine", "(", "self", ")", ":", "commandLine", "=", "self", ".", "precursor", "+", "self", ".", "sep", "if", "self", ".", "precursor", "else", "''", "commandLine", "+=", "self", ".", "cd", "+", "' '", "+", "self", ".", "path", "+", "s...
Insert the precursor and change directory commands
[ "Insert", "the", "precursor", "and", "change", "directory", "commands" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/command.py#L28-L34
train
55,962
Cadasta/django-tutelary
tutelary/models.py
_policy_psets
def _policy_psets(policy_instances): """Find all permission sets making use of all of a list of policy_instances. The input is an array of policy instances. """ if len(policy_instances) == 0: # Special case: find any permission sets that don't have # associated policy instances. ...
python
def _policy_psets(policy_instances): """Find all permission sets making use of all of a list of policy_instances. The input is an array of policy instances. """ if len(policy_instances) == 0: # Special case: find any permission sets that don't have # associated policy instances. ...
[ "def", "_policy_psets", "(", "policy_instances", ")", ":", "if", "len", "(", "policy_instances", ")", "==", "0", ":", "# Special case: find any permission sets that don't have", "# associated policy instances.", "return", "PermissionSet", ".", "objects", ".", "filter", "(...
Find all permission sets making use of all of a list of policy_instances. The input is an array of policy instances.
[ "Find", "all", "permission", "sets", "making", "use", "of", "all", "of", "a", "list", "of", "policy_instances", ".", "The", "input", "is", "an", "array", "of", "policy", "instances", "." ]
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/models.py#L151-L162
train
55,963
Cadasta/django-tutelary
tutelary/models.py
_get_permission_set_tree
def _get_permission_set_tree(user): """ Helper to return cached permission set tree from user instance if set, else generates and returns analyzed permission set tree. Does not cache set automatically, that must be done explicitely. """ if hasattr(user, CACHED_PSET_PROPERTY_KEY): return ...
python
def _get_permission_set_tree(user): """ Helper to return cached permission set tree from user instance if set, else generates and returns analyzed permission set tree. Does not cache set automatically, that must be done explicitely. """ if hasattr(user, CACHED_PSET_PROPERTY_KEY): return ...
[ "def", "_get_permission_set_tree", "(", "user", ")", ":", "if", "hasattr", "(", "user", ",", "CACHED_PSET_PROPERTY_KEY", ")", ":", "return", "getattr", "(", "user", ",", "CACHED_PSET_PROPERTY_KEY", ")", "if", "user", ".", "is_authenticated", "(", ")", ":", "tr...
Helper to return cached permission set tree from user instance if set, else generates and returns analyzed permission set tree. Does not cache set automatically, that must be done explicitely.
[ "Helper", "to", "return", "cached", "permission", "set", "tree", "from", "user", "instance", "if", "set", "else", "generates", "and", "returns", "analyzed", "permission", "set", "tree", ".", "Does", "not", "cache", "set", "automatically", "that", "must", "be",...
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/models.py#L296-L309
train
55,964
Cadasta/django-tutelary
tutelary/models.py
ensure_permission_set_tree_cached
def ensure_permission_set_tree_cached(user): """ Helper to cache permission set tree on user instance """ if hasattr(user, CACHED_PSET_PROPERTY_KEY): return try: setattr( user, CACHED_PSET_PROPERTY_KEY, _get_permission_set_tree(user)) except ObjectDoesNotExist: # No permissi...
python
def ensure_permission_set_tree_cached(user): """ Helper to cache permission set tree on user instance """ if hasattr(user, CACHED_PSET_PROPERTY_KEY): return try: setattr( user, CACHED_PSET_PROPERTY_KEY, _get_permission_set_tree(user)) except ObjectDoesNotExist: # No permissi...
[ "def", "ensure_permission_set_tree_cached", "(", "user", ")", ":", "if", "hasattr", "(", "user", ",", "CACHED_PSET_PROPERTY_KEY", ")", ":", "return", "try", ":", "setattr", "(", "user", ",", "CACHED_PSET_PROPERTY_KEY", ",", "_get_permission_set_tree", "(", "user", ...
Helper to cache permission set tree on user instance
[ "Helper", "to", "cache", "permission", "set", "tree", "on", "user", "instance" ]
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/models.py#L326-L334
train
55,965
kevinconway/confpy
confpy/loaders/json.py
JsonFile.parsed
def parsed(self): """Get the JSON dictionary object which represents the content. This property is cached and only parses the content once. """ if not self._parsed: self._parsed = json.loads(self.content) return self._parsed
python
def parsed(self): """Get the JSON dictionary object which represents the content. This property is cached and only parses the content once. """ if not self._parsed: self._parsed = json.loads(self.content) return self._parsed
[ "def", "parsed", "(", "self", ")", ":", "if", "not", "self", ".", "_parsed", ":", "self", ".", "_parsed", "=", "json", ".", "loads", "(", "self", ".", "content", ")", "return", "self", ".", "_parsed" ]
Get the JSON dictionary object which represents the content. This property is cached and only parses the content once.
[ "Get", "the", "JSON", "dictionary", "object", "which", "represents", "the", "content", "." ]
1ee8afcab46ac6915a5ff4184180434ac7b84a60
https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/loaders/json.py#L22-L31
train
55,966
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.cleanup_logger
def cleanup_logger(self): """Clean up logger to close out file handles. After this is called, writing to self.log will get logs ending up getting discarded. """ self.log_handler.close() self.log.removeHandler(self.log_handler)
python
def cleanup_logger(self): """Clean up logger to close out file handles. After this is called, writing to self.log will get logs ending up getting discarded. """ self.log_handler.close() self.log.removeHandler(self.log_handler)
[ "def", "cleanup_logger", "(", "self", ")", ":", "self", ".", "log_handler", ".", "close", "(", ")", "self", ".", "log", ".", "removeHandler", "(", "self", ".", "log_handler", ")" ]
Clean up logger to close out file handles. After this is called, writing to self.log will get logs ending up getting discarded.
[ "Clean", "up", "logger", "to", "close", "out", "file", "handles", "." ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L92-L99
train
55,967
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.update_configs
def update_configs(self, release): """ Update the fedora-atomic.git repositories for a given release """ git_repo = release['git_repo'] git_cache = release['git_cache'] if not os.path.isdir(git_cache): self.call(['git', 'clone', '--mirror', git_repo, git_cache]) else:...
python
def update_configs(self, release): """ Update the fedora-atomic.git repositories for a given release """ git_repo = release['git_repo'] git_cache = release['git_cache'] if not os.path.isdir(git_cache): self.call(['git', 'clone', '--mirror', git_repo, git_cache]) else:...
[ "def", "update_configs", "(", "self", ",", "release", ")", ":", "git_repo", "=", "release", "[", "'git_repo'", "]", "git_cache", "=", "release", "[", "'git_cache'", "]", "if", "not", "os", ".", "path", ".", "isdir", "(", "git_cache", ")", ":", "self", ...
Update the fedora-atomic.git repositories for a given release
[ "Update", "the", "fedora", "-", "atomic", ".", "git", "repositories", "for", "a", "given", "release" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L101-L117
train
55,968
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.mock_cmd
def mock_cmd(self, release, *cmd, **kwargs): """Run a mock command in the chroot for a given release""" fmt = '{mock_cmd}' if kwargs.get('new_chroot') is True: fmt +=' --new-chroot' fmt += ' --configdir={mock_dir}' return self.call(fmt.format(**release).split() ...
python
def mock_cmd(self, release, *cmd, **kwargs): """Run a mock command in the chroot for a given release""" fmt = '{mock_cmd}' if kwargs.get('new_chroot') is True: fmt +=' --new-chroot' fmt += ' --configdir={mock_dir}' return self.call(fmt.format(**release).split() ...
[ "def", "mock_cmd", "(", "self", ",", "release", ",", "*", "cmd", ",", "*", "*", "kwargs", ")", ":", "fmt", "=", "'{mock_cmd}'", "if", "kwargs", ".", "get", "(", "'new_chroot'", ")", "is", "True", ":", "fmt", "+=", "' --new-chroot'", "fmt", "+=", "' -...
Run a mock command in the chroot for a given release
[ "Run", "a", "mock", "command", "in", "the", "chroot", "for", "a", "given", "release" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L119-L126
train
55,969
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.generate_mock_config
def generate_mock_config(self, release): """Dynamically generate our mock configuration""" mock_tmpl = pkg_resources.resource_string(__name__, 'templates/mock.mako') mock_dir = release['mock_dir'] = os.path.join(release['tmp_dir'], 'mock') mock_cfg = os.path.join(release['mock_dir'], rel...
python
def generate_mock_config(self, release): """Dynamically generate our mock configuration""" mock_tmpl = pkg_resources.resource_string(__name__, 'templates/mock.mako') mock_dir = release['mock_dir'] = os.path.join(release['tmp_dir'], 'mock') mock_cfg = os.path.join(release['mock_dir'], rel...
[ "def", "generate_mock_config", "(", "self", ",", "release", ")", ":", "mock_tmpl", "=", "pkg_resources", ".", "resource_string", "(", "__name__", ",", "'templates/mock.mako'", ")", "mock_dir", "=", "release", "[", "'mock_dir'", "]", "=", "os", ".", "path", "."...
Dynamically generate our mock configuration
[ "Dynamically", "generate", "our", "mock", "configuration" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L143-L154
train
55,970
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.mock_chroot
def mock_chroot(self, release, cmd, **kwargs): """Run a commend in the mock container for a release""" return self.mock_cmd(release, '--chroot', cmd, **kwargs)
python
def mock_chroot(self, release, cmd, **kwargs): """Run a commend in the mock container for a release""" return self.mock_cmd(release, '--chroot', cmd, **kwargs)
[ "def", "mock_chroot", "(", "self", ",", "release", ",", "cmd", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "mock_cmd", "(", "release", ",", "'--chroot'", ",", "cmd", ",", "*", "*", "kwargs", ")" ]
Run a commend in the mock container for a release
[ "Run", "a", "commend", "in", "the", "mock", "container", "for", "a", "release" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L156-L158
train
55,971
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.generate_repo_files
def generate_repo_files(self, release): """Dynamically generate our yum repo configuration""" repo_tmpl = pkg_resources.resource_string(__name__, 'templates/repo.mako') repo_file = os.path.join(release['git_dir'], '%s.repo' % release['repo']) with file(repo_file, 'w') as repo: ...
python
def generate_repo_files(self, release): """Dynamically generate our yum repo configuration""" repo_tmpl = pkg_resources.resource_string(__name__, 'templates/repo.mako') repo_file = os.path.join(release['git_dir'], '%s.repo' % release['repo']) with file(repo_file, 'w') as repo: ...
[ "def", "generate_repo_files", "(", "self", ",", "release", ")", ":", "repo_tmpl", "=", "pkg_resources", ".", "resource_string", "(", "__name__", ",", "'templates/repo.mako'", ")", "repo_file", "=", "os", ".", "path", ".", "join", "(", "release", "[", "'git_dir...
Dynamically generate our yum repo configuration
[ "Dynamically", "generate", "our", "yum", "repo", "configuration" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L160-L168
train
55,972
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.ostree_init
def ostree_init(self, release): """Initialize the OSTree for a release""" out = release['output_dir'].rstrip('/') base = os.path.dirname(out) if not os.path.isdir(base): self.log.info('Creating %s', base) os.makedirs(base, mode=0755) if not os.path.isdir(o...
python
def ostree_init(self, release): """Initialize the OSTree for a release""" out = release['output_dir'].rstrip('/') base = os.path.dirname(out) if not os.path.isdir(base): self.log.info('Creating %s', base) os.makedirs(base, mode=0755) if not os.path.isdir(o...
[ "def", "ostree_init", "(", "self", ",", "release", ")", ":", "out", "=", "release", "[", "'output_dir'", "]", ".", "rstrip", "(", "'/'", ")", "base", "=", "os", ".", "path", ".", "dirname", "(", "out", ")", "if", "not", "os", ".", "path", ".", "i...
Initialize the OSTree for a release
[ "Initialize", "the", "OSTree", "for", "a", "release" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L170-L178
train
55,973
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.ostree_compose
def ostree_compose(self, release): """Compose the OSTree in the mock container""" start = datetime.utcnow() treefile = os.path.join(release['git_dir'], 'treefile.json') cmd = release['ostree_compose'] % treefile with file(treefile, 'w') as tree: json.dump(release['tre...
python
def ostree_compose(self, release): """Compose the OSTree in the mock container""" start = datetime.utcnow() treefile = os.path.join(release['git_dir'], 'treefile.json') cmd = release['ostree_compose'] % treefile with file(treefile, 'w') as tree: json.dump(release['tre...
[ "def", "ostree_compose", "(", "self", ",", "release", ")", ":", "start", "=", "datetime", ".", "utcnow", "(", ")", "treefile", "=", "os", ".", "path", ".", "join", "(", "release", "[", "'git_dir'", "]", ",", "'treefile.json'", ")", "cmd", "=", "release...
Compose the OSTree in the mock container
[ "Compose", "the", "OSTree", "in", "the", "mock", "container" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L180-L198
train
55,974
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.update_ostree_summary
def update_ostree_summary(self, release): """Update the ostree summary file and return a path to it""" self.log.info('Updating the ostree summary for %s', release['name']) self.mock_chroot(release, release['ostree_summary']) return os.path.join(release['output_dir'], 'summary')
python
def update_ostree_summary(self, release): """Update the ostree summary file and return a path to it""" self.log.info('Updating the ostree summary for %s', release['name']) self.mock_chroot(release, release['ostree_summary']) return os.path.join(release['output_dir'], 'summary')
[ "def", "update_ostree_summary", "(", "self", ",", "release", ")", ":", "self", ".", "log", ".", "info", "(", "'Updating the ostree summary for %s'", ",", "release", "[", "'name'", "]", ")", "self", ".", "mock_chroot", "(", "release", ",", "release", "[", "'o...
Update the ostree summary file and return a path to it
[ "Update", "the", "ostree", "summary", "file", "and", "return", "a", "path", "to", "it" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L200-L204
train
55,975
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.sync_in
def sync_in(self, release): """Sync the canonical repo to our local working directory""" tree = release['canonical_dir'] if os.path.exists(tree) and release.get('rsync_in_objs'): out = release['output_dir'] if not os.path.isdir(out): self.log.info('Creatin...
python
def sync_in(self, release): """Sync the canonical repo to our local working directory""" tree = release['canonical_dir'] if os.path.exists(tree) and release.get('rsync_in_objs'): out = release['output_dir'] if not os.path.isdir(out): self.log.info('Creatin...
[ "def", "sync_in", "(", "self", ",", "release", ")", ":", "tree", "=", "release", "[", "'canonical_dir'", "]", "if", "os", ".", "path", ".", "exists", "(", "tree", ")", "and", "release", ".", "get", "(", "'rsync_in_objs'", ")", ":", "out", "=", "relea...
Sync the canonical repo to our local working directory
[ "Sync", "the", "canonical", "repo", "to", "our", "local", "working", "directory" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L206-L215
train
55,976
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.sync_out
def sync_out(self, release): """Sync our tree to the canonical location""" if release.get('rsync_out_objs'): tree = release['canonical_dir'] if not os.path.isdir(tree): self.log.info('Creating %s', tree) os.makedirs(tree) self.call(rele...
python
def sync_out(self, release): """Sync our tree to the canonical location""" if release.get('rsync_out_objs'): tree = release['canonical_dir'] if not os.path.isdir(tree): self.log.info('Creating %s', tree) os.makedirs(tree) self.call(rele...
[ "def", "sync_out", "(", "self", ",", "release", ")", ":", "if", "release", ".", "get", "(", "'rsync_out_objs'", ")", ":", "tree", "=", "release", "[", "'canonical_dir'", "]", "if", "not", "os", ".", "path", ".", "isdir", "(", "tree", ")", ":", "self"...
Sync our tree to the canonical location
[ "Sync", "our", "tree", "to", "the", "canonical", "location" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L217-L225
train
55,977
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
AtomicComposer.call
def call(self, cmd, **kwargs): """A simple subprocess wrapper""" if isinstance(cmd, basestring): cmd = cmd.split() self.log.info('Running %s', cmd) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs) out, er...
python
def call(self, cmd, **kwargs): """A simple subprocess wrapper""" if isinstance(cmd, basestring): cmd = cmd.split() self.log.info('Running %s', cmd) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs) out, er...
[ "def", "call", "(", "self", ",", "cmd", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "cmd", ",", "basestring", ")", ":", "cmd", "=", "cmd", ".", "split", "(", ")", "self", ".", "log", ".", "info", "(", "'Running %s'", ",", "cmd", ...
A simple subprocess wrapper
[ "A", "simple", "subprocess", "wrapper" ]
9be9fd4955af0568f8743d7a1a243cd8f70020c3
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L227-L245
train
55,978
standage/tag
tag/range.py
Range.intersect
def intersect(self, other): """ Determine the interval of overlap between this range and another. :returns: a new Range object representing the overlapping interval, or `None` if the ranges do not overlap. """ if not self.overlap(other): return None...
python
def intersect(self, other): """ Determine the interval of overlap between this range and another. :returns: a new Range object representing the overlapping interval, or `None` if the ranges do not overlap. """ if not self.overlap(other): return None...
[ "def", "intersect", "(", "self", ",", "other", ")", ":", "if", "not", "self", ".", "overlap", "(", "other", ")", ":", "return", "None", "newstart", "=", "max", "(", "self", ".", "_start", ",", "other", ".", "start", ")", "newend", "=", "min", "(", ...
Determine the interval of overlap between this range and another. :returns: a new Range object representing the overlapping interval, or `None` if the ranges do not overlap.
[ "Determine", "the", "interval", "of", "overlap", "between", "this", "range", "and", "another", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/range.py#L121-L133
train
55,979
standage/tag
tag/range.py
Range.overlap
def overlap(self, other): """Determine whether this range overlaps with another.""" if self._start < other.end and self._end > other.start: return True return False
python
def overlap(self, other): """Determine whether this range overlaps with another.""" if self._start < other.end and self._end > other.start: return True return False
[ "def", "overlap", "(", "self", ",", "other", ")", ":", "if", "self", ".", "_start", "<", "other", ".", "end", "and", "self", ".", "_end", ">", "other", ".", "start", ":", "return", "True", "return", "False" ]
Determine whether this range overlaps with another.
[ "Determine", "whether", "this", "range", "overlaps", "with", "another", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/range.py#L135-L139
train
55,980
standage/tag
tag/range.py
Range.contains
def contains(self, other): """Determine whether this range contains another.""" return self._start <= other.start and self._end >= other.end
python
def contains(self, other): """Determine whether this range contains another.""" return self._start <= other.start and self._end >= other.end
[ "def", "contains", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_start", "<=", "other", ".", "start", "and", "self", ".", "_end", ">=", "other", ".", "end" ]
Determine whether this range contains another.
[ "Determine", "whether", "this", "range", "contains", "another", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/range.py#L141-L143
train
55,981
standage/tag
tag/range.py
Range.transform
def transform(self, offset): """ Shift this range by the specified offset. Note: the resulting range must be a valid interval. """ assert self._start + offset > 0, \ ('offset {} invalid; resulting range [{}, {}) is ' 'undefined'.format(offset, self._star...
python
def transform(self, offset): """ Shift this range by the specified offset. Note: the resulting range must be a valid interval. """ assert self._start + offset > 0, \ ('offset {} invalid; resulting range [{}, {}) is ' 'undefined'.format(offset, self._star...
[ "def", "transform", "(", "self", ",", "offset", ")", ":", "assert", "self", ".", "_start", "+", "offset", ">", "0", ",", "(", "'offset {} invalid; resulting range [{}, {}) is '", "'undefined'", ".", "format", "(", "offset", ",", "self", ".", "_start", "+", "...
Shift this range by the specified offset. Note: the resulting range must be a valid interval.
[ "Shift", "this", "range", "by", "the", "specified", "offset", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/range.py#L153-L163
train
55,982
e7dal/bubble3
behave4cmd0/command_shell.py
Command.run
def run(cls, command, cwd=".", **kwargs): """ Make a subprocess call, collect its output and returncode. Returns CommandResult instance as ValueObject. """ assert isinstance(command, six.string_types) command_result = CommandResult() command_result.command = comma...
python
def run(cls, command, cwd=".", **kwargs): """ Make a subprocess call, collect its output and returncode. Returns CommandResult instance as ValueObject. """ assert isinstance(command, six.string_types) command_result = CommandResult() command_result.command = comma...
[ "def", "run", "(", "cls", ",", "command", ",", "cwd", "=", "\".\"", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "command", ",", "six", ".", "string_types", ")", "command_result", "=", "CommandResult", "(", ")", "command_result", ".", ...
Make a subprocess call, collect its output and returncode. Returns CommandResult instance as ValueObject.
[ "Make", "a", "subprocess", "call", "collect", "its", "output", "and", "returncode", ".", "Returns", "CommandResult", "instance", "as", "ValueObject", "." ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_shell.py#L100-L161
train
55,983
stephrdev/django-tapeforms
tapeforms/contrib/foundation.py
FoundationTapeformMixin.get_field_template
def get_field_template(self, bound_field, template_name=None): """ Uses a special field template for widget with multiple inputs. It only applies if no other template than the default one has been defined. """ template_name = super().get_field_template(bound_field, template_name)...
python
def get_field_template(self, bound_field, template_name=None): """ Uses a special field template for widget with multiple inputs. It only applies if no other template than the default one has been defined. """ template_name = super().get_field_template(bound_field, template_name)...
[ "def", "get_field_template", "(", "self", ",", "bound_field", ",", "template_name", "=", "None", ")", ":", "template_name", "=", "super", "(", ")", ".", "get_field_template", "(", "bound_field", ",", "template_name", ")", "if", "(", "template_name", "==", "sel...
Uses a special field template for widget with multiple inputs. It only applies if no other template than the default one has been defined.
[ "Uses", "a", "special", "field", "template", "for", "widget", "with", "multiple", "inputs", ".", "It", "only", "applies", "if", "no", "other", "template", "than", "the", "default", "one", "has", "been", "defined", "." ]
255602de43777141f18afaf30669d7bdd4f7c323
https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/contrib/foundation.py#L27-L39
train
55,984
GeorgeArgyros/symautomata
symautomata/pythonpda.py
PDAState.printer
def printer(self): """Prints PDA state attributes""" print " ID " + repr(self.id) if self.type == 0: print " Tag: - " print " Start State - " elif self.type == 1: print " Push " + repr(self.sym) elif self.type == 2: print " Pop Stat...
python
def printer(self): """Prints PDA state attributes""" print " ID " + repr(self.id) if self.type == 0: print " Tag: - " print " Start State - " elif self.type == 1: print " Push " + repr(self.sym) elif self.type == 2: print " Pop Stat...
[ "def", "printer", "(", "self", ")", ":", "print", "\" ID \"", "+", "repr", "(", "self", ".", "id", ")", "if", "self", ".", "type", "==", "0", ":", "print", "\" Tag: - \"", "print", "\" Start State - \"", "elif", "self", ".", "type", "==", "1", ":", "...
Prints PDA state attributes
[ "Prints", "PDA", "state", "attributes" ]
f5d66533573b27e155bec3f36b8c00b8e3937cb3
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/pythonpda.py#L14-L31
train
55,985
GeorgeArgyros/symautomata
symautomata/pythonpda.py
PythonPDA.printer
def printer(self): """Prints PDA states and their attributes""" i = 0 while i < self.n + 1: print "--------- State No --------" + repr(i) self.s[i].printer() i = i + 1
python
def printer(self): """Prints PDA states and their attributes""" i = 0 while i < self.n + 1: print "--------- State No --------" + repr(i) self.s[i].printer() i = i + 1
[ "def", "printer", "(", "self", ")", ":", "i", "=", "0", "while", "i", "<", "self", ".", "n", "+", "1", ":", "print", "\"--------- State No --------\"", "+", "repr", "(", "i", ")", "self", ".", "s", "[", "i", "]", ".", "printer", "(", ")", "i", ...
Prints PDA states and their attributes
[ "Prints", "PDA", "states", "and", "their", "attributes" ]
f5d66533573b27e155bec3f36b8c00b8e3937cb3
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/pythonpda.py#L96-L102
train
55,986
davgeo/clear
clear/database.py
RenamerDB._ActionDatabase
def _ActionDatabase(self, cmd, args = None, commit = True, error = True): """ Do action on database. Parameters ---------- cmd : string SQL command. args : tuple [optional : default = None] Arguments to be passed along with the SQL command. e.g. cmd="SELECT Value FR...
python
def _ActionDatabase(self, cmd, args = None, commit = True, error = True): """ Do action on database. Parameters ---------- cmd : string SQL command. args : tuple [optional : default = None] Arguments to be passed along with the SQL command. e.g. cmd="SELECT Value FR...
[ "def", "_ActionDatabase", "(", "self", ",", "cmd", ",", "args", "=", "None", ",", "commit", "=", "True", ",", "error", "=", "True", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Database Command: {0} {1}\"", ".", "format", "(",...
Do action on database. Parameters ---------- cmd : string SQL command. args : tuple [optional : default = None] Arguments to be passed along with the SQL command. e.g. cmd="SELECT Value FROM Config WHERE Name=?" args=(fieldName, ) commit : boolean [optional : default...
[ "Do", "action", "on", "database", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L139-L179
train
55,987
davgeo/clear
clear/database.py
RenamerDB._PurgeTable
def _PurgeTable(self, tableName): """ Deletes all rows from given table without dropping table. Parameters ---------- tableName : string Name of table. """ goodlogging.Log.Info("DB", "Deleting all entries from table {0}".format(tableName), verbosity=self.logVerbosity) self._Ac...
python
def _PurgeTable(self, tableName): """ Deletes all rows from given table without dropping table. Parameters ---------- tableName : string Name of table. """ goodlogging.Log.Info("DB", "Deleting all entries from table {0}".format(tableName), verbosity=self.logVerbosity) self._Ac...
[ "def", "_PurgeTable", "(", "self", ",", "tableName", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Deleting all entries from table {0}\"", ".", "format", "(", "tableName", ")", ",", "verbosity", "=", "self", ".", "logVerbosity", ")",...
Deletes all rows from given table without dropping table. Parameters ---------- tableName : string Name of table.
[ "Deletes", "all", "rows", "from", "given", "table", "without", "dropping", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L184-L194
train
55,988
davgeo/clear
clear/database.py
RenamerDB.GetConfigValue
def GetConfigValue(self, fieldName): """ Match given field name in Config table and return corresponding value. Parameters ---------- fieldName : string String matching Name column in Config table. Returns ---------- string or None If a match is found the correspond...
python
def GetConfigValue(self, fieldName): """ Match given field name in Config table and return corresponding value. Parameters ---------- fieldName : string String matching Name column in Config table. Returns ---------- string or None If a match is found the correspond...
[ "def", "GetConfigValue", "(", "self", ",", "fieldName", ")", ":", "result", "=", "self", ".", "_ActionDatabase", "(", "\"SELECT Value FROM Config WHERE Name=?\"", ",", "(", "fieldName", ",", ")", ")", "if", "result", "is", "None", ":", "return", "None", "elif"...
Match given field name in Config table and return corresponding value. Parameters ---------- fieldName : string String matching Name column in Config table. Returns ---------- string or None If a match is found the corresponding entry in the Value column of the data...
[ "Match", "given", "field", "name", "in", "Config", "table", "and", "return", "corresponding", "value", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L199-L225
train
55,989
davgeo/clear
clear/database.py
RenamerDB.SetConfigValue
def SetConfigValue(self, fieldName, value): """ Set value in Config table. If a entry already exists this is updated with the new value, otherwise a new entry is added. Parameters ---------- fieldName : string String to be inserted or matched against Name column in Config table. ...
python
def SetConfigValue(self, fieldName, value): """ Set value in Config table. If a entry already exists this is updated with the new value, otherwise a new entry is added. Parameters ---------- fieldName : string String to be inserted or matched against Name column in Config table. ...
[ "def", "SetConfigValue", "(", "self", ",", "fieldName", ",", "value", ")", ":", "currentConfigValue", "=", "self", ".", "GetConfigValue", "(", "fieldName", ")", "if", "currentConfigValue", "is", "None", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB...
Set value in Config table. If a entry already exists this is updated with the new value, otherwise a new entry is added. Parameters ---------- fieldName : string String to be inserted or matched against Name column in Config table. value : string Entry to be inserted or up...
[ "Set", "value", "in", "Config", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L230-L252
train
55,990
davgeo/clear
clear/database.py
RenamerDB._AddToSingleColumnTable
def _AddToSingleColumnTable(self, tableName, columnHeading, newValue): """ Add an entry to a table containing a single column. Checks existing table entries to avoid duplicate entries if the given value already exists in the table. Parameters ---------- tableName : string Name of ...
python
def _AddToSingleColumnTable(self, tableName, columnHeading, newValue): """ Add an entry to a table containing a single column. Checks existing table entries to avoid duplicate entries if the given value already exists in the table. Parameters ---------- tableName : string Name of ...
[ "def", "_AddToSingleColumnTable", "(", "self", ",", "tableName", ",", "columnHeading", ",", "newValue", ")", ":", "match", "=", "None", "currentTable", "=", "self", ".", "_GetFromSingleColumnTable", "(", "tableName", ")", "if", "currentTable", "is", "not", "None...
Add an entry to a table containing a single column. Checks existing table entries to avoid duplicate entries if the given value already exists in the table. Parameters ---------- tableName : string Name of table to add entry to. columnHeading : string Name of column heading...
[ "Add", "an", "entry", "to", "a", "table", "containing", "a", "single", "column", ".", "Checks", "existing", "table", "entries", "to", "avoid", "duplicate", "entries", "if", "the", "given", "value", "already", "exists", "in", "the", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L257-L304
train
55,991
davgeo/clear
clear/database.py
RenamerDB.AddShowToTVLibrary
def AddShowToTVLibrary(self, showName): """ Add show to TVLibrary table. If the show already exists in the table a fatal error is raised. Parameters ---------- showName : string Show name to add to TV library table. Returns ---------- int Unique show id generate...
python
def AddShowToTVLibrary(self, showName): """ Add show to TVLibrary table. If the show already exists in the table a fatal error is raised. Parameters ---------- showName : string Show name to add to TV library table. Returns ---------- int Unique show id generate...
[ "def", "AddShowToTVLibrary", "(", "self", ",", "showName", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Adding {0} to TV library\"", ".", "format", "(", "showName", ")", ",", "verbosity", "=", "self", ".", "logVerbosity", ")", "cu...
Add show to TVLibrary table. If the show already exists in the table a fatal error is raised. Parameters ---------- showName : string Show name to add to TV library table. Returns ---------- int Unique show id generated for show when it is added to the table. Used ...
[ "Add", "show", "to", "TVLibrary", "table", ".", "If", "the", "show", "already", "exists", "in", "the", "table", "a", "fatal", "error", "is", "raised", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L392-L417
train
55,992
davgeo/clear
clear/database.py
RenamerDB.UpdateShowDirInTVLibrary
def UpdateShowDirInTVLibrary(self, showID, showDir): """ Update show directory entry for given show id in TVLibrary table. Parameters ---------- showID : int Show id value. showDir : string Show directory name. """ goodlogging.Log.Info("DB", "Updating TV library for...
python
def UpdateShowDirInTVLibrary(self, showID, showDir): """ Update show directory entry for given show id in TVLibrary table. Parameters ---------- showID : int Show id value. showDir : string Show directory name. """ goodlogging.Log.Info("DB", "Updating TV library for...
[ "def", "UpdateShowDirInTVLibrary", "(", "self", ",", "showID", ",", "showDir", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Updating TV library for ShowID={0}: ShowDir={1}\"", ".", "format", "(", "showID", ",", "showDir", ")", ")", "s...
Update show directory entry for given show id in TVLibrary table. Parameters ---------- showID : int Show id value. showDir : string Show directory name.
[ "Update", "show", "directory", "entry", "for", "given", "show", "id", "in", "TVLibrary", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L422-L435
train
55,993
davgeo/clear
clear/database.py
RenamerDB.SearchTVLibrary
def SearchTVLibrary(self, showName = None, showID = None, showDir = None): """ Search TVLibrary table. If none of the optonal arguments are given it looks up all entries of the table, otherwise it will look up entries which match the given arguments. Note that it only looks up based on one argumen...
python
def SearchTVLibrary(self, showName = None, showID = None, showDir = None): """ Search TVLibrary table. If none of the optonal arguments are given it looks up all entries of the table, otherwise it will look up entries which match the given arguments. Note that it only looks up based on one argumen...
[ "def", "SearchTVLibrary", "(", "self", ",", "showName", "=", "None", ",", "showID", "=", "None", ",", "showDir", "=", "None", ")", ":", "unique", "=", "True", "if", "showName", "is", "None", "and", "showID", "is", "None", "and", "showDir", "is", "None"...
Search TVLibrary table. If none of the optonal arguments are given it looks up all entries of the table, otherwise it will look up entries which match the given arguments. Note that it only looks up based on one argument - if show directory is given this will be used, otherwise show id will be used if...
[ "Search", "TVLibrary", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L440-L502
train
55,994
davgeo/clear
clear/database.py
RenamerDB.SearchFileNameTable
def SearchFileNameTable(self, fileName): """ Search FileName table. Find the show id for a given file name. Parameters ---------- fileName : string File name to look up in table. Returns ---------- int or None If a match is found in the database table the show ...
python
def SearchFileNameTable(self, fileName): """ Search FileName table. Find the show id for a given file name. Parameters ---------- fileName : string File name to look up in table. Returns ---------- int or None If a match is found in the database table the show ...
[ "def", "SearchFileNameTable", "(", "self", ",", "fileName", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Looking up filename string '{0}' in database\"", ".", "format", "(", "fileName", ")", ",", "verbosity", "=", "self", ".", "logVer...
Search FileName table. Find the show id for a given file name. Parameters ---------- fileName : string File name to look up in table. Returns ---------- int or None If a match is found in the database table the show id for this entry is returned, otherwise this...
[ "Search", "FileName", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L507-L540
train
55,995
davgeo/clear
clear/database.py
RenamerDB.AddToFileNameTable
def AddToFileNameTable(self, fileName, showID): """ Add entry to FileName table. If the file name and show id combination already exists in the table a fatal error is raised. Parameters ---------- fileName : string File name. showID : int Show id. """ goodloggin...
python
def AddToFileNameTable(self, fileName, showID): """ Add entry to FileName table. If the file name and show id combination already exists in the table a fatal error is raised. Parameters ---------- fileName : string File name. showID : int Show id. """ goodloggin...
[ "def", "AddToFileNameTable", "(", "self", ",", "fileName", ",", "showID", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Adding filename string match '{0}'={1} to database\"", ".", "format", "(", "fileName", ",", "showID", ")", ",", "ve...
Add entry to FileName table. If the file name and show id combination already exists in the table a fatal error is raised. Parameters ---------- fileName : string File name. showID : int Show id.
[ "Add", "entry", "to", "FileName", "table", ".", "If", "the", "file", "name", "and", "show", "id", "combination", "already", "exists", "in", "the", "table", "a", "fatal", "error", "is", "raised", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L545-L565
train
55,996
davgeo/clear
clear/database.py
RenamerDB.SearchSeasonDirTable
def SearchSeasonDirTable(self, showID, seasonNum): """ Search SeasonDir table. Find the season directory for a given show id and season combination. Parameters ---------- showID : int Show id for given show. seasonNum : int Season number. Returns ---------- ...
python
def SearchSeasonDirTable(self, showID, seasonNum): """ Search SeasonDir table. Find the season directory for a given show id and season combination. Parameters ---------- showID : int Show id for given show. seasonNum : int Season number. Returns ---------- ...
[ "def", "SearchSeasonDirTable", "(", "self", ",", "showID", ",", "seasonNum", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Looking up directory for ShowID={0} Season={1} in database\"", ".", "format", "(", "showID", ",", "seasonNum", ")", ...
Search SeasonDir table. Find the season directory for a given show id and season combination. Parameters ---------- showID : int Show id for given show. seasonNum : int Season number. Returns ---------- string or None If no match is found this returns No...
[ "Search", "SeasonDir", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L570-L607
train
55,997
davgeo/clear
clear/database.py
RenamerDB.AddSeasonDirTable
def AddSeasonDirTable(self, showID, seasonNum, seasonDir): """ Add entry to SeasonDir table. If a different entry for season directory is found for the given show id and season number combination this raises a fatal error. Parameters ---------- showID : int Show id. seasonN...
python
def AddSeasonDirTable(self, showID, seasonNum, seasonDir): """ Add entry to SeasonDir table. If a different entry for season directory is found for the given show id and season number combination this raises a fatal error. Parameters ---------- showID : int Show id. seasonN...
[ "def", "AddSeasonDirTable", "(", "self", ",", "showID", ",", "seasonNum", ",", "seasonDir", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Adding season directory ({0}) to database for ShowID={1}, Season={2}\"", ".", "format", "(", "seasonDir...
Add entry to SeasonDir table. If a different entry for season directory is found for the given show id and season number combination this raises a fatal error. Parameters ---------- showID : int Show id. seasonNum : int Season number. seasonDir : string Seaso...
[ "Add", "entry", "to", "SeasonDir", "table", ".", "If", "a", "different", "entry", "for", "season", "directory", "is", "found", "for", "the", "given", "show", "id", "and", "season", "number", "combination", "this", "raises", "a", "fatal", "error", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L612-L639
train
55,998
davgeo/clear
clear/database.py
RenamerDB.PrintAllTables
def PrintAllTables(self): """ Prints contents of every table. """ goodlogging.Log.Info("DB", "Database contents:\n") for table in self._tableDict.keys(): self._PrintDatabaseTable(table)
python
def PrintAllTables(self): """ Prints contents of every table. """ goodlogging.Log.Info("DB", "Database contents:\n") for table in self._tableDict.keys(): self._PrintDatabaseTable(table)
[ "def", "PrintAllTables", "(", "self", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"DB\"", ",", "\"Database contents:\\n\"", ")", "for", "table", "in", "self", ".", "_tableDict", ".", "keys", "(", ")", ":", "self", ".", "_PrintDatabaseTable", "...
Prints contents of every table.
[ "Prints", "contents", "of", "every", "table", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/database.py#L711-L715
train
55,999