id
int32
0
252k
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
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
238,800
shoeffner/pandoc-source-exec
pandoc_source_exec.py
filter_lines
def filter_lines(code, line_spec): """Removes all lines not matching the line_spec. Args: code The code to filter line_spec The line specification. This should be a comma-separated string of lines or line ranges, e.g. 1,2,5-12,15 If a line range starts with -...
python
def filter_lines(code, line_spec): """Removes all lines not matching the line_spec. Args: code The code to filter line_spec The line specification. This should be a comma-separated string of lines or line ranges, e.g. 1,2,5-12,15 If a line range starts with -...
[ "def", "filter_lines", "(", "code", ",", "line_spec", ")", ":", "code_lines", "=", "code", ".", "splitlines", "(", ")", "line_specs", "=", "[", "line_denom", ".", "strip", "(", ")", "for", "line_denom", "in", "line_spec", ".", "split", "(", "','", ")", ...
Removes all lines not matching the line_spec. Args: code The code to filter line_spec The line specification. This should be a comma-separated string of lines or line ranges, e.g. 1,2,5-12,15 If a line range starts with -, all lines up to this line are ...
[ "Removes", "all", "lines", "not", "matching", "the", "line_spec", "." ]
9a13b9054d629a60b63196a906fafe2673722d13
https://github.com/shoeffner/pandoc-source-exec/blob/9a13b9054d629a60b63196a906fafe2673722d13/pandoc_source_exec.py#L149-L184
238,801
shoeffner/pandoc-source-exec
pandoc_source_exec.py
remove_import_statements
def remove_import_statements(code): """Removes lines with import statements from the code. Args: code: The code to be stripped. Returns: The code without import statements. """ new_code = [] for line in code.splitlines(): if not line.lstrip().startswith('import ') and \...
python
def remove_import_statements(code): """Removes lines with import statements from the code. Args: code: The code to be stripped. Returns: The code without import statements. """ new_code = [] for line in code.splitlines(): if not line.lstrip().startswith('import ') and \...
[ "def", "remove_import_statements", "(", "code", ")", ":", "new_code", "=", "[", "]", "for", "line", "in", "code", ".", "splitlines", "(", ")", ":", "if", "not", "line", ".", "lstrip", "(", ")", ".", "startswith", "(", "'import '", ")", "and", "not", ...
Removes lines with import statements from the code. Args: code: The code to be stripped. Returns: The code without import statements.
[ "Removes", "lines", "with", "import", "statements", "from", "the", "code", "." ]
9a13b9054d629a60b63196a906fafe2673722d13
https://github.com/shoeffner/pandoc-source-exec/blob/9a13b9054d629a60b63196a906fafe2673722d13/pandoc_source_exec.py#L189-L209
238,802
shoeffner/pandoc-source-exec
pandoc_source_exec.py
save_plot
def save_plot(code, elem): """Converts matplotlib plots to tikz code. If elem has either the plt attribute (format: plt=width,height) or the attributes width=width and/or height=height, the figurewidth and -height are set accordingly. If none are given, a height of 4cm and a width of 6cm is used as...
python
def save_plot(code, elem): """Converts matplotlib plots to tikz code. If elem has either the plt attribute (format: plt=width,height) or the attributes width=width and/or height=height, the figurewidth and -height are set accordingly. If none are given, a height of 4cm and a width of 6cm is used as...
[ "def", "save_plot", "(", "code", ",", "elem", ")", ":", "if", "'plt'", "in", "elem", ".", "attributes", ":", "figurewidth", ",", "figureheight", "=", "elem", ".", "attributes", "[", "'plt'", "]", ".", "split", "(", "','", ")", "else", ":", "try", ":"...
Converts matplotlib plots to tikz code. If elem has either the plt attribute (format: plt=width,height) or the attributes width=width and/or height=height, the figurewidth and -height are set accordingly. If none are given, a height of 4cm and a width of 6cm is used as default. Args: code:...
[ "Converts", "matplotlib", "plots", "to", "tikz", "code", "." ]
9a13b9054d629a60b63196a906fafe2673722d13
https://github.com/shoeffner/pandoc-source-exec/blob/9a13b9054d629a60b63196a906fafe2673722d13/pandoc_source_exec.py#L212-L245
238,803
shoeffner/pandoc-source-exec
pandoc_source_exec.py
trimpath
def trimpath(attributes): """Simplifies the given path. If pathdepth is in attributes, the last pathdepth elements will be returned. If pathdepth is "full", the full path will be returned. Otherwise the filename only will be returned. Args: attributes: The element attributes. Returns:...
python
def trimpath(attributes): """Simplifies the given path. If pathdepth is in attributes, the last pathdepth elements will be returned. If pathdepth is "full", the full path will be returned. Otherwise the filename only will be returned. Args: attributes: The element attributes. Returns:...
[ "def", "trimpath", "(", "attributes", ")", ":", "if", "'pathdepth'", "in", "attributes", ":", "if", "attributes", "[", "'pathdepth'", "]", "!=", "'full'", ":", "pathelements", "=", "[", "]", "remainder", "=", "attributes", "[", "'file'", "]", "limit", "=",...
Simplifies the given path. If pathdepth is in attributes, the last pathdepth elements will be returned. If pathdepth is "full", the full path will be returned. Otherwise the filename only will be returned. Args: attributes: The element attributes. Returns: The trimmed path.
[ "Simplifies", "the", "given", "path", "." ]
9a13b9054d629a60b63196a906fafe2673722d13
https://github.com/shoeffner/pandoc-source-exec/blob/9a13b9054d629a60b63196a906fafe2673722d13/pandoc_source_exec.py#L248-L271
238,804
shoeffner/pandoc-source-exec
pandoc_source_exec.py
prepare
def prepare(doc): """Sets the caption_found and plot_found variables to False.""" doc.caption_found = False doc.plot_found = False doc.listings_counter = 0
python
def prepare(doc): """Sets the caption_found and plot_found variables to False.""" doc.caption_found = False doc.plot_found = False doc.listings_counter = 0
[ "def", "prepare", "(", "doc", ")", ":", "doc", ".", "caption_found", "=", "False", "doc", ".", "plot_found", "=", "False", "doc", ".", "listings_counter", "=", "0" ]
Sets the caption_found and plot_found variables to False.
[ "Sets", "the", "caption_found", "and", "plot_found", "variables", "to", "False", "." ]
9a13b9054d629a60b63196a906fafe2673722d13
https://github.com/shoeffner/pandoc-source-exec/blob/9a13b9054d629a60b63196a906fafe2673722d13/pandoc_source_exec.py#L311-L315
238,805
shoeffner/pandoc-source-exec
pandoc_source_exec.py
maybe_center_plot
def maybe_center_plot(result): """Embeds a possible tikz image inside a center environment. Searches for matplotlib2tikz last commend line to detect tikz images. Args: result: The code execution result Returns: The input result if no tikzpicture was found, otherwise a centered ...
python
def maybe_center_plot(result): """Embeds a possible tikz image inside a center environment. Searches for matplotlib2tikz last commend line to detect tikz images. Args: result: The code execution result Returns: The input result if no tikzpicture was found, otherwise a centered ...
[ "def", "maybe_center_plot", "(", "result", ")", ":", "begin", "=", "re", ".", "search", "(", "'(% .* matplotlib2tikz v.*)'", ",", "result", ")", "if", "begin", ":", "result", "=", "(", "'\\\\begin{center}\\n'", "+", "result", "[", "begin", ".", "end", "(", ...
Embeds a possible tikz image inside a center environment. Searches for matplotlib2tikz last commend line to detect tikz images. Args: result: The code execution result Returns: The input result if no tikzpicture was found, otherwise a centered version.
[ "Embeds", "a", "possible", "tikz", "image", "inside", "a", "center", "environment", "." ]
9a13b9054d629a60b63196a906fafe2673722d13
https://github.com/shoeffner/pandoc-source-exec/blob/9a13b9054d629a60b63196a906fafe2673722d13/pandoc_source_exec.py#L318-L334
238,806
shoeffner/pandoc-source-exec
pandoc_source_exec.py
action
def action(elem, doc): # noqa """Processes pf.CodeBlocks. For details and a specification of how each command should behave, check the example files (especially the md and pdf)! Args: elem: The element to process. doc: The document. Returns: A changed element or None. ...
python
def action(elem, doc): # noqa """Processes pf.CodeBlocks. For details and a specification of how each command should behave, check the example files (especially the md and pdf)! Args: elem: The element to process. doc: The document. Returns: A changed element or None. ...
[ "def", "action", "(", "elem", ",", "doc", ")", ":", "# noqa", "if", "isinstance", "(", "elem", ",", "pf", ".", "CodeBlock", ")", ":", "doc", ".", "listings_counter", "+=", "1", "elems", "=", "[", "elem", "]", "if", "'hide'", "not", "in", "elem", "....
Processes pf.CodeBlocks. For details and a specification of how each command should behave, check the example files (especially the md and pdf)! Args: elem: The element to process. doc: The document. Returns: A changed element or None.
[ "Processes", "pf", ".", "CodeBlocks", "." ]
9a13b9054d629a60b63196a906fafe2673722d13
https://github.com/shoeffner/pandoc-source-exec/blob/9a13b9054d629a60b63196a906fafe2673722d13/pandoc_source_exec.py#L337-L406
238,807
shoeffner/pandoc-source-exec
pandoc_source_exec.py
finalize
def finalize(doc): """Adds the pgfplots and caption packages to the header-includes if needed. """ if doc.plot_found: pgfplots_inline = pf.MetaInlines(pf.RawInline( r'''% \makeatletter \@ifpackageloaded{pgfplots}{}{\usepackage{pgfplots}} \makeatother \usepgfplotslibrary{groupplots} ''', ...
python
def finalize(doc): """Adds the pgfplots and caption packages to the header-includes if needed. """ if doc.plot_found: pgfplots_inline = pf.MetaInlines(pf.RawInline( r'''% \makeatletter \@ifpackageloaded{pgfplots}{}{\usepackage{pgfplots}} \makeatother \usepgfplotslibrary{groupplots} ''', ...
[ "def", "finalize", "(", "doc", ")", ":", "if", "doc", ".", "plot_found", ":", "pgfplots_inline", "=", "pf", ".", "MetaInlines", "(", "pf", ".", "RawInline", "(", "r'''%\n\\makeatletter\n\\@ifpackageloaded{pgfplots}{}{\\usepackage{pgfplots}}\n\\makeatother\n\\usepgfplotslibr...
Adds the pgfplots and caption packages to the header-includes if needed.
[ "Adds", "the", "pgfplots", "and", "caption", "packages", "to", "the", "header", "-", "includes", "if", "needed", "." ]
9a13b9054d629a60b63196a906fafe2673722d13
https://github.com/shoeffner/pandoc-source-exec/blob/9a13b9054d629a60b63196a906fafe2673722d13/pandoc_source_exec.py#L409-L442
238,808
s-m-i-t-a/railroad
railroad/rescue.py
rescue
def rescue(f, on_success, on_error=reraise, on_complete=nop): ''' Functional try-except-finally :param function f: guarded function :param function on_succes: called when f is executed without error :param function on_error: called with `error` parameter when f failed :param function on_complet...
python
def rescue(f, on_success, on_error=reraise, on_complete=nop): ''' Functional try-except-finally :param function f: guarded function :param function on_succes: called when f is executed without error :param function on_error: called with `error` parameter when f failed :param function on_complet...
[ "def", "rescue", "(", "f", ",", "on_success", ",", "on_error", "=", "reraise", ",", "on_complete", "=", "nop", ")", ":", "def", "_rescue", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "on_success", "(", "f", "(", "*", ...
Functional try-except-finally :param function f: guarded function :param function on_succes: called when f is executed without error :param function on_error: called with `error` parameter when f failed :param function on_complete: called as finally block :returns function: call signature is equal ...
[ "Functional", "try", "-", "except", "-", "finally" ]
ddb4afa018b8523b5d8c3a86e55388d1ea0ab37c
https://github.com/s-m-i-t-a/railroad/blob/ddb4afa018b8523b5d8c3a86e55388d1ea0ab37c/railroad/rescue.py#L12-L30
238,809
realestate-com-au/dashmat
dashmat/collector.py
Collector.read_file
def read_file(self, location): """Read in a yaml file and return as a python object""" try: return yaml.load(open(location)) except (yaml.parser.ParserError, yaml.scanner.ScannerError) as error: raise self.BadFileErrorKls("Failed to read yaml", location=location, error_ty...
python
def read_file(self, location): """Read in a yaml file and return as a python object""" try: return yaml.load(open(location)) except (yaml.parser.ParserError, yaml.scanner.ScannerError) as error: raise self.BadFileErrorKls("Failed to read yaml", location=location, error_ty...
[ "def", "read_file", "(", "self", ",", "location", ")", ":", "try", ":", "return", "yaml", ".", "load", "(", "open", "(", "location", ")", ")", "except", "(", "yaml", ".", "parser", ".", "ParserError", ",", "yaml", ".", "scanner", ".", "ScannerError", ...
Read in a yaml file and return as a python object
[ "Read", "in", "a", "yaml", "file", "and", "return", "as", "a", "python", "object" ]
433886e52698f0ddb9956f087b76041966c3bcd1
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/collector.py#L54-L59
238,810
toumorokoshi/jenks
jenks/subcommand/trigger.py
_trigger_job
def _trigger_job(job): """ trigger a job """ if job.api_instance().is_running(): return "{0}, {1} is already running".format(job.host, job.name) else: requests.get(job.api_instance().get_build_triggerurl()) return "triggering {0}, {1}...".format(job.host, job.name)
python
def _trigger_job(job): """ trigger a job """ if job.api_instance().is_running(): return "{0}, {1} is already running".format(job.host, job.name) else: requests.get(job.api_instance().get_build_triggerurl()) return "triggering {0}, {1}...".format(job.host, job.name)
[ "def", "_trigger_job", "(", "job", ")", ":", "if", "job", ".", "api_instance", "(", ")", ".", "is_running", "(", ")", ":", "return", "\"{0}, {1} is already running\"", ".", "format", "(", "job", ".", "host", ",", "job", ".", "name", ")", "else", ":", "...
trigger a job
[ "trigger", "a", "job" ]
d3333a7b86ba290b7185aa5b8da75e76a28124f5
https://github.com/toumorokoshi/jenks/blob/d3333a7b86ba290b7185aa5b8da75e76a28124f5/jenks/subcommand/trigger.py#L24-L30
238,811
roboogle/gtkmvc3
gtkmvco/gtkmvc3/observable.py
Observable.observed
def observed(cls, _func): """ Decorate methods to be observable. If they are called on an instance stored in a property, the model will emit before and after notifications. """ def wrapper(*args, **kwargs): self = args[0] assert(isinstance(self, O...
python
def observed(cls, _func): """ Decorate methods to be observable. If they are called on an instance stored in a property, the model will emit before and after notifications. """ def wrapper(*args, **kwargs): self = args[0] assert(isinstance(self, O...
[ "def", "observed", "(", "cls", ",", "_func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", "=", "args", "[", "0", "]", "assert", "(", "isinstance", "(", "self", ",", "Observable", ")", ")", "self", ".", ...
Decorate methods to be observable. If they are called on an instance stored in a property, the model will emit before and after notifications.
[ "Decorate", "methods", "to", "be", "observable", ".", "If", "they", "are", "called", "on", "an", "instance", "stored", "in", "a", "property", "the", "model", "will", "emit", "before", "and", "after", "notifications", "." ]
63405fd8d2056be26af49103b13a8d5e57fe4dff
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/observable.py#L34-L50
238,812
roboogle/gtkmvc3
gtkmvco/gtkmvc3/observable.py
Signal.emit
def emit(self, arg=None): """Emits the signal, passing the optional argument""" for model,name in self.__get_models__(): model.notify_signal_emit(name, arg)
python
def emit(self, arg=None): """Emits the signal, passing the optional argument""" for model,name in self.__get_models__(): model.notify_signal_emit(name, arg)
[ "def", "emit", "(", "self", ",", "arg", "=", "None", ")", ":", "for", "model", ",", "name", "in", "self", ".", "__get_models__", "(", ")", ":", "model", ".", "notify_signal_emit", "(", "name", ",", "arg", ")" ]
Emits the signal, passing the optional argument
[ "Emits", "the", "signal", "passing", "the", "optional", "argument" ]
63405fd8d2056be26af49103b13a8d5e57fe4dff
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/observable.py#L87-L90
238,813
klmitch/policies
policies/instructions.py
Instructions._linearize
def _linearize(cls, inst_list): """ A generator function which performs linearization of the list of instructions; that is, each instruction which should be executed will be yielded in turn, recursing into ``Instructions`` instances that appear in the list. :param inst_l...
python
def _linearize(cls, inst_list): """ A generator function which performs linearization of the list of instructions; that is, each instruction which should be executed will be yielded in turn, recursing into ``Instructions`` instances that appear in the list. :param inst_l...
[ "def", "_linearize", "(", "cls", ",", "inst_list", ")", ":", "for", "inst", "in", "inst_list", ":", "# Check if we need to recurse", "if", "isinstance", "(", "inst", ",", "Instructions", ")", ":", "for", "sub_inst", "in", "cls", ".", "_linearize", "(", "inst...
A generator function which performs linearization of the list of instructions; that is, each instruction which should be executed will be yielded in turn, recursing into ``Instructions`` instances that appear in the list. :param inst_list: A list (or other sequence) of instructions. ...
[ "A", "generator", "function", "which", "performs", "linearization", "of", "the", "list", "of", "instructions", ";", "that", "is", "each", "instruction", "which", "should", "be", "executed", "will", "be", "yielded", "in", "turn", "recursing", "into", "Instruction...
edf26c5707a5a0cc8e9f59a209a64dee7f79b7a4
https://github.com/klmitch/policies/blob/edf26c5707a5a0cc8e9f59a209a64dee7f79b7a4/policies/instructions.py#L206-L224
238,814
samuel-phan/mssh-copy-id
msshcopyid/__init__.py
SSHCopyId.add_to_known_hosts
def add_to_known_hosts(self, hosts, known_hosts=DEFAULT_KNOWN_HOSTS, dry=False): """ Add the remote host SSH public key to the `known_hosts` file. :param hosts: the list of the remote `Host` objects. :param known_hosts: the `known_hosts` file to store the SSH public keys. :param...
python
def add_to_known_hosts(self, hosts, known_hosts=DEFAULT_KNOWN_HOSTS, dry=False): """ Add the remote host SSH public key to the `known_hosts` file. :param hosts: the list of the remote `Host` objects. :param known_hosts: the `known_hosts` file to store the SSH public keys. :param...
[ "def", "add_to_known_hosts", "(", "self", ",", "hosts", ",", "known_hosts", "=", "DEFAULT_KNOWN_HOSTS", ",", "dry", "=", "False", ")", ":", "to_add", "=", "[", "]", "with", "open", "(", "known_hosts", ")", "as", "fh", ":", "known_hosts_set", "=", "set", ...
Add the remote host SSH public key to the `known_hosts` file. :param hosts: the list of the remote `Host` objects. :param known_hosts: the `known_hosts` file to store the SSH public keys. :param dry: perform a dry run.
[ "Add", "the", "remote", "host", "SSH", "public", "key", "to", "the", "known_hosts", "file", "." ]
59c50eabb74c4e0eeb729266df57c285e6661b0b
https://github.com/samuel-phan/mssh-copy-id/blob/59c50eabb74c4e0eeb729266df57c285e6661b0b/msshcopyid/__init__.py#L46-L71
238,815
samuel-phan/mssh-copy-id
msshcopyid/__init__.py
SSHCopyId.remove_from_known_hosts
def remove_from_known_hosts(self, hosts, known_hosts=DEFAULT_KNOWN_HOSTS, dry=False): """ Remove the remote host SSH public key to the `known_hosts` file. :param hosts: the list of the remote `Host` objects. :param known_hosts: the `known_hosts` file to store the SSH public keys. ...
python
def remove_from_known_hosts(self, hosts, known_hosts=DEFAULT_KNOWN_HOSTS, dry=False): """ Remove the remote host SSH public key to the `known_hosts` file. :param hosts: the list of the remote `Host` objects. :param known_hosts: the `known_hosts` file to store the SSH public keys. ...
[ "def", "remove_from_known_hosts", "(", "self", ",", "hosts", ",", "known_hosts", "=", "DEFAULT_KNOWN_HOSTS", ",", "dry", "=", "False", ")", ":", "for", "host", "in", "hosts", ":", "logger", ".", "info", "(", "'[%s] Removing the remote host SSH public key from [%s].....
Remove the remote host SSH public key to the `known_hosts` file. :param hosts: the list of the remote `Host` objects. :param known_hosts: the `known_hosts` file to store the SSH public keys. :param dry: perform a dry run.
[ "Remove", "the", "remote", "host", "SSH", "public", "key", "to", "the", "known_hosts", "file", "." ]
59c50eabb74c4e0eeb729266df57c285e6661b0b
https://github.com/samuel-phan/mssh-copy-id/blob/59c50eabb74c4e0eeb729266df57c285e6661b0b/msshcopyid/__init__.py#L73-L89
238,816
pipermerriam/ethereum-client-utils
eth_client_utils/client.py
BaseClient.process_requests
def process_requests(self): """ Loop that runs in a thread to process requests synchronously. """ while True: id, args, kwargs = self.request_queue.get() try: response = self._make_request(*args, **kwargs) except Exception as e: ...
python
def process_requests(self): """ Loop that runs in a thread to process requests synchronously. """ while True: id, args, kwargs = self.request_queue.get() try: response = self._make_request(*args, **kwargs) except Exception as e: ...
[ "def", "process_requests", "(", "self", ")", ":", "while", "True", ":", "id", ",", "args", ",", "kwargs", "=", "self", ".", "request_queue", ".", "get", "(", ")", "try", ":", "response", "=", "self", ".", "_make_request", "(", "*", "args", ",", "*", ...
Loop that runs in a thread to process requests synchronously.
[ "Loop", "that", "runs", "in", "a", "thread", "to", "process", "requests", "synchronously", "." ]
34d0976305a262200a1159b2f336b69ce4f02d70
https://github.com/pipermerriam/ethereum-client-utils/blob/34d0976305a262200a1159b2f336b69ce4f02d70/eth_client_utils/client.py#L30-L40
238,817
pipermerriam/ethereum-client-utils
eth_client_utils/client.py
JSONRPCBaseClient.default_from_address
def default_from_address(self): """ Cache the coinbase address so that we don't make two requests for every single transaction. """ if self._coinbase_cache_til is not None: if time.time - self._coinbase_cache_til > 30: self._coinbase_cache_til = None ...
python
def default_from_address(self): """ Cache the coinbase address so that we don't make two requests for every single transaction. """ if self._coinbase_cache_til is not None: if time.time - self._coinbase_cache_til > 30: self._coinbase_cache_til = None ...
[ "def", "default_from_address", "(", "self", ")", ":", "if", "self", ".", "_coinbase_cache_til", "is", "not", "None", ":", "if", "time", ".", "time", "-", "self", ".", "_coinbase_cache_til", ">", "30", ":", "self", ".", "_coinbase_cache_til", "=", "None", "...
Cache the coinbase address so that we don't make two requests for every single transaction.
[ "Cache", "the", "coinbase", "address", "so", "that", "we", "don", "t", "make", "two", "requests", "for", "every", "single", "transaction", "." ]
34d0976305a262200a1159b2f336b69ce4f02d70
https://github.com/pipermerriam/ethereum-client-utils/blob/34d0976305a262200a1159b2f336b69ce4f02d70/eth_client_utils/client.py#L72-L85
238,818
rosenbrockc/ci
pyci/server.py
Server.find_pulls
def find_pulls(self, testpulls=None): """Finds a list of new pull requests that need to be processed. :arg testpulls: a list of tserver.FakePull instances so we can test the code functionality without making live requests to github. """ #We check all the repositories installed...
python
def find_pulls(self, testpulls=None): """Finds a list of new pull requests that need to be processed. :arg testpulls: a list of tserver.FakePull instances so we can test the code functionality without making live requests to github. """ #We check all the repositories installed...
[ "def", "find_pulls", "(", "self", ",", "testpulls", "=", "None", ")", ":", "#We check all the repositories installed for new (open) pull requests.", "#If any exist, we check the pull request number against our archive to", "#see if we have to do anything for it.", "result", "=", "{", ...
Finds a list of new pull requests that need to be processed. :arg testpulls: a list of tserver.FakePull instances so we can test the code functionality without making live requests to github.
[ "Finds", "a", "list", "of", "new", "pull", "requests", "that", "need", "to", "be", "processed", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L163-L199
238,819
rosenbrockc/ci
pyci/server.py
Server._save_archive
def _save_archive(self): """Saves the JSON archive of processed pull requests. """ import json from utility import json_serial with open(self.archpath, 'w') as f: json.dump(self.archive, f, default=json_serial)
python
def _save_archive(self): """Saves the JSON archive of processed pull requests. """ import json from utility import json_serial with open(self.archpath, 'w') as f: json.dump(self.archive, f, default=json_serial)
[ "def", "_save_archive", "(", "self", ")", ":", "import", "json", "from", "utility", "import", "json_serial", "with", "open", "(", "self", ".", "archpath", ",", "'w'", ")", "as", "f", ":", "json", ".", "dump", "(", "self", ".", "archive", ",", "f", ",...
Saves the JSON archive of processed pull requests.
[ "Saves", "the", "JSON", "archive", "of", "processed", "pull", "requests", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L208-L214
238,820
rosenbrockc/ci
pyci/server.py
Server._get_repos
def _get_repos(self): """Gets a list of all the installed repositories in this server. """ result = {} for xmlpath in self.installed: repo = RepositorySettings(self, xmlpath) result[repo.name.lower()] = repo return result
python
def _get_repos(self): """Gets a list of all the installed repositories in this server. """ result = {} for xmlpath in self.installed: repo = RepositorySettings(self, xmlpath) result[repo.name.lower()] = repo return result
[ "def", "_get_repos", "(", "self", ")", ":", "result", "=", "{", "}", "for", "xmlpath", "in", "self", ".", "installed", ":", "repo", "=", "RepositorySettings", "(", "self", ",", "xmlpath", ")", "result", "[", "repo", ".", "name", ".", "lower", "(", ")...
Gets a list of all the installed repositories in this server.
[ "Gets", "a", "list", "of", "all", "the", "installed", "repositories", "in", "this", "server", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L216-L224
238,821
rosenbrockc/ci
pyci/server.py
Server._get_installed
def _get_installed(self): """Gets a list of the file paths to repo settings files that are being monitored by the CI server. """ from utility import get_json #This is a little tricky because the data file doesn't just have a list #of installed servers. It also manages the...
python
def _get_installed(self): """Gets a list of the file paths to repo settings files that are being monitored by the CI server. """ from utility import get_json #This is a little tricky because the data file doesn't just have a list #of installed servers. It also manages the...
[ "def", "_get_installed", "(", "self", ")", ":", "from", "utility", "import", "get_json", "#This is a little tricky because the data file doesn't just have a list", "#of installed servers. It also manages the script's database that tracks", "#the user's interactions with it.", "fulldata", ...
Gets a list of the file paths to repo settings files that are being monitored by the CI server.
[ "Gets", "a", "list", "of", "the", "file", "paths", "to", "repo", "settings", "files", "that", "are", "being", "monitored", "by", "the", "CI", "server", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L226-L238
238,822
rosenbrockc/ci
pyci/server.py
Server.uninstall
def uninstall(self, xmlpath): """Uninstalls the repository with the specified XML path from the server. """ from os import path fullpath = path.abspath(path.expanduser(xmlpath)) if fullpath in self.installed: repo = RepositorySettings(self, fullpath) if re...
python
def uninstall(self, xmlpath): """Uninstalls the repository with the specified XML path from the server. """ from os import path fullpath = path.abspath(path.expanduser(xmlpath)) if fullpath in self.installed: repo = RepositorySettings(self, fullpath) if re...
[ "def", "uninstall", "(", "self", ",", "xmlpath", ")", ":", "from", "os", "import", "path", "fullpath", "=", "path", ".", "abspath", "(", "path", ".", "expanduser", "(", "xmlpath", ")", ")", "if", "fullpath", "in", "self", ".", "installed", ":", "repo",...
Uninstalls the repository with the specified XML path from the server.
[ "Uninstalls", "the", "repository", "with", "the", "specified", "XML", "path", "from", "the", "server", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L240-L255
238,823
rosenbrockc/ci
pyci/server.py
Server.install
def install(self, xmlpath): """Installs the repository at the specified XML path as an additional repo to monitor pull requests for. """ #Before we can install it, we need to make sure that none of the existing #installed paths point to the same repo. from os import path ...
python
def install(self, xmlpath): """Installs the repository at the specified XML path as an additional repo to monitor pull requests for. """ #Before we can install it, we need to make sure that none of the existing #installed paths point to the same repo. from os import path ...
[ "def", "install", "(", "self", ",", "xmlpath", ")", ":", "#Before we can install it, we need to make sure that none of the existing", "#installed paths point to the same repo.", "from", "os", "import", "path", "fullpath", "=", "path", ".", "abspath", "(", "path", ".", "ex...
Installs the repository at the specified XML path as an additional repo to monitor pull requests for.
[ "Installs", "the", "repository", "at", "the", "specified", "XML", "path", "as", "an", "additional", "repo", "to", "monitor", "pull", "requests", "for", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L257-L275
238,824
rosenbrockc/ci
pyci/server.py
Server._save_installed
def _save_installed(self): """Saves the list of installed repo XML settings files.""" import json from utility import json_serial, get_json #This is a little tricky because the data file doesn't just have a list #of installed servers. It also manages the script's database that tr...
python
def _save_installed(self): """Saves the list of installed repo XML settings files.""" import json from utility import json_serial, get_json #This is a little tricky because the data file doesn't just have a list #of installed servers. It also manages the script's database that tr...
[ "def", "_save_installed", "(", "self", ")", ":", "import", "json", "from", "utility", "import", "json_serial", ",", "get_json", "#This is a little tricky because the data file doesn't just have a list", "#of installed servers. It also manages the script's database that tracks", "#the...
Saves the list of installed repo XML settings files.
[ "Saves", "the", "list", "of", "installed", "repo", "XML", "settings", "files", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L277-L287
238,825
rosenbrockc/ci
pyci/server.py
PullRequest.init
def init(self, archive): """Creates the repo folder locally, copies the static files and folders available locally, initalizes the repo with git so it has the correct remote origin and is ready to sync. :arg staging: the full path to the directory to stage the unit tests in. ""...
python
def init(self, archive): """Creates the repo folder locally, copies the static files and folders available locally, initalizes the repo with git so it has the correct remote origin and is ready to sync. :arg staging: the full path to the directory to stage the unit tests in. ""...
[ "def", "init", "(", "self", ",", "archive", ")", ":", "from", "os", "import", "makedirs", ",", "path", ",", "chdir", ",", "system", ",", "getcwd", "self", ".", "repodir", "=", "path", ".", "abspath", "(", "path", ".", "expanduser", "(", "self", ".", ...
Creates the repo folder locally, copies the static files and folders available locally, initalizes the repo with git so it has the correct remote origin and is ready to sync. :arg staging: the full path to the directory to stage the unit tests in.
[ "Creates", "the", "repo", "folder", "locally", "copies", "the", "static", "files", "and", "folders", "available", "locally", "initalizes", "the", "repo", "with", "git", "so", "it", "has", "the", "correct", "remote", "origin", "and", "is", "ready", "to", "syn...
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L346-L401
238,826
rosenbrockc/ci
pyci/server.py
PullRequest._fields_common
def _fields_common(self): """Returns a dictionary of fields and values that are common to all events for which fields dictionaries are created. """ result = {} if not self.testmode: result["__reponame__"] = self.repo.repo.full_name result["__repodesc__"] =...
python
def _fields_common(self): """Returns a dictionary of fields and values that are common to all events for which fields dictionaries are created. """ result = {} if not self.testmode: result["__reponame__"] = self.repo.repo.full_name result["__repodesc__"] =...
[ "def", "_fields_common", "(", "self", ")", ":", "result", "=", "{", "}", "if", "not", "self", ".", "testmode", ":", "result", "[", "\"__reponame__\"", "]", "=", "self", ".", "repo", ".", "repo", ".", "full_name", "result", "[", "\"__repodesc__\"", "]", ...
Returns a dictionary of fields and values that are common to all events for which fields dictionaries are created.
[ "Returns", "a", "dictionary", "of", "fields", "and", "values", "that", "are", "common", "to", "all", "events", "for", "which", "fields", "dictionaries", "are", "created", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L509-L530
238,827
rosenbrockc/ci
pyci/server.py
PullRequest.wiki
def wiki(self): """Returns the wiki markup describing the details of the github pull request as well as a link to the details on github. """ date = self.pull.created_at.strftime("%m/%d/%Y %H:%M") return "{} {} ({} [{} github])\n".format(self.pull.avatar_url, self.pull.body, date,...
python
def wiki(self): """Returns the wiki markup describing the details of the github pull request as well as a link to the details on github. """ date = self.pull.created_at.strftime("%m/%d/%Y %H:%M") return "{} {} ({} [{} github])\n".format(self.pull.avatar_url, self.pull.body, date,...
[ "def", "wiki", "(", "self", ")", ":", "date", "=", "self", ".", "pull", ".", "created_at", ".", "strftime", "(", "\"%m/%d/%Y %H:%M\"", ")", "return", "\"{} {} ({} [{} github])\\n\"", ".", "format", "(", "self", ".", "pull", ".", "avatar_url", ",", "self", ...
Returns the wiki markup describing the details of the github pull request as well as a link to the details on github.
[ "Returns", "the", "wiki", "markup", "describing", "the", "details", "of", "the", "github", "pull", "request", "as", "well", "as", "a", "link", "to", "the", "details", "on", "github", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L532-L538
238,828
rosenbrockc/ci
pyci/server.py
PullRequest.fields_general
def fields_general(self, event): """Appends any additional fields to the common ones and returns the fields dictionary. """ result = self._fields_common() basic = { "__test_html__": self.repo.testing.html(False), "__test_text__": self.repo.testing.text(Fal...
python
def fields_general(self, event): """Appends any additional fields to the common ones and returns the fields dictionary. """ result = self._fields_common() basic = { "__test_html__": self.repo.testing.html(False), "__test_text__": self.repo.testing.text(Fal...
[ "def", "fields_general", "(", "self", ",", "event", ")", ":", "result", "=", "self", ".", "_fields_common", "(", ")", "basic", "=", "{", "\"__test_html__\"", ":", "self", ".", "repo", ".", "testing", ".", "html", "(", "False", ")", ",", "\"__test_text__\...
Appends any additional fields to the common ones and returns the fields dictionary.
[ "Appends", "any", "additional", "fields", "to", "the", "common", "ones", "and", "returns", "the", "fields", "dictionary", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L540-L565
238,829
rosenbrockc/ci
pyci/server.py
Wiki._get_site
def _get_site(self): """Returns the mwclient.Site for accessing and editing the wiki pages. """ import mwclient parts = self.server.settings.wiki.replace("http", "").replace("://", "").split("/") self.url = parts[0] if len(parts) > 1 and parts[1].strip() != "": ...
python
def _get_site(self): """Returns the mwclient.Site for accessing and editing the wiki pages. """ import mwclient parts = self.server.settings.wiki.replace("http", "").replace("://", "").split("/") self.url = parts[0] if len(parts) > 1 and parts[1].strip() != "": ...
[ "def", "_get_site", "(", "self", ")", ":", "import", "mwclient", "parts", "=", "self", ".", "server", ".", "settings", ".", "wiki", ".", "replace", "(", "\"http\"", ",", "\"\"", ")", ".", "replace", "(", "\"://\"", ",", "\"\"", ")", ".", "split", "("...
Returns the mwclient.Site for accessing and editing the wiki pages.
[ "Returns", "the", "mwclient", ".", "Site", "for", "accessing", "and", "editing", "the", "wiki", "pages", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L607-L622
238,830
rosenbrockc/ci
pyci/server.py
Wiki._site_login
def _site_login(self, repo): """Logs the user specified in the repo into the wiki. :arg repo: an instance of config.RepositorySettings with wiki credentials. """ try: if not self.testmode: self.site.login(repo.wiki["user"], repo.wiki["password"]) exce...
python
def _site_login(self, repo): """Logs the user specified in the repo into the wiki. :arg repo: an instance of config.RepositorySettings with wiki credentials. """ try: if not self.testmode: self.site.login(repo.wiki["user"], repo.wiki["password"]) exce...
[ "def", "_site_login", "(", "self", ",", "repo", ")", ":", "try", ":", "if", "not", "self", ".", "testmode", ":", "self", ".", "site", ".", "login", "(", "repo", ".", "wiki", "[", "\"user\"", "]", ",", "repo", ".", "wiki", "[", "\"password\"", "]", ...
Logs the user specified in the repo into the wiki. :arg repo: an instance of config.RepositorySettings with wiki credentials.
[ "Logs", "the", "user", "specified", "in", "the", "repo", "into", "the", "wiki", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L624-L634
238,831
rosenbrockc/ci
pyci/server.py
Wiki.create
def create(self, request): """Creates a new wiki page for the specified PullRequest instance. The page gets initialized with basic information about the pull request, the tests that will be run, etc. Returns the URL on the wiki. :arg request: the PullRequest instance with testing inform...
python
def create(self, request): """Creates a new wiki page for the specified PullRequest instance. The page gets initialized with basic information about the pull request, the tests that will be run, etc. Returns the URL on the wiki. :arg request: the PullRequest instance with testing inform...
[ "def", "create", "(", "self", ",", "request", ")", ":", "self", ".", "_site_login", "(", "request", ".", "repo", ")", "self", ".", "prefix", "=", "\"{}_Pull_Request_{}\"", ".", "format", "(", "request", ".", "repo", ".", "name", ",", "request", ".", "p...
Creates a new wiki page for the specified PullRequest instance. The page gets initialized with basic information about the pull request, the tests that will be run, etc. Returns the URL on the wiki. :arg request: the PullRequest instance with testing information.
[ "Creates", "a", "new", "wiki", "page", "for", "the", "specified", "PullRequest", "instance", ".", "The", "page", "gets", "initialized", "with", "basic", "information", "about", "the", "pull", "request", "the", "tests", "that", "will", "be", "run", "etc", "."...
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L636-L649
238,832
rosenbrockc/ci
pyci/server.py
Wiki.update
def update(self, request): """Updates the wiki page with the results of the unit tests run for the pull request. :arg percent: the percent success rate of the unit tests. :arg ttotal: the total time elapsed in running *all* the unit tests. """ from os import path ...
python
def update(self, request): """Updates the wiki page with the results of the unit tests run for the pull request. :arg percent: the percent success rate of the unit tests. :arg ttotal: the total time elapsed in running *all* the unit tests. """ from os import path ...
[ "def", "update", "(", "self", ",", "request", ")", ":", "from", "os", "import", "path", "self", ".", "_site_login", "(", "request", ".", "repo", ")", "self", ".", "prefix", "=", "\"{}_Pull_Request_{}\"", ".", "format", "(", "request", ".", "repo", ".", ...
Updates the wiki page with the results of the unit tests run for the pull request. :arg percent: the percent success rate of the unit tests. :arg ttotal: the total time elapsed in running *all* the unit tests.
[ "Updates", "the", "wiki", "page", "with", "the", "results", "of", "the", "unit", "tests", "run", "for", "the", "pull", "request", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L651-L691
238,833
rosenbrockc/ci
pyci/server.py
Wiki._create_new
def _create_new(self, request): """Creates the new wiki page that houses the details of the unit testing runs. """ self.prefix = "{}_Pull_Request_{}".format(request.repo.name, request.pull.number) head = list(self._newpage_head) head.append(request.repo.testing.wiki(False)) ...
python
def _create_new(self, request): """Creates the new wiki page that houses the details of the unit testing runs. """ self.prefix = "{}_Pull_Request_{}".format(request.repo.name, request.pull.number) head = list(self._newpage_head) head.append(request.repo.testing.wiki(False)) ...
[ "def", "_create_new", "(", "self", ",", "request", ")", ":", "self", ".", "prefix", "=", "\"{}_Pull_Request_{}\"", ".", "format", "(", "request", ".", "repo", ".", "name", ",", "request", ".", "pull", ".", "number", ")", "head", "=", "list", "(", "self...
Creates the new wiki page that houses the details of the unit testing runs.
[ "Creates", "the", "new", "wiki", "page", "that", "houses", "the", "details", "of", "the", "unit", "testing", "runs", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L693-L704
238,834
rosenbrockc/ci
pyci/server.py
Wiki._edit_main
def _edit_main(self, request): """Adds the link to the new unit testing results on the repo's main wiki page. """ self.prefix = "{}_Pull_Request_{}".format(request.repo.name, request.pull.number) if not self.testmode: page = site.pages[self.basepage] text = page.t...
python
def _edit_main(self, request): """Adds the link to the new unit testing results on the repo's main wiki page. """ self.prefix = "{}_Pull_Request_{}".format(request.repo.name, request.pull.number) if not self.testmode: page = site.pages[self.basepage] text = page.t...
[ "def", "_edit_main", "(", "self", ",", "request", ")", ":", "self", ".", "prefix", "=", "\"{}_Pull_Request_{}\"", ".", "format", "(", "request", ".", "repo", ".", "name", ",", "request", ".", "pull", ".", "number", ")", "if", "not", "self", ".", "testm...
Adds the link to the new unit testing results on the repo's main wiki page.
[ "Adds", "the", "link", "to", "the", "new", "unit", "testing", "results", "on", "the", "repo", "s", "main", "wiki", "page", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L706-L724
238,835
rosenbrockc/ci
pyci/server.py
CronManager.email
def email(self, repo, event, fields, dryrun=False): """Sends an email to the configured recipients for the specified event. :arg repo: the name of the repository to include in the email subject. :arg event: one of ["start", "success", "failure", "timeout", "error"]. :arg fields: a dicti...
python
def email(self, repo, event, fields, dryrun=False): """Sends an email to the configured recipients for the specified event. :arg repo: the name of the repository to include in the email subject. :arg event: one of ["start", "success", "failure", "timeout", "error"]. :arg fields: a dicti...
[ "def", "email", "(", "self", ",", "repo", ",", "event", ",", "fields", ",", "dryrun", "=", "False", ")", ":", "tcontents", "=", "self", ".", "_get_template", "(", "event", ",", "\"txt\"", ",", "fields", ")", "hcontents", "=", "self", ".", "_get_templat...
Sends an email to the configured recipients for the specified event. :arg repo: the name of the repository to include in the email subject. :arg event: one of ["start", "success", "failure", "timeout", "error"]. :arg fields: a dictionary of field values to replace into the email template ...
[ "Sends", "an", "email", "to", "the", "configured", "recipients", "for", "the", "specified", "event", "." ]
4d5a60291424a83124d1d962d17fb4c7718cde2b
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L762-L775
238,836
JukeboxPipeline/jukebox-core
src/jukeboxcore/ostool.py
detect_sys
def detect_sys(): """Tries to identify your python platform :returns: a dict with the gathered information :rtype: dict :raises: None the returned dict has these keys: 'system', 'bit', 'compiler', 'python_version_tuple' eg.:: {'system':'Windows', 'bit':'32bit', 'compiler':'MSC v.1500 3...
python
def detect_sys(): """Tries to identify your python platform :returns: a dict with the gathered information :rtype: dict :raises: None the returned dict has these keys: 'system', 'bit', 'compiler', 'python_version_tuple' eg.:: {'system':'Windows', 'bit':'32bit', 'compiler':'MSC v.1500 3...
[ "def", "detect_sys", "(", ")", ":", "system", "=", "platform", ".", "system", "(", ")", "bit", "=", "platform", ".", "architecture", "(", ")", "[", "0", "]", "compiler", "=", "platform", ".", "python_compiler", "(", ")", "ver", "=", "platform", ".", ...
Tries to identify your python platform :returns: a dict with the gathered information :rtype: dict :raises: None the returned dict has these keys: 'system', 'bit', 'compiler', 'python_version_tuple' eg.:: {'system':'Windows', 'bit':'32bit', 'compiler':'MSC v.1500 32bit (Intel)', 'python_ve...
[ "Tries", "to", "identify", "your", "python", "platform" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/ostool.py#L24-L42
238,837
JukeboxPipeline/jukebox-core
src/jukeboxcore/ostool.py
WindowsInterface.get_maya_location
def get_maya_location(self, ): """ Return the installation path to maya :returns: path to maya :rtype: str :raises: errors.SoftwareNotFoundError """ import _winreg # query winreg entry # the last flag is needed, if we want to test with 32 bit python! ...
python
def get_maya_location(self, ): """ Return the installation path to maya :returns: path to maya :rtype: str :raises: errors.SoftwareNotFoundError """ import _winreg # query winreg entry # the last flag is needed, if we want to test with 32 bit python! ...
[ "def", "get_maya_location", "(", "self", ",", ")", ":", "import", "_winreg", "# query winreg entry", "# the last flag is needed, if we want to test with 32 bit python!", "# Because Maya is an 64 bit key!", "for", "ver", "in", "MAYA_VERSIONS", ":", "try", ":", "key", "=", "_...
Return the installation path to maya :returns: path to maya :rtype: str :raises: errors.SoftwareNotFoundError
[ "Return", "the", "installation", "path", "to", "maya" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/ostool.py#L132-L153
238,838
JukeboxPipeline/jukebox-core
src/jukeboxcore/ostool.py
WindowsInterface.get_maya_envpath
def get_maya_envpath(self): """Return the PYTHONPATH neccessary for running mayapy If you start native mayapy, it will setup these paths. You might want to prepend this to your path if running from an external intepreter. :returns: the PYTHONPATH that is used for running mayapy...
python
def get_maya_envpath(self): """Return the PYTHONPATH neccessary for running mayapy If you start native mayapy, it will setup these paths. You might want to prepend this to your path if running from an external intepreter. :returns: the PYTHONPATH that is used for running mayapy...
[ "def", "get_maya_envpath", "(", "self", ")", ":", "opj", "=", "os", ".", "path", ".", "join", "ml", "=", "self", ".", "get_maya_location", "(", ")", "mb", "=", "self", ".", "get_maya_bin", "(", ")", "msp", "=", "self", ".", "get_maya_sitepackage_dir", ...
Return the PYTHONPATH neccessary for running mayapy If you start native mayapy, it will setup these paths. You might want to prepend this to your path if running from an external intepreter. :returns: the PYTHONPATH that is used for running mayapy :rtype: str :raises: N...
[ "Return", "the", "PYTHONPATH", "neccessary", "for", "running", "mayapy" ]
bac2280ca49940355270e4b69400ce9976ab2e6f
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/ostool.py#L195-L217
238,839
FujiMakoto/AgentML
agentml/parser/trigger/response/container.py
ResponseContainer._sort
def _sort(self): """ Sort the response dictionaries priority levels for ordered iteration """ self._log.debug('Sorting responses by priority') self._responses = OrderedDict(sorted(list(self._responses.items()), reverse=True)) self.sorted = True
python
def _sort(self): """ Sort the response dictionaries priority levels for ordered iteration """ self._log.debug('Sorting responses by priority') self._responses = OrderedDict(sorted(list(self._responses.items()), reverse=True)) self.sorted = True
[ "def", "_sort", "(", "self", ")", ":", "self", ".", "_log", ".", "debug", "(", "'Sorting responses by priority'", ")", "self", ".", "_responses", "=", "OrderedDict", "(", "sorted", "(", "list", "(", "self", ".", "_responses", ".", "items", "(", ")", ")",...
Sort the response dictionaries priority levels for ordered iteration
[ "Sort", "the", "response", "dictionaries", "priority", "levels", "for", "ordered", "iteration" ]
c8cb64b460d876666bf29ea2c682189874c7c403
https://github.com/FujiMakoto/AgentML/blob/c8cb64b460d876666bf29ea2c682189874c7c403/agentml/parser/trigger/response/container.py#L22-L28
238,840
joelcolucci/flask-registerblueprints
flask_registerblueprints/register.py
register_blueprints
def register_blueprints(app, application_package_name=None, blueprint_directory=None): """Register Flask blueprints on app object""" if not application_package_name: application_package_name = 'app' if not blueprint_directory: blueprint_directory = os.path.join(os.getcwd(), application_pack...
python
def register_blueprints(app, application_package_name=None, blueprint_directory=None): """Register Flask blueprints on app object""" if not application_package_name: application_package_name = 'app' if not blueprint_directory: blueprint_directory = os.path.join(os.getcwd(), application_pack...
[ "def", "register_blueprints", "(", "app", ",", "application_package_name", "=", "None", ",", "blueprint_directory", "=", "None", ")", ":", "if", "not", "application_package_name", ":", "application_package_name", "=", "'app'", "if", "not", "blueprint_directory", ":", ...
Register Flask blueprints on app object
[ "Register", "Flask", "blueprints", "on", "app", "object" ]
c117404691b66594f2cc84bff103ce893c633ecc
https://github.com/joelcolucci/flask-registerblueprints/blob/c117404691b66594f2cc84bff103ce893c633ecc/flask_registerblueprints/register.py#L7-L21
238,841
joelcolucci/flask-registerblueprints
flask_registerblueprints/register.py
get_child_directories
def get_child_directories(path): """Return names of immediate child directories""" if not _is_valid_directory(path): raise exceptions.InvalidDirectory entries = os.listdir(path) directory_names = [] for entry in entries: abs_entry_path = os.path.join(path, entry) if _is_val...
python
def get_child_directories(path): """Return names of immediate child directories""" if not _is_valid_directory(path): raise exceptions.InvalidDirectory entries = os.listdir(path) directory_names = [] for entry in entries: abs_entry_path = os.path.join(path, entry) if _is_val...
[ "def", "get_child_directories", "(", "path", ")", ":", "if", "not", "_is_valid_directory", "(", "path", ")", ":", "raise", "exceptions", ".", "InvalidDirectory", "entries", "=", "os", ".", "listdir", "(", "path", ")", "directory_names", "=", "[", "]", "for",...
Return names of immediate child directories
[ "Return", "names", "of", "immediate", "child", "directories" ]
c117404691b66594f2cc84bff103ce893c633ecc
https://github.com/joelcolucci/flask-registerblueprints/blob/c117404691b66594f2cc84bff103ce893c633ecc/flask_registerblueprints/register.py#L24-L37
238,842
JoshAshby/pyRedisORM
redisORM/redis_model.py
RedisKeys.delete
def delete(self): """ Deletes all the keys from redis along with emptying the objects internal `_data` dict, then deleting itself at the end of it all. """ redis_search_key = ":".join([self.namespace, self.key, "*"]) keys = self.conn.keys(redis_search_key) if keys...
python
def delete(self): """ Deletes all the keys from redis along with emptying the objects internal `_data` dict, then deleting itself at the end of it all. """ redis_search_key = ":".join([self.namespace, self.key, "*"]) keys = self.conn.keys(redis_search_key) if keys...
[ "def", "delete", "(", "self", ")", ":", "redis_search_key", "=", "\":\"", ".", "join", "(", "[", "self", ".", "namespace", ",", "self", ".", "key", ",", "\"*\"", "]", ")", "keys", "=", "self", ".", "conn", ".", "keys", "(", "redis_search_key", ")", ...
Deletes all the keys from redis along with emptying the objects internal `_data` dict, then deleting itself at the end of it all.
[ "Deletes", "all", "the", "keys", "from", "redis", "along", "with", "emptying", "the", "objects", "internal", "_data", "dict", "then", "deleting", "itself", "at", "the", "end", "of", "it", "all", "." ]
02b40889453638c5f0a1dc63df5279cfbfd1fe4c
https://github.com/JoshAshby/pyRedisORM/blob/02b40889453638c5f0a1dc63df5279cfbfd1fe4c/redisORM/redis_model.py#L102-L115
238,843
JoshAshby/pyRedisORM
redisORM/redis_model.py
RedisKeys.get
def get(self, part): """ Retrieves a part of the model from redis and stores it. :param part: The part of the model to retrieve. :raises RedisORMException: If the redis type is different from string or list (the only two supported types at this time.) """ red...
python
def get(self, part): """ Retrieves a part of the model from redis and stores it. :param part: The part of the model to retrieve. :raises RedisORMException: If the redis type is different from string or list (the only two supported types at this time.) """ red...
[ "def", "get", "(", "self", ",", "part", ")", ":", "redis_key", "=", "':'", ".", "join", "(", "[", "self", ".", "namespace", ",", "self", ".", "key", ",", "part", "]", ")", "objectType", "=", "self", ".", "conn", ".", "type", "(", "redis_key", ")"...
Retrieves a part of the model from redis and stores it. :param part: The part of the model to retrieve. :raises RedisORMException: If the redis type is different from string or list (the only two supported types at this time.)
[ "Retrieves", "a", "part", "of", "the", "model", "from", "redis", "and", "stores", "it", "." ]
02b40889453638c5f0a1dc63df5279cfbfd1fe4c
https://github.com/JoshAshby/pyRedisORM/blob/02b40889453638c5f0a1dc63df5279cfbfd1fe4c/redisORM/redis_model.py#L117-L135
238,844
wooga/play-deliver
playdeliver/inapp_product.py
upload
def upload(client, source_dir): """Upload inappproducts to play store.""" print('') print('upload inappproducs') print('---------------------') products_folder = os.path.join(source_dir, 'products') product_files = filter(os.path.isfile, list_dir_abspath(products_folder)) current_product_s...
python
def upload(client, source_dir): """Upload inappproducts to play store.""" print('') print('upload inappproducs') print('---------------------') products_folder = os.path.join(source_dir, 'products') product_files = filter(os.path.isfile, list_dir_abspath(products_folder)) current_product_s...
[ "def", "upload", "(", "client", ",", "source_dir", ")", ":", "print", "(", "''", ")", "print", "(", "'upload inappproducs'", ")", "print", "(", "'---------------------'", ")", "products_folder", "=", "os", ".", "path", ".", "join", "(", "source_dir", ",", ...
Upload inappproducts to play store.
[ "Upload", "inappproducts", "to", "play", "store", "." ]
9de0f35376f5342720b3a90bd3ca296b1f3a3f4c
https://github.com/wooga/play-deliver/blob/9de0f35376f5342720b3a90bd3ca296b1f3a3f4c/playdeliver/inapp_product.py#L7-L30
238,845
wooga/play-deliver
playdeliver/inapp_product.py
download
def download(client, target_dir): """Download inappproducts from play store.""" print('') print("download inappproducts") print('---------------------') products = client.list_inappproducts() for product in products: path = os.path.join(target_dir, 'products') del product['packa...
python
def download(client, target_dir): """Download inappproducts from play store.""" print('') print("download inappproducts") print('---------------------') products = client.list_inappproducts() for product in products: path = os.path.join(target_dir, 'products') del product['packa...
[ "def", "download", "(", "client", ",", "target_dir", ")", ":", "print", "(", "''", ")", "print", "(", "\"download inappproducts\"", ")", "print", "(", "'---------------------'", ")", "products", "=", "client", ".", "list_inappproducts", "(", ")", "for", "produ...
Download inappproducts from play store.
[ "Download", "inappproducts", "from", "play", "store", "." ]
9de0f35376f5342720b3a90bd3ca296b1f3a3f4c
https://github.com/wooga/play-deliver/blob/9de0f35376f5342720b3a90bd3ca296b1f3a3f4c/playdeliver/inapp_product.py#L33-L48
238,846
sbarham/dsrt
dsrt/application/utils.py
dataset_exists
def dataset_exists(dataset_name): '''If a dataset with the given name exists, return its absolute path; otherwise return None''' dataset_dir = os.path.join(LIB_DIR, 'datasets') dataset_path = os.path.join(dataset_dir, dataset_name) return dataset_path if os.path.isdir(dataset_path) else None
python
def dataset_exists(dataset_name): '''If a dataset with the given name exists, return its absolute path; otherwise return None''' dataset_dir = os.path.join(LIB_DIR, 'datasets') dataset_path = os.path.join(dataset_dir, dataset_name) return dataset_path if os.path.isdir(dataset_path) else None
[ "def", "dataset_exists", "(", "dataset_name", ")", ":", "dataset_dir", "=", "os", ".", "path", ".", "join", "(", "LIB_DIR", ",", "'datasets'", ")", "dataset_path", "=", "os", ".", "path", ".", "join", "(", "dataset_dir", ",", "dataset_name", ")", "return",...
If a dataset with the given name exists, return its absolute path; otherwise return None
[ "If", "a", "dataset", "with", "the", "given", "name", "exists", "return", "its", "absolute", "path", ";", "otherwise", "return", "None" ]
bc664739f2f52839461d3e72773b71146fd56a9a
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/dsrt/application/utils.py#L40-L45
238,847
realestate-com-au/dashmat
dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/modularinput/script.py
Script.run_script
def run_script(self, args, event_writer, input_stream): """Handles all the specifics of running a modular input :param args: List of command line arguments passed to this script. :param event_writer: An ``EventWriter`` object for writing events. :param input_stream: An input stream for ...
python
def run_script(self, args, event_writer, input_stream): """Handles all the specifics of running a modular input :param args: List of command line arguments passed to this script. :param event_writer: An ``EventWriter`` object for writing events. :param input_stream: An input stream for ...
[ "def", "run_script", "(", "self", ",", "args", ",", "event_writer", ",", "input_stream", ")", ":", "try", ":", "if", "len", "(", "args", ")", "==", "1", ":", "# This script is running as an input. Input definitions will be", "# passed on stdin as XML, and the script wil...
Handles all the specifics of running a modular input :param args: List of command line arguments passed to this script. :param event_writer: An ``EventWriter`` object for writing events. :param input_stream: An input stream for reading inputs. :returns: An integer to be used as the exit...
[ "Handles", "all", "the", "specifics", "of", "running", "a", "modular", "input" ]
433886e52698f0ddb9956f087b76041966c3bcd1
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/modularinput/script.py#L57-L108
238,848
cslarsen/elv
elv/elv.py
Parse.money
def money(s, thousand_sep=".", decimal_sep=","): """Converts money amount in string to a Decimal object. With the default arguments, the format is expected to be ``-38.500,00``, where dots separate thousands and comma the decimals. Args: thousand_sep: Separator for thousand...
python
def money(s, thousand_sep=".", decimal_sep=","): """Converts money amount in string to a Decimal object. With the default arguments, the format is expected to be ``-38.500,00``, where dots separate thousands and comma the decimals. Args: thousand_sep: Separator for thousand...
[ "def", "money", "(", "s", ",", "thousand_sep", "=", "\".\"", ",", "decimal_sep", "=", "\",\"", ")", ":", "s", "=", "s", ".", "replace", "(", "thousand_sep", ",", "\"\"", ")", "s", "=", "s", ".", "replace", "(", "decimal_sep", ",", "\".\"", ")", "re...
Converts money amount in string to a Decimal object. With the default arguments, the format is expected to be ``-38.500,00``, where dots separate thousands and comma the decimals. Args: thousand_sep: Separator for thousands. decimal_sep: Separator for decimals. ...
[ "Converts", "money", "amount", "in", "string", "to", "a", "Decimal", "object", "." ]
4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097
https://github.com/cslarsen/elv/blob/4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097/elv/elv.py#L45-L60
238,849
cslarsen/elv
elv/elv.py
Parse.csv_row_to_transaction
def csv_row_to_transaction(index, row, source_encoding="latin1", date_format="%d-%m-%Y", thousand_sep=".", decimal_sep=","): """ Parses a row of strings to a ``Transaction`` object. Args: index: The index of this row in the original CSV file. Used for sorting...
python
def csv_row_to_transaction(index, row, source_encoding="latin1", date_format="%d-%m-%Y", thousand_sep=".", decimal_sep=","): """ Parses a row of strings to a ``Transaction`` object. Args: index: The index of this row in the original CSV file. Used for sorting...
[ "def", "csv_row_to_transaction", "(", "index", ",", "row", ",", "source_encoding", "=", "\"latin1\"", ",", "date_format", "=", "\"%d-%m-%Y\"", ",", "thousand_sep", "=", "\".\"", ",", "decimal_sep", "=", "\",\"", ")", ":", "xfer", ",", "posted", ",", "message",...
Parses a row of strings to a ``Transaction`` object. Args: index: The index of this row in the original CSV file. Used for sorting ``Transaction``s by their order of appearance. row: The row containing strings for [transfer_date, posted_date, message, money_amou...
[ "Parses", "a", "row", "of", "strings", "to", "a", "Transaction", "object", "." ]
4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097
https://github.com/cslarsen/elv/blob/4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097/elv/elv.py#L70-L101
238,850
cslarsen/elv
elv/elv.py
Parse.csv_to_transactions
def csv_to_transactions(handle, source_encoding="latin1", date_format="%d-%m-%Y", thousand_sep=".", decimal_sep=","): """ Parses CSV data from stream and returns ``Transactions``. Args: index: The index of this row in the original CSV file. Used for sorting `...
python
def csv_to_transactions(handle, source_encoding="latin1", date_format="%d-%m-%Y", thousand_sep=".", decimal_sep=","): """ Parses CSV data from stream and returns ``Transactions``. Args: index: The index of this row in the original CSV file. Used for sorting `...
[ "def", "csv_to_transactions", "(", "handle", ",", "source_encoding", "=", "\"latin1\"", ",", "date_format", "=", "\"%d-%m-%Y\"", ",", "thousand_sep", "=", "\".\"", ",", "decimal_sep", "=", "\",\"", ")", ":", "trans", "=", "Transactions", "(", ")", "rows", "=",...
Parses CSV data from stream and returns ``Transactions``. Args: index: The index of this row in the original CSV file. Used for sorting ``Transaction``s by their order of appearance. row: The row containing strings for [transfer_date, posted_date, message, money...
[ "Parses", "CSV", "data", "from", "stream", "and", "returns", "Transactions", "." ]
4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097
https://github.com/cslarsen/elv/blob/4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097/elv/elv.py#L104-L134
238,851
cslarsen/elv
elv/elv.py
Transactions.to_sqlite3
def to_sqlite3(self, location=":memory:"): """Returns an SQLITE3 connection to a database containing the transactions.""" def decimal_to_sqlite3(n): return int(100*n) def sqlite3_to_decimal(s): return Decimal(s)/100 sqlite3.register_adapter(Decimal, dec...
python
def to_sqlite3(self, location=":memory:"): """Returns an SQLITE3 connection to a database containing the transactions.""" def decimal_to_sqlite3(n): return int(100*n) def sqlite3_to_decimal(s): return Decimal(s)/100 sqlite3.register_adapter(Decimal, dec...
[ "def", "to_sqlite3", "(", "self", ",", "location", "=", "\":memory:\"", ")", ":", "def", "decimal_to_sqlite3", "(", "n", ")", ":", "return", "int", "(", "100", "*", "n", ")", "def", "sqlite3_to_decimal", "(", "s", ")", ":", "return", "Decimal", "(", "s...
Returns an SQLITE3 connection to a database containing the transactions.
[ "Returns", "an", "SQLITE3", "connection", "to", "a", "database", "containing", "the", "transactions", "." ]
4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097
https://github.com/cslarsen/elv/blob/4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097/elv/elv.py#L286-L312
238,852
cslarsen/elv
elv/elv.py
Transactions.group_by
def group_by(self, key, field=lambda x: x.xfer): """Returns all transactions whose given ``field`` matches ``key``. Returns: A ``Transactions`` object. """ return Transactions([t for t in self.trans if field(t) == key])
python
def group_by(self, key, field=lambda x: x.xfer): """Returns all transactions whose given ``field`` matches ``key``. Returns: A ``Transactions`` object. """ return Transactions([t for t in self.trans if field(t) == key])
[ "def", "group_by", "(", "self", ",", "key", ",", "field", "=", "lambda", "x", ":", "x", ".", "xfer", ")", ":", "return", "Transactions", "(", "[", "t", "for", "t", "in", "self", ".", "trans", "if", "field", "(", "t", ")", "==", "key", "]", ")" ...
Returns all transactions whose given ``field`` matches ``key``. Returns: A ``Transactions`` object.
[ "Returns", "all", "transactions", "whose", "given", "field", "matches", "key", "." ]
4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097
https://github.com/cslarsen/elv/blob/4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097/elv/elv.py#L367-L373
238,853
cslarsen/elv
elv/elv.py
Transactions.range
def range(self, start_date=None, stop_date=None, field=lambda x: x.xfer): """Return a ``Transactions`` object in an inclusive date range. Args: start_date: A ``datetime.Date`` object that marks the inclusive start date for the range. stop_date: A ``datetime.Date`` o...
python
def range(self, start_date=None, stop_date=None, field=lambda x: x.xfer): """Return a ``Transactions`` object in an inclusive date range. Args: start_date: A ``datetime.Date`` object that marks the inclusive start date for the range. stop_date: A ``datetime.Date`` o...
[ "def", "range", "(", "self", ",", "start_date", "=", "None", ",", "stop_date", "=", "None", ",", "field", "=", "lambda", "x", ":", "x", ".", "xfer", ")", ":", "assert", "start_date", "<=", "stop_date", ",", "\"Start date must be earlier than end date.\"", "o...
Return a ``Transactions`` object in an inclusive date range. Args: start_date: A ``datetime.Date`` object that marks the inclusive start date for the range. stop_date: A ``datetime.Date`` object that marks the inclusive end date for the range. field...
[ "Return", "a", "Transactions", "object", "in", "an", "inclusive", "date", "range", "." ]
4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097
https://github.com/cslarsen/elv/blob/4bacf2093a0dcbe6a2b4d79be0fe339bb2b99097/elv/elv.py#L398-L427
238,854
emilydolson/avida-spatial-tools
avidaspatial/utils.py
agg_grid
def agg_grid(grid, agg=None): """ Many functions return a 2d list with a complex data type in each cell. For instance, grids representing environments have a set of resources, while reading in multiple data files at once will yield a list containing the values for that cell from each file. In order ...
python
def agg_grid(grid, agg=None): """ Many functions return a 2d list with a complex data type in each cell. For instance, grids representing environments have a set of resources, while reading in multiple data files at once will yield a list containing the values for that cell from each file. In order ...
[ "def", "agg_grid", "(", "grid", ",", "agg", "=", "None", ")", ":", "grid", "=", "deepcopy", "(", "grid", ")", "if", "agg", "is", "None", ":", "if", "type", "(", "grid", "[", "0", "]", "[", "0", "]", ")", "is", "list", "and", "type", "(", "gri...
Many functions return a 2d list with a complex data type in each cell. For instance, grids representing environments have a set of resources, while reading in multiple data files at once will yield a list containing the values for that cell from each file. In order to visualize these data types it is he...
[ "Many", "functions", "return", "a", "2d", "list", "with", "a", "complex", "data", "type", "in", "each", "cell", ".", "For", "instance", "grids", "representing", "environments", "have", "a", "set", "of", "resources", "while", "reading", "in", "multiple", "dat...
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L66-L95
238,855
emilydolson/avida-spatial-tools
avidaspatial/utils.py
flatten_array
def flatten_array(grid): """ Takes a multi-dimensional array and returns a 1 dimensional array with the same contents. """ grid = [grid[i][j] for i in range(len(grid)) for j in range(len(grid[i]))] while type(grid[0]) is list: grid = flatten_array(grid) return grid
python
def flatten_array(grid): """ Takes a multi-dimensional array and returns a 1 dimensional array with the same contents. """ grid = [grid[i][j] for i in range(len(grid)) for j in range(len(grid[i]))] while type(grid[0]) is list: grid = flatten_array(grid) return grid
[ "def", "flatten_array", "(", "grid", ")", ":", "grid", "=", "[", "grid", "[", "i", "]", "[", "j", "]", "for", "i", "in", "range", "(", "len", "(", "grid", ")", ")", "for", "j", "in", "range", "(", "len", "(", "grid", "[", "i", "]", ")", ")"...
Takes a multi-dimensional array and returns a 1 dimensional array with the same contents.
[ "Takes", "a", "multi", "-", "dimensional", "array", "and", "returns", "a", "1", "dimensional", "array", "with", "the", "same", "contents", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L113-L121
238,856
emilydolson/avida-spatial-tools
avidaspatial/utils.py
prepend_zeros_to_lists
def prepend_zeros_to_lists(ls): """ Takes a list of lists and appends 0s to the beggining of each sub_list until they are all the same length. Used for sign-extending binary numbers. """ longest = max([len(l) for l in ls]) for i in range(len(ls)): while len(ls[i]) < longest: ...
python
def prepend_zeros_to_lists(ls): """ Takes a list of lists and appends 0s to the beggining of each sub_list until they are all the same length. Used for sign-extending binary numbers. """ longest = max([len(l) for l in ls]) for i in range(len(ls)): while len(ls[i]) < longest: ...
[ "def", "prepend_zeros_to_lists", "(", "ls", ")", ":", "longest", "=", "max", "(", "[", "len", "(", "l", ")", "for", "l", "in", "ls", "]", ")", "for", "i", "in", "range", "(", "len", "(", "ls", ")", ")", ":", "while", "len", "(", "ls", "[", "i...
Takes a list of lists and appends 0s to the beggining of each sub_list until they are all the same length. Used for sign-extending binary numbers.
[ "Takes", "a", "list", "of", "lists", "and", "appends", "0s", "to", "the", "beggining", "of", "each", "sub_list", "until", "they", "are", "all", "the", "same", "length", ".", "Used", "for", "sign", "-", "extending", "binary", "numbers", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L124-L133
238,857
emilydolson/avida-spatial-tools
avidaspatial/utils.py
squared_toroidal_dist
def squared_toroidal_dist(p1, p2, world_size=(60, 60)): """ Separated out because sqrt has a lot of overhead """ halfx = world_size[0]/2.0 if world_size[0] == world_size[1]: halfy = halfx else: halfy = world_size[1]/2.0 deltax = p1[0] - p2[0] if deltax < -halfx: ...
python
def squared_toroidal_dist(p1, p2, world_size=(60, 60)): """ Separated out because sqrt has a lot of overhead """ halfx = world_size[0]/2.0 if world_size[0] == world_size[1]: halfy = halfx else: halfy = world_size[1]/2.0 deltax = p1[0] - p2[0] if deltax < -halfx: ...
[ "def", "squared_toroidal_dist", "(", "p1", ",", "p2", ",", "world_size", "=", "(", "60", ",", "60", ")", ")", ":", "halfx", "=", "world_size", "[", "0", "]", "/", "2.0", "if", "world_size", "[", "0", "]", "==", "world_size", "[", "1", "]", ":", "...
Separated out because sqrt has a lot of overhead
[ "Separated", "out", "because", "sqrt", "has", "a", "lot", "of", "overhead" ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L143-L165
238,858
emilydolson/avida-spatial-tools
avidaspatial/utils.py
phenotype_to_res_set
def phenotype_to_res_set(phenotype, resources): """ Converts a binary string to a set containing the resources indicated by the bits in the string. Inputs: phenotype - a binary string resources - a list of string indicating which resources correspond to which indices...
python
def phenotype_to_res_set(phenotype, resources): """ Converts a binary string to a set containing the resources indicated by the bits in the string. Inputs: phenotype - a binary string resources - a list of string indicating which resources correspond to which indices...
[ "def", "phenotype_to_res_set", "(", "phenotype", ",", "resources", ")", ":", "assert", "(", "phenotype", "[", "0", ":", "2", "]", "==", "\"0b\"", ")", "phenotype", "=", "phenotype", "[", "2", ":", "]", "# Fill in leading zeroes", "while", "len", "(", "phen...
Converts a binary string to a set containing the resources indicated by the bits in the string. Inputs: phenotype - a binary string resources - a list of string indicating which resources correspond to which indices of the phenotype returns: A set of strings indicating ...
[ "Converts", "a", "binary", "string", "to", "a", "set", "containing", "the", "resources", "indicated", "by", "the", "bits", "in", "the", "string", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L217-L241
238,859
emilydolson/avida-spatial-tools
avidaspatial/utils.py
res_set_to_phenotype
def res_set_to_phenotype(res_set, full_list): """ Converts a set of strings indicating resources to a binary string where the positions of 1s indicate which resources are present. Inputs: res_set - a set of strings indicating which resources are present full_list - a list of strings indicat...
python
def res_set_to_phenotype(res_set, full_list): """ Converts a set of strings indicating resources to a binary string where the positions of 1s indicate which resources are present. Inputs: res_set - a set of strings indicating which resources are present full_list - a list of strings indicat...
[ "def", "res_set_to_phenotype", "(", "res_set", ",", "full_list", ")", ":", "full_list", "=", "list", "(", "full_list", ")", "phenotype", "=", "len", "(", "full_list", ")", "*", "[", "\"0\"", "]", "for", "i", "in", "range", "(", "len", "(", "full_list", ...
Converts a set of strings indicating resources to a binary string where the positions of 1s indicate which resources are present. Inputs: res_set - a set of strings indicating which resources are present full_list - a list of strings indicating all resources which could coul...
[ "Converts", "a", "set", "of", "strings", "indicating", "resources", "to", "a", "binary", "string", "where", "the", "positions", "of", "1s", "indicate", "which", "resources", "are", "present", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L244-L269
238,860
emilydolson/avida-spatial-tools
avidaspatial/utils.py
weighted_hamming
def weighted_hamming(b1, b2): """ Hamming distance that emphasizes differences earlier in strings. """ assert(len(b1) == len(b2)) hamming = 0 for i in range(len(b1)): if b1[i] != b2[i]: # differences at more significant (leftward) bits # are more important ...
python
def weighted_hamming(b1, b2): """ Hamming distance that emphasizes differences earlier in strings. """ assert(len(b1) == len(b2)) hamming = 0 for i in range(len(b1)): if b1[i] != b2[i]: # differences at more significant (leftward) bits # are more important ...
[ "def", "weighted_hamming", "(", "b1", ",", "b2", ")", ":", "assert", "(", "len", "(", "b1", ")", "==", "len", "(", "b2", ")", ")", "hamming", "=", "0", "for", "i", "in", "range", "(", "len", "(", "b1", ")", ")", ":", "if", "b1", "[", "i", "...
Hamming distance that emphasizes differences earlier in strings.
[ "Hamming", "distance", "that", "emphasizes", "differences", "earlier", "in", "strings", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L272-L285
238,861
emilydolson/avida-spatial-tools
avidaspatial/utils.py
n_tasks
def n_tasks(dec_num): """ Takes a decimal number as input and returns the number of ones in the binary representation. This translates to the number of tasks being done by an organism with a phenotype represented as a decimal number. """ bitstring = "" try: bitstring = dec_num[2:...
python
def n_tasks(dec_num): """ Takes a decimal number as input and returns the number of ones in the binary representation. This translates to the number of tasks being done by an organism with a phenotype represented as a decimal number. """ bitstring = "" try: bitstring = dec_num[2:...
[ "def", "n_tasks", "(", "dec_num", ")", ":", "bitstring", "=", "\"\"", "try", ":", "bitstring", "=", "dec_num", "[", "2", ":", "]", "except", ":", "bitstring", "=", "bin", "(", "int", "(", "dec_num", ")", ")", "[", "2", ":", "]", "# cut off 0b", "# ...
Takes a decimal number as input and returns the number of ones in the binary representation. This translates to the number of tasks being done by an organism with a phenotype represented as a decimal number.
[ "Takes", "a", "decimal", "number", "as", "input", "and", "returns", "the", "number", "of", "ones", "in", "the", "binary", "representation", ".", "This", "translates", "to", "the", "number", "of", "tasks", "being", "done", "by", "an", "organism", "with", "a...
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L288-L301
238,862
emilydolson/avida-spatial-tools
avidaspatial/utils.py
convert_to_pysal
def convert_to_pysal(data): """ Pysal expects a distance matrix, and data formatted in a numpy array. This functions takes a data grid and returns those things. """ w = pysal.lat2W(len(data[0]), len(data)) data = np.array(data) data = np.reshape(data, (len(data)*len(data[0]), 1)) return ...
python
def convert_to_pysal(data): """ Pysal expects a distance matrix, and data formatted in a numpy array. This functions takes a data grid and returns those things. """ w = pysal.lat2W(len(data[0]), len(data)) data = np.array(data) data = np.reshape(data, (len(data)*len(data[0]), 1)) return ...
[ "def", "convert_to_pysal", "(", "data", ")", ":", "w", "=", "pysal", ".", "lat2W", "(", "len", "(", "data", "[", "0", "]", ")", ",", "len", "(", "data", ")", ")", "data", "=", "np", ".", "array", "(", "data", ")", "data", "=", "np", ".", "res...
Pysal expects a distance matrix, and data formatted in a numpy array. This functions takes a data grid and returns those things.
[ "Pysal", "expects", "a", "distance", "matrix", "and", "data", "formatted", "in", "a", "numpy", "array", ".", "This", "functions", "takes", "a", "data", "grid", "and", "returns", "those", "things", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L304-L312
238,863
emilydolson/avida-spatial-tools
avidaspatial/utils.py
median
def median(ls): """ Takes a list and returns the median. """ ls = sorted(ls) return ls[int(floor(len(ls)/2.0))]
python
def median(ls): """ Takes a list and returns the median. """ ls = sorted(ls) return ls[int(floor(len(ls)/2.0))]
[ "def", "median", "(", "ls", ")", ":", "ls", "=", "sorted", "(", "ls", ")", "return", "ls", "[", "int", "(", "floor", "(", "len", "(", "ls", ")", "/", "2.0", ")", ")", "]" ]
Takes a list and returns the median.
[ "Takes", "a", "list", "and", "returns", "the", "median", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L333-L338
238,864
emilydolson/avida-spatial-tools
avidaspatial/utils.py
string_avg
def string_avg(strings, binary=True): """ Takes a list of strings of equal length and returns a string containing the most common value from each index in the string. Optional argument: binary - a boolean indicating whether or not to treat strings as binary numbers (fill in leading zeros if lengths...
python
def string_avg(strings, binary=True): """ Takes a list of strings of equal length and returns a string containing the most common value from each index in the string. Optional argument: binary - a boolean indicating whether or not to treat strings as binary numbers (fill in leading zeros if lengths...
[ "def", "string_avg", "(", "strings", ",", "binary", "=", "True", ")", ":", "if", "binary", ":", "# Assume this is a binary number and fill leading zeros", "strings", "=", "deepcopy", "(", "strings", ")", "longest", "=", "len", "(", "max", "(", "strings", ",", ...
Takes a list of strings of equal length and returns a string containing the most common value from each index in the string. Optional argument: binary - a boolean indicating whether or not to treat strings as binary numbers (fill in leading zeros if lengths differ).
[ "Takes", "a", "list", "of", "strings", "of", "equal", "length", "and", "returns", "a", "string", "containing", "the", "most", "common", "value", "from", "each", "index", "in", "the", "string", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L341-L366
238,865
emilydolson/avida-spatial-tools
avidaspatial/utils.py
get_world_dimensions
def get_world_dimensions(gridfile, delim=" "): """ This function takes the name of a file in grid_task format and returns the dimensions of the world it represents. """ infile = open(gridfile) lines = infile.readlines() infile.close() world_x = len(lines[0].strip().split(delim)) worl...
python
def get_world_dimensions(gridfile, delim=" "): """ This function takes the name of a file in grid_task format and returns the dimensions of the world it represents. """ infile = open(gridfile) lines = infile.readlines() infile.close() world_x = len(lines[0].strip().split(delim)) worl...
[ "def", "get_world_dimensions", "(", "gridfile", ",", "delim", "=", "\" \"", ")", ":", "infile", "=", "open", "(", "gridfile", ")", "lines", "=", "infile", ".", "readlines", "(", ")", "infile", ".", "close", "(", ")", "world_x", "=", "len", "(", "lines"...
This function takes the name of a file in grid_task format and returns the dimensions of the world it represents.
[ "This", "function", "takes", "the", "name", "of", "a", "file", "in", "grid_task", "format", "and", "returns", "the", "dimensions", "of", "the", "world", "it", "represents", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/utils.py#L369-L379
238,866
Carreau/Love
love/flit.py
modify_config
def modify_config(path): """ Context manager to modify a flit config file. Will read the config file, validate the config, yield the config object, validate and write back the config to the file on exit """ if isinstance(path, str): path = Path(path) config = _read_pkg_ini(path) ...
python
def modify_config(path): """ Context manager to modify a flit config file. Will read the config file, validate the config, yield the config object, validate and write back the config to the file on exit """ if isinstance(path, str): path = Path(path) config = _read_pkg_ini(path) ...
[ "def", "modify_config", "(", "path", ")", ":", "if", "isinstance", "(", "path", ",", "str", ")", ":", "path", "=", "Path", "(", "path", ")", "config", "=", "_read_pkg_ini", "(", "path", ")", "_validate_config", "(", "config", ",", "path", ")", "# don't...
Context manager to modify a flit config file. Will read the config file, validate the config, yield the config object, validate and write back the config to the file on exit
[ "Context", "manager", "to", "modify", "a", "flit", "config", "file", "." ]
a85d1139b32ee926b3bee73447e32e89b86983ba
https://github.com/Carreau/Love/blob/a85d1139b32ee926b3bee73447e32e89b86983ba/love/flit.py#L11-L28
238,867
6809/dragonlib
dragonlib/core/basic_parser.py
ParsedBASIC.pformat
def pformat(self): ''' Manually pformat to force using """...""" and supress escaping apostrophe ''' result = "{\n" indent1 = " " * 4 indent2 = " " * 8 for line_no, code_objects in sorted(self.items()): result += '%s%i: [\n' % (indent1, line_no) ...
python
def pformat(self): ''' Manually pformat to force using """...""" and supress escaping apostrophe ''' result = "{\n" indent1 = " " * 4 indent2 = " " * 8 for line_no, code_objects in sorted(self.items()): result += '%s%i: [\n' % (indent1, line_no) ...
[ "def", "pformat", "(", "self", ")", ":", "result", "=", "\"{\\n\"", "indent1", "=", "\" \"", "*", "4", "indent2", "=", "\" \"", "*", "8", "for", "line_no", ",", "code_objects", "in", "sorted", "(", "self", ".", "items", "(", ")", ")", ":", "result", ...
Manually pformat to force using """...""" and supress escaping apostrophe
[ "Manually", "pformat", "to", "force", "using", "...", "and", "supress", "escaping", "apostrophe" ]
faa4011e76c5857db96efdb4199e2fd49711e999
https://github.com/6809/dragonlib/blob/faa4011e76c5857db96efdb4199e2fd49711e999/dragonlib/core/basic_parser.py#L65-L81
238,868
6809/dragonlib
dragonlib/core/basic_parser.py
BASICParser._parse_string
def _parse_string(self, line): """ Consume the complete string until next " or \n """ log.debug("*** parse STRING: >>>%r<<<", line) parts = self.regex_split_string.split(line, maxsplit=1) if len(parts) == 1: # end return parts[0], None pre, match, po...
python
def _parse_string(self, line): """ Consume the complete string until next " or \n """ log.debug("*** parse STRING: >>>%r<<<", line) parts = self.regex_split_string.split(line, maxsplit=1) if len(parts) == 1: # end return parts[0], None pre, match, po...
[ "def", "_parse_string", "(", "self", ",", "line", ")", ":", "log", ".", "debug", "(", "\"*** parse STRING: >>>%r<<<\"", ",", "line", ")", "parts", "=", "self", ".", "regex_split_string", ".", "split", "(", "line", ",", "maxsplit", "=", "1", ")", "if", "l...
Consume the complete string until next " or \n
[ "Consume", "the", "complete", "string", "until", "next", "or", "\\", "n" ]
faa4011e76c5857db96efdb4199e2fd49711e999
https://github.com/6809/dragonlib/blob/faa4011e76c5857db96efdb4199e2fd49711e999/dragonlib/core/basic_parser.py#L162-L177
238,869
6809/dragonlib
dragonlib/core/basic_parser.py
BASICParser._parse_code
def _parse_code(self, line): """ parse the given BASIC line and branch into DATA, String and consume a complete Comment """ log.debug("*** parse CODE: >>>%r<<<", line) parts = self.regex_split_all.split(line, maxsplit=1) if len(parts) == 1: # end self...
python
def _parse_code(self, line): """ parse the given BASIC line and branch into DATA, String and consume a complete Comment """ log.debug("*** parse CODE: >>>%r<<<", line) parts = self.regex_split_all.split(line, maxsplit=1) if len(parts) == 1: # end self...
[ "def", "_parse_code", "(", "self", ",", "line", ")", ":", "log", ".", "debug", "(", "\"*** parse CODE: >>>%r<<<\"", ",", "line", ")", "parts", "=", "self", ".", "regex_split_all", ".", "split", "(", "line", ",", "maxsplit", "=", "1", ")", "if", "len", ...
parse the given BASIC line and branch into DATA, String and consume a complete Comment
[ "parse", "the", "given", "BASIC", "line", "and", "branch", "into", "DATA", "String", "and", "consume", "a", "complete", "Comment" ]
faa4011e76c5857db96efdb4199e2fd49711e999
https://github.com/6809/dragonlib/blob/faa4011e76c5857db96efdb4199e2fd49711e999/dragonlib/core/basic_parser.py#L179-L218
238,870
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Closer.py
Closer.close
def close(correlation_id, components): """ Closes multiple components. To be closed components must implement [[ICloseable]] interface. If they don't the call to this method has no effect. :param correlation_id: (optional) transaction id to trace execution through call chain. ...
python
def close(correlation_id, components): """ Closes multiple components. To be closed components must implement [[ICloseable]] interface. If they don't the call to this method has no effect. :param correlation_id: (optional) transaction id to trace execution through call chain. ...
[ "def", "close", "(", "correlation_id", ",", "components", ")", ":", "if", "components", "==", "None", ":", "return", "for", "component", "in", "components", ":", "Closer", ".", "close_one", "(", "correlation_id", ",", "component", ")" ]
Closes multiple components. To be closed components must implement [[ICloseable]] interface. If they don't the call to this method has no effect. :param correlation_id: (optional) transaction id to trace execution through call chain. :param components: the list of components that are ...
[ "Closes", "multiple", "components", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Closer.py#L35-L50
238,871
salsita/flask-ecstatic
flask_ecstatic.py
add
def add(app, url = None, path = None, endpoint=None, decorate=None, index='index.html', **options): """Adds static files endpoint with optional directory index.""" url = url or app.static_url_path or '' path = os.path.abspath(path or app.static_folder or '.') endpoint = endpoint or 'static_' + os.path....
python
def add(app, url = None, path = None, endpoint=None, decorate=None, index='index.html', **options): """Adds static files endpoint with optional directory index.""" url = url or app.static_url_path or '' path = os.path.abspath(path or app.static_folder or '.') endpoint = endpoint or 'static_' + os.path....
[ "def", "add", "(", "app", ",", "url", "=", "None", ",", "path", "=", "None", ",", "endpoint", "=", "None", ",", "decorate", "=", "None", ",", "index", "=", "'index.html'", ",", "*", "*", "options", ")", ":", "url", "=", "url", "or", "app", ".", ...
Adds static files endpoint with optional directory index.
[ "Adds", "static", "files", "endpoint", "with", "optional", "directory", "index", "." ]
27f67f36eee3afe5855958e4187ff1268d7a5e69
https://github.com/salsita/flask-ecstatic/blob/27f67f36eee3afe5855958e4187ff1268d7a5e69/flask_ecstatic.py#L19-L65
238,872
6809/dragonlib
dragonlib/api.py
BaseAPI.program_dump2ascii_lines
def program_dump2ascii_lines(self, dump, program_start=None): """ convert a memory dump of a tokensized BASIC listing into ASCII listing list. """ dump = bytearray(dump) # assert isinstance(dump, bytearray) if program_start is None: program_start = se...
python
def program_dump2ascii_lines(self, dump, program_start=None): """ convert a memory dump of a tokensized BASIC listing into ASCII listing list. """ dump = bytearray(dump) # assert isinstance(dump, bytearray) if program_start is None: program_start = se...
[ "def", "program_dump2ascii_lines", "(", "self", ",", "dump", ",", "program_start", "=", "None", ")", ":", "dump", "=", "bytearray", "(", "dump", ")", "# assert isinstance(dump, bytearray)", "if", "program_start", "is", "None", ":", "program_start", "=", "self", ...
convert a memory dump of a tokensized BASIC listing into ASCII listing list.
[ "convert", "a", "memory", "dump", "of", "a", "tokensized", "BASIC", "listing", "into", "ASCII", "listing", "list", "." ]
faa4011e76c5857db96efdb4199e2fd49711e999
https://github.com/6809/dragonlib/blob/faa4011e76c5857db96efdb4199e2fd49711e999/dragonlib/api.py#L43-L53
238,873
6809/dragonlib
dragonlib/api.py
BaseAPI.ascii_listing2program_dump
def ascii_listing2program_dump(self, basic_program_ascii, program_start=None): """ convert a ASCII BASIC program listing into tokens. This tokens list can be used to insert it into the Emulator RAM. """ if program_start is None: program_start = self.DEFAULT_PR...
python
def ascii_listing2program_dump(self, basic_program_ascii, program_start=None): """ convert a ASCII BASIC program listing into tokens. This tokens list can be used to insert it into the Emulator RAM. """ if program_start is None: program_start = self.DEFAULT_PR...
[ "def", "ascii_listing2program_dump", "(", "self", ",", "basic_program_ascii", ",", "program_start", "=", "None", ")", ":", "if", "program_start", "is", "None", ":", "program_start", "=", "self", ".", "DEFAULT_PROGRAM_START", "basic_lines", "=", "self", ".", "ascii...
convert a ASCII BASIC program listing into tokens. This tokens list can be used to insert it into the Emulator RAM.
[ "convert", "a", "ASCII", "BASIC", "program", "listing", "into", "tokens", ".", "This", "tokens", "list", "can", "be", "used", "to", "insert", "it", "into", "the", "Emulator", "RAM", "." ]
faa4011e76c5857db96efdb4199e2fd49711e999
https://github.com/6809/dragonlib/blob/faa4011e76c5857db96efdb4199e2fd49711e999/dragonlib/api.py#L76-L91
238,874
flo-compbio/goparser
goparser/annotation.py
GOAnnotation.get_gaf_format
def get_gaf_format(self): """Return a GAF 2.0-compatible string representation of the annotation. Parameters ---------- Returns ------- str The formatted string. """ sep = '\t' return sep.join( [self.gene, self.db_ref, sel...
python
def get_gaf_format(self): """Return a GAF 2.0-compatible string representation of the annotation. Parameters ---------- Returns ------- str The formatted string. """ sep = '\t' return sep.join( [self.gene, self.db_ref, sel...
[ "def", "get_gaf_format", "(", "self", ")", ":", "sep", "=", "'\\t'", "return", "sep", ".", "join", "(", "[", "self", ".", "gene", ",", "self", ".", "db_ref", ",", "self", ".", "term", ".", "id", ",", "self", ".", "evidence", ",", "'|'", ".", "joi...
Return a GAF 2.0-compatible string representation of the annotation. Parameters ---------- Returns ------- str The formatted string.
[ "Return", "a", "GAF", "2", ".", "0", "-", "compatible", "string", "representation", "of", "the", "annotation", "." ]
5e27d7d04a26a70a1d9dc113357041abff72be3f
https://github.com/flo-compbio/goparser/blob/5e27d7d04a26a70a1d9dc113357041abff72be3f/goparser/annotation.py#L199-L213
238,875
twneale/hercules
hercules/stream.py
Stream.ahead
def ahead(self, i, j=None): '''Raising stopiteration with end the parse. ''' if j is None: return self._stream[self.i + i] else: return self._stream[self.i + i: self.i + j]
python
def ahead(self, i, j=None): '''Raising stopiteration with end the parse. ''' if j is None: return self._stream[self.i + i] else: return self._stream[self.i + i: self.i + j]
[ "def", "ahead", "(", "self", ",", "i", ",", "j", "=", "None", ")", ":", "if", "j", "is", "None", ":", "return", "self", ".", "_stream", "[", "self", ".", "i", "+", "i", "]", "else", ":", "return", "self", ".", "_stream", "[", "self", ".", "i"...
Raising stopiteration with end the parse.
[ "Raising", "stopiteration", "with", "end", "the", "parse", "." ]
cd61582ef7e593093e9b28b56798df4203d1467a
https://github.com/twneale/hercules/blob/cd61582ef7e593093e9b28b56798df4203d1467a/hercules/stream.py#L63-L69
238,876
genesluder/python-agiletixapi
agiletixapi/utils.py
method_name
def method_name(func): """Method wrapper that adds the name of the method being called to its arguments list in Pascal case """ @wraps(func) def _method_name(*args, **kwargs): name = to_pascal_case(func.__name__) return func(name=name, *args, **kwargs) return _method_name
python
def method_name(func): """Method wrapper that adds the name of the method being called to its arguments list in Pascal case """ @wraps(func) def _method_name(*args, **kwargs): name = to_pascal_case(func.__name__) return func(name=name, *args, **kwargs) return _method_name
[ "def", "method_name", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "_method_name", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "name", "=", "to_pascal_case", "(", "func", ".", "__name__", ")", "return", "func", "(", "name", ...
Method wrapper that adds the name of the method being called to its arguments list in Pascal case
[ "Method", "wrapper", "that", "adds", "the", "name", "of", "the", "method", "being", "called", "to", "its", "arguments", "list", "in", "Pascal", "case" ]
a7a3907414cd5623f4542b03cb970862368a894a
https://github.com/genesluder/python-agiletixapi/blob/a7a3907414cd5623f4542b03cb970862368a894a/agiletixapi/utils.py#L53-L61
238,877
genesluder/python-agiletixapi
agiletixapi/utils.py
to_pascal_case
def to_pascal_case(s): """Transform underscore separated string to pascal case """ return re.sub(r'(?!^)_([a-zA-Z])', lambda m: m.group(1).upper(), s.capitalize())
python
def to_pascal_case(s): """Transform underscore separated string to pascal case """ return re.sub(r'(?!^)_([a-zA-Z])', lambda m: m.group(1).upper(), s.capitalize())
[ "def", "to_pascal_case", "(", "s", ")", ":", "return", "re", ".", "sub", "(", "r'(?!^)_([a-zA-Z])'", ",", "lambda", "m", ":", "m", ".", "group", "(", "1", ")", ".", "upper", "(", ")", ",", "s", ".", "capitalize", "(", ")", ")" ]
Transform underscore separated string to pascal case
[ "Transform", "underscore", "separated", "string", "to", "pascal", "case" ]
a7a3907414cd5623f4542b03cb970862368a894a
https://github.com/genesluder/python-agiletixapi/blob/a7a3907414cd5623f4542b03cb970862368a894a/agiletixapi/utils.py#L79-L83
238,878
genesluder/python-agiletixapi
agiletixapi/utils.py
to_underscore
def to_underscore(s): """Transform camel or pascal case to underscore separated string """ return re.sub( r'(?!^)([A-Z]+)', lambda m: "_{0}".format(m.group(1).lower()), re.sub(r'(?!^)([A-Z]{1}[a-z]{1})', lambda m: "_{0}".format(m.group(1).lower()), s) ).lower()
python
def to_underscore(s): """Transform camel or pascal case to underscore separated string """ return re.sub( r'(?!^)([A-Z]+)', lambda m: "_{0}".format(m.group(1).lower()), re.sub(r'(?!^)([A-Z]{1}[a-z]{1})', lambda m: "_{0}".format(m.group(1).lower()), s) ).lower()
[ "def", "to_underscore", "(", "s", ")", ":", "return", "re", ".", "sub", "(", "r'(?!^)([A-Z]+)'", ",", "lambda", "m", ":", "\"_{0}\"", ".", "format", "(", "m", ".", "group", "(", "1", ")", ".", "lower", "(", ")", ")", ",", "re", ".", "sub", "(", ...
Transform camel or pascal case to underscore separated string
[ "Transform", "camel", "or", "pascal", "case", "to", "underscore", "separated", "string" ]
a7a3907414cd5623f4542b03cb970862368a894a
https://github.com/genesluder/python-agiletixapi/blob/a7a3907414cd5623f4542b03cb970862368a894a/agiletixapi/utils.py#L86-L94
238,879
pip-services3-python/pip-services3-commons-python
pip_services3_commons/commands/Event.py
Event.notify
def notify(self, correlation_id, args): """ Fires this event and notifies all registred listeners. :param correlation_id: (optional) transaction id to trace execution through call chain. :param args: the parameters to raise this event with. """ for listener in self._lis...
python
def notify(self, correlation_id, args): """ Fires this event and notifies all registred listeners. :param correlation_id: (optional) transaction id to trace execution through call chain. :param args: the parameters to raise this event with. """ for listener in self._lis...
[ "def", "notify", "(", "self", ",", "correlation_id", ",", "args", ")", ":", "for", "listener", "in", "self", ".", "_listeners", ":", "try", ":", "listener", ".", "on_event", "(", "correlation_id", ",", "self", ",", "args", ")", "except", "Exception", "as...
Fires this event and notifies all registred listeners. :param correlation_id: (optional) transaction id to trace execution through call chain. :param args: the parameters to raise this event with.
[ "Fires", "this", "event", "and", "notifies", "all", "registred", "listeners", "." ]
22cbbb3e91e49717f65c083d36147fdb07ba9e3b
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/commands/Event.py#L79-L95
238,880
Bystroushaak/pyDHTMLParser
src/dhtmlparser/htmlelement/html_parser.py
HTMLParser._parseIsTag
def _parseIsTag(self): """ Detect whether the element is HTML tag or not. Result is saved to the :attr:`_istag` property. """ el = self._element self._istag = el and el[0] == "<" and el[-1] == ">"
python
def _parseIsTag(self): """ Detect whether the element is HTML tag or not. Result is saved to the :attr:`_istag` property. """ el = self._element self._istag = el and el[0] == "<" and el[-1] == ">"
[ "def", "_parseIsTag", "(", "self", ")", ":", "el", "=", "self", ".", "_element", "self", ".", "_istag", "=", "el", "and", "el", "[", "0", "]", "==", "\"<\"", "and", "el", "[", "-", "1", "]", "==", "\">\"" ]
Detect whether the element is HTML tag or not. Result is saved to the :attr:`_istag` property.
[ "Detect", "whether", "the", "element", "is", "HTML", "tag", "or", "not", "." ]
4756f93dd048500b038ece2323fe26e46b6bfdea
https://github.com/Bystroushaak/pyDHTMLParser/blob/4756f93dd048500b038ece2323fe26e46b6bfdea/src/dhtmlparser/htmlelement/html_parser.py#L162-L169
238,881
Bystroushaak/pyDHTMLParser
src/dhtmlparser/htmlelement/html_parser.py
HTMLParser._parseIsComment
def _parseIsComment(self): """ Detect whether the element is HTML comment or not. Result is saved to the :attr:`_iscomment` property. """ self._iscomment = ( self._element.startswith("<!--") and self._element.endswith("-->") )
python
def _parseIsComment(self): """ Detect whether the element is HTML comment or not. Result is saved to the :attr:`_iscomment` property. """ self._iscomment = ( self._element.startswith("<!--") and self._element.endswith("-->") )
[ "def", "_parseIsComment", "(", "self", ")", ":", "self", ".", "_iscomment", "=", "(", "self", ".", "_element", ".", "startswith", "(", "\"<!--\"", ")", "and", "self", ".", "_element", ".", "endswith", "(", "\"-->\"", ")", ")" ]
Detect whether the element is HTML comment or not. Result is saved to the :attr:`_iscomment` property.
[ "Detect", "whether", "the", "element", "is", "HTML", "comment", "or", "not", "." ]
4756f93dd048500b038ece2323fe26e46b6bfdea
https://github.com/Bystroushaak/pyDHTMLParser/blob/4756f93dd048500b038ece2323fe26e46b6bfdea/src/dhtmlparser/htmlelement/html_parser.py#L197-L205
238,882
Bystroushaak/pyDHTMLParser
src/dhtmlparser/htmlelement/html_parser.py
HTMLParser._parseTagName
def _parseTagName(self): """ Parse name of the tag. Result is saved to the :attr:`_tagname` property. """ for el in self._element.split(): el = el.replace("/", "").replace("<", "").replace(">", "") if el.strip(): self._tagname = el.rstrip...
python
def _parseTagName(self): """ Parse name of the tag. Result is saved to the :attr:`_tagname` property. """ for el in self._element.split(): el = el.replace("/", "").replace("<", "").replace(">", "") if el.strip(): self._tagname = el.rstrip...
[ "def", "_parseTagName", "(", "self", ")", ":", "for", "el", "in", "self", ".", "_element", ".", "split", "(", ")", ":", "el", "=", "el", ".", "replace", "(", "\"/\"", ",", "\"\"", ")", ".", "replace", "(", "\"<\"", ",", "\"\"", ")", ".", "replace...
Parse name of the tag. Result is saved to the :attr:`_tagname` property.
[ "Parse", "name", "of", "the", "tag", "." ]
4756f93dd048500b038ece2323fe26e46b6bfdea
https://github.com/Bystroushaak/pyDHTMLParser/blob/4756f93dd048500b038ece2323fe26e46b6bfdea/src/dhtmlparser/htmlelement/html_parser.py#L207-L218
238,883
Bystroushaak/pyDHTMLParser
src/dhtmlparser/htmlelement/html_parser.py
HTMLParser._parseParams
def _parseParams(self): """ Parse parameters from their string HTML representation to dictionary. Result is saved to the :attr:`params` property. """ # check if there are any parameters if " " not in self._element or "=" not in self._element: return ...
python
def _parseParams(self): """ Parse parameters from their string HTML representation to dictionary. Result is saved to the :attr:`params` property. """ # check if there are any parameters if " " not in self._element or "=" not in self._element: return ...
[ "def", "_parseParams", "(", "self", ")", ":", "# check if there are any parameters", "if", "\" \"", "not", "in", "self", ".", "_element", "or", "\"=\"", "not", "in", "self", ".", "_element", ":", "return", "# remove '<' & '>'", "params", "=", "self", ".", "_el...
Parse parameters from their string HTML representation to dictionary. Result is saved to the :attr:`params` property.
[ "Parse", "parameters", "from", "their", "string", "HTML", "representation", "to", "dictionary", "." ]
4756f93dd048500b038ece2323fe26e46b6bfdea
https://github.com/Bystroushaak/pyDHTMLParser/blob/4756f93dd048500b038ece2323fe26e46b6bfdea/src/dhtmlparser/htmlelement/html_parser.py#L220-L290
238,884
Bystroushaak/pyDHTMLParser
src/dhtmlparser/htmlelement/html_parser.py
HTMLParser.isOpeningTag
def isOpeningTag(self): """ Detect whether this tag is opening or not. Returns: bool: True if it is opening. """ if self.isTag() and \ not self.isComment() and \ not self.isEndTag() and \ not self.isNonPairTag(): return Tr...
python
def isOpeningTag(self): """ Detect whether this tag is opening or not. Returns: bool: True if it is opening. """ if self.isTag() and \ not self.isComment() and \ not self.isEndTag() and \ not self.isNonPairTag(): return Tr...
[ "def", "isOpeningTag", "(", "self", ")", ":", "if", "self", ".", "isTag", "(", ")", "and", "not", "self", ".", "isComment", "(", ")", "and", "not", "self", ".", "isEndTag", "(", ")", "and", "not", "self", ".", "isNonPairTag", "(", ")", ":", "return...
Detect whether this tag is opening or not. Returns: bool: True if it is opening.
[ "Detect", "whether", "this", "tag", "is", "opening", "or", "not", "." ]
4756f93dd048500b038ece2323fe26e46b6bfdea
https://github.com/Bystroushaak/pyDHTMLParser/blob/4756f93dd048500b038ece2323fe26e46b6bfdea/src/dhtmlparser/htmlelement/html_parser.py#L354-L367
238,885
emilydolson/avida-spatial-tools
avidaspatial/landscape_stats.py
entropy
def entropy(dictionary): """ Helper function for entropy calculations. Takes a frequency dictionary and calculates entropy of the keys. """ total = 0.0 entropy = 0 for key in dictionary.keys(): total += dictionary[key] for key in dictionary.keys(): entropy += dictionary[...
python
def entropy(dictionary): """ Helper function for entropy calculations. Takes a frequency dictionary and calculates entropy of the keys. """ total = 0.0 entropy = 0 for key in dictionary.keys(): total += dictionary[key] for key in dictionary.keys(): entropy += dictionary[...
[ "def", "entropy", "(", "dictionary", ")", ":", "total", "=", "0.0", "entropy", "=", "0", "for", "key", "in", "dictionary", ".", "keys", "(", ")", ":", "total", "+=", "dictionary", "[", "key", "]", "for", "key", "in", "dictionary", ".", "keys", "(", ...
Helper function for entropy calculations. Takes a frequency dictionary and calculates entropy of the keys.
[ "Helper", "function", "for", "entropy", "calculations", ".", "Takes", "a", "frequency", "dictionary", "and", "calculates", "entropy", "of", "the", "keys", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/landscape_stats.py#L70-L82
238,886
emilydolson/avida-spatial-tools
avidaspatial/landscape_stats.py
sqrt_shannon_entropy
def sqrt_shannon_entropy(filename): """ Calculates Shannon entropy based on square root of phenotype count. This might account for relationship between population size and evolvability. """ data = load_grid_data(filename, "int") data = agg_grid(data, mode) phenotypes = {} for r in da...
python
def sqrt_shannon_entropy(filename): """ Calculates Shannon entropy based on square root of phenotype count. This might account for relationship between population size and evolvability. """ data = load_grid_data(filename, "int") data = agg_grid(data, mode) phenotypes = {} for r in da...
[ "def", "sqrt_shannon_entropy", "(", "filename", ")", ":", "data", "=", "load_grid_data", "(", "filename", ",", "\"int\"", ")", "data", "=", "agg_grid", "(", "data", ",", "mode", ")", "phenotypes", "=", "{", "}", "for", "r", "in", "data", ":", "for", "c...
Calculates Shannon entropy based on square root of phenotype count. This might account for relationship between population size and evolvability.
[ "Calculates", "Shannon", "entropy", "based", "on", "square", "root", "of", "phenotype", "count", ".", "This", "might", "account", "for", "relationship", "between", "population", "size", "and", "evolvability", "." ]
7beb0166ccefad5fa722215b030ac2a53d62b59e
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/landscape_stats.py#L85-L104
238,887
quantopian/metautils
metautils/compat.py
_composed_doc
def _composed_doc(fs): """ Generate a docstring for the composition of fs. """ if not fs: # Argument name for the docstring. return 'n' return '{f}({g})'.format(f=fs[0].__name__, g=_composed_doc(fs[1:]))
python
def _composed_doc(fs): """ Generate a docstring for the composition of fs. """ if not fs: # Argument name for the docstring. return 'n' return '{f}({g})'.format(f=fs[0].__name__, g=_composed_doc(fs[1:]))
[ "def", "_composed_doc", "(", "fs", ")", ":", "if", "not", "fs", ":", "# Argument name for the docstring.", "return", "'n'", "return", "'{f}({g})'", ".", "format", "(", "f", "=", "fs", "[", "0", "]", ".", "__name__", ",", "g", "=", "_composed_doc", "(", "...
Generate a docstring for the composition of fs.
[ "Generate", "a", "docstring", "for", "the", "composition", "of", "fs", "." ]
10e11c5bd8bd7ded52b97261f61c3186607bd617
https://github.com/quantopian/metautils/blob/10e11c5bd8bd7ded52b97261f61c3186607bd617/metautils/compat.py#L61-L69
238,888
roboogle/gtkmvc3
gtkmvco/gtkmvc3/adapters/containers.py
StaticContainerAdapter.update_model
def update_model(self, idx=None): """Updates the value of property at given index. If idx is None, all controlled indices will be updated. This method should be called directly by the user in very unusual conditions.""" if idx is None: for w in self._widgets: ...
python
def update_model(self, idx=None): """Updates the value of property at given index. If idx is None, all controlled indices will be updated. This method should be called directly by the user in very unusual conditions.""" if idx is None: for w in self._widgets: ...
[ "def", "update_model", "(", "self", ",", "idx", "=", "None", ")", ":", "if", "idx", "is", "None", ":", "for", "w", "in", "self", ".", "_widgets", ":", "idx", "=", "self", ".", "_get_idx_from_widget", "(", "w", ")", "try", ":", "val", "=", "self", ...
Updates the value of property at given index. If idx is None, all controlled indices will be updated. This method should be called directly by the user in very unusual conditions.
[ "Updates", "the", "value", "of", "property", "at", "given", "index", ".", "If", "idx", "is", "None", "all", "controlled", "indices", "will", "be", "updated", ".", "This", "method", "should", "be", "called", "directly", "by", "the", "user", "in", "very", ...
63405fd8d2056be26af49103b13a8d5e57fe4dff
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/adapters/containers.py#L146-L163
238,889
roboogle/gtkmvc3
gtkmvco/gtkmvc3/adapters/containers.py
StaticContainerAdapter.update_widget
def update_widget(self, idx=None): """Forces the widget at given index to be updated from the property value. If index is not given, all controlled widgets will be updated. This method should be called directly by the user when the property is not observable, or in very unusual c...
python
def update_widget(self, idx=None): """Forces the widget at given index to be updated from the property value. If index is not given, all controlled widgets will be updated. This method should be called directly by the user when the property is not observable, or in very unusual c...
[ "def", "update_widget", "(", "self", ",", "idx", "=", "None", ")", ":", "if", "idx", "is", "None", ":", "for", "w", "in", "self", ".", "_widgets", ":", "idx", "=", "self", ".", "_get_idx_from_widget", "(", "w", ")", "self", ".", "_write_widget", "(",...
Forces the widget at given index to be updated from the property value. If index is not given, all controlled widgets will be updated. This method should be called directly by the user when the property is not observable, or in very unusual conditions.
[ "Forces", "the", "widget", "at", "given", "index", "to", "be", "updated", "from", "the", "property", "value", ".", "If", "index", "is", "not", "given", "all", "controlled", "widgets", "will", "be", "updated", ".", "This", "method", "should", "be", "called"...
63405fd8d2056be26af49103b13a8d5e57fe4dff
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/adapters/containers.py#L165-L177
238,890
roboogle/gtkmvc3
gtkmvco/gtkmvc3/adapters/containers.py
StaticContainerAdapter._on_wid_changed
def _on_wid_changed(self, wid): """Called when the widget is changed""" if self._itsme: return self.update_model(self._get_idx_from_widget(wid)) return
python
def _on_wid_changed(self, wid): """Called when the widget is changed""" if self._itsme: return self.update_model(self._get_idx_from_widget(wid)) return
[ "def", "_on_wid_changed", "(", "self", ",", "wid", ")", ":", "if", "self", ".", "_itsme", ":", "return", "self", ".", "update_model", "(", "self", ".", "_get_idx_from_widget", "(", "wid", ")", ")", "return" ]
Called when the widget is changed
[ "Called", "when", "the", "widget", "is", "changed" ]
63405fd8d2056be26af49103b13a8d5e57fe4dff
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/adapters/containers.py#L236-L240
238,891
lewiseason/rfc
rfc/cli.py
fetch_url
def fetch_url(url): """ Fetch the given url, strip formfeeds and decode it into the defined encoding """ with closing(urllib.urlopen(url)) as f: if f.code is 200: response = f.read() return strip_formfeeds(response).decode(ENCODING)
python
def fetch_url(url): """ Fetch the given url, strip formfeeds and decode it into the defined encoding """ with closing(urllib.urlopen(url)) as f: if f.code is 200: response = f.read() return strip_formfeeds(response).decode(ENCODING)
[ "def", "fetch_url", "(", "url", ")", ":", "with", "closing", "(", "urllib", ".", "urlopen", "(", "url", ")", ")", "as", "f", ":", "if", "f", ".", "code", "is", "200", ":", "response", "=", "f", ".", "read", "(", ")", "return", "strip_formfeeds", ...
Fetch the given url, strip formfeeds and decode it into the defined encoding
[ "Fetch", "the", "given", "url", "strip", "formfeeds", "and", "decode", "it", "into", "the", "defined", "encoding" ]
2a322d8ab681ade0f3a8574c48d62505141082bf
https://github.com/lewiseason/rfc/blob/2a322d8ab681ade0f3a8574c48d62505141082bf/rfc/cli.py#L27-L36
238,892
ravenac95/overlay4u
overlay4u/mountutils.py
match_entry_line
def match_entry_line(str_to_match, regex_obj=MAIN_REGEX_OBJ): """Does a regex match of the mount entry string""" match_obj = regex_obj.match(str_to_match) if not match_obj: error_message = ('Line "%s" is unrecognized by overlay4u. ' 'This is only meant for use with Ubuntu Linux.') ...
python
def match_entry_line(str_to_match, regex_obj=MAIN_REGEX_OBJ): """Does a regex match of the mount entry string""" match_obj = regex_obj.match(str_to_match) if not match_obj: error_message = ('Line "%s" is unrecognized by overlay4u. ' 'This is only meant for use with Ubuntu Linux.') ...
[ "def", "match_entry_line", "(", "str_to_match", ",", "regex_obj", "=", "MAIN_REGEX_OBJ", ")", ":", "match_obj", "=", "regex_obj", ".", "match", "(", "str_to_match", ")", "if", "not", "match_obj", ":", "error_message", "=", "(", "'Line \"%s\" is unrecognized by overl...
Does a regex match of the mount entry string
[ "Does", "a", "regex", "match", "of", "the", "mount", "entry", "string" ]
621eecc0d4d40951aa8afcb533b5eec5d91c73cc
https://github.com/ravenac95/overlay4u/blob/621eecc0d4d40951aa8afcb533b5eec5d91c73cc/overlay4u/mountutils.py#L9-L16
238,893
ravenac95/overlay4u
overlay4u/mountutils.py
MountTable.as_list
def as_list(self, fs_type=None): """List mount entries""" entries = self._entries if fs_type: entries = filter(lambda a: a.fs_type == fs_type, entries) return entries
python
def as_list(self, fs_type=None): """List mount entries""" entries = self._entries if fs_type: entries = filter(lambda a: a.fs_type == fs_type, entries) return entries
[ "def", "as_list", "(", "self", ",", "fs_type", "=", "None", ")", ":", "entries", "=", "self", ".", "_entries", "if", "fs_type", ":", "entries", "=", "filter", "(", "lambda", "a", ":", "a", ".", "fs_type", "==", "fs_type", ",", "entries", ")", "return...
List mount entries
[ "List", "mount", "entries" ]
621eecc0d4d40951aa8afcb533b5eec5d91c73cc
https://github.com/ravenac95/overlay4u/blob/621eecc0d4d40951aa8afcb533b5eec5d91c73cc/overlay4u/mountutils.py#L56-L61
238,894
majerteam/sqla_inspect
sqla_inspect/ods.py
OdsWriter.render
def render(self, f_buf=None): """ Definitely render the workbook :param obj f_buf: A file buffer supporting the write and seek methods """ if f_buf is None: f_buf = StringIO.StringIO() with odswriter.writer(f_buf) as writer: default_sheet ...
python
def render(self, f_buf=None): """ Definitely render the workbook :param obj f_buf: A file buffer supporting the write and seek methods """ if f_buf is None: f_buf = StringIO.StringIO() with odswriter.writer(f_buf) as writer: default_sheet ...
[ "def", "render", "(", "self", ",", "f_buf", "=", "None", ")", ":", "if", "f_buf", "is", "None", ":", "f_buf", "=", "StringIO", ".", "StringIO", "(", ")", "with", "odswriter", ".", "writer", "(", "f_buf", ")", "as", "writer", ":", "default_sheet", "="...
Definitely render the workbook :param obj f_buf: A file buffer supporting the write and seek methods
[ "Definitely", "render", "the", "workbook" ]
67edb5541e6a56b0a657d3774d1e19c1110cd402
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/ods.py#L47-L67
238,895
majerteam/sqla_inspect
sqla_inspect/ods.py
SqlaOdsExporter._get_related_exporter
def _get_related_exporter(self, related_obj, column): """ returns an SqlaOdsExporter for the given related object and stores it in the column object as a cache """ result = column.get('sqla_ods_exporter') if result is None: result = column['sqla_ods_exporter']...
python
def _get_related_exporter(self, related_obj, column): """ returns an SqlaOdsExporter for the given related object and stores it in the column object as a cache """ result = column.get('sqla_ods_exporter') if result is None: result = column['sqla_ods_exporter']...
[ "def", "_get_related_exporter", "(", "self", ",", "related_obj", ",", "column", ")", ":", "result", "=", "column", ".", "get", "(", "'sqla_ods_exporter'", ")", "if", "result", "is", "None", ":", "result", "=", "column", "[", "'sqla_ods_exporter'", "]", "=", ...
returns an SqlaOdsExporter for the given related object and stores it in the column object as a cache
[ "returns", "an", "SqlaOdsExporter", "for", "the", "given", "related", "object", "and", "stores", "it", "in", "the", "column", "object", "as", "a", "cache" ]
67edb5541e6a56b0a657d3774d1e19c1110cd402
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/ods.py#L178-L191
238,896
majerteam/sqla_inspect
sqla_inspect/ods.py
SqlaOdsExporter._get_relationship_cell_val
def _get_relationship_cell_val(self, obj, column): """ Return the value to insert in a relationship cell Handle the case of complex related datas we want to handle """ val = SqlaExporter._get_relationship_cell_val(self, obj, column) if val == "": related_key =...
python
def _get_relationship_cell_val(self, obj, column): """ Return the value to insert in a relationship cell Handle the case of complex related datas we want to handle """ val = SqlaExporter._get_relationship_cell_val(self, obj, column) if val == "": related_key =...
[ "def", "_get_relationship_cell_val", "(", "self", ",", "obj", ",", "column", ")", ":", "val", "=", "SqlaExporter", ".", "_get_relationship_cell_val", "(", "self", ",", "obj", ",", "column", ")", "if", "val", "==", "\"\"", ":", "related_key", "=", "column", ...
Return the value to insert in a relationship cell Handle the case of complex related datas we want to handle
[ "Return", "the", "value", "to", "insert", "in", "a", "relationship", "cell", "Handle", "the", "case", "of", "complex", "related", "datas", "we", "want", "to", "handle" ]
67edb5541e6a56b0a657d3774d1e19c1110cd402
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/ods.py#L193-L218
238,897
cyrus-/cypy
cypy/np/plotting.py
raster
def raster(times, indices, max_time=None, max_index=None, x_label="Timestep", y_label="Index", **kwargs): """Plots a raster plot given times and indices of events.""" # set default size to 1 if 's' not in kwargs: kwargs['s'] = 1 scatter(times, indices, **kwargs) if max_time ...
python
def raster(times, indices, max_time=None, max_index=None, x_label="Timestep", y_label="Index", **kwargs): """Plots a raster plot given times and indices of events.""" # set default size to 1 if 's' not in kwargs: kwargs['s'] = 1 scatter(times, indices, **kwargs) if max_time ...
[ "def", "raster", "(", "times", ",", "indices", ",", "max_time", "=", "None", ",", "max_index", "=", "None", ",", "x_label", "=", "\"Timestep\"", ",", "y_label", "=", "\"Index\"", ",", "*", "*", "kwargs", ")", ":", "# set default size to 1", "if", "'s'", ...
Plots a raster plot given times and indices of events.
[ "Plots", "a", "raster", "plot", "given", "times", "and", "indices", "of", "events", "." ]
04bb59e91fa314e8cf987743189c77a9b6bc371d
https://github.com/cyrus-/cypy/blob/04bb59e91fa314e8cf987743189c77a9b6bc371d/cypy/np/plotting.py#L25-L39
238,898
zkbt/the-friendly-stars
thefriendlystars/constellations/gaia.py
query
def query(query): ''' Send an ADQL query to the Gaia archive, wait for a response, and hang on to the results. ''' # send the query to the Gaia archive with warnings.catch_warnings() : warnings.filterwarnings("ignore") _gaia_job = astroquery.gaia.Gaia.launch_job(query) ...
python
def query(query): ''' Send an ADQL query to the Gaia archive, wait for a response, and hang on to the results. ''' # send the query to the Gaia archive with warnings.catch_warnings() : warnings.filterwarnings("ignore") _gaia_job = astroquery.gaia.Gaia.launch_job(query) ...
[ "def", "query", "(", "query", ")", ":", "# send the query to the Gaia archive", "with", "warnings", ".", "catch_warnings", "(", ")", ":", "warnings", ".", "filterwarnings", "(", "\"ignore\"", ")", "_gaia_job", "=", "astroquery", ".", "gaia", ".", "Gaia", ".", ...
Send an ADQL query to the Gaia archive, wait for a response, and hang on to the results.
[ "Send", "an", "ADQL", "query", "to", "the", "Gaia", "archive", "wait", "for", "a", "response", "and", "hang", "on", "to", "the", "results", "." ]
50d3f979e79e63c66629065c75595696dc79802e
https://github.com/zkbt/the-friendly-stars/blob/50d3f979e79e63c66629065c75595696dc79802e/thefriendlystars/constellations/gaia.py#L4-L18
238,899
znerol/txexiftool
txexiftool/__init__.py
ExiftoolProtocol.connectionMade
def connectionMade(self): """ Initializes the protocol. """ self._buffer = b'' self._queue = {} self._stopped = None self._tag = 0
python
def connectionMade(self): """ Initializes the protocol. """ self._buffer = b'' self._queue = {} self._stopped = None self._tag = 0
[ "def", "connectionMade", "(", "self", ")", ":", "self", ".", "_buffer", "=", "b''", "self", ".", "_queue", "=", "{", "}", "self", ".", "_stopped", "=", "None", "self", ".", "_tag", "=", "0" ]
Initializes the protocol.
[ "Initializes", "the", "protocol", "." ]
a3d75a31262a492f81072840d4fc818f65bf3265
https://github.com/znerol/txexiftool/blob/a3d75a31262a492f81072840d4fc818f65bf3265/txexiftool/__init__.py#L33-L40