repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
jrheard/madison_axi
madison_axi/axi.py
initialize
def initialize(): """IMPORTANT: Call this function at the beginning of your program.""" try: requests.get('http://localhost:4242/poll') state['connected_to_bot'] = True except requests.exceptions.ConnectionError: state['connected_to_bot'] = False # set up turtle state['windo...
python
def initialize(): """IMPORTANT: Call this function at the beginning of your program.""" try: requests.get('http://localhost:4242/poll') state['connected_to_bot'] = True except requests.exceptions.ConnectionError: state['connected_to_bot'] = False # set up turtle state['windo...
[ "def", "initialize", "(", ")", ":", "try", ":", "requests", ".", "get", "(", "'http://localhost:4242/poll'", ")", "state", "[", "'connected_to_bot'", "]", "=", "True", "except", "requests", ".", "exceptions", ".", "ConnectionError", ":", "state", "[", "'connec...
IMPORTANT: Call this function at the beginning of your program.
[ "IMPORTANT", ":", "Call", "this", "function", "at", "the", "beginning", "of", "your", "program", "." ]
train
https://github.com/jrheard/madison_axi/blob/240cd002aec134cefb69294a9e9b65630a60cddc/madison_axi/axi.py#L38-L54
jrheard/madison_axi
madison_axi/axi.py
move_forward
def move_forward(num_steps): """Moves the pen forward a few steps in the direction that its "turtle" is facing. Arguments: num_steps - a number like 20. A bigger number makes the pen move farther. """ assert int(num_steps) == num_steps, "move_forward() only accepts integers, but you gave it " +...
python
def move_forward(num_steps): """Moves the pen forward a few steps in the direction that its "turtle" is facing. Arguments: num_steps - a number like 20. A bigger number makes the pen move farther. """ assert int(num_steps) == num_steps, "move_forward() only accepts integers, but you gave it " +...
[ "def", "move_forward", "(", "num_steps", ")", ":", "assert", "int", "(", "num_steps", ")", "==", "num_steps", ",", "\"move_forward() only accepts integers, but you gave it \"", "+", "str", "(", "num_steps", ")", "_make_cnc_request", "(", "\"move.forward./\"", "+", "st...
Moves the pen forward a few steps in the direction that its "turtle" is facing. Arguments: num_steps - a number like 20. A bigger number makes the pen move farther.
[ "Moves", "the", "pen", "forward", "a", "few", "steps", "in", "the", "direction", "that", "its", "turtle", "is", "facing", "." ]
train
https://github.com/jrheard/madison_axi/blob/240cd002aec134cefb69294a9e9b65630a60cddc/madison_axi/axi.py#L97-L107
JHowell45/helium-cli
helium/utility_functions/decorators.py
command_banner
def command_banner(title, banner_colour='white'): """Use this function to display a banner before and after a command/ This function is used for surrounding a Helium CLI command with a banner. This will show what the command is for and separate out the command making it easier to see what is part of th...
python
def command_banner(title, banner_colour='white'): """Use this function to display a banner before and after a command/ This function is used for surrounding a Helium CLI command with a banner. This will show what the command is for and separate out the command making it easier to see what is part of th...
[ "def", "command_banner", "(", "title", ",", "banner_colour", "=", "'white'", ")", ":", "size", "=", "get_terminal_size", "(", ")", "def", "decorator", "(", "function", ")", ":", "\"\"\"Use this function to create the basic decorator.\n\n This function is used for def...
Use this function to display a banner before and after a command/ This function is used for surrounding a Helium CLI command with a banner. This will show what the command is for and separate out the command making it easier to see what is part of the commands output (if any). :param title: the title ...
[ "Use", "this", "function", "to", "display", "a", "banner", "before", "and", "after", "a", "command", "/" ]
train
https://github.com/JHowell45/helium-cli/blob/8decc2f410a17314440eeed411a4b19dd4b4e780/helium/utility_functions/decorators.py#L13-L61
pjuren/pyokit
src/pyokit/statistics/online.py
RollingMean.add
def add(self, v): """Add a new value.""" self._vals_added += 1 if self._mean is None: self._mean = v self._mean = self._mean + ((v - self._mean) / float(self._vals_added))
python
def add(self, v): """Add a new value.""" self._vals_added += 1 if self._mean is None: self._mean = v self._mean = self._mean + ((v - self._mean) / float(self._vals_added))
[ "def", "add", "(", "self", ",", "v", ")", ":", "self", ".", "_vals_added", "+=", "1", "if", "self", ".", "_mean", "is", "None", ":", "self", ".", "_mean", "=", "v", "self", ".", "_mean", "=", "self", ".", "_mean", "+", "(", "(", "v", "-", "se...
Add a new value.
[ "Add", "a", "new", "value", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/statistics/online.py#L45-L50
pjuren/pyokit
src/pyokit/datastruct/genomeAlignment.py
_build_trees_by_chrom
def _build_trees_by_chrom(blocks, verbose=False): """ Construct set of interval trees from an iterable of genome alignment blocks. :return: a dictionary indexed by chromosome name where each entry is an interval tree for that chromosome. """ if verbose: sys.stderr.write("separating blocks by c...
python
def _build_trees_by_chrom(blocks, verbose=False): """ Construct set of interval trees from an iterable of genome alignment blocks. :return: a dictionary indexed by chromosome name where each entry is an interval tree for that chromosome. """ if verbose: sys.stderr.write("separating blocks by c...
[ "def", "_build_trees_by_chrom", "(", "blocks", ",", "verbose", "=", "False", ")", ":", "if", "verbose", ":", "sys", ".", "stderr", ".", "write", "(", "\"separating blocks by chromosome... \"", ")", "by_chrom", "=", "{", "}", "for", "b", "in", "blocks", ":", ...
Construct set of interval trees from an iterable of genome alignment blocks. :return: a dictionary indexed by chromosome name where each entry is an interval tree for that chromosome.
[ "Construct", "set", "of", "interval", "trees", "from", "an", "iterable", "of", "genome", "alignment", "blocks", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/genomeAlignment.py#L73-L98
pjuren/pyokit
src/pyokit/datastruct/genomeAlignment.py
GenomeAlignmentBlock.get_column_absolute
def get_column_absolute(self, position, miss_seqs=MissingSequenceHandler.TREAT_AS_ALL_GAPS, species=None): """ return a column from the block as dictionary indexed by seq. name. :param position: the index to extract from the block; must be absolute ...
python
def get_column_absolute(self, position, miss_seqs=MissingSequenceHandler.TREAT_AS_ALL_GAPS, species=None): """ return a column from the block as dictionary indexed by seq. name. :param position: the index to extract from the block; must be absolute ...
[ "def", "get_column_absolute", "(", "self", ",", "position", ",", "miss_seqs", "=", "MissingSequenceHandler", ".", "TREAT_AS_ALL_GAPS", ",", "species", "=", "None", ")", ":", "if", "position", "<", "self", ".", "start", "or", "position", ">=", "self", ".", "e...
return a column from the block as dictionary indexed by seq. name. :param position: the index to extract from the block; must be absolute coordinates (i.e. between self.start and self.end, not inclusive of the end). :param miss_seqs: how to treat sequence with no ac...
[ "return", "a", "column", "from", "the", "block", "as", "dictionary", "indexed", "by", "seq", ".", "name", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/genomeAlignment.py#L158-L191
pjuren/pyokit
src/pyokit/datastruct/genomeAlignment.py
GenomeAlignment.get_blocks
def get_blocks(self, chrom, start, end): """ Get any blocks in this alignment that overlap the given location. :return: the alignment blocks that overlap a given genomic interval; potentially none, in which case the empty list is returned. """ if chrom not in self.block_trees: re...
python
def get_blocks(self, chrom, start, end): """ Get any blocks in this alignment that overlap the given location. :return: the alignment blocks that overlap a given genomic interval; potentially none, in which case the empty list is returned. """ if chrom not in self.block_trees: re...
[ "def", "get_blocks", "(", "self", ",", "chrom", ",", "start", ",", "end", ")", ":", "if", "chrom", "not", "in", "self", ".", "block_trees", ":", "return", "[", "]", "return", "self", ".", "block_trees", "[", "chrom", "]", ".", "intersectingInterval", "...
Get any blocks in this alignment that overlap the given location. :return: the alignment blocks that overlap a given genomic interval; potentially none, in which case the empty list is returned.
[ "Get", "any", "blocks", "in", "this", "alignment", "that", "overlap", "the", "given", "location", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/genomeAlignment.py#L301-L310
pjuren/pyokit
src/pyokit/datastruct/genomeAlignment.py
GenomeAlignment.get_column
def get_column(self, chrom, position, missing_seqs=MissingSequenceHandler.TREAT_AS_ALL_GAPS, species=None): """Get the alignment column at the specified chromosome and position.""" blocks = self.get_blocks(chrom, position, position + 1) if len(blocks) == 0: raise NoSu...
python
def get_column(self, chrom, position, missing_seqs=MissingSequenceHandler.TREAT_AS_ALL_GAPS, species=None): """Get the alignment column at the specified chromosome and position.""" blocks = self.get_blocks(chrom, position, position + 1) if len(blocks) == 0: raise NoSu...
[ "def", "get_column", "(", "self", ",", "chrom", ",", "position", ",", "missing_seqs", "=", "MissingSequenceHandler", ".", "TREAT_AS_ALL_GAPS", ",", "species", "=", "None", ")", ":", "blocks", "=", "self", ".", "get_blocks", "(", "chrom", ",", "position", ","...
Get the alignment column at the specified chromosome and position.
[ "Get", "the", "alignment", "column", "at", "the", "specified", "chromosome", "and", "position", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/genomeAlignment.py#L312-L328
pjuren/pyokit
src/pyokit/datastruct/genomeAlignment.py
JustInTimeGenomeAlignment.__get_keys
def __get_keys(self, chrom, start, end=None): """ Get the hash keys in whole/partial_chrom_files that overlap the interval. :return: list of hash keys. """ keys = [] if chrom in self.whole_chrom_files: keys.append(self.whole_chrom_files[chrom]) if chrom in self.partial_trees: if...
python
def __get_keys(self, chrom, start, end=None): """ Get the hash keys in whole/partial_chrom_files that overlap the interval. :return: list of hash keys. """ keys = [] if chrom in self.whole_chrom_files: keys.append(self.whole_chrom_files[chrom]) if chrom in self.partial_trees: if...
[ "def", "__get_keys", "(", "self", ",", "chrom", ",", "start", ",", "end", "=", "None", ")", ":", "keys", "=", "[", "]", "if", "chrom", "in", "self", ".", "whole_chrom_files", ":", "keys", ".", "append", "(", "self", ".", "whole_chrom_files", "[", "ch...
Get the hash keys in whole/partial_chrom_files that overlap the interval. :return: list of hash keys.
[ "Get", "the", "hash", "keys", "in", "whole", "/", "partial_chrom_files", "that", "overlap", "the", "interval", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/genomeAlignment.py#L398-L414
pjuren/pyokit
src/pyokit/datastruct/genomeAlignment.py
JustInTimeGenomeAlignment.get_blocks
def get_blocks(self, chrom, start, end): """ Get any blocks in this alignment that overlap the given location. :return: the alignment blocks that overlap a given genomic interval; potentially none, in which case the empty list is returned. """ blocks = [] for k in self.__get_keys(c...
python
def get_blocks(self, chrom, start, end): """ Get any blocks in this alignment that overlap the given location. :return: the alignment blocks that overlap a given genomic interval; potentially none, in which case the empty list is returned. """ blocks = [] for k in self.__get_keys(c...
[ "def", "get_blocks", "(", "self", ",", "chrom", ",", "start", ",", "end", ")", ":", "blocks", "=", "[", "]", "for", "k", "in", "self", ".", "__get_keys", "(", "chrom", ",", "start", ",", "end", ")", ":", "self", ".", "__switch_alig", "(", "k", ")...
Get any blocks in this alignment that overlap the given location. :return: the alignment blocks that overlap a given genomic interval; potentially none, in which case the empty list is returned.
[ "Get", "any", "blocks", "in", "this", "alignment", "that", "overlap", "the", "given", "location", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/genomeAlignment.py#L421-L432
emencia/emencia_paste_djangocms_3
emencia_paste_djangocms_3/django_buildout/project/utils/context_processors.py
get_site_metas
def get_site_metas(with_static=False, with_media=False, is_secure=False, extra={}): """ Return metas from the current *Site* and settings Added Site metas will be callable in templates like this ``SITE.themetaname`` This can be used in code out of a Django requests (like in mana...
python
def get_site_metas(with_static=False, with_media=False, is_secure=False, extra={}): """ Return metas from the current *Site* and settings Added Site metas will be callable in templates like this ``SITE.themetaname`` This can be used in code out of a Django requests (like in mana...
[ "def", "get_site_metas", "(", "with_static", "=", "False", ",", "with_media", "=", "False", ",", "is_secure", "=", "False", ",", "extra", "=", "{", "}", ")", ":", "site_current", "=", "Site", ".", "objects", ".", "get_current", "(", ")", "metas", "=", ...
Return metas from the current *Site* and settings Added Site metas will be callable in templates like this ``SITE.themetaname`` This can be used in code out of a Django requests (like in management commands) or in a context processor to get the *Site* urls. Default metas returned : * SITE.na...
[ "Return", "metas", "from", "the", "current", "*", "Site", "*", "and", "settings" ]
train
https://github.com/emencia/emencia_paste_djangocms_3/blob/29eabbcb17e21996a6e1d99592fc719dc8833b59/emencia_paste_djangocms_3/django_buildout/project/utils/context_processors.py#L6-L42
cogniteev/docido-python-sdk
docido_sdk/toolbox/decorators.py
decorate_instance_methods
def decorate_instance_methods(obj, decorator, includes=None, excludes=None): """Decorator instance methods of an object. :param obj: Python object whose instance methods have to be decorated :param decorator: instance method decorator. >>> def decorate(name, f): >>> def __wrap(*args, **...
python
def decorate_instance_methods(obj, decorator, includes=None, excludes=None): """Decorator instance methods of an object. :param obj: Python object whose instance methods have to be decorated :param decorator: instance method decorator. >>> def decorate(name, f): >>> def __wrap(*args, **...
[ "def", "decorate_instance_methods", "(", "obj", ",", "decorator", ",", "includes", "=", "None", ",", "excludes", "=", "None", ")", ":", "class", "InstanceMethodDecorator", "(", "object", ")", ":", "def", "__getattribute__", "(", "self", ",", "name", ")", ":"...
Decorator instance methods of an object. :param obj: Python object whose instance methods have to be decorated :param decorator: instance method decorator. >>> def decorate(name, f): >>> def __wrap(*args, **kwargs) >>> print '--> entering instance method {}'.format(name) >>>...
[ "Decorator", "instance", "methods", "of", "an", "object", "." ]
train
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/decorators.py#L33-L63
cogniteev/docido-python-sdk
docido_sdk/toolbox/decorators.py
reraise
def reraise(clazz): """ Decorator catching every exception that might be raised by wrapped function and raise another exception instead. Exception initially raised is passed in first argument of the raised exception. :param: Exception class: clazz: Python exception class to raise """ ...
python
def reraise(clazz): """ Decorator catching every exception that might be raised by wrapped function and raise another exception instead. Exception initially raised is passed in first argument of the raised exception. :param: Exception class: clazz: Python exception class to raise """ ...
[ "def", "reraise", "(", "clazz", ")", ":", "def", "_decorator", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "_wrap", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "f", "(", "*", "args", ...
Decorator catching every exception that might be raised by wrapped function and raise another exception instead. Exception initially raised is passed in first argument of the raised exception. :param: Exception class: clazz: Python exception class to raise
[ "Decorator", "catching", "every", "exception", "that", "might", "be", "raised", "by", "wrapped", "function", "and", "raise", "another", "exception", "instead", ".", "Exception", "initially", "raised", "is", "passed", "in", "first", "argument", "of", "the", "rais...
train
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/decorators.py#L66-L83
edeposit/edeposit.amqp.aleph
src/edeposit/amqp/aleph/aleph.py
getListOfBases
def getListOfBases(): """ This function is here mainly for purposes of unittest Returns: list of str: Valid bases as they are used as URL parameters in links at Aleph main page. """ downer = Downloader() data = downer.download(ALEPH_URL + "/F/?func=file&file_name=ba...
python
def getListOfBases(): """ This function is here mainly for purposes of unittest Returns: list of str: Valid bases as they are used as URL parameters in links at Aleph main page. """ downer = Downloader() data = downer.download(ALEPH_URL + "/F/?func=file&file_name=ba...
[ "def", "getListOfBases", "(", ")", ":", "downer", "=", "Downloader", "(", ")", "data", "=", "downer", ".", "download", "(", "ALEPH_URL", "+", "\"/F/?func=file&file_name=base-list\"", ")", "dom", "=", "dhtmlparser", ".", "parseString", "(", "data", ".", "lower"...
This function is here mainly for purposes of unittest Returns: list of str: Valid bases as they are used as URL parameters in links at Aleph main page.
[ "This", "function", "is", "here", "mainly", "for", "purposes", "of", "unittest" ]
train
https://github.com/edeposit/edeposit.amqp.aleph/blob/360342c0504d5daa2344e864762cdf938d4149c7/src/edeposit/amqp/aleph/aleph.py#L235-L268
edeposit/edeposit.amqp.aleph
src/edeposit/amqp/aleph/aleph.py
_alephResultToDict
def _alephResultToDict(dom): """ Convert part of non-nested XML to :py:class:`dict`. Args: dom (HTMLElement tree): pre-parsed XML (see dhtmlparser). Returns: dict: with python data """ result = {} for i in dom.childs: if not i.isOpeningTag(): continue ...
python
def _alephResultToDict(dom): """ Convert part of non-nested XML to :py:class:`dict`. Args: dom (HTMLElement tree): pre-parsed XML (see dhtmlparser). Returns: dict: with python data """ result = {} for i in dom.childs: if not i.isOpeningTag(): continue ...
[ "def", "_alephResultToDict", "(", "dom", ")", ":", "result", "=", "{", "}", "for", "i", "in", "dom", ".", "childs", ":", "if", "not", "i", ".", "isOpeningTag", "(", ")", ":", "continue", "keyword", "=", "i", ".", "getTagName", "(", ")", ".", "strip...
Convert part of non-nested XML to :py:class:`dict`. Args: dom (HTMLElement tree): pre-parsed XML (see dhtmlparser). Returns: dict: with python data
[ "Convert", "part", "of", "non", "-", "nested", "XML", "to", ":", "py", ":", "class", ":", "dict", "." ]
train
https://github.com/edeposit/edeposit.amqp.aleph/blob/360342c0504d5daa2344e864762cdf938d4149c7/src/edeposit/amqp/aleph/aleph.py#L285-L313
edeposit/edeposit.amqp.aleph
src/edeposit/amqp/aleph/aleph.py
searchInAleph
def searchInAleph(base, phrase, considerSimilar, field): """ Send request to the aleph search engine. Request itself is pretty useless, but it can be later used as parameter for :func:`getDocumentIDs`, which can fetch records from Aleph. Args: base (str): which database you want to use ...
python
def searchInAleph(base, phrase, considerSimilar, field): """ Send request to the aleph search engine. Request itself is pretty useless, but it can be later used as parameter for :func:`getDocumentIDs`, which can fetch records from Aleph. Args: base (str): which database you want to use ...
[ "def", "searchInAleph", "(", "base", ",", "phrase", ",", "considerSimilar", ",", "field", ")", ":", "downer", "=", "Downloader", "(", ")", "if", "field", ".", "lower", "(", ")", "not", "in", "VALID_ALEPH_FIELDS", ":", "raise", "InvalidAlephFieldException", "...
Send request to the aleph search engine. Request itself is pretty useless, but it can be later used as parameter for :func:`getDocumentIDs`, which can fetch records from Aleph. Args: base (str): which database you want to use phrase (str): what do you want to search considerSimilar...
[ "Send", "request", "to", "the", "aleph", "search", "engine", "." ]
train
https://github.com/edeposit/edeposit.amqp.aleph/blob/360342c0504d5daa2344e864762cdf938d4149c7/src/edeposit/amqp/aleph/aleph.py#L316-L388
edeposit/edeposit.amqp.aleph
src/edeposit/amqp/aleph/aleph.py
downloadRecords
def downloadRecords(search_result, from_doc=1): """ Download `MAX_RECORDS` documents from `search_result` starting from `from_doc`. Attr: search_result (dict): returned from :func:`searchInAleph`. from_doc (int, default 1): Start from document number `from_doc`. Returns: li...
python
def downloadRecords(search_result, from_doc=1): """ Download `MAX_RECORDS` documents from `search_result` starting from `from_doc`. Attr: search_result (dict): returned from :func:`searchInAleph`. from_doc (int, default 1): Start from document number `from_doc`. Returns: li...
[ "def", "downloadRecords", "(", "search_result", ",", "from_doc", "=", "1", ")", ":", "downer", "=", "Downloader", "(", ")", "if", "\"set_number\"", "not", "in", "search_result", ":", "return", "[", "]", "# set numbers should be probably aligned to some length", "set...
Download `MAX_RECORDS` documents from `search_result` starting from `from_doc`. Attr: search_result (dict): returned from :func:`searchInAleph`. from_doc (int, default 1): Start from document number `from_doc`. Returns: list: List of XML strings with documents in MARC OAI.
[ "Download", "MAX_RECORDS", "documents", "from", "search_result", "starting", "from", "from_doc", "." ]
train
https://github.com/edeposit/edeposit.amqp.aleph/blob/360342c0504d5daa2344e864762cdf938d4149c7/src/edeposit/amqp/aleph/aleph.py#L391-L430
edeposit/edeposit.amqp.aleph
src/edeposit/amqp/aleph/aleph.py
getDocumentIDs
def getDocumentIDs(aleph_search_result, number_of_docs=-1): """ Get IDs, which can be used as parameters for other functions. Args: aleph_search_result (dict): returned from :func:`searchInAleph` number_of_docs (int, optional): how many :class:`DocumentID` from set ...
python
def getDocumentIDs(aleph_search_result, number_of_docs=-1): """ Get IDs, which can be used as parameters for other functions. Args: aleph_search_result (dict): returned from :func:`searchInAleph` number_of_docs (int, optional): how many :class:`DocumentID` from set ...
[ "def", "getDocumentIDs", "(", "aleph_search_result", ",", "number_of_docs", "=", "-", "1", ")", ":", "downer", "=", "Downloader", "(", ")", "if", "\"set_number\"", "not", "in", "aleph_search_result", ":", "return", "[", "]", "# set numbers should be probably aligned...
Get IDs, which can be used as parameters for other functions. Args: aleph_search_result (dict): returned from :func:`searchInAleph` number_of_docs (int, optional): how many :class:`DocumentID` from set given by `aleph_search_result` should be returned. ...
[ "Get", "IDs", "which", "can", "be", "used", "as", "parameters", "for", "other", "functions", "." ]
train
https://github.com/edeposit/edeposit.amqp.aleph/blob/360342c0504d5daa2344e864762cdf938d4149c7/src/edeposit/amqp/aleph/aleph.py#L433-L512
edeposit/edeposit.amqp.aleph
src/edeposit/amqp/aleph/aleph.py
downloadMARCXML
def downloadMARCXML(doc_id, library, base="nkc"): """ Download MARC XML document with given `doc_id` from given `library`. Args: doc_id (DocumentID): You will get this from :func:`getDocumentIDs`. library (str): "``NKC01``" in our case, but don't worry, :func:`getDocument...
python
def downloadMARCXML(doc_id, library, base="nkc"): """ Download MARC XML document with given `doc_id` from given `library`. Args: doc_id (DocumentID): You will get this from :func:`getDocumentIDs`. library (str): "``NKC01``" in our case, but don't worry, :func:`getDocument...
[ "def", "downloadMARCXML", "(", "doc_id", ",", "library", ",", "base", "=", "\"nkc\"", ")", ":", "downer", "=", "Downloader", "(", ")", "data", "=", "downer", ".", "download", "(", "ALEPH_URL", "+", "Template", "(", "DOC_URL_TEMPLATE", ")", ".", "substitute...
Download MARC XML document with given `doc_id` from given `library`. Args: doc_id (DocumentID): You will get this from :func:`getDocumentIDs`. library (str): "``NKC01``" in our case, but don't worry, :func:`getDocumentIDs` adds library specification into :class...
[ "Download", "MARC", "XML", "document", "with", "given", "doc_id", "from", "given", "library", "." ]
train
https://github.com/edeposit/edeposit.amqp.aleph/blob/360342c0504d5daa2344e864762cdf938d4149c7/src/edeposit/amqp/aleph/aleph.py#L515-L566
edeposit/edeposit.amqp.aleph
src/edeposit/amqp/aleph/aleph.py
downloadMARCOAI
def downloadMARCOAI(doc_id, base): """ Download MARC OAI document with given `doc_id` from given (logical) `base`. Funny part is, that some documents can be obtained only with this function in their full text. Args: doc_id (str): You will get this from :func:`getDocumentIDs`. ...
python
def downloadMARCOAI(doc_id, base): """ Download MARC OAI document with given `doc_id` from given (logical) `base`. Funny part is, that some documents can be obtained only with this function in their full text. Args: doc_id (str): You will get this from :func:`getDocumentIDs`. ...
[ "def", "downloadMARCOAI", "(", "doc_id", ",", "base", ")", ":", "downer", "=", "Downloader", "(", ")", "data", "=", "downer", ".", "download", "(", "ALEPH_URL", "+", "Template", "(", "OAI_DOC_URL_TEMPLATE", ")", ".", "substitute", "(", "DOC_ID", "=", "doc_...
Download MARC OAI document with given `doc_id` from given (logical) `base`. Funny part is, that some documents can be obtained only with this function in their full text. Args: doc_id (str): You will get this from :func:`getDocumentIDs`. base (str, optional): Base from which you wa...
[ "Download", "MARC", "OAI", "document", "with", "given", "doc_id", "from", "given", "(", "logical", ")", "base", "." ]
train
https://github.com/edeposit/edeposit.amqp.aleph/blob/360342c0504d5daa2344e864762cdf938d4149c7/src/edeposit/amqp/aleph/aleph.py#L569-L615
lehins/python-wepay
wepay/calls/subscription.py
Subscription.__create
def __create(self, subscription_plan_id, **kwargs): """Call documentation: `/subscription/create <https://www.wepay.com/developer/reference/subscription#create>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_to...
python
def __create(self, subscription_plan_id, **kwargs): """Call documentation: `/subscription/create <https://www.wepay.com/developer/reference/subscription#create>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_to...
[ "def", "__create", "(", "self", ",", "subscription_plan_id", ",", "*", "*", "kwargs", ")", ":", "params", "=", "{", "'subscription_plan_id'", ":", "subscription_plan_id", "}", "return", "self", ".", "make_call", "(", "self", ".", "__create", ",", "params", "...
Call documentation: `/subscription/create <https://www.wepay.com/developer/reference/subscription#create>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_token``, with ``batch_mode=True`` will set `authorization` ...
[ "Call", "documentation", ":", "/", "subscription", "/", "create", "<https", ":", "//", "www", ".", "wepay", ".", "com", "/", "developer", "/", "reference", "/", "subscription#create", ">", "_", "plus", "extra", "keyword", "parameters", ":", ":", "keyword", ...
train
https://github.com/lehins/python-wepay/blob/414d25a1a8d0ecb22a3ddd1f16c60b805bb52a1f/wepay/calls/subscription.py#L62-L84
lehins/python-wepay
wepay/calls/subscription.py
Subscription.__cancel
def __cancel(self, subscription_id, **kwargs): """Call documentation: `/subscription/cancel <https://www.wepay.com/developer/reference/subscription#cancel>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_token``...
python
def __cancel(self, subscription_id, **kwargs): """Call documentation: `/subscription/cancel <https://www.wepay.com/developer/reference/subscription#cancel>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_token``...
[ "def", "__cancel", "(", "self", ",", "subscription_id", ",", "*", "*", "kwargs", ")", ":", "params", "=", "{", "'subscription_id'", ":", "subscription_id", "}", "return", "self", ".", "make_call", "(", "self", ".", "__cancel", ",", "params", ",", "kwargs",...
Call documentation: `/subscription/cancel <https://www.wepay.com/developer/reference/subscription#cancel>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_token``, with ``batch_mode=True`` will set `authorization` ...
[ "Call", "documentation", ":", "/", "subscription", "/", "cancel", "<https", ":", "//", "www", ".", "wepay", ".", "com", "/", "developer", "/", "reference", "/", "subscription#cancel", ">", "_", "plus", "extra", "keyword", "parameters", ":", ":", "keyword", ...
train
https://github.com/lehins/python-wepay/blob/414d25a1a8d0ecb22a3ddd1f16c60b805bb52a1f/wepay/calls/subscription.py#L92-L114
lehins/python-wepay
wepay/calls/subscription.py
Subscription.__modify
def __modify(self, subscription_id, **kwargs): """Call documentation: `/subscription/modify <https://www.wepay.com/developer/reference/subscription#modify>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_token``...
python
def __modify(self, subscription_id, **kwargs): """Call documentation: `/subscription/modify <https://www.wepay.com/developer/reference/subscription#modify>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_token``...
[ "def", "__modify", "(", "self", ",", "subscription_id", ",", "*", "*", "kwargs", ")", ":", "params", "=", "{", "'subscription_id'", ":", "subscription_id", "}", "return", "self", ".", "make_call", "(", "self", ".", "__modify", ",", "params", ",", "kwargs",...
Call documentation: `/subscription/modify <https://www.wepay.com/developer/reference/subscription#modify>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_token``, with ``batch_mode=True`` will set `authorization` ...
[ "Call", "documentation", ":", "/", "subscription", "/", "modify", "<https", ":", "//", "www", ".", "wepay", ".", "com", "/", "developer", "/", "reference", "/", "subscription#modify", ">", "_", "plus", "extra", "keyword", "parameters", ":", ":", "keyword", ...
train
https://github.com/lehins/python-wepay/blob/414d25a1a8d0ecb22a3ddd1f16c60b805bb52a1f/wepay/calls/subscription.py#L118-L140
KnowledgeLinks/rdfframework
rdfframework/search/esloaders_temp.py
EsRdfBulkLoader._index_item
def _index_item(self, uri, num, batch_num): """ queries the triplestore for an item sends it to elasticsearch """ data = RdfDataset(get_all_item_data(uri, self.namespace), uri).base_class.es_json() self.batch_data[batch_num].append(data) self.count += 1
python
def _index_item(self, uri, num, batch_num): """ queries the triplestore for an item sends it to elasticsearch """ data = RdfDataset(get_all_item_data(uri, self.namespace), uri).base_class.es_json() self.batch_data[batch_num].append(data) self.count += 1
[ "def", "_index_item", "(", "self", ",", "uri", ",", "num", ",", "batch_num", ")", ":", "data", "=", "RdfDataset", "(", "get_all_item_data", "(", "uri", ",", "self", ".", "namespace", ")", ",", "uri", ")", ".", "base_class", ".", "es_json", "(", ")", ...
queries the triplestore for an item sends it to elasticsearch
[ "queries", "the", "triplestore", "for", "an", "item", "sends", "it", "to", "elasticsearch" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/search/esloaders_temp.py#L59-L65
KnowledgeLinks/rdfframework
rdfframework/search/esloaders_temp.py
EsRdfBulkLoader._index_group_with_sub
def _index_group_with_sub(self): """ indexes all the URIs defined by the query into Elasticsearch """ lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3])) lg.setLevel(self.log_level) # get a list of all the uri to index results = run_sparql_query(sparql=self.query,...
python
def _index_group_with_sub(self): """ indexes all the URIs defined by the query into Elasticsearch """ lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3])) lg.setLevel(self.log_level) # get a list of all the uri to index results = run_sparql_query(sparql=self.query,...
[ "def", "_index_group_with_sub", "(", "self", ")", ":", "lg", "=", "logging", ".", "getLogger", "(", "\"%s.%s\"", "%", "(", "self", ".", "ln", ",", "inspect", ".", "stack", "(", ")", "[", "0", "]", "[", "3", "]", ")", ")", "lg", ".", "setLevel", "...
indexes all the URIs defined by the query into Elasticsearch
[ "indexes", "all", "the", "URIs", "defined", "by", "the", "query", "into", "Elasticsearch" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/search/esloaders_temp.py#L86-L143
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
select_newest_project
def select_newest_project(dx_project_ids): """ Given a list of DNAnexus project IDs, returns the one that is newest as determined by creation date. Args: dx_project_ids: `list` of DNAnexus project IDs. Returns: `str`. """ if len(dx_project_ids) == 1: return dx_proj...
python
def select_newest_project(dx_project_ids): """ Given a list of DNAnexus project IDs, returns the one that is newest as determined by creation date. Args: dx_project_ids: `list` of DNAnexus project IDs. Returns: `str`. """ if len(dx_project_ids) == 1: return dx_proj...
[ "def", "select_newest_project", "(", "dx_project_ids", ")", ":", "if", "len", "(", "dx_project_ids", ")", "==", "1", ":", "return", "dx_project_ids", "[", "0", "]", "projects", "=", "[", "dxpy", ".", "DXProject", "(", "x", ")", "for", "x", "in", "dx_proj...
Given a list of DNAnexus project IDs, returns the one that is newest as determined by creation date. Args: dx_project_ids: `list` of DNAnexus project IDs. Returns: `str`.
[ "Given", "a", "list", "of", "DNAnexus", "project", "IDs", "returns", "the", "one", "that", "is", "newest", "as", "determined", "by", "creation", "date", ".", "Args", ":", "dx_project_ids", ":", "list", "of", "DNAnexus", "project", "IDs", ".", "Returns", ":...
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L67-L84
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
accept_project_transfers
def accept_project_transfers(access_level,queue,org,share_with_org=None): """ Args: access_level: `str`. Permissions level the new member should have on transferred projects. Should be one of ["VIEW","UPLOAD","CONTRIBUTE","ADMINISTER"]. See https://wiki.dnanexus.com/A...
python
def accept_project_transfers(access_level,queue,org,share_with_org=None): """ Args: access_level: `str`. Permissions level the new member should have on transferred projects. Should be one of ["VIEW","UPLOAD","CONTRIBUTE","ADMINISTER"]. See https://wiki.dnanexus.com/A...
[ "def", "accept_project_transfers", "(", "access_level", ",", "queue", ",", "org", ",", "share_with_org", "=", "None", ")", ":", "dx_username", "=", "gbsc_dnanexus", ".", "utils", ".", "get_dx_username", "(", ")", "#gbsc_dnanexus.utils.log_into_dnanexus(dx_username)", ...
Args: access_level: `str`. Permissions level the new member should have on transferred projects. Should be one of ["VIEW","UPLOAD","CONTRIBUTE","ADMINISTER"]. See https://wiki.dnanexus.com/API-Specification-v1.0.0/Project-Permissions-and-Sharing for more details on access levels....
[ "Args", ":", "access_level", ":", "str", ".", "Permissions", "level", "the", "new", "member", "should", "have", "on", "transferred", "projects", ".", "Should", "be", "one", "of", "[", "VIEW", "UPLOAD", "CONTRIBUTE", "ADMINISTER", "]", ".", "See", "https", ...
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L86-L130
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
share_with_org
def share_with_org(project_ids, org, access_level, suppress_email_notification=False): """ Shares one or more DNAnexus projects with an organization. Args: project_ids: `list`. One or more DNAnexus project identifiers, where each project ID is in the form "project-FXq6B809p5jKzp2vJkjkK...
python
def share_with_org(project_ids, org, access_level, suppress_email_notification=False): """ Shares one or more DNAnexus projects with an organization. Args: project_ids: `list`. One or more DNAnexus project identifiers, where each project ID is in the form "project-FXq6B809p5jKzp2vJkjkK...
[ "def", "share_with_org", "(", "project_ids", ",", "org", ",", "access_level", ",", "suppress_email_notification", "=", "False", ")", ":", "for", "p", "in", "project_ids", ":", "dxpy", ".", "api", ".", "project_invite", "(", "object_id", "=", "p", ",", "input...
Shares one or more DNAnexus projects with an organization. Args: project_ids: `list`. One or more DNAnexus project identifiers, where each project ID is in the form "project-FXq6B809p5jKzp2vJkjkKvg3". org: `str`. The name of the DNAnexus org with which to share the projects. ...
[ "Shares", "one", "or", "more", "DNAnexus", "projects", "with", "an", "organization", "." ]
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L133-L147
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
DxSeqResults._set_dxproject_id
def _set_dxproject_id(self,latest_project=False): """ Searches for the project in DNAnexus based on the input arguments when instantiating the class. If multiple projects are found based on the search criteria, an exception will be raised. A few various search strategies are employed, ...
python
def _set_dxproject_id(self,latest_project=False): """ Searches for the project in DNAnexus based on the input arguments when instantiating the class. If multiple projects are found based on the search criteria, an exception will be raised. A few various search strategies are employed, ...
[ "def", "_set_dxproject_id", "(", "self", ",", "latest_project", "=", "False", ")", ":", "dx_project_props", "=", "{", "}", "if", "self", ".", "library_name", ":", "dx_project_props", "[", "\"library_name\"", "]", "=", "self", ".", "library_name", "if", "self",...
Searches for the project in DNAnexus based on the input arguments when instantiating the class. If multiple projects are found based on the search criteria, an exception will be raised. A few various search strategies are employed, based on the input arguments. In all cases, if the 'billing_a...
[ "Searches", "for", "the", "project", "in", "DNAnexus", "based", "on", "the", "input", "arguments", "when", "instantiating", "the", "class", ".", "If", "multiple", "projects", "are", "found", "based", "on", "the", "search", "criteria", "an", "exception", "will"...
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L226-L295
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
DxSeqResults.get_run_details_json
def get_run_details_json(self): """ Retrieves the JSON object for the stats in the file named run_details.json in the project specified by self.dx_project_id. Returns: JSON object of the run details. """ run_details_filename = "run_details.json" ...
python
def get_run_details_json(self): """ Retrieves the JSON object for the stats in the file named run_details.json in the project specified by self.dx_project_id. Returns: JSON object of the run details. """ run_details_filename = "run_details.json" ...
[ "def", "get_run_details_json", "(", "self", ")", ":", "run_details_filename", "=", "\"run_details.json\"", "run_details_json_id", "=", "dxpy", ".", "find_one_data_object", "(", "more_ok", "=", "False", ",", "zero_ok", "=", "True", ",", "project", "=", "self", ".",...
Retrieves the JSON object for the stats in the file named run_details.json in the project specified by self.dx_project_id. Returns: JSON object of the run details.
[ "Retrieves", "the", "JSON", "object", "for", "the", "stats", "in", "the", "file", "named", "run_details", ".", "json", "in", "the", "project", "specified", "by", "self", ".", "dx_project_id", ".", "Returns", ":", "JSON", "object", "of", "the", "run", "deta...
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L304-L316
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
DxSeqResults.get_alignment_summary_metrics
def get_alignment_summary_metrics(self, barcode): """ Parses the metrics in a ${barcode}alignment_summary_metrics file in the DNAnexus project (usually in the qc folder). This contains metrics produced by Picard Tools's CollectAlignmentSummaryMetrics program. """ filena...
python
def get_alignment_summary_metrics(self, barcode): """ Parses the metrics in a ${barcode}alignment_summary_metrics file in the DNAnexus project (usually in the qc folder). This contains metrics produced by Picard Tools's CollectAlignmentSummaryMetrics program. """ filena...
[ "def", "get_alignment_summary_metrics", "(", "self", ",", "barcode", ")", ":", "filename", "=", "barcode", "+", "\".alignment_summary_metrics\"", "# In the call to dxpy.find_one_data_object() below, I'd normally set the ", "# more_ok parameter to False, but this blows-up in Python 3.7 - ...
Parses the metrics in a ${barcode}alignment_summary_metrics file in the DNAnexus project (usually in the qc folder). This contains metrics produced by Picard Tools's CollectAlignmentSummaryMetrics program.
[ "Parses", "the", "metrics", "in", "a", "$", "{", "barcode", "}", "alignment_summary_metrics", "file", "in", "the", "DNAnexus", "project", "(", "usually", "in", "the", "qc", "folder", ")", ".", "This", "contains", "metrics", "produced", "by", "Picard", "Tools...
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L318-L340
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
DxSeqResults.get_barcode_stats
def get_barcode_stats(self, barcode): """ Loads the JSON in a ${barcode}_stats.json file in the DNAnexus project (usually in the qc folder). """ filename = barcode + "_stats.json" # In the call to dxpy.find_one_data_object() below, I'd normally set the # more_ok...
python
def get_barcode_stats(self, barcode): """ Loads the JSON in a ${barcode}_stats.json file in the DNAnexus project (usually in the qc folder). """ filename = barcode + "_stats.json" # In the call to dxpy.find_one_data_object() below, I'd normally set the # more_ok...
[ "def", "get_barcode_stats", "(", "self", ",", "barcode", ")", ":", "filename", "=", "barcode", "+", "\"_stats.json\"", "# In the call to dxpy.find_one_data_object() below, I'd normally set the ", "# more_ok parameter to False, but this blows-up in Python 3.7 - giving me a RuntimeError. "...
Loads the JSON in a ${barcode}_stats.json file in the DNAnexus project (usually in the qc folder).
[ "Loads", "the", "JSON", "in", "a", "$", "{", "barcode", "}", "_stats", ".", "json", "file", "in", "the", "DNAnexus", "project", "(", "usually", "in", "the", "qc", "folder", ")", "." ]
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L342-L357
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
DxSeqResults.get_sample_stats_json
def get_sample_stats_json(self,barcode=None): """ .. deprecated:: 0.1.0 GSSC has removed the sample_stats.json file since the entire folder it was in has been removed. Use :meth:`get_barcode_stats` instead. Retrieves the JSON object for the stats in the file named s...
python
def get_sample_stats_json(self,barcode=None): """ .. deprecated:: 0.1.0 GSSC has removed the sample_stats.json file since the entire folder it was in has been removed. Use :meth:`get_barcode_stats` instead. Retrieves the JSON object for the stats in the file named s...
[ "def", "get_sample_stats_json", "(", "self", ",", "barcode", "=", "None", ")", ":", "sample_stats_json_filename", "=", "\"sample_stats.json\"", "sample_stats_json_id", "=", "dxpy", ".", "find_one_data_object", "(", "more_ok", "=", "False", ",", "zero_ok", "=", "Fals...
.. deprecated:: 0.1.0 GSSC has removed the sample_stats.json file since the entire folder it was in has been removed. Use :meth:`get_barcode_stats` instead. Retrieves the JSON object for the stats in the file named sample_stats.json in the project specified by self.dx_proj...
[ "..", "deprecated", "::", "0", ".", "1", ".", "0", "GSSC", "has", "removed", "the", "sample_stats", ".", "json", "file", "since", "the", "entire", "folder", "it", "was", "in", "has", "been", "removed", ".", "Use", ":", "meth", ":", "get_barcode_stats", ...
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L359-L392
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
DxSeqResults.download_metadata_tar
def download_metadata_tar(self,download_dir): """ Downloads the ${run_name}.metadata.tar file from the DNAnexus sequencing results project. Args: download_dir: `str` - The local directory path to download the QC report to. Returns: `str`: The filepath to t...
python
def download_metadata_tar(self,download_dir): """ Downloads the ${run_name}.metadata.tar file from the DNAnexus sequencing results project. Args: download_dir: `str` - The local directory path to download the QC report to. Returns: `str`: The filepath to t...
[ "def", "download_metadata_tar", "(", "self", ",", "download_dir", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "download_dir", ")", ":", "os", ".", "makedirs", "(", "download_dir", ")", "res", "=", "dxpy", ".", "find_one_data_object", "(", ...
Downloads the ${run_name}.metadata.tar file from the DNAnexus sequencing results project. Args: download_dir: `str` - The local directory path to download the QC report to. Returns: `str`: The filepath to the downloaded metadata tarball.
[ "Downloads", "the", "$", "{", "run_name", "}", ".", "metadata", ".", "tar", "file", "from", "the", "DNAnexus", "sequencing", "results", "project", ".", "Args", ":", "download_dir", ":", "str", "-", "The", "local", "directory", "path", "to", "download", "th...
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L394-L414
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
DxSeqResults.download_fastqc_reports
def download_fastqc_reports(self,download_dir): """ Downloads the QC report from the DNAnexus sequencing results project. Args: download_dir: `str` - The local directory path to download the QC report to. Returns: `str`. The filepath to the downloaded ...
python
def download_fastqc_reports(self,download_dir): """ Downloads the QC report from the DNAnexus sequencing results project. Args: download_dir: `str` - The local directory path to download the QC report to. Returns: `str`. The filepath to the downloaded ...
[ "def", "download_fastqc_reports", "(", "self", ",", "download_dir", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "download_dir", ")", ":", "os", ".", "makedirs", "(", "download_dir", ")", "msg", "=", "\"the FASTQC reports to {download_dir}.\"", ...
Downloads the QC report from the DNAnexus sequencing results project. Args: download_dir: `str` - The local directory path to download the QC report to. Returns: `str`. The filepath to the downloaded FASTQC reports folder.
[ "Downloads", "the", "QC", "report", "from", "the", "DNAnexus", "sequencing", "results", "project", ".", "Args", ":", "download_dir", ":", "str", "-", "The", "local", "directory", "path", "to", "download", "the", "QC", "report", "to", ".", "Returns", ":", "...
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L508-L525
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
DxSeqResults.download_fastqs
def download_fastqs(self,dest_dir,barcode,overwrite=False): """ Downloads all FASTQ files in the project that match the specified barcode, or if a barcode isn't given, all FASTQ files as in this case it is assumed that this is not a multiplexed experiment. Files are downloaded to the d...
python
def download_fastqs(self,dest_dir,barcode,overwrite=False): """ Downloads all FASTQ files in the project that match the specified barcode, or if a barcode isn't given, all FASTQ files as in this case it is assumed that this is not a multiplexed experiment. Files are downloaded to the d...
[ "def", "download_fastqs", "(", "self", ",", "dest_dir", ",", "barcode", ",", "overwrite", "=", "False", ")", ":", "fastq_props", "=", "self", ".", "get_fastq_files_props", "(", "barcode", "=", "barcode", ")", "res", "=", "{", "}", "for", "f", "in", "fast...
Downloads all FASTQ files in the project that match the specified barcode, or if a barcode isn't given, all FASTQ files as in this case it is assumed that this is not a multiplexed experiment. Files are downloaded to the directory specified by dest_dir. Args: barcode: `str`. ...
[ "Downloads", "all", "FASTQ", "files", "in", "the", "project", "that", "match", "the", "specified", "barcode", "or", "if", "a", "barcode", "isn", "t", "given", "all", "FASTQ", "files", "as", "in", "this", "case", "it", "is", "assumed", "that", "this", "is...
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L556-L591
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
DxSeqResults.get_fastq_dxfile_objects
def get_fastq_dxfile_objects(self,barcode=None): """ Retrieves all the FASTQ files in project self.dx_project_name as DXFile objects. Args: barcode: `str`. If set, then only FASTQ file properties for FASTQ files having the specified barcode are returned. Returns: ...
python
def get_fastq_dxfile_objects(self,barcode=None): """ Retrieves all the FASTQ files in project self.dx_project_name as DXFile objects. Args: barcode: `str`. If set, then only FASTQ file properties for FASTQ files having the specified barcode are returned. Returns: ...
[ "def", "get_fastq_dxfile_objects", "(", "self", ",", "barcode", "=", "None", ")", ":", "fq_ext_glob", "=", "\"*{}\"", ".", "format", "(", "self", ".", "FQEXT", ")", "name", "=", "fq_ext_glob", "if", "barcode", ":", "name", "=", "\"*_{barcode}_*{FQEXT}\"", "....
Retrieves all the FASTQ files in project self.dx_project_name as DXFile objects. Args: barcode: `str`. If set, then only FASTQ file properties for FASTQ files having the specified barcode are returned. Returns: `list` of DXFile objects representing FASTQ files. ...
[ "Retrieves", "all", "the", "FASTQ", "files", "in", "project", "self", ".", "dx_project_name", "as", "DXFile", "objects", ".", "Args", ":", "barcode", ":", "str", ".", "If", "set", "then", "only", "FASTQ", "file", "properties", "for", "FASTQ", "files", "hav...
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L593-L621
StanfordBioinformatics/scgpm_seqresults_dnanexus
scgpm_seqresults_dnanexus/dnanexus_utils.py
DxSeqResults.get_fastq_files_props
def get_fastq_files_props(self,barcode=None): """ Returns the DNAnexus file properties for all FASTQ files in the project that match the specified barcode, or all FASTQ files if not barcode is specified. Args: barcode: `str`. If set, then only FASTQ file properties for FA...
python
def get_fastq_files_props(self,barcode=None): """ Returns the DNAnexus file properties for all FASTQ files in the project that match the specified barcode, or all FASTQ files if not barcode is specified. Args: barcode: `str`. If set, then only FASTQ file properties for FA...
[ "def", "get_fastq_files_props", "(", "self", ",", "barcode", "=", "None", ")", ":", "fastqs", "=", "self", ".", "get_fastq_dxfile_objects", "(", "barcode", "=", "barcode", ")", "#FastqNotFound Exception here if no FASTQs found for specified barcode.", "dico", "=", "{", ...
Returns the DNAnexus file properties for all FASTQ files in the project that match the specified barcode, or all FASTQ files if not barcode is specified. Args: barcode: `str`. If set, then only FASTQ file properties for FASTQ files having the specified barcode are returned. Re...
[ "Returns", "the", "DNAnexus", "file", "properties", "for", "all", "FASTQ", "files", "in", "the", "project", "that", "match", "the", "specified", "barcode", "or", "all", "FASTQ", "files", "if", "not", "barcode", "is", "specified", ".", "Args", ":", "barcode",...
train
https://github.com/StanfordBioinformatics/scgpm_seqresults_dnanexus/blob/2bdaae5ec5d38a07fec99e0c5379074a591d77b6/scgpm_seqresults_dnanexus/dnanexus_utils.py#L623-L646
amcfague/webunit2
webunit2/utils.py
parse_url
def parse_url(url): """ Takes a URL string and returns its protocol and server """ # Verify that the protocol makes sense. We shouldn't guess! if not RE_PROTOCOL_SERVER.match(url): raise Exception("URL should begin with `protocol://domain`") protocol, server, path, _, _, _ = urlparse.urlparse(...
python
def parse_url(url): """ Takes a URL string and returns its protocol and server """ # Verify that the protocol makes sense. We shouldn't guess! if not RE_PROTOCOL_SERVER.match(url): raise Exception("URL should begin with `protocol://domain`") protocol, server, path, _, _, _ = urlparse.urlparse(...
[ "def", "parse_url", "(", "url", ")", ":", "# Verify that the protocol makes sense. We shouldn't guess!", "if", "not", "RE_PROTOCOL_SERVER", ".", "match", "(", "url", ")", ":", "raise", "Exception", "(", "\"URL should begin with `protocol://domain`\"", ")", "protocol", ",...
Takes a URL string and returns its protocol and server
[ "Takes", "a", "URL", "string", "and", "returns", "its", "protocol", "and", "server" ]
train
https://github.com/amcfague/webunit2/blob/3157e5837aad0810800628c1383f1fe11ee3e513/webunit2/utils.py#L45-L53
msuozzo/Aduro
aduro/store.py
EventStore.record_event
def record_event(self, event): """Records the ``KindleEvent`` `event` in the store """ with open(self._path, 'a') as file_: file_.write(str(event) + '\n')
python
def record_event(self, event): """Records the ``KindleEvent`` `event` in the store """ with open(self._path, 'a') as file_: file_.write(str(event) + '\n')
[ "def", "record_event", "(", "self", ",", "event", ")", ":", "with", "open", "(", "self", ".", "_path", ",", "'a'", ")", "as", "file_", ":", "file_", ".", "write", "(", "str", "(", "event", ")", "+", "'\\n'", ")" ]
Records the ``KindleEvent`` `event` in the store
[ "Records", "the", "KindleEvent", "event", "in", "the", "store" ]
train
https://github.com/msuozzo/Aduro/blob/338eeb1deeff30c198e721b660ae4daca3660911/aduro/store.py#L14-L18
msuozzo/Aduro
aduro/store.py
EventStore.get_events
def get_events(self): """Returns a list of all ``KindleEvent``s held in the store """ with open(self._path, 'r') as file_: file_lines = file_.read().splitlines() event_lines = [line for line in file_lines if line] events = [] for event_line in event_lines:...
python
def get_events(self): """Returns a list of all ``KindleEvent``s held in the store """ with open(self._path, 'r') as file_: file_lines = file_.read().splitlines() event_lines = [line for line in file_lines if line] events = [] for event_line in event_lines:...
[ "def", "get_events", "(", "self", ")", ":", "with", "open", "(", "self", ".", "_path", ",", "'r'", ")", "as", "file_", ":", "file_lines", "=", "file_", ".", "read", "(", ")", ".", "splitlines", "(", ")", "event_lines", "=", "[", "line", "for", "lin...
Returns a list of all ``KindleEvent``s held in the store
[ "Returns", "a", "list", "of", "all", "KindleEvent", "s", "held", "in", "the", "store" ]
train
https://github.com/msuozzo/Aduro/blob/338eeb1deeff30c198e721b660ae4daca3660911/aduro/store.py#L20-L36
b3j0f/conf
b3j0f/conf/model/param.py
Parameter.name
def name(self, value): """Set parameter name. :param str value: name value. """ if isinstance(value, string_types): match = Parameter._PARAM_NAME_COMPILER_MATCHER(value) if match is None or match.group() != value: value = re_compile(value) ...
python
def name(self, value): """Set parameter name. :param str value: name value. """ if isinstance(value, string_types): match = Parameter._PARAM_NAME_COMPILER_MATCHER(value) if match is None or match.group() != value: value = re_compile(value) ...
[ "def", "name", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "string_types", ")", ":", "match", "=", "Parameter", ".", "_PARAM_NAME_COMPILER_MATCHER", "(", "value", ")", "if", "match", "is", "None", "or", "match", ".", "grou...
Set parameter name. :param str value: name value.
[ "Set", "parameter", "name", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/param.py#L354-L367
b3j0f/conf
b3j0f/conf/model/param.py
Parameter.svalue
def svalue(self): """Get serialized value. :rtype: str """ result = self._svalue if result is None: # try to get svalue from value if svalue is None try: value = self.value except Parameter.Error: pass els...
python
def svalue(self): """Get serialized value. :rtype: str """ result = self._svalue if result is None: # try to get svalue from value if svalue is None try: value = self.value except Parameter.Error: pass els...
[ "def", "svalue", "(", "self", ")", ":", "result", "=", "self", ".", "_svalue", "if", "result", "is", "None", ":", "# try to get svalue from value if svalue is None", "try", ":", "value", "=", "self", ".", "value", "except", "Parameter", ".", "Error", ":", "p...
Get serialized value. :rtype: str
[ "Get", "serialized", "value", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/param.py#L380-L399
b3j0f/conf
b3j0f/conf/model/param.py
Parameter.svalue
def svalue(self, value): """Change of serialized value. Nonify this value as well. :param str value: serialized value to use. """ if value is not None: # if value is not None self._value = None self._error = None self._svalue = value
python
def svalue(self, value): """Change of serialized value. Nonify this value as well. :param str value: serialized value to use. """ if value is not None: # if value is not None self._value = None self._error = None self._svalue = value
[ "def", "svalue", "(", "self", ",", "value", ")", ":", "if", "value", "is", "not", "None", ":", "# if value is not None", "self", ".", "_value", "=", "None", "self", ".", "_error", "=", "None", "self", ".", "_svalue", "=", "value" ]
Change of serialized value. Nonify this value as well. :param str value: serialized value to use.
[ "Change", "of", "serialized", "value", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/param.py#L402-L414
b3j0f/conf
b3j0f/conf/model/param.py
Parameter.resolve
def resolve( self, configurable=None, conf=None, scope=None, ptype=None, parser=None, error=True, svalue=None, safe=None, besteffort=None ): """Resolve this parameter value related to a configurable and a configuration. Save error in this attr...
python
def resolve( self, configurable=None, conf=None, scope=None, ptype=None, parser=None, error=True, svalue=None, safe=None, besteffort=None ): """Resolve this parameter value related to a configurable and a configuration. Save error in this attr...
[ "def", "resolve", "(", "self", ",", "configurable", "=", "None", ",", "conf", "=", "None", ",", "scope", "=", "None", ",", "ptype", "=", "None", ",", "parser", "=", "None", ",", "error", "=", "True", ",", "svalue", "=", "None", ",", "safe", "=", ...
Resolve this parameter value related to a configurable and a configuration. Save error in this attribute `error` in case of failure. :param str svalue: serialized value too resolve. Default is this svalue. :param Configurable configurable: configurable to use for foreign pa...
[ "Resolve", "this", "parameter", "value", "related", "to", "a", "configurable", "and", "a", "configuration", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/param.py#L416-L493
b3j0f/conf
b3j0f/conf/model/param.py
Parameter.value
def value(self): """Get parameter value. If this cached value is None and this serialized value is not None, calculate the new value from the serialized one. :return: parameter value. :raises: TypeError if serialized value is not an instance of self ptype . ParserEr...
python
def value(self): """Get parameter value. If this cached value is None and this serialized value is not None, calculate the new value from the serialized one. :return: parameter value. :raises: TypeError if serialized value is not an instance of self ptype . ParserEr...
[ "def", "value", "(", "self", ")", ":", "result", "=", "self", ".", "_value", "if", "result", "is", "None", "and", "self", ".", "_svalue", "is", "not", "None", ":", "try", ":", "result", "=", "self", ".", "_value", "=", "self", ".", "resolve", "(", ...
Get parameter value. If this cached value is None and this serialized value is not None, calculate the new value from the serialized one. :return: parameter value. :raises: TypeError if serialized value is not an instance of self ptype . ParserError if parsing step raised a...
[ "Get", "parameter", "value", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/param.py#L496-L520
b3j0f/conf
b3j0f/conf/model/param.py
Parameter.value
def value(self, value): """Change of parameter value. If an error occured, it is stored in this error attribute. :param value: new value to use. If input value is not an instance of self.ptype, self error :raises: TypeError if input value is not an instance of self ptype. ...
python
def value(self, value): """Change of parameter value. If an error occured, it is stored in this error attribute. :param value: new value to use. If input value is not an instance of self.ptype, self error :raises: TypeError if input value is not an instance of self ptype. ...
[ "def", "value", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", "or", "(", "self", ".", "ptype", "is", "None", "or", "isinstance", "(", "value", ",", "self", ".", "ptype", ")", ")", ":", "self", ".", "_value", "=", "value", "els...
Change of parameter value. If an error occured, it is stored in this error attribute. :param value: new value to use. If input value is not an instance of self.ptype, self error :raises: TypeError if input value is not an instance of self ptype.
[ "Change", "of", "parameter", "value", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/param.py#L523-L546
scdoshi/django-bits
bits/templatetags/attribute.py
attr
def attr(object, attr): """ Lookup attributes in django templates dynamically From http://stackoverflow.com/a/3466349/594269 Allows lookups such as {{ user|attr:item }} where item is a template variable """ pseudo_context = {'object': object} try: value = Variable('object.%s' % ...
python
def attr(object, attr): """ Lookup attributes in django templates dynamically From http://stackoverflow.com/a/3466349/594269 Allows lookups such as {{ user|attr:item }} where item is a template variable """ pseudo_context = {'object': object} try: value = Variable('object.%s' % ...
[ "def", "attr", "(", "object", ",", "attr", ")", ":", "pseudo_context", "=", "{", "'object'", ":", "object", "}", "try", ":", "value", "=", "Variable", "(", "'object.%s'", "%", "attr", ")", ".", "resolve", "(", "pseudo_context", ")", "except", "VariableDo...
Lookup attributes in django templates dynamically From http://stackoverflow.com/a/3466349/594269 Allows lookups such as {{ user|attr:item }} where item is a template variable
[ "Lookup", "attributes", "in", "django", "templates", "dynamically", "From", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "3466349", "/", "594269" ]
train
https://github.com/scdoshi/django-bits/blob/0a2f4fd9374d2a8acb8df9a7b83eebcf2782256f/bits/templatetags/attribute.py#L15-L28
ericmjl/polcart
polcart/polcart.py
to_cartesian
def to_cartesian(r, theta, theta_units="radians"): """ Converts polar r, theta to cartesian x, y. """ assert theta_units in ['radians', 'degrees'],\ "kwarg theta_units must specified in radians or degrees" # Convert to radians if theta_units == "degrees": theta = to_radians(thet...
python
def to_cartesian(r, theta, theta_units="radians"): """ Converts polar r, theta to cartesian x, y. """ assert theta_units in ['radians', 'degrees'],\ "kwarg theta_units must specified in radians or degrees" # Convert to radians if theta_units == "degrees": theta = to_radians(thet...
[ "def", "to_cartesian", "(", "r", ",", "theta", ",", "theta_units", "=", "\"radians\"", ")", ":", "assert", "theta_units", "in", "[", "'radians'", ",", "'degrees'", "]", ",", "\"kwarg theta_units must specified in radians or degrees\"", "# Convert to radians", "if", "t...
Converts polar r, theta to cartesian x, y.
[ "Converts", "polar", "r", "theta", "to", "cartesian", "x", "y", "." ]
train
https://github.com/ericmjl/polcart/blob/1d003987f269c14884726205f871dd91de8610ce/polcart/polcart.py#L5-L20
rraadd88/meld
meld/dfs.py
set_index
def set_index(data,col_index): """ Sets the index if the index is not present :param data: pandas table :param col_index: column name which will be assigned as a index """ if col_index in data: data=data.reset_index().set_index(col_index) if 'index' in data: del dat...
python
def set_index(data,col_index): """ Sets the index if the index is not present :param data: pandas table :param col_index: column name which will be assigned as a index """ if col_index in data: data=data.reset_index().set_index(col_index) if 'index' in data: del dat...
[ "def", "set_index", "(", "data", ",", "col_index", ")", ":", "if", "col_index", "in", "data", ":", "data", "=", "data", ".", "reset_index", "(", ")", ".", "set_index", "(", "col_index", ")", "if", "'index'", "in", "data", ":", "del", "data", "[", "'i...
Sets the index if the index is not present :param data: pandas table :param col_index: column name which will be assigned as a index
[ "Sets", "the", "index", "if", "the", "index", "is", "not", "present" ]
train
https://github.com/rraadd88/meld/blob/e25aba1c07b2c775031224a8b55bf006ccb24dfd/meld/dfs.py#L18-L34
rraadd88/meld
meld/dfs.py
del_Unnamed
def del_Unnamed(df): """ Deletes all the unnamed columns :param df: pandas dataframe """ cols_del=[c for c in df.columns if 'Unnamed' in c] return df.drop(cols_del,axis=1)
python
def del_Unnamed(df): """ Deletes all the unnamed columns :param df: pandas dataframe """ cols_del=[c for c in df.columns if 'Unnamed' in c] return df.drop(cols_del,axis=1)
[ "def", "del_Unnamed", "(", "df", ")", ":", "cols_del", "=", "[", "c", "for", "c", "in", "df", ".", "columns", "if", "'Unnamed'", "in", "c", "]", "return", "df", ".", "drop", "(", "cols_del", ",", "axis", "=", "1", ")" ]
Deletes all the unnamed columns :param df: pandas dataframe
[ "Deletes", "all", "the", "unnamed", "columns" ]
train
https://github.com/rraadd88/meld/blob/e25aba1c07b2c775031224a8b55bf006ccb24dfd/meld/dfs.py#L71-L78
rraadd88/meld
meld/dfs.py
fhs2data_combo
def fhs2data_combo(fhs,cols,index,labels=None,col_sep=': '): """ Collates data from multiple csv files :param fhs: list of paths to csv files :param cols: list of column names to concatenate :param index: name of the column name to be used as the common index of the output pandas table """ ...
python
def fhs2data_combo(fhs,cols,index,labels=None,col_sep=': '): """ Collates data from multiple csv files :param fhs: list of paths to csv files :param cols: list of column names to concatenate :param index: name of the column name to be used as the common index of the output pandas table """ ...
[ "def", "fhs2data_combo", "(", "fhs", ",", "cols", ",", "index", ",", "labels", "=", "None", ",", "col_sep", "=", "': '", ")", ":", "if", "labels", "is", "None", ":", "labels", "=", "[", "basename", "(", "fh", ")", "for", "fh", "in", "fhs", "]", "...
Collates data from multiple csv files :param fhs: list of paths to csv files :param cols: list of column names to concatenate :param index: name of the column name to be used as the common index of the output pandas table
[ "Collates", "data", "from", "multiple", "csv", "files" ]
train
https://github.com/rraadd88/meld/blob/e25aba1c07b2c775031224a8b55bf006ccb24dfd/meld/dfs.py#L93-L117
DoWhileGeek/authentise-services
authentise_services/session.py
Session.__create_session
def __create_session(username=None, password=None): """grabs the configuration, and makes the call to Authentise to create the session""" config = Config() if not username or not password: username = config.username password = config.password payload = { ...
python
def __create_session(username=None, password=None): """grabs the configuration, and makes the call to Authentise to create the session""" config = Config() if not username or not password: username = config.username password = config.password payload = { ...
[ "def", "__create_session", "(", "username", "=", "None", ",", "password", "=", "None", ")", ":", "config", "=", "Config", "(", ")", "if", "not", "username", "or", "not", "password", ":", "username", "=", "config", ".", "username", "password", "=", "confi...
grabs the configuration, and makes the call to Authentise to create the session
[ "grabs", "the", "configuration", "and", "makes", "the", "call", "to", "Authentise", "to", "create", "the", "session" ]
train
https://github.com/DoWhileGeek/authentise-services/blob/ee32bd7f7de15d3fb24c0a6374640d3a1ec8096d/authentise_services/session.py#L18-L35
DoWhileGeek/authentise-services
authentise_services/session.py
Session.create_user
def create_user(cls, username, password, name, email): """utility class method to create a user""" config = Config() payload = {"username": username, "email": email, "name": name, "password": password, } user_creation_resp = reques...
python
def create_user(cls, username, password, name, email): """utility class method to create a user""" config = Config() payload = {"username": username, "email": email, "name": name, "password": password, } user_creation_resp = reques...
[ "def", "create_user", "(", "cls", ",", "username", ",", "password", ",", "name", ",", "email", ")", ":", "config", "=", "Config", "(", ")", "payload", "=", "{", "\"username\"", ":", "username", ",", "\"email\"", ":", "email", ",", "\"name\"", ":", "nam...
utility class method to create a user
[ "utility", "class", "method", "to", "create", "a", "user" ]
train
https://github.com/DoWhileGeek/authentise-services/blob/ee32bd7f7de15d3fb24c0a6374640d3a1ec8096d/authentise_services/session.py#L38-L48
mush42/mezzanine-live-tile
mezzanine_live_tile/templatetags/tile_tags.py
wrap_text
def wrap_text(paragraph, line_count, min_char_per_line=0): """Wraps the given text to the specified number of lines.""" one_string = strip_all_white_space(paragraph) if min_char_per_line: lines = wrap(one_string, width=min_char_per_line) try: return lines[:line_count] except IndexError: return lines els...
python
def wrap_text(paragraph, line_count, min_char_per_line=0): """Wraps the given text to the specified number of lines.""" one_string = strip_all_white_space(paragraph) if min_char_per_line: lines = wrap(one_string, width=min_char_per_line) try: return lines[:line_count] except IndexError: return lines els...
[ "def", "wrap_text", "(", "paragraph", ",", "line_count", ",", "min_char_per_line", "=", "0", ")", ":", "one_string", "=", "strip_all_white_space", "(", "paragraph", ")", "if", "min_char_per_line", ":", "lines", "=", "wrap", "(", "one_string", ",", "width", "="...
Wraps the given text to the specified number of lines.
[ "Wraps", "the", "given", "text", "to", "the", "specified", "number", "of", "lines", "." ]
train
https://github.com/mush42/mezzanine-live-tile/blob/28dd6cb1af43f25c50e724f141b5dd00f4f166e7/mezzanine_live_tile/templatetags/tile_tags.py#L15-L25
rsarun-uninstallio/apprequest
apprequest/AppRequest.py
AppRequest.get_request_id
def get_request_id(self, renew=False): """ :Brief: This method is used in every place to get the already generated request ID or generate new request ID and sent off """ if not AppRequest.__request_id or renew: self.set_request_id(uuid.uuid1()) return AppReque...
python
def get_request_id(self, renew=False): """ :Brief: This method is used in every place to get the already generated request ID or generate new request ID and sent off """ if not AppRequest.__request_id or renew: self.set_request_id(uuid.uuid1()) return AppReque...
[ "def", "get_request_id", "(", "self", ",", "renew", "=", "False", ")", ":", "if", "not", "AppRequest", ".", "__request_id", "or", "renew", ":", "self", ".", "set_request_id", "(", "uuid", ".", "uuid1", "(", ")", ")", "return", "AppRequest", ".", "__reque...
:Brief: This method is used in every place to get the already generated request ID or generate new request ID and sent off
[ ":", "Brief", ":", "This", "method", "is", "used", "in", "every", "place", "to", "get", "the", "already", "generated", "request", "ID", "or", "generate", "new", "request", "ID", "and", "sent", "off" ]
train
https://github.com/rsarun-uninstallio/apprequest/blob/dd595d9733e21731f2db7f0d3128c2b6f56a6dc0/apprequest/AppRequest.py#L16-L23
neuroticnerd/armory
armory/serialize.py
jsonify
def jsonify(data, pretty=False, **kwargs): """Serialize Python objects to JSON with optional 'pretty' formatting Raises: TypeError: from :mod:`json` lib ValueError: from :mod:`json` lib JSONDecodeError: from :mod:`json` lib """ isod = isinstance(data, OrderedDict) params = {...
python
def jsonify(data, pretty=False, **kwargs): """Serialize Python objects to JSON with optional 'pretty' formatting Raises: TypeError: from :mod:`json` lib ValueError: from :mod:`json` lib JSONDecodeError: from :mod:`json` lib """ isod = isinstance(data, OrderedDict) params = {...
[ "def", "jsonify", "(", "data", ",", "pretty", "=", "False", ",", "*", "*", "kwargs", ")", ":", "isod", "=", "isinstance", "(", "data", ",", "OrderedDict", ")", "params", "=", "{", "'for_json'", ":", "True", ",", "'default'", ":", "_complex_encode", ","...
Serialize Python objects to JSON with optional 'pretty' formatting Raises: TypeError: from :mod:`json` lib ValueError: from :mod:`json` lib JSONDecodeError: from :mod:`json` lib
[ "Serialize", "Python", "objects", "to", "JSON", "with", "optional", "pretty", "formatting" ]
train
https://github.com/neuroticnerd/armory/blob/d37c5ca1dbdd60dddb968e35f0bbe4bc1299dca1/armory/serialize.py#L15-L35
soasme/rio-client
rio_client/transports/base.py
Transport.get_emit_api
def get_emit_api(self, action): """Build emit api.""" args = {'action': action} args.update(self.context) return ( '%(scheme)s://%(sender)s:%(token)s@%(domain)s:%(port)d' '/event/%(project)s/emit/%(action)s' % args )
python
def get_emit_api(self, action): """Build emit api.""" args = {'action': action} args.update(self.context) return ( '%(scheme)s://%(sender)s:%(token)s@%(domain)s:%(port)d' '/event/%(project)s/emit/%(action)s' % args )
[ "def", "get_emit_api", "(", "self", ",", "action", ")", ":", "args", "=", "{", "'action'", ":", "action", "}", "args", ".", "update", "(", "self", ".", "context", ")", "return", "(", "'%(scheme)s://%(sender)s:%(token)s@%(domain)s:%(port)d'", "'/event/%(project)s/e...
Build emit api.
[ "Build", "emit", "api", "." ]
train
https://github.com/soasme/rio-client/blob/c6d684c6f9deea5b43f2b05bcaf40714c48b5619/rio_client/transports/base.py#L17-L24
edeposit/edeposit.amqp.aleph
src/edeposit/amqp/aleph/doc_number.py
getDocNumber
def getDocNumber(xml): """ Parse <doc_number> tag from `xml`. Args: xml (str): XML string returned from :func:`aleph.aleph.downloadRecords` Returns: str: Doc ID as string or "-1" if not found. """ dom = dhtmlparser.parseString(xml) doc_number_tag = dom.find("doc_number") ...
python
def getDocNumber(xml): """ Parse <doc_number> tag from `xml`. Args: xml (str): XML string returned from :func:`aleph.aleph.downloadRecords` Returns: str: Doc ID as string or "-1" if not found. """ dom = dhtmlparser.parseString(xml) doc_number_tag = dom.find("doc_number") ...
[ "def", "getDocNumber", "(", "xml", ")", ":", "dom", "=", "dhtmlparser", ".", "parseString", "(", "xml", ")", "doc_number_tag", "=", "dom", ".", "find", "(", "\"doc_number\"", ")", "if", "not", "doc_number_tag", ":", "return", "\"-1\"", "return", "doc_number_...
Parse <doc_number> tag from `xml`. Args: xml (str): XML string returned from :func:`aleph.aleph.downloadRecords` Returns: str: Doc ID as string or "-1" if not found.
[ "Parse", "<doc_number", ">", "tag", "from", "xml", "." ]
train
https://github.com/edeposit/edeposit.amqp.aleph/blob/360342c0504d5daa2344e864762cdf938d4149c7/src/edeposit/amqp/aleph/doc_number.py#L11-L28
tmacwill/stellata
stellata/model.py
serialize
def serialize(data, format: str = 'json', pretty: bool = False): """Serialize a stellata object to a string format.""" def encode(obj): if isinstance(obj, stellata.model.Model): return obj.to_dict() elif isinstance(obj, datetime.datetime): return int(obj.timestamp()) ...
python
def serialize(data, format: str = 'json', pretty: bool = False): """Serialize a stellata object to a string format.""" def encode(obj): if isinstance(obj, stellata.model.Model): return obj.to_dict() elif isinstance(obj, datetime.datetime): return int(obj.timestamp()) ...
[ "def", "serialize", "(", "data", ",", "format", ":", "str", "=", "'json'", ",", "pretty", ":", "bool", "=", "False", ")", ":", "def", "encode", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "stellata", ".", "model", ".", "Model", ")", ...
Serialize a stellata object to a string format.
[ "Serialize", "a", "stellata", "object", "to", "a", "string", "format", "." ]
train
https://github.com/tmacwill/stellata/blob/9519c170397740eb6faf5d8a96b9a77f0d909b92/stellata/model.py#L191-L215
dabercro/customdocs
customdocs/__init__.py
pretty_exe_doc
def pretty_exe_doc(program, parser, stack=1, under='-'): """ Takes the name of a script and a parser that will give the help message for it. The module that called this function will then add a header to the docstring of the script, followed immediately by the help message generated by the OptionPar...
python
def pretty_exe_doc(program, parser, stack=1, under='-'): """ Takes the name of a script and a parser that will give the help message for it. The module that called this function will then add a header to the docstring of the script, followed immediately by the help message generated by the OptionPar...
[ "def", "pretty_exe_doc", "(", "program", ",", "parser", ",", "stack", "=", "1", ",", "under", "=", "'-'", ")", ":", "if", "os", ".", "path", ".", "basename", "(", "sys", ".", "argv", "[", "0", "]", ")", "==", "'sphinx-build'", ":", "# Get the calling...
Takes the name of a script and a parser that will give the help message for it. The module that called this function will then add a header to the docstring of the script, followed immediately by the help message generated by the OptionParser :param str program: Name of the program that we want to make...
[ "Takes", "the", "name", "of", "a", "script", "and", "a", "parser", "that", "will", "give", "the", "help", "message", "for", "it", ".", "The", "module", "that", "called", "this", "function", "will", "then", "add", "a", "header", "to", "the", "docstring", ...
train
https://github.com/dabercro/customdocs/blob/e8c46349ce40d9ac9dc6b5d93924c974c4ade21e/customdocs/__init__.py#L90-L117
polysquare/polysquare-generic-file-linter
polysquarelinter/cache_populate.py
main
def main(): # suppress(unused-function) """Cause the cache to be populated with valid words.""" description = ("""Pre-populate cache for polysquare-generic-file-linter """ """and spellcheck-linter.""") parser = argparse.ArgumentParser(description=description) parser.add_argument("cac...
python
def main(): # suppress(unused-function) """Cause the cache to be populated with valid words.""" description = ("""Pre-populate cache for polysquare-generic-file-linter """ """and spellcheck-linter.""") parser = argparse.ArgumentParser(description=description) parser.add_argument("cac...
[ "def", "main", "(", ")", ":", "# suppress(unused-function)", "description", "=", "(", "\"\"\"Pre-populate cache for polysquare-generic-file-linter \"\"\"", "\"\"\"and spellcheck-linter.\"\"\"", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "d...
Cause the cache to be populated with valid words.
[ "Cause", "the", "cache", "to", "be", "populated", "with", "valid", "words", "." ]
train
https://github.com/polysquare/polysquare-generic-file-linter/blob/cfc88771acd3d5551c28fa5d917bb0aeb584c4cc/polysquarelinter/cache_populate.py#L16-L33
uw-it-aca/uw-restclients-kws
uw_kws/__init__.py
KWS.get_key
def get_key(self, key_id): """ Returns a restclients.Key object for the given key ID. If the key ID isn't found, or if there is an error communicating with the KWS, a DataFailureException will be thrown. """ url = ENCRYPTION_KEY_URL.format(key_id) return self._ke...
python
def get_key(self, key_id): """ Returns a restclients.Key object for the given key ID. If the key ID isn't found, or if there is an error communicating with the KWS, a DataFailureException will be thrown. """ url = ENCRYPTION_KEY_URL.format(key_id) return self._ke...
[ "def", "get_key", "(", "self", ",", "key_id", ")", ":", "url", "=", "ENCRYPTION_KEY_URL", ".", "format", "(", "key_id", ")", "return", "self", ".", "_key_from_json", "(", "self", ".", "_get_resource", "(", "url", ")", ")" ]
Returns a restclients.Key object for the given key ID. If the key ID isn't found, or if there is an error communicating with the KWS, a DataFailureException will be thrown.
[ "Returns", "a", "restclients", ".", "Key", "object", "for", "the", "given", "key", "ID", ".", "If", "the", "key", "ID", "isn", "t", "found", "or", "if", "there", "is", "an", "error", "communicating", "with", "the", "KWS", "a", "DataFailureException", "wi...
train
https://github.com/uw-it-aca/uw-restclients-kws/blob/072e5fed31e2b62a1b21eb6c19b975e760a39c7e/uw_kws/__init__.py#L29-L36
uw-it-aca/uw-restclients-kws
uw_kws/__init__.py
KWS.get_current_key
def get_current_key(self, resource_name): """ Returns a restclients.Key object for the given resource. If the resource isn't found, or if there is an error communicating with the KWS, a DataFailureException will be thrown. """ url = ENCRYPTION_CURRENT_KEY_URL.format(reso...
python
def get_current_key(self, resource_name): """ Returns a restclients.Key object for the given resource. If the resource isn't found, or if there is an error communicating with the KWS, a DataFailureException will be thrown. """ url = ENCRYPTION_CURRENT_KEY_URL.format(reso...
[ "def", "get_current_key", "(", "self", ",", "resource_name", ")", ":", "url", "=", "ENCRYPTION_CURRENT_KEY_URL", ".", "format", "(", "resource_name", ")", "return", "self", ".", "_key_from_json", "(", "self", ".", "_get_resource", "(", "url", ")", ")" ]
Returns a restclients.Key object for the given resource. If the resource isn't found, or if there is an error communicating with the KWS, a DataFailureException will be thrown.
[ "Returns", "a", "restclients", ".", "Key", "object", "for", "the", "given", "resource", ".", "If", "the", "resource", "isn", "t", "found", "or", "if", "there", "is", "an", "error", "communicating", "with", "the", "KWS", "a", "DataFailureException", "will", ...
train
https://github.com/uw-it-aca/uw-restclients-kws/blob/072e5fed31e2b62a1b21eb6c19b975e760a39c7e/uw_kws/__init__.py#L38-L45
uw-it-aca/uw-restclients-kws
uw_kws/__init__.py
KWS._key_from_json
def _key_from_json(self, data): """ Internal method, for creating the Key object. """ key = Key() key.algorithm = data["Algorithm"] key.cipher_mode = data["CipherMode"] key.expiration = datetime.strptime(data["Expiration"].split(".")[0], ...
python
def _key_from_json(self, data): """ Internal method, for creating the Key object. """ key = Key() key.algorithm = data["Algorithm"] key.cipher_mode = data["CipherMode"] key.expiration = datetime.strptime(data["Expiration"].split(".")[0], ...
[ "def", "_key_from_json", "(", "self", ",", "data", ")", ":", "key", "=", "Key", "(", ")", "key", ".", "algorithm", "=", "data", "[", "\"Algorithm\"", "]", "key", ".", "cipher_mode", "=", "data", "[", "\"CipherMode\"", "]", "key", ".", "expiration", "="...
Internal method, for creating the Key object.
[ "Internal", "method", "for", "creating", "the", "Key", "object", "." ]
train
https://github.com/uw-it-aca/uw-restclients-kws/blob/072e5fed31e2b62a1b21eb6c19b975e760a39c7e/uw_kws/__init__.py#L47-L60
zvolsky/qrplatba-fpdf
qrplatba_fpdf.py
qrplatba
def qrplatba(pdf, IBAN, castka=None, mena='CZK', splatnost=None, msg=None, KS='0558', VS='', SS=None, IBAN2=None, w=36, x=None, y=None, **payment_more): """This is the main method which generates the QR platba code. pdf - object from: with PDF(<outputfilename>) as pdf: (we use ...
python
def qrplatba(pdf, IBAN, castka=None, mena='CZK', splatnost=None, msg=None, KS='0558', VS='', SS=None, IBAN2=None, w=36, x=None, y=None, **payment_more): """This is the main method which generates the QR platba code. pdf - object from: with PDF(<outputfilename>) as pdf: (we use ...
[ "def", "qrplatba", "(", "pdf", ",", "IBAN", ",", "castka", "=", "None", ",", "mena", "=", "'CZK'", ",", "splatnost", "=", "None", ",", "msg", "=", "None", ",", "KS", "=", "'0558'", ",", "VS", "=", "''", ",", "SS", "=", "None", ",", "IBAN2", "="...
This is the main method which generates the QR platba code. pdf - object from: with PDF(<outputfilename>) as pdf: (we use wfpdf (which is really minor wrapper), we haven't not tested the calling with fpdf directly, but maybe it is easy) IBAN..IBAN2 - ACC, AM, CC, DT, MSG, X-KS, X-VS, X-SS, ALT-A...
[ "This", "is", "the", "main", "method", "which", "generates", "the", "QR", "platba", "code", ".", "pdf", "-", "object", "from", ":", "with", "PDF", "(", "<outputfilename", ">", ")", "as", "pdf", ":", "(", "we", "use", "wfpdf", "(", "which", "is", "rea...
train
https://github.com/zvolsky/qrplatba-fpdf/blob/5bfb65582e8d01552becb71129e1042a9603fb10/qrplatba_fpdf.py#L20-L86
nabeen/gswrap
gswrap/Gswrap.py
Gswrap.get_value
def get_value(self, spreadsheet_id: str, range_name: str) -> dict: """ get value by range :param spreadsheet_id: :param range_name: :return: """ service = self.__get_service() result = service.spreadsheets().values().get(spreadsheetId=spreadsheet_id, range...
python
def get_value(self, spreadsheet_id: str, range_name: str) -> dict: """ get value by range :param spreadsheet_id: :param range_name: :return: """ service = self.__get_service() result = service.spreadsheets().values().get(spreadsheetId=spreadsheet_id, range...
[ "def", "get_value", "(", "self", ",", "spreadsheet_id", ":", "str", ",", "range_name", ":", "str", ")", "->", "dict", ":", "service", "=", "self", ".", "__get_service", "(", ")", "result", "=", "service", ".", "spreadsheets", "(", ")", ".", "values", "...
get value by range :param spreadsheet_id: :param range_name: :return:
[ "get", "value", "by", "range", ":", "param", "spreadsheet_id", ":", ":", "param", "range_name", ":", ":", "return", ":" ]
train
https://github.com/nabeen/gswrap/blob/28a7f2f03886ca200fb44a3f36992f9ef83191fc/gswrap/Gswrap.py#L35-L44
eallik/spinoff
spinoff/util/async.py
with_timeout
def with_timeout(timeout, d, reactor=reactor): """Returns a `Deferred` that is in all respects equivalent to `d`, e.g. when `cancel()` is called on it `Deferred`, the wrapped `Deferred` will also be cancelled; however, a `Timeout` will be fired after the `timeout` number of seconds if `d` has not fired by t...
python
def with_timeout(timeout, d, reactor=reactor): """Returns a `Deferred` that is in all respects equivalent to `d`, e.g. when `cancel()` is called on it `Deferred`, the wrapped `Deferred` will also be cancelled; however, a `Timeout` will be fired after the `timeout` number of seconds if `d` has not fired by t...
[ "def", "with_timeout", "(", "timeout", ",", "d", ",", "reactor", "=", "reactor", ")", ":", "if", "timeout", "is", "None", "or", "not", "isinstance", "(", "d", ",", "Deferred", ")", ":", "return", "d", "ret", "=", "Deferred", "(", "canceller", "=", "l...
Returns a `Deferred` that is in all respects equivalent to `d`, e.g. when `cancel()` is called on it `Deferred`, the wrapped `Deferred` will also be cancelled; however, a `Timeout` will be fired after the `timeout` number of seconds if `d` has not fired by that time. When a `Timeout` is raised, `d` will be...
[ "Returns", "a", "Deferred", "that", "is", "in", "all", "respects", "equivalent", "to", "d", "e", ".", "g", ".", "when", "cancel", "()", "is", "called", "on", "it", "Deferred", "the", "wrapped", "Deferred", "will", "also", "be", "cancelled", ";", "however...
train
https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/spinoff/util/async.py#L28-L66
jmgilman/Neolib
neolib/http/Page.py
Page.form
def form(self, usr=None, **kwargs): """ Returns an HTTPForm that matches the given criteria Searches for an HTML form in the page's content matching the criteria specified in kwargs. If a form is found, returns an HTTPForm instance that represents the form. P...
python
def form(self, usr=None, **kwargs): """ Returns an HTTPForm that matches the given criteria Searches for an HTML form in the page's content matching the criteria specified in kwargs. If a form is found, returns an HTTPForm instance that represents the form. P...
[ "def", "form", "(", "self", ",", "usr", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "usr", ":", "usr", "=", "self", ".", "usr", "if", "self", ".", "find", "(", "\"form\"", ",", "kwargs", ")", ":", "return", "HTTPForm", "(...
Returns an HTTPForm that matches the given criteria Searches for an HTML form in the page's content matching the criteria specified in kwargs. If a form is found, returns an HTTPForm instance that represents the form. Parameters: usr (User) -- User to asso...
[ "Returns", "an", "HTTPForm", "that", "matches", "the", "given", "criteria", "Searches", "for", "an", "HTML", "form", "in", "the", "page", "s", "content", "matching", "the", "criteria", "specified", "in", "kwargs", ".", "If", "a", "form", "is", "found", "re...
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/http/Page.py#L105-L121
jmgilman/Neolib
neolib/http/Page.py
Page.newSession
def newSession(): """ Returns a new Requests session with pre-loaded default HTTP Headers Generates a new Requests session and consults with the Configuration class to determine if a Configuration exists and attempts to use the configured HTTP Request headers first. If this fail...
python
def newSession(): """ Returns a new Requests session with pre-loaded default HTTP Headers Generates a new Requests session and consults with the Configuration class to determine if a Configuration exists and attempts to use the configured HTTP Request headers first. If this fail...
[ "def", "newSession", "(", ")", ":", "from", "neolib", ".", "config", ".", "Configuration", "import", "Configuration", "s", "=", "requests", ".", "session", "(", ")", "if", "not", "Configuration", ".", "loaded", "(", ")", ":", "if", "not", "Configuration", ...
Returns a new Requests session with pre-loaded default HTTP Headers Generates a new Requests session and consults with the Configuration class to determine if a Configuration exists and attempts to use the configured HTTP Request headers first. If this fails, it attempts to create a new...
[ "Returns", "a", "new", "Requests", "session", "with", "pre", "-", "loaded", "default", "HTTP", "Headers", "Generates", "a", "new", "Requests", "session", "and", "consults", "with", "the", "Configuration", "class", "to", "determine", "if", "a", "Configuration", ...
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/http/Page.py#L124-L150
ramrod-project/database-brain
schema/brain/controller/verification.py
verify_port_map
def verify_port_map(plugin): """ extra validation / PB2 sees empty lists the same as non-existant lists :param plugin: :return: """ result = True ex_ports = plugin.get(EX_PORTS_KEY) result &= isinstance(ex_ports, list) and verify_ports(ex_ports) in_ports = plugin.get(IN_PORTS_KEY...
python
def verify_port_map(plugin): """ extra validation / PB2 sees empty lists the same as non-existant lists :param plugin: :return: """ result = True ex_ports = plugin.get(EX_PORTS_KEY) result &= isinstance(ex_ports, list) and verify_ports(ex_ports) in_ports = plugin.get(IN_PORTS_KEY...
[ "def", "verify_port_map", "(", "plugin", ")", ":", "result", "=", "True", "ex_ports", "=", "plugin", ".", "get", "(", "EX_PORTS_KEY", ")", "result", "&=", "isinstance", "(", "ex_ports", ",", "list", ")", "and", "verify_ports", "(", "ex_ports", ")", "in_por...
extra validation / PB2 sees empty lists the same as non-existant lists :param plugin: :return:
[ "extra", "validation", "/", "PB2", "sees", "empty", "lists", "the", "same", "as", "non", "-", "existant", "lists", ":", "param", "plugin", ":", ":", "return", ":" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/controller/verification.py#L9-L25
ramrod-project/database-brain
schema/brain/controller/verification.py
verify_ports
def verify_ports(port_list): """ ports should be of the format <int:port_number>/<str:protocol> where protocol is either tcp or udp :param port_list: <list> :return: <bool> """ result = True # empty list is ok for item in port_list: try: (port, protocol) = item....
python
def verify_ports(port_list): """ ports should be of the format <int:port_number>/<str:protocol> where protocol is either tcp or udp :param port_list: <list> :return: <bool> """ result = True # empty list is ok for item in port_list: try: (port, protocol) = item....
[ "def", "verify_ports", "(", "port_list", ")", ":", "result", "=", "True", "# empty list is ok", "for", "item", "in", "port_list", ":", "try", ":", "(", "port", ",", "protocol", ")", "=", "item", ".", "split", "(", "PORT_SEPARATOR", ")", "port_num", "=", ...
ports should be of the format <int:port_number>/<str:protocol> where protocol is either tcp or udp :param port_list: <list> :return: <bool>
[ "ports", "should", "be", "of", "the", "format", "<int", ":", "port_number", ">", "/", "<str", ":", "protocol", ">", "where", "protocol", "is", "either", "tcp", "or", "udp" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/controller/verification.py#L28-L47
treycucco/bidon
bidon/db/access/model_access.py
get_model_id_constraints
def get_model_id_constraints(model): """Returns constraints to target a specific model.""" pkname = model.primary_key_name pkey = model.primary_key return get_id_constraints(pkname, pkey)
python
def get_model_id_constraints(model): """Returns constraints to target a specific model.""" pkname = model.primary_key_name pkey = model.primary_key return get_id_constraints(pkname, pkey)
[ "def", "get_model_id_constraints", "(", "model", ")", ":", "pkname", "=", "model", ".", "primary_key_name", "pkey", "=", "model", ".", "primary_key", "return", "get_id_constraints", "(", "pkname", ",", "pkey", ")" ]
Returns constraints to target a specific model.
[ "Returns", "constraints", "to", "target", "a", "specific", "model", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L208-L212
treycucco/bidon
bidon/db/access/model_access.py
get_id_constraints
def get_id_constraints(pkname, pkey): """Returns primary key consraints. :pkname: if a string, returns a dict with pkname=pkey. pkname and pkey must be enumerables of matching length. """ if isinstance(pkname, str): return {pkname: pkey} else: return dict(zip(pkname, pkey))
python
def get_id_constraints(pkname, pkey): """Returns primary key consraints. :pkname: if a string, returns a dict with pkname=pkey. pkname and pkey must be enumerables of matching length. """ if isinstance(pkname, str): return {pkname: pkey} else: return dict(zip(pkname, pkey))
[ "def", "get_id_constraints", "(", "pkname", ",", "pkey", ")", ":", "if", "isinstance", "(", "pkname", ",", "str", ")", ":", "return", "{", "pkname", ":", "pkey", "}", "else", ":", "return", "dict", "(", "zip", "(", "pkname", ",", "pkey", ")", ")" ]
Returns primary key consraints. :pkname: if a string, returns a dict with pkname=pkey. pkname and pkey must be enumerables of matching length.
[ "Returns", "primary", "key", "consraints", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L215-L224
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess._find_model
def _find_model(self, constructor, table_name, constraints=None, *, columns=None, order_by=None): """Calls DataAccess.find and passes the results to the given constructor.""" data = self.find(table_name, constraints, columns=columns, order_by=order_by) return constructor(data) if data else None
python
def _find_model(self, constructor, table_name, constraints=None, *, columns=None, order_by=None): """Calls DataAccess.find and passes the results to the given constructor.""" data = self.find(table_name, constraints, columns=columns, order_by=order_by) return constructor(data) if data else None
[ "def", "_find_model", "(", "self", ",", "constructor", ",", "table_name", ",", "constraints", "=", "None", ",", "*", ",", "columns", "=", "None", ",", "order_by", "=", "None", ")", ":", "data", "=", "self", ".", "find", "(", "table_name", ",", "constra...
Calls DataAccess.find and passes the results to the given constructor.
[ "Calls", "DataAccess", ".", "find", "and", "passes", "the", "results", "to", "the", "given", "constructor", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L11-L14
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess._find_models
def _find_models(self, constructor, table_name, constraints=None, *, columns=None, order_by=None, limiting=None): """Calls DataAccess.find_all and passes the results to the given constructor.""" for record in self.find_all(table_name, constraints, columns=columns, order_by=order_by, ...
python
def _find_models(self, constructor, table_name, constraints=None, *, columns=None, order_by=None, limiting=None): """Calls DataAccess.find_all and passes the results to the given constructor.""" for record in self.find_all(table_name, constraints, columns=columns, order_by=order_by, ...
[ "def", "_find_models", "(", "self", ",", "constructor", ",", "table_name", ",", "constraints", "=", "None", ",", "*", ",", "columns", "=", "None", ",", "order_by", "=", "None", ",", "limiting", "=", "None", ")", ":", "for", "record", "in", "self", ".",...
Calls DataAccess.find_all and passes the results to the given constructor.
[ "Calls", "DataAccess", ".", "find_all", "and", "passes", "the", "results", "to", "the", "given", "constructor", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L16-L21
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess.find_model
def find_model(self, constructor, constraints=None, *, columns=None, table_name=None, order_by=None): """Specialization of DataAccess.find that returns a model instead of cursor object.""" return self._find_model(constructor, table_name or constructor.table_name, constraints, ...
python
def find_model(self, constructor, constraints=None, *, columns=None, table_name=None, order_by=None): """Specialization of DataAccess.find that returns a model instead of cursor object.""" return self._find_model(constructor, table_name or constructor.table_name, constraints, ...
[ "def", "find_model", "(", "self", ",", "constructor", ",", "constraints", "=", "None", ",", "*", ",", "columns", "=", "None", ",", "table_name", "=", "None", ",", "order_by", "=", "None", ")", ":", "return", "self", ".", "_find_model", "(", "constructor"...
Specialization of DataAccess.find that returns a model instead of cursor object.
[ "Specialization", "of", "DataAccess", ".", "find", "that", "returns", "a", "model", "instead", "of", "cursor", "object", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L23-L27
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess.find_models
def find_models(self, constructor, constraints=None, *, columns=None, order_by=None, limiting=None, table_name=None): """Specialization of DataAccess.find_all that returns models instead of cursor objects.""" return self._find_models( constructor, table_name or constructor.table_name, co...
python
def find_models(self, constructor, constraints=None, *, columns=None, order_by=None, limiting=None, table_name=None): """Specialization of DataAccess.find_all that returns models instead of cursor objects.""" return self._find_models( constructor, table_name or constructor.table_name, co...
[ "def", "find_models", "(", "self", ",", "constructor", ",", "constraints", "=", "None", ",", "*", ",", "columns", "=", "None", ",", "order_by", "=", "None", ",", "limiting", "=", "None", ",", "table_name", "=", "None", ")", ":", "return", "self", ".", ...
Specialization of DataAccess.find_all that returns models instead of cursor objects.
[ "Specialization", "of", "DataAccess", ".", "find_all", "that", "returns", "models", "instead", "of", "cursor", "objects", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L29-L34
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess.page_models
def page_models(self, constructor, paging, constraints=None, *, columns=None, order_by=None): """Specialization of DataAccess.page that returns models instead of cursor objects.""" records, count = self.page(constructor.table_name, paging, constraints, columns=columns, order_by=or...
python
def page_models(self, constructor, paging, constraints=None, *, columns=None, order_by=None): """Specialization of DataAccess.page that returns models instead of cursor objects.""" records, count = self.page(constructor.table_name, paging, constraints, columns=columns, order_by=or...
[ "def", "page_models", "(", "self", ",", "constructor", ",", "paging", ",", "constraints", "=", "None", ",", "*", ",", "columns", "=", "None", ",", "order_by", "=", "None", ")", ":", "records", ",", "count", "=", "self", ".", "page", "(", "constructor",...
Specialization of DataAccess.page that returns models instead of cursor objects.
[ "Specialization", "of", "DataAccess", ".", "page", "that", "returns", "models", "instead", "of", "cursor", "objects", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L36-L40
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess.find_model_by_id
def find_model_by_id(self, constructor, id_, *, columns=None): """Searches for a model by id, according to its class' primary_key_name. If primary_key_name is a tuple, id_ must be a tuple with a matching length. """ return self.find_model( constructor, get_id_constraints(constructor.primary_key_n...
python
def find_model_by_id(self, constructor, id_, *, columns=None): """Searches for a model by id, according to its class' primary_key_name. If primary_key_name is a tuple, id_ must be a tuple with a matching length. """ return self.find_model( constructor, get_id_constraints(constructor.primary_key_n...
[ "def", "find_model_by_id", "(", "self", ",", "constructor", ",", "id_", ",", "*", ",", "columns", "=", "None", ")", ":", "return", "self", ".", "find_model", "(", "constructor", ",", "get_id_constraints", "(", "constructor", ".", "primary_key_name", ",", "id...
Searches for a model by id, according to its class' primary_key_name. If primary_key_name is a tuple, id_ must be a tuple with a matching length.
[ "Searches", "for", "a", "model", "by", "id", "according", "to", "its", "class", "primary_key_name", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L42-L48
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess.refresh_model
def refresh_model(self, model, *, overwrite=False): """Pulls the model's record from the database. If overwrite is True, the model values are overwritten and returns the model, otherwise a new model instance with the newer record is returned. """ new_model = self.find_model_by_id(model.__class__, mo...
python
def refresh_model(self, model, *, overwrite=False): """Pulls the model's record from the database. If overwrite is True, the model values are overwritten and returns the model, otherwise a new model instance with the newer record is returned. """ new_model = self.find_model_by_id(model.__class__, mo...
[ "def", "refresh_model", "(", "self", ",", "model", ",", "*", ",", "overwrite", "=", "False", ")", ":", "new_model", "=", "self", ".", "find_model_by_id", "(", "model", ".", "__class__", ",", "model", ".", "primary_key", ")", "if", "overwrite", ":", "mode...
Pulls the model's record from the database. If overwrite is True, the model values are overwritten and returns the model, otherwise a new model instance with the newer record is returned.
[ "Pulls", "the", "model", "s", "record", "from", "the", "database", ".", "If", "overwrite", "is", "True", "the", "model", "values", "are", "overwritten", "and", "returns", "the", "model", "otherwise", "a", "new", "model", "instance", "with", "the", "newer", ...
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L50-L60
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess.update_model
def update_model(self, model, *, include_keys=None): """Updates a model. :include_keys: if given, only updates the given attributes. Otherwise, updates all non-id attributes. """ id_constraints = get_model_id_constraints(model) if include_keys is None: include_keys = set( model.a...
python
def update_model(self, model, *, include_keys=None): """Updates a model. :include_keys: if given, only updates the given attributes. Otherwise, updates all non-id attributes. """ id_constraints = get_model_id_constraints(model) if include_keys is None: include_keys = set( model.a...
[ "def", "update_model", "(", "self", ",", "model", ",", "*", ",", "include_keys", "=", "None", ")", ":", "id_constraints", "=", "get_model_id_constraints", "(", "model", ")", "if", "include_keys", "is", "None", ":", "include_keys", "=", "set", "(", "model", ...
Updates a model. :include_keys: if given, only updates the given attributes. Otherwise, updates all non-id attributes.
[ "Updates", "a", "model", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L62-L95
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess.insert_model
def insert_model(self, model, *, upsert=None): """Inserts a record for the given model. If model's primary key is auto, the primary key will be set appropriately. """ pkname = model.primary_key_name include_keys = set(model.attrs.keys()).difference(model.exclude_keys_sql) if model.primary_key_...
python
def insert_model(self, model, *, upsert=None): """Inserts a record for the given model. If model's primary key is auto, the primary key will be set appropriately. """ pkname = model.primary_key_name include_keys = set(model.attrs.keys()).difference(model.exclude_keys_sql) if model.primary_key_...
[ "def", "insert_model", "(", "self", ",", "model", ",", "*", ",", "upsert", "=", "None", ")", ":", "pkname", "=", "model", ".", "primary_key_name", "include_keys", "=", "set", "(", "model", ".", "attrs", ".", "keys", "(", ")", ")", ".", "difference", ...
Inserts a record for the given model. If model's primary key is auto, the primary key will be set appropriately.
[ "Inserts", "a", "record", "for", "the", "given", "model", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L97-L135
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess.delete_model
def delete_model(self, model_or_type, id_=None): """Deletes a model. :model_or_type: if a model, delete that model. If it is a ModelBase subclass, id_ must be specified, and the associated record is deleted. """ if not id_: constraints = get_model_id_constraints(model_or_type) else: ...
python
def delete_model(self, model_or_type, id_=None): """Deletes a model. :model_or_type: if a model, delete that model. If it is a ModelBase subclass, id_ must be specified, and the associated record is deleted. """ if not id_: constraints = get_model_id_constraints(model_or_type) else: ...
[ "def", "delete_model", "(", "self", ",", "model_or_type", ",", "id_", "=", "None", ")", ":", "if", "not", "id_", ":", "constraints", "=", "get_model_id_constraints", "(", "model_or_type", ")", "else", ":", "constraints", "=", "get_id_constraints", "(", "model_...
Deletes a model. :model_or_type: if a model, delete that model. If it is a ModelBase subclass, id_ must be specified, and the associated record is deleted.
[ "Deletes", "a", "model", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L137-L149
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess.find_or_build
def find_or_build(self, constructor, props): """Looks for a model that matches the given dictionary constraints. If it is not found, a new model of the given type is constructed and returned. """ model = self.find_model(constructor, props) return model or constructor(**props)
python
def find_or_build(self, constructor, props): """Looks for a model that matches the given dictionary constraints. If it is not found, a new model of the given type is constructed and returned. """ model = self.find_model(constructor, props) return model or constructor(**props)
[ "def", "find_or_build", "(", "self", ",", "constructor", ",", "props", ")", ":", "model", "=", "self", ".", "find_model", "(", "constructor", ",", "props", ")", "return", "model", "or", "constructor", "(", "*", "*", "props", ")" ]
Looks for a model that matches the given dictionary constraints. If it is not found, a new model of the given type is constructed and returned.
[ "Looks", "for", "a", "model", "that", "matches", "the", "given", "dictionary", "constraints", ".", "If", "it", "is", "not", "found", "a", "new", "model", "of", "the", "given", "type", "is", "constructed", "and", "returned", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L151-L156
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess.find_or_create
def find_or_create(self, constructor, props, *, comp=None): """Looks for a model taht matches the given dictionary constraints. If it is not found, a new model of the given type is created and saved to the database, then returned. """ model = self.find_model(constructor, comp or props) if model is N...
python
def find_or_create(self, constructor, props, *, comp=None): """Looks for a model taht matches the given dictionary constraints. If it is not found, a new model of the given type is created and saved to the database, then returned. """ model = self.find_model(constructor, comp or props) if model is N...
[ "def", "find_or_create", "(", "self", ",", "constructor", ",", "props", ",", "*", ",", "comp", "=", "None", ")", ":", "model", "=", "self", ".", "find_model", "(", "constructor", ",", "comp", "or", "props", ")", "if", "model", "is", "None", ":", "mod...
Looks for a model taht matches the given dictionary constraints. If it is not found, a new model of the given type is created and saved to the database, then returned.
[ "Looks", "for", "a", "model", "taht", "matches", "the", "given", "dictionary", "constraints", ".", "If", "it", "is", "not", "found", "a", "new", "model", "of", "the", "given", "type", "is", "created", "and", "saved", "to", "the", "database", "then", "ret...
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L158-L166
treycucco/bidon
bidon/db/access/model_access.py
ModelAccess.find_or_upsert
def find_or_upsert(self, constructor, props, *, comp=None, return_status=False): """This finds or upserts a model with an auto primary key, and is a bit more flexible than find_or_create. First it looks for the model matching either comp, or props if comp is None. If not found, it will try to upsert t...
python
def find_or_upsert(self, constructor, props, *, comp=None, return_status=False): """This finds or upserts a model with an auto primary key, and is a bit more flexible than find_or_create. First it looks for the model matching either comp, or props if comp is None. If not found, it will try to upsert t...
[ "def", "find_or_upsert", "(", "self", ",", "constructor", ",", "props", ",", "*", ",", "comp", "=", "None", ",", "return_status", "=", "False", ")", ":", "model", "=", "self", ".", "find_model", "(", "constructor", ",", "comp", "or", "props", ")", "sta...
This finds or upserts a model with an auto primary key, and is a bit more flexible than find_or_create. First it looks for the model matching either comp, or props if comp is None. If not found, it will try to upsert the model, doing nothing. If the returned model is new, meaning it's primary key is n...
[ "This", "finds", "or", "upserts", "a", "model", "with", "an", "auto", "primary", "key", "and", "is", "a", "bit", "more", "flexible", "than", "find_or_create", "." ]
train
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L168-L205
naphatkrit/easyci
easyci/vcs/base.py
Vcs.temp_copy
def temp_copy(self): """Yields a new Vcs object that represents a temporary, disposable copy of the current repository. The copy is deleted at the end of the context. The following are not copied: - ignored files - easyci private directory (.git/eci for git) Yie...
python
def temp_copy(self): """Yields a new Vcs object that represents a temporary, disposable copy of the current repository. The copy is deleted at the end of the context. The following are not copied: - ignored files - easyci private directory (.git/eci for git) Yie...
[ "def", "temp_copy", "(", "self", ")", ":", "with", "contextmanagers", ".", "temp_dir", "(", ")", "as", "temp_dir", ":", "temp_root_path", "=", "os", ".", "path", ".", "join", "(", "temp_dir", ",", "'root'", ")", "path", "=", "os", ".", "path", ".", "...
Yields a new Vcs object that represents a temporary, disposable copy of the current repository. The copy is deleted at the end of the context. The following are not copied: - ignored files - easyci private directory (.git/eci for git) Yields: Vcs
[ "Yields", "a", "new", "Vcs", "object", "that", "represents", "a", "temporary", "disposable", "copy", "of", "the", "current", "repository", ".", "The", "copy", "is", "deleted", "at", "the", "end", "of", "the", "context", "." ]
train
https://github.com/naphatkrit/easyci/blob/7aee8d7694fe4e2da42ce35b0f700bc840c8b95f/easyci/vcs/base.py#L185-L203
chrisdrackett/django-support
support/forms/processing.py
process_form
def process_form(request, form_class, form_dict=None, save_kwargs=None, *a, **kw): ''' Optional: ========= You can pass kwargs to the form save function in a 'save_kwargs' dict. Example Usage: ============== success, form = process_form(request, DiscussionForm, in...
python
def process_form(request, form_class, form_dict=None, save_kwargs=None, *a, **kw): ''' Optional: ========= You can pass kwargs to the form save function in a 'save_kwargs' dict. Example Usage: ============== success, form = process_form(request, DiscussionForm, in...
[ "def", "process_form", "(", "request", ",", "form_class", ",", "form_dict", "=", "None", ",", "save_kwargs", "=", "None", ",", "*", "a", ",", "*", "*", "kw", ")", ":", "form", "=", "form_class", "(", "form_dict", "or", "request", ".", "POST", "or", "...
Optional: ========= You can pass kwargs to the form save function in a 'save_kwargs' dict. Example Usage: ============== success, form = process_form(request, DiscussionForm, initial={ 'category':Category.objects.all()[0].id, }) if success: ...
[ "Optional", ":", "=========" ]
train
https://github.com/chrisdrackett/django-support/blob/a4f29421a31797e0b069637a0afec85328b4f0ca/support/forms/processing.py#L1-L32
etcher-be/elib_config
elib_config/_value/_config_value_path.py
ConfigValuePath.friendly_type_name
def friendly_type_name(self) -> str: """ :return: friendly type name for the end-user :rtype: str """ _constraints_set = [] if self._must_be_dir: _constraints_set.append('must be a directory') if self._must_be_file: _constraints_set.append(...
python
def friendly_type_name(self) -> str: """ :return: friendly type name for the end-user :rtype: str """ _constraints_set = [] if self._must_be_dir: _constraints_set.append('must be a directory') if self._must_be_file: _constraints_set.append(...
[ "def", "friendly_type_name", "(", "self", ")", "->", "str", ":", "_constraints_set", "=", "[", "]", "if", "self", ".", "_must_be_dir", ":", "_constraints_set", ".", "append", "(", "'must be a directory'", ")", "if", "self", ".", "_must_be_file", ":", "_constra...
:return: friendly type name for the end-user :rtype: str
[ ":", "return", ":", "friendly", "type", "name", "for", "the", "end", "-", "user", ":", "rtype", ":", "str" ]
train
https://github.com/etcher-be/elib_config/blob/5d8c839e84d70126620ab0186dc1f717e5868bd0/elib_config/_value/_config_value_path.py#L69-L82
limiear/soyprice
soyprice/bots/presenter_bot.py
Presenter.tweet
def tweet(self, status, images): # time.sleep(10) template = "%s #soyprice" """ if not images: self.twitter.update_status(status=template % status) else: medias = map(lambda i: self.upload_media(i), images) self.twitter.post('/statuses/update_w...
python
def tweet(self, status, images): # time.sleep(10) template = "%s #soyprice" """ if not images: self.twitter.update_status(status=template % status) else: medias = map(lambda i: self.upload_media(i), images) self.twitter.post('/statuses/update_w...
[ "def", "tweet", "(", "self", ",", "status", ",", "images", ")", ":", "# time.sleep(10)", "template", "=", "\"%s #soyprice\"", "print", "template", "%", "status", ",", "len", "(", "template", "%", "status", ")" ]
if not images: self.twitter.update_status(status=template % status) else: medias = map(lambda i: self.upload_media(i), images) self.twitter.post('/statuses/update_with_media', params={'status': template % status, 'me...
[ "if", "not", "images", ":", "self", ".", "twitter", ".", "update_status", "(", "status", "=", "template", "%", "status", ")", "else", ":", "medias", "=", "map", "(", "lambda", "i", ":", "self", ".", "upload_media", "(", "i", ")", "images", ")", "self...
train
https://github.com/limiear/soyprice/blob/b7f8847b1ab4ba7d9e654135321c5598c7d1aeb1/soyprice/bots/presenter_bot.py#L43-L55
minhhoit/yacms
yacms/pages/managers.py
PageManager.published
def published(self, for_user=None, include_login_required=False): """ Override ``DisplayableManager.published`` to exclude pages with ``login_required`` set to ``True``. if the user is unauthenticated and the setting ``PAGES_PUBLISHED_INCLUDE_LOGIN_REQUIRED`` is ``False``. ...
python
def published(self, for_user=None, include_login_required=False): """ Override ``DisplayableManager.published`` to exclude pages with ``login_required`` set to ``True``. if the user is unauthenticated and the setting ``PAGES_PUBLISHED_INCLUDE_LOGIN_REQUIRED`` is ``False``. ...
[ "def", "published", "(", "self", ",", "for_user", "=", "None", ",", "include_login_required", "=", "False", ")", ":", "published", "=", "super", "(", "PageManager", ",", "self", ")", ".", "published", "(", "for_user", "=", "for_user", ")", "unauthenticated",...
Override ``DisplayableManager.published`` to exclude pages with ``login_required`` set to ``True``. if the user is unauthenticated and the setting ``PAGES_PUBLISHED_INCLUDE_LOGIN_REQUIRED`` is ``False``. The extra ``include_login_required`` arg allows callers to override the ``P...
[ "Override", "DisplayableManager", ".", "published", "to", "exclude", "pages", "with", "login_required", "set", "to", "True", ".", "if", "the", "user", "is", "unauthenticated", "and", "the", "setting", "PAGES_PUBLISHED_INCLUDE_LOGIN_REQUIRED", "is", "False", "." ]
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/pages/managers.py#L11-L29
minhhoit/yacms
yacms/pages/managers.py
PageManager.with_ascendants_for_slug
def with_ascendants_for_slug(self, slug, **kwargs): """ Given a slug, returns a list of pages from ascendants to descendants, that form the parent/child page relationships for that slug. The main concern is to do this in a single database query rather than querying the database f...
python
def with_ascendants_for_slug(self, slug, **kwargs): """ Given a slug, returns a list of pages from ascendants to descendants, that form the parent/child page relationships for that slug. The main concern is to do this in a single database query rather than querying the database f...
[ "def", "with_ascendants_for_slug", "(", "self", ",", "slug", ",", "*", "*", "kwargs", ")", ":", "if", "slug", "==", "\"/\"", ":", "slugs", "=", "[", "home_slug", "(", ")", "]", "else", ":", "# Create a list of slugs within this slug,", "# eg: ['about', 'about/te...
Given a slug, returns a list of pages from ascendants to descendants, that form the parent/child page relationships for that slug. The main concern is to do this in a single database query rather than querying the database for parents of a given page. Primarily used in ``PageMid...
[ "Given", "a", "slug", "returns", "a", "list", "of", "pages", "from", "ascendants", "to", "descendants", "that", "form", "the", "parent", "/", "child", "page", "relationships", "for", "that", "slug", ".", "The", "main", "concern", "is", "to", "do", "this", ...
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/pages/managers.py#L31-L93
stevemarple/python-atomiccreate
atomiccreate/__init__.py
atomic_symlink
def atomic_symlink(src, dst): """Create or update a symbolic link atomically. This function is similar to :py:func:`os.symlink` but will update a symlink atomically.""" dst_dir = os.path.dirname(dst) tmp = None max_tries = getattr(os, 'TMP_MAX', 10000) try: if not os.path.exists(dst_d...
python
def atomic_symlink(src, dst): """Create or update a symbolic link atomically. This function is similar to :py:func:`os.symlink` but will update a symlink atomically.""" dst_dir = os.path.dirname(dst) tmp = None max_tries = getattr(os, 'TMP_MAX', 10000) try: if not os.path.exists(dst_d...
[ "def", "atomic_symlink", "(", "src", ",", "dst", ")", ":", "dst_dir", "=", "os", ".", "path", ".", "dirname", "(", "dst", ")", "tmp", "=", "None", "max_tries", "=", "getattr", "(", "os", ",", "'TMP_MAX'", ",", "10000", ")", "try", ":", "if", "not",...
Create or update a symbolic link atomically. This function is similar to :py:func:`os.symlink` but will update a symlink atomically.
[ "Create", "or", "update", "a", "symbolic", "link", "atomically", "." ]
train
https://github.com/stevemarple/python-atomiccreate/blob/33bbbe8ce706dbd5f89ef3e4e29609d51e5fb39a/atomiccreate/__init__.py#L114-L146
msuozzo/Aduro
main.py
run
def run(): #pylint: disable=too-many-locals """Execute the command loop """ store = EventStore(STORE_PATH) with open(CREDENTIAL_PATH, 'r') as cred_file: creds = json.load(cred_file) uname, pword = creds['uname'], creds['pword'] mgr = KindleProgressMgr(store, uname, pword) print...
python
def run(): #pylint: disable=too-many-locals """Execute the command loop """ store = EventStore(STORE_PATH) with open(CREDENTIAL_PATH, 'r') as cred_file: creds = json.load(cred_file) uname, pword = creds['uname'], creds['pword'] mgr = KindleProgressMgr(store, uname, pword) print...
[ "def", "run", "(", ")", ":", "#pylint: disable=too-many-locals", "store", "=", "EventStore", "(", "STORE_PATH", ")", "with", "open", "(", "CREDENTIAL_PATH", ",", "'r'", ")", "as", "cred_file", ":", "creds", "=", "json", ".", "load", "(", "cred_file", ")", ...
Execute the command loop
[ "Execute", "the", "command", "loop" ]
train
https://github.com/msuozzo/Aduro/blob/338eeb1deeff30c198e721b660ae4daca3660911/main.py#L28-L53
msuozzo/Aduro
main.py
_change_state_prompt
def _change_state_prompt(mgr): """Runs a prompt to change the state of books. Registers `Event`s with `mgr` as they are requested. Args: mgr: A `KindleProgressMgr` object with the `books` and `progress` fields populated. """ cmd = '' book_range = range(1, len(mgr.books) + 1...
python
def _change_state_prompt(mgr): """Runs a prompt to change the state of books. Registers `Event`s with `mgr` as they are requested. Args: mgr: A `KindleProgressMgr` object with the `books` and `progress` fields populated. """ cmd = '' book_range = range(1, len(mgr.books) + 1...
[ "def", "_change_state_prompt", "(", "mgr", ")", ":", "cmd", "=", "''", "book_range", "=", "range", "(", "1", ",", "len", "(", "mgr", ".", "books", ")", "+", "1", ")", "ind_to_book", "=", "dict", "(", "zip", "(", "book_range", ",", "mgr", ".", "book...
Runs a prompt to change the state of books. Registers `Event`s with `mgr` as they are requested. Args: mgr: A `KindleProgressMgr` object with the `books` and `progress` fields populated.
[ "Runs", "a", "prompt", "to", "change", "the", "state", "of", "books", "." ]
train
https://github.com/msuozzo/Aduro/blob/338eeb1deeff30c198e721b660ae4daca3660911/main.py#L56-L94
emlazzarin/acrylic
acrylic/ExcelRW.py
UnicodeReader.change_sheet
def change_sheet(self, sheet_name_or_num): """ Calling this method changes the sheet in anticipation for the next time you create an iterator. If you change the active sheet while iterating on a UnicodeReader instance, it will continue to iterate correctly until completion. ...
python
def change_sheet(self, sheet_name_or_num): """ Calling this method changes the sheet in anticipation for the next time you create an iterator. If you change the active sheet while iterating on a UnicodeReader instance, it will continue to iterate correctly until completion. ...
[ "def", "change_sheet", "(", "self", ",", "sheet_name_or_num", ")", ":", "if", "isinstance", "(", "sheet_name_or_num", ",", "int", ")", ":", "self", ".", "_sheet", "=", "self", ".", "__wb", "[", "self", ".", "__wb", ".", "sheetnames", "[", "sheet_name_or_nu...
Calling this method changes the sheet in anticipation for the next time you create an iterator. If you change the active sheet while iterating on a UnicodeReader instance, it will continue to iterate correctly until completion. The next time you iterate through reader, it will begin all...
[ "Calling", "this", "method", "changes", "the", "sheet", "in", "anticipation", "for", "the", "next", "time", "you", "create", "an", "iterator", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/ExcelRW.py#L27-L43
contains-io/containment
containment/builder.py
CommandLineInterface._os_install
def _os_install(self, package_file): """ take in a dict return a string of docker build RUN directives one RUN per package type one package type per JSON key """ packages = " ".join(json.load(package_file.open())) if packages: for packager in self.pkg_...
python
def _os_install(self, package_file): """ take in a dict return a string of docker build RUN directives one RUN per package type one package type per JSON key """ packages = " ".join(json.load(package_file.open())) if packages: for packager in self.pkg_...
[ "def", "_os_install", "(", "self", ",", "package_file", ")", ":", "packages", "=", "\" \"", ".", "join", "(", "json", ".", "load", "(", "package_file", ".", "open", "(", ")", ")", ")", "if", "packages", ":", "for", "packager", "in", "self", ".", "pkg...
take in a dict return a string of docker build RUN directives one RUN per package type one package type per JSON key
[ "take", "in", "a", "dict", "return", "a", "string", "of", "docker", "build", "RUN", "directives", "one", "RUN", "per", "package", "type", "one", "package", "type", "per", "JSON", "key" ]
train
https://github.com/contains-io/containment/blob/4f7e2c2338e0ca7c107a7b3a9913bb5e6e07245f/containment/builder.py#L65-L78
contains-io/containment
containment/builder.py
CommandLineInterface.pave_profile
def pave_profile(self): """ Usage: containment pave_profile """ settings.personal_config.path.mkdir() json.dump( settings.personal_config.package_list, settings.personal_config.os_packages.open(mode="w"), ) json.dump({}, settings....
python
def pave_profile(self): """ Usage: containment pave_profile """ settings.personal_config.path.mkdir() json.dump( settings.personal_config.package_list, settings.personal_config.os_packages.open(mode="w"), ) json.dump({}, settings....
[ "def", "pave_profile", "(", "self", ")", ":", "settings", ".", "personal_config", ".", "path", ".", "mkdir", "(", ")", "json", ".", "dump", "(", "settings", ".", "personal_config", ".", "package_list", ",", "settings", ".", "personal_config", ".", "os_packag...
Usage: containment pave_profile
[ "Usage", ":", "containment", "pave_profile" ]
train
https://github.com/contains-io/containment/blob/4f7e2c2338e0ca7c107a7b3a9913bb5e6e07245f/containment/builder.py#L97-L108
contains-io/containment
containment/builder.py
CommandLineInterface.pave_project
def pave_project(self): """ Usage: containment pave_project """ settings.project_customization.path.mkdir() settings.project_customization.entrypoint.write_text( self.context.entrypoint_text ) settings.project_customization.runfile.write_text...
python
def pave_project(self): """ Usage: containment pave_project """ settings.project_customization.path.mkdir() settings.project_customization.entrypoint.write_text( self.context.entrypoint_text ) settings.project_customization.runfile.write_text...
[ "def", "pave_project", "(", "self", ")", ":", "settings", ".", "project_customization", ".", "path", ".", "mkdir", "(", ")", "settings", ".", "project_customization", ".", "entrypoint", ".", "write_text", "(", "self", ".", "context", ".", "entrypoint_text", ")...
Usage: containment pave_project
[ "Usage", ":", "containment", "pave_project" ]
train
https://github.com/contains-io/containment/blob/4f7e2c2338e0ca7c107a7b3a9913bb5e6e07245f/containment/builder.py#L110-L124