repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
suurjaak/InputScope
inputscope/conf.py
defaults
def defaults(values={}): """Returns a once-assembled dict of this module's storable attributes.""" if values: return values save_types = basestring, int, float, tuple, list, dict, type(None) for k, v in globals().items(): if isinstance(v, save_types) and not k.startswith("_"): values[k] = v...
python
def defaults(values={}): """Returns a once-assembled dict of this module's storable attributes.""" if values: return values save_types = basestring, int, float, tuple, list, dict, type(None) for k, v in globals().items(): if isinstance(v, save_types) and not k.startswith("_"): values[k] = v...
[ "def", "defaults", "(", "values", "=", "{", "}", ")", ":", "if", "values", ":", "return", "values", "save_types", "=", "basestring", ",", "int", ",", "float", ",", "tuple", ",", "list", ",", "dict", ",", "type", "(", "None", ")", "for", "k", ",", ...
Returns a once-assembled dict of this module's storable attributes.
[ "Returns", "a", "once", "-", "assembled", "dict", "of", "this", "module", "s", "storable", "attributes", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/conf.py#L297-L303
train
Phyks/libbmc
libbmc/papers/tearpages.py
fix_pdf
def fix_pdf(pdf_file, destination): """ Fix malformed pdf files when data are present after '%%EOF' ..note :: Originally from sciunto, https://github.com/sciunto/tear-pages :param pdfFile: PDF filepath :param destination: destination """ tmp = tempfile.NamedTemporaryFile() wit...
python
def fix_pdf(pdf_file, destination): """ Fix malformed pdf files when data are present after '%%EOF' ..note :: Originally from sciunto, https://github.com/sciunto/tear-pages :param pdfFile: PDF filepath :param destination: destination """ tmp = tempfile.NamedTemporaryFile() wit...
[ "def", "fix_pdf", "(", "pdf_file", ",", "destination", ")", ":", "tmp", "=", "tempfile", ".", "NamedTemporaryFile", "(", ")", "with", "open", "(", "tmp", ".", "name", ",", "'wb'", ")", "as", "output", ":", "with", "open", "(", "pdf_file", ",", "\"rb\""...
Fix malformed pdf files when data are present after '%%EOF' ..note :: Originally from sciunto, https://github.com/sciunto/tear-pages :param pdfFile: PDF filepath :param destination: destination
[ "Fix", "malformed", "pdf", "files", "when", "data", "are", "present", "after", "%%EOF" ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/papers/tearpages.py#L24-L42
train
Phyks/libbmc
libbmc/papers/tearpages.py
tearpage_backend
def tearpage_backend(filename, teared_pages=None): """ Copy filename to a tempfile, write pages to filename except the teared one. ..note :: Adapted from sciunto's code, https://github.com/sciunto/tear-pages :param filename: PDF filepath :param teared_pages: Numbers of the pages to tear. ...
python
def tearpage_backend(filename, teared_pages=None): """ Copy filename to a tempfile, write pages to filename except the teared one. ..note :: Adapted from sciunto's code, https://github.com/sciunto/tear-pages :param filename: PDF filepath :param teared_pages: Numbers of the pages to tear. ...
[ "def", "tearpage_backend", "(", "filename", ",", "teared_pages", "=", "None", ")", ":", "if", "teared_pages", "is", "None", ":", "teared_pages", "=", "[", "0", "]", "with", "tempfile", ".", "NamedTemporaryFile", "(", ")", "as", "tmp", ":", "shutil", ".", ...
Copy filename to a tempfile, write pages to filename except the teared one. ..note :: Adapted from sciunto's code, https://github.com/sciunto/tear-pages :param filename: PDF filepath :param teared_pages: Numbers of the pages to tear. Default to first page \ only.
[ "Copy", "filename", "to", "a", "tempfile", "write", "pages", "to", "filename", "except", "the", "teared", "one", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/papers/tearpages.py#L45-L85
train
Phyks/libbmc
libbmc/papers/tearpages.py
tearpage_needed
def tearpage_needed(bibtex): """ Check whether a given paper needs some pages to be teared or not. :params bibtex: The bibtex entry associated to the paper, to guess \ whether tearing is needed. :returns: A list of pages to tear. """ for publisher in BAD_JOURNALS: if publish...
python
def tearpage_needed(bibtex): """ Check whether a given paper needs some pages to be teared or not. :params bibtex: The bibtex entry associated to the paper, to guess \ whether tearing is needed. :returns: A list of pages to tear. """ for publisher in BAD_JOURNALS: if publish...
[ "def", "tearpage_needed", "(", "bibtex", ")", ":", "for", "publisher", "in", "BAD_JOURNALS", ":", "if", "publisher", "in", "bibtex", ".", "get", "(", "\"journal\"", ",", "\"\"", ")", ".", "lower", "(", ")", ":", "return", "BAD_JOURNALS", "[", "publisher", ...
Check whether a given paper needs some pages to be teared or not. :params bibtex: The bibtex entry associated to the paper, to guess \ whether tearing is needed. :returns: A list of pages to tear.
[ "Check", "whether", "a", "given", "paper", "needs", "some", "pages", "to", "be", "teared", "or", "not", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/papers/tearpages.py#L88-L102
train
Phyks/libbmc
libbmc/papers/tearpages.py
tearpage
def tearpage(filename, bibtex=None, force=None): """ Tear some pages of the file if needed. :params filename: Path to the file to handle. :params bibtex: BibTeX dict associated to this file, as the one given by \ ``bibtexparser``. (Mandatory if force is not specified) :params force: If ...
python
def tearpage(filename, bibtex=None, force=None): """ Tear some pages of the file if needed. :params filename: Path to the file to handle. :params bibtex: BibTeX dict associated to this file, as the one given by \ ``bibtexparser``. (Mandatory if force is not specified) :params force: If ...
[ "def", "tearpage", "(", "filename", ",", "bibtex", "=", "None", ",", "force", "=", "None", ")", ":", "pages_to_tear", "=", "[", "]", "if", "force", "is", "not", "None", ":", "pages_to_tear", "=", "force", "elif", "bibtex", "is", "not", "None", ":", "...
Tear some pages of the file if needed. :params filename: Path to the file to handle. :params bibtex: BibTeX dict associated to this file, as the one given by \ ``bibtexparser``. (Mandatory if force is not specified) :params force: If a list of integers, force the tearing of the \ sp...
[ "Tear", "some", "pages", "of", "the", "file", "if", "needed", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/papers/tearpages.py#L105-L130
train
theiviaxx/python-perforce
perforce/api.py
edit
def edit(filename, connection=None): """Checks out a file into the default changelist :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() rev = c.ls(filename) if r...
python
def edit(filename, connection=None): """Checks out a file into the default changelist :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() rev = c.ls(filename) if r...
[ "def", "edit", "(", "filename", ",", "connection", "=", "None", ")", ":", "c", "=", "connection", "or", "connect", "(", ")", "rev", "=", "c", ".", "ls", "(", "filename", ")", "if", "rev", ":", "rev", "[", "0", "]", ".", "edit", "(", ")" ]
Checks out a file into the default changelist :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection`
[ "Checks", "out", "a", "file", "into", "the", "default", "changelist" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/api.py#L28-L39
train
theiviaxx/python-perforce
perforce/api.py
sync
def sync(filename, connection=None): """Syncs a file :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() rev = c.ls(filename) if rev: rev[0].sync()
python
def sync(filename, connection=None): """Syncs a file :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() rev = c.ls(filename) if rev: rev[0].sync()
[ "def", "sync", "(", "filename", ",", "connection", "=", "None", ")", ":", "c", "=", "connection", "or", "connect", "(", ")", "rev", "=", "c", ".", "ls", "(", "filename", ")", "if", "rev", ":", "rev", "[", "0", "]", ".", "sync", "(", ")" ]
Syncs a file :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection`
[ "Syncs", "a", "file" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/api.py#L42-L53
train
theiviaxx/python-perforce
perforce/api.py
open
def open(filename, connection=None): """Edits or Adds a filename ensuring the file is in perforce and editable :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() res ...
python
def open(filename, connection=None): """Edits or Adds a filename ensuring the file is in perforce and editable :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() res ...
[ "def", "open", "(", "filename", ",", "connection", "=", "None", ")", ":", "c", "=", "connection", "or", "connect", "(", ")", "res", "=", "c", ".", "ls", "(", "filename", ")", "if", "res", "and", "res", "[", "0", "]", ".", "revision", ":", "res", ...
Edits or Adds a filename ensuring the file is in perforce and editable :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection`
[ "Edits", "or", "Adds", "a", "filename", "ensuring", "the", "file", "is", "in", "perforce", "and", "editable" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/api.py#L81-L94
train
Phyks/libbmc
libbmc/repositories/arxiv.py
is_valid
def is_valid(arxiv_id): """ Check that a given arXiv ID is a valid one. :param arxiv_id: The arXiv ID to be checked. :returns: Boolean indicating whether the arXiv ID is valid or not. >>> is_valid('1506.06690') True >>> is_valid('1506.06690v1') True >>> is_valid('arXiv:1506.06690...
python
def is_valid(arxiv_id): """ Check that a given arXiv ID is a valid one. :param arxiv_id: The arXiv ID to be checked. :returns: Boolean indicating whether the arXiv ID is valid or not. >>> is_valid('1506.06690') True >>> is_valid('1506.06690v1') True >>> is_valid('arXiv:1506.06690...
[ "def", "is_valid", "(", "arxiv_id", ")", ":", "match", "=", "REGEX", ".", "match", "(", "arxiv_id", ")", "return", "(", "match", "is", "not", "None", ")", "and", "(", "match", ".", "group", "(", "0", ")", "==", "arxiv_id", ")" ]
Check that a given arXiv ID is a valid one. :param arxiv_id: The arXiv ID to be checked. :returns: Boolean indicating whether the arXiv ID is valid or not. >>> is_valid('1506.06690') True >>> is_valid('1506.06690v1') True >>> is_valid('arXiv:1506.06690') True >>> is_valid('arXiv...
[ "Check", "that", "a", "given", "arXiv", "ID", "is", "a", "valid", "one", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L235-L273
train
Phyks/libbmc
libbmc/repositories/arxiv.py
get_bibtex
def get_bibtex(arxiv_id): """ Get a BibTeX entry for a given arXiv ID. .. note:: Using awesome https://pypi.python.org/pypi/arxiv2bib/ module. :param arxiv_id: The canonical arXiv id to get BibTeX from. :returns: A BibTeX string or ``None``. >>> get_bibtex('1506.06690') "@article...
python
def get_bibtex(arxiv_id): """ Get a BibTeX entry for a given arXiv ID. .. note:: Using awesome https://pypi.python.org/pypi/arxiv2bib/ module. :param arxiv_id: The canonical arXiv id to get BibTeX from. :returns: A BibTeX string or ``None``. >>> get_bibtex('1506.06690') "@article...
[ "def", "get_bibtex", "(", "arxiv_id", ")", ":", "try", ":", "bibtex", "=", "arxiv2bib", ".", "arxiv2bib", "(", "[", "arxiv_id", "]", ")", "except", "HTTPError", ":", "bibtex", "=", "[", "]", "for", "bib", "in", "bibtex", ":", "if", "isinstance", "(", ...
Get a BibTeX entry for a given arXiv ID. .. note:: Using awesome https://pypi.python.org/pypi/arxiv2bib/ module. :param arxiv_id: The canonical arXiv id to get BibTeX from. :returns: A BibTeX string or ``None``. >>> get_bibtex('1506.06690') "@article{1506.06690v2,\\nAuthor = {Luca...
[ "Get", "a", "BibTeX", "entry", "for", "a", "given", "arXiv", "ID", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L276-L306
train
Phyks/libbmc
libbmc/repositories/arxiv.py
extract_from_text
def extract_from_text(text): """ Extract arXiv IDs from a text. :param text: The text to extract arXiv IDs from. :returns: A list of matching arXiv IDs, in canonical form. >>> sorted(extract_from_text('1506.06690 1506.06690v1 arXiv:1506.06690 arXiv:1506.06690v1 arxiv:1506.06690 arxiv:1506.06690v1 ...
python
def extract_from_text(text): """ Extract arXiv IDs from a text. :param text: The text to extract arXiv IDs from. :returns: A list of matching arXiv IDs, in canonical form. >>> sorted(extract_from_text('1506.06690 1506.06690v1 arXiv:1506.06690 arXiv:1506.06690v1 arxiv:1506.06690 arxiv:1506.06690v1 ...
[ "def", "extract_from_text", "(", "text", ")", ":", "return", "tools", ".", "remove_duplicates", "(", "[", "re", ".", "sub", "(", "\"arxiv:\"", ",", "\"\"", ",", "i", "[", "0", "]", ",", "flags", "=", "re", ".", "IGNORECASE", ")", "for", "i", "in", ...
Extract arXiv IDs from a text. :param text: The text to extract arXiv IDs from. :returns: A list of matching arXiv IDs, in canonical form. >>> sorted(extract_from_text('1506.06690 1506.06690v1 arXiv:1506.06690 arXiv:1506.06690v1 arxiv:1506.06690 arxiv:1506.06690v1 math.GT/0309136 abcdf bar1506.06690foo ma...
[ "Extract", "arXiv", "IDs", "from", "a", "text", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L309-L322
train
Phyks/libbmc
libbmc/repositories/arxiv.py
from_doi
def from_doi(doi): """ Get the arXiv eprint id for a given DOI. .. note:: Uses arXiv API. Will not return anything if arXiv is not aware of the associated DOI. :param doi: The DOI of the resource to look for. :returns: The arXiv eprint id, or ``None`` if not found. >>> from_d...
python
def from_doi(doi): """ Get the arXiv eprint id for a given DOI. .. note:: Uses arXiv API. Will not return anything if arXiv is not aware of the associated DOI. :param doi: The DOI of the resource to look for. :returns: The arXiv eprint id, or ``None`` if not found. >>> from_d...
[ "def", "from_doi", "(", "doi", ")", ":", "try", ":", "request", "=", "requests", ".", "get", "(", "\"http://export.arxiv.org/api/query\"", ",", "params", "=", "{", "\"search_query\"", ":", "\"doi:%s\"", "%", "(", "doi", ",", ")", ",", "\"max_results\"", ":",...
Get the arXiv eprint id for a given DOI. .. note:: Uses arXiv API. Will not return anything if arXiv is not aware of the associated DOI. :param doi: The DOI of the resource to look for. :returns: The arXiv eprint id, or ``None`` if not found. >>> from_doi('10.1209/0295-5075/111/40005...
[ "Get", "the", "arXiv", "eprint", "id", "for", "a", "given", "DOI", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L366-L397
train
Phyks/libbmc
libbmc/repositories/arxiv.py
get_sources
def get_sources(arxiv_id): """ Download sources on arXiv for a given preprint. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param eprint: The arXiv id (e.g. ``1401.2910`` or ``1401...
python
def get_sources(arxiv_id): """ Download sources on arXiv for a given preprint. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param eprint: The arXiv id (e.g. ``1401.2910`` or ``1401...
[ "def", "get_sources", "(", "arxiv_id", ")", ":", "try", ":", "request", "=", "requests", ".", "get", "(", "ARXIV_EPRINT_URL", ".", "format", "(", "arxiv_id", "=", "arxiv_id", ")", ")", "request", ".", "raise_for_status", "(", ")", "file_object", "=", "io",...
Download sources on arXiv for a given preprint. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param eprint: The arXiv id (e.g. ``1401.2910`` or ``1401.2910v1``) in a \ canonical...
[ "Download", "sources", "on", "arXiv", "for", "a", "given", "preprint", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L435-L455
train
crm416/semantic
semantic/dates.py
extractDates
def extractDates(inp, tz=None, now=None): """Extract semantic date information from an input string. This is a convenience method which would only be used if you'd rather not initialize a DateService object. Args: inp (str): The input string to be parsed. tz: An optional Pytz timezone. ...
python
def extractDates(inp, tz=None, now=None): """Extract semantic date information from an input string. This is a convenience method which would only be used if you'd rather not initialize a DateService object. Args: inp (str): The input string to be parsed. tz: An optional Pytz timezone. ...
[ "def", "extractDates", "(", "inp", ",", "tz", "=", "None", ",", "now", "=", "None", ")", ":", "service", "=", "DateService", "(", "tz", "=", "tz", ",", "now", "=", "now", ")", "return", "service", ".", "extractDates", "(", "inp", ")" ]
Extract semantic date information from an input string. This is a convenience method which would only be used if you'd rather not initialize a DateService object. Args: inp (str): The input string to be parsed. tz: An optional Pytz timezone. All datetime objects returned will be...
[ "Extract", "semantic", "date", "information", "from", "an", "input", "string", ".", "This", "is", "a", "convenience", "method", "which", "would", "only", "be", "used", "if", "you", "d", "rather", "not", "initialize", "a", "DateService", "object", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L476-L495
train
crm416/semantic
semantic/dates.py
DateService.extractTimes
def extractTimes(self, inp): """Extracts time-related information from an input string. Ignores any information related to the specific date, focusing on the time-of-day. Args: inp (str): Input string to be parsed. Returns: A list of datetime objects con...
python
def extractTimes(self, inp): """Extracts time-related information from an input string. Ignores any information related to the specific date, focusing on the time-of-day. Args: inp (str): Input string to be parsed. Returns: A list of datetime objects con...
[ "def", "extractTimes", "(", "self", ",", "inp", ")", ":", "def", "handleMatch", "(", "time", ")", ":", "relative", "=", "False", "if", "not", "time", ":", "return", "None", "elif", "time", ".", "group", "(", "1", ")", "==", "'morning'", ":", "h", "...
Extracts time-related information from an input string. Ignores any information related to the specific date, focusing on the time-of-day. Args: inp (str): Input string to be parsed. Returns: A list of datetime objects containing the extracted times from the ...
[ "Extracts", "time", "-", "related", "information", "from", "an", "input", "string", ".", "Ignores", "any", "information", "related", "to", "the", "specific", "date", "focusing", "on", "the", "time", "-", "of", "-", "day", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L263-L339
train
crm416/semantic
semantic/dates.py
DateService.extractDates
def extractDates(self, inp): """Extract semantic date information from an input string. In effect, runs both parseDay and parseTime on the input string and merges the results to produce a comprehensive datetime object. Args: inp (str): Input string to be parsed. ...
python
def extractDates(self, inp): """Extract semantic date information from an input string. In effect, runs both parseDay and parseTime on the input string and merges the results to produce a comprehensive datetime object. Args: inp (str): Input string to be parsed. ...
[ "def", "extractDates", "(", "self", ",", "inp", ")", ":", "def", "merge", "(", "param", ")", ":", "day", ",", "time", "=", "param", "if", "not", "(", "day", "or", "time", ")", ":", "return", "None", "if", "not", "day", ":", "return", "time", "if"...
Extract semantic date information from an input string. In effect, runs both parseDay and parseTime on the input string and merges the results to produce a comprehensive datetime object. Args: inp (str): Input string to be parsed. Returns: A list of date...
[ "Extract", "semantic", "date", "information", "from", "an", "input", "string", ".", "In", "effect", "runs", "both", "parseDay", "and", "parseTime", "on", "the", "input", "string", "and", "merges", "the", "results", "to", "produce", "a", "comprehensive", "datet...
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L349-L378
train
crm416/semantic
semantic/dates.py
DateService.extractDate
def extractDate(self, inp): """Returns the first date found in the input string, or None if not found.""" dates = self.extractDates(inp) for date in dates: return date return None
python
def extractDate(self, inp): """Returns the first date found in the input string, or None if not found.""" dates = self.extractDates(inp) for date in dates: return date return None
[ "def", "extractDate", "(", "self", ",", "inp", ")", ":", "dates", "=", "self", ".", "extractDates", "(", "inp", ")", "for", "date", "in", "dates", ":", "return", "date", "return", "None" ]
Returns the first date found in the input string, or None if not found.
[ "Returns", "the", "first", "date", "found", "in", "the", "input", "string", "or", "None", "if", "not", "found", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L380-L386
train
crm416/semantic
semantic/dates.py
DateService.convertDay
def convertDay(self, day, prefix="", weekday=False): """Convert a datetime object representing a day into a human-ready string that can be read, spoken aloud, etc. Args: day (datetime.date): A datetime object to be converted into text. prefix (str): An optional argument ...
python
def convertDay(self, day, prefix="", weekday=False): """Convert a datetime object representing a day into a human-ready string that can be read, spoken aloud, etc. Args: day (datetime.date): A datetime object to be converted into text. prefix (str): An optional argument ...
[ "def", "convertDay", "(", "self", ",", "day", ",", "prefix", "=", "\"\"", ",", "weekday", "=", "False", ")", ":", "def", "sameDay", "(", "d1", ",", "d2", ")", ":", "d", "=", "d1", ".", "day", "==", "d2", ".", "day", "m", "=", "d1", ".", "mont...
Convert a datetime object representing a day into a human-ready string that can be read, spoken aloud, etc. Args: day (datetime.date): A datetime object to be converted into text. prefix (str): An optional argument that prefixes the converted string. For example,...
[ "Convert", "a", "datetime", "object", "representing", "a", "day", "into", "a", "human", "-", "ready", "string", "that", "can", "be", "read", "spoken", "aloud", "etc", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L388-L427
train
crm416/semantic
semantic/dates.py
DateService.convertTime
def convertTime(self, time): """Convert a datetime object representing a time into a human-ready string that can be read, spoken aloud, etc. Args: time (datetime.date): A datetime object to be converted into text. Returns: A string representation of the input ti...
python
def convertTime(self, time): """Convert a datetime object representing a time into a human-ready string that can be read, spoken aloud, etc. Args: time (datetime.date): A datetime object to be converted into text. Returns: A string representation of the input ti...
[ "def", "convertTime", "(", "self", ",", "time", ")", ":", "m_format", "=", "\"\"", "if", "time", ".", "minute", ":", "m_format", "=", "\":%M\"", "timeString", "=", "time", ".", "strftime", "(", "\"%I\"", "+", "m_format", "+", "\" %p\"", ")", "if", "not...
Convert a datetime object representing a time into a human-ready string that can be read, spoken aloud, etc. Args: time (datetime.date): A datetime object to be converted into text. Returns: A string representation of the input time, ignoring any day-related ...
[ "Convert", "a", "datetime", "object", "representing", "a", "time", "into", "a", "human", "-", "ready", "string", "that", "can", "be", "read", "spoken", "aloud", "etc", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L429-L451
train
crm416/semantic
semantic/dates.py
DateService.convertDate
def convertDate(self, date, prefix="", weekday=False): """Convert a datetime object representing into a human-ready string that can be read, spoken aloud, etc. In effect, runs both convertDay and convertTime on the input, merging the results. Args: date (datetime.date): A da...
python
def convertDate(self, date, prefix="", weekday=False): """Convert a datetime object representing into a human-ready string that can be read, spoken aloud, etc. In effect, runs both convertDay and convertTime on the input, merging the results. Args: date (datetime.date): A da...
[ "def", "convertDate", "(", "self", ",", "date", ",", "prefix", "=", "\"\"", ",", "weekday", "=", "False", ")", ":", "dayString", "=", "self", ".", "convertDay", "(", "date", ",", "prefix", "=", "prefix", ",", "weekday", "=", "weekday", ")", "timeString...
Convert a datetime object representing into a human-ready string that can be read, spoken aloud, etc. In effect, runs both convertDay and convertTime on the input, merging the results. Args: date (datetime.date): A datetime object to be converted into text. prefix (str):...
[ "Convert", "a", "datetime", "object", "representing", "into", "a", "human", "-", "ready", "string", "that", "can", "be", "read", "spoken", "aloud", "etc", ".", "In", "effect", "runs", "both", "convertDay", "and", "convertTime", "on", "the", "input", "merging...
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L453-L473
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilesystemHandler._move
def _move(self): """ Called during a PUT request where the action specifies a move operation. Returns resource URI of the destination file. """ newpath = self.action['newpath'] try: self.fs.move(self.fp,newpath) except OSError: raise tornad...
python
def _move(self): """ Called during a PUT request where the action specifies a move operation. Returns resource URI of the destination file. """ newpath = self.action['newpath'] try: self.fs.move(self.fp,newpath) except OSError: raise tornad...
[ "def", "_move", "(", "self", ")", ":", "newpath", "=", "self", ".", "action", "[", "'newpath'", "]", "try", ":", "self", ".", "fs", ".", "move", "(", "self", ".", "fp", ",", "newpath", ")", "except", "OSError", ":", "raise", "tornado", ".", "web", ...
Called during a PUT request where the action specifies a move operation. Returns resource URI of the destination file.
[ "Called", "during", "a", "PUT", "request", "where", "the", "action", "specifies", "a", "move", "operation", ".", "Returns", "resource", "URI", "of", "the", "destination", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L32-L42
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilesystemHandler._copy
def _copy(self): """ Called during a PUT request where the action specifies a copy operation. Returns resource URI of the new file. """ copypath = self.action['copypath'] try: self.fs.copy(self.fp,copypath) except OSError: raise tornado.web...
python
def _copy(self): """ Called during a PUT request where the action specifies a copy operation. Returns resource URI of the new file. """ copypath = self.action['copypath'] try: self.fs.copy(self.fp,copypath) except OSError: raise tornado.web...
[ "def", "_copy", "(", "self", ")", ":", "copypath", "=", "self", ".", "action", "[", "'copypath'", "]", "try", ":", "self", ".", "fs", ".", "copy", "(", "self", ".", "fp", ",", "copypath", ")", "except", "OSError", ":", "raise", "tornado", ".", "web...
Called during a PUT request where the action specifies a copy operation. Returns resource URI of the new file.
[ "Called", "during", "a", "PUT", "request", "where", "the", "action", "specifies", "a", "copy", "operation", ".", "Returns", "resource", "URI", "of", "the", "new", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L44-L54
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilesystemHandler._rename
def _rename(self): """ Called during a PUT request where the action specifies a rename operation. Returns resource URI of the renamed file. """ newname = self.action['newname'] try: newpath = self.fs.rename(self.fp,newname) except OSError: ...
python
def _rename(self): """ Called during a PUT request where the action specifies a rename operation. Returns resource URI of the renamed file. """ newname = self.action['newname'] try: newpath = self.fs.rename(self.fp,newname) except OSError: ...
[ "def", "_rename", "(", "self", ")", ":", "newname", "=", "self", ".", "action", "[", "'newname'", "]", "try", ":", "newpath", "=", "self", ".", "fs", ".", "rename", "(", "self", ".", "fp", ",", "newname", ")", "except", "OSError", ":", "raise", "to...
Called during a PUT request where the action specifies a rename operation. Returns resource URI of the renamed file.
[ "Called", "during", "a", "PUT", "request", "where", "the", "action", "specifies", "a", "rename", "operation", ".", "Returns", "resource", "URI", "of", "the", "renamed", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L56-L66
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilesystemHandler.get
def get(self): """ Return details for the filesystem, including configured volumes. """ res = self.fs.get_filesystem_details() res = res.to_dict() self.write(res)
python
def get(self): """ Return details for the filesystem, including configured volumes. """ res = self.fs.get_filesystem_details() res = res.to_dict() self.write(res)
[ "def", "get", "(", "self", ")", ":", "res", "=", "self", ".", "fs", ".", "get_filesystem_details", "(", ")", "res", "=", "res", ".", "to_dict", "(", ")", "self", ".", "write", "(", "res", ")" ]
Return details for the filesystem, including configured volumes.
[ "Return", "details", "for", "the", "filesystem", "including", "configured", "volumes", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L69-L75
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilesystemHandler.put
def put(self): """ Provides move, copy, and rename functionality. An action must be specified when calling this method. """ self.fp = self.get_body_argument('filepath') self.action = self.get_body_argument('action') try: ptype = self.fs.get_type_from_...
python
def put(self): """ Provides move, copy, and rename functionality. An action must be specified when calling this method. """ self.fp = self.get_body_argument('filepath') self.action = self.get_body_argument('action') try: ptype = self.fs.get_type_from_...
[ "def", "put", "(", "self", ")", ":", "self", ".", "fp", "=", "self", ".", "get_body_argument", "(", "'filepath'", ")", "self", ".", "action", "=", "self", ".", "get_body_argument", "(", "'action'", ")", "try", ":", "ptype", "=", "self", ".", "fs", "....
Provides move, copy, and rename functionality. An action must be specified when calling this method.
[ "Provides", "move", "copy", "and", "rename", "functionality", ".", "An", "action", "must", "be", "specified", "when", "calling", "this", "method", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L78-L105
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilewatcherCreateHandler.post
def post(self, *args): """ Start a new filewatcher at the specified path. """ filepath = self.get_body_argument('filepath') if not self.fs.exists(filepath): raise tornado.web.HTTPError(404) Filewatcher.add_directory_to_watch(filepath) self.write({'msg...
python
def post(self, *args): """ Start a new filewatcher at the specified path. """ filepath = self.get_body_argument('filepath') if not self.fs.exists(filepath): raise tornado.web.HTTPError(404) Filewatcher.add_directory_to_watch(filepath) self.write({'msg...
[ "def", "post", "(", "self", ",", "*", "args", ")", ":", "filepath", "=", "self", ".", "get_body_argument", "(", "'filepath'", ")", "if", "not", "self", ".", "fs", ".", "exists", "(", "filepath", ")", ":", "raise", "tornado", ".", "web", ".", "HTTPErr...
Start a new filewatcher at the specified path.
[ "Start", "a", "new", "filewatcher", "at", "the", "specified", "path", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L113-L122
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilewatcherDeleteHandler.delete
def delete(self, filepath): """ Stop and delete the specified filewatcher. """ Filewatcher.remove_directory_to_watch(filepath) self.write({'msg':'Watcher deleted for {}'.format(filepath)})
python
def delete(self, filepath): """ Stop and delete the specified filewatcher. """ Filewatcher.remove_directory_to_watch(filepath) self.write({'msg':'Watcher deleted for {}'.format(filepath)})
[ "def", "delete", "(", "self", ",", "filepath", ")", ":", "Filewatcher", ".", "remove_directory_to_watch", "(", "filepath", ")", "self", ".", "write", "(", "{", "'msg'", ":", "'Watcher deleted for {}'", ".", "format", "(", "filepath", ")", "}", ")" ]
Stop and delete the specified filewatcher.
[ "Stop", "and", "delete", "the", "specified", "filewatcher", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L129-L134
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileHandler.get
def get(self, filepath): """ Get file details for the specified file. """ try: res = self.fs.get_file_details(filepath) res = res.to_dict() self.write(res) except OSError: raise tornado.web.HTTPError(404)
python
def get(self, filepath): """ Get file details for the specified file. """ try: res = self.fs.get_file_details(filepath) res = res.to_dict() self.write(res) except OSError: raise tornado.web.HTTPError(404)
[ "def", "get", "(", "self", ",", "filepath", ")", ":", "try", ":", "res", "=", "self", ".", "fs", ".", "get_file_details", "(", "filepath", ")", "res", "=", "res", ".", "to_dict", "(", ")", "self", ".", "write", "(", "res", ")", "except", "OSError",...
Get file details for the specified file.
[ "Get", "file", "details", "for", "the", "specified", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L144-L153
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileHandler.put
def put(self, filepath): """ Change the group or permissions of the specified file. Action must be specified when calling this method. """ action = self.get_body_argument('action') if action['action'] == 'update_group': newgrp = action['group'] tr...
python
def put(self, filepath): """ Change the group or permissions of the specified file. Action must be specified when calling this method. """ action = self.get_body_argument('action') if action['action'] == 'update_group': newgrp = action['group'] tr...
[ "def", "put", "(", "self", ",", "filepath", ")", ":", "action", "=", "self", ".", "get_body_argument", "(", "'action'", ")", "if", "action", "[", "'action'", "]", "==", "'update_group'", ":", "newgrp", "=", "action", "[", "'group'", "]", "try", ":", "s...
Change the group or permissions of the specified file. Action must be specified when calling this method.
[ "Change", "the", "group", "or", "permissions", "of", "the", "specified", "file", ".", "Action", "must", "be", "specified", "when", "calling", "this", "method", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L156-L178
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileHandler.delete
def delete(self, filepath): """ Delete the specified file. """ try: self.fs.delete(filepath) self.write({'msg':'File deleted at {}'.format(filepath)}) except OSError: raise tornado.web.HTTPError(404)
python
def delete(self, filepath): """ Delete the specified file. """ try: self.fs.delete(filepath) self.write({'msg':'File deleted at {}'.format(filepath)}) except OSError: raise tornado.web.HTTPError(404)
[ "def", "delete", "(", "self", ",", "filepath", ")", ":", "try", ":", "self", ".", "fs", ".", "delete", "(", "filepath", ")", "self", ".", "write", "(", "{", "'msg'", ":", "'File deleted at {}'", ".", "format", "(", "filepath", ")", "}", ")", "except"...
Delete the specified file.
[ "Delete", "the", "specified", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L181-L189
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
DirectoryCreateHandler.post
def post(self): """ Create a new directory at the specified path. """ filepath = self.get_body_argument('filepath') try: self.fs.create_directory(filepath) encoded_filepath = tornado.escape.url_escape(filepath,plus=True) resource_uri = self.re...
python
def post(self): """ Create a new directory at the specified path. """ filepath = self.get_body_argument('filepath') try: self.fs.create_directory(filepath) encoded_filepath = tornado.escape.url_escape(filepath,plus=True) resource_uri = self.re...
[ "def", "post", "(", "self", ")", ":", "filepath", "=", "self", ".", "get_body_argument", "(", "'filepath'", ")", "try", ":", "self", ".", "fs", ".", "create_directory", "(", "filepath", ")", "encoded_filepath", "=", "tornado", ".", "escape", ".", "url_esca...
Create a new directory at the specified path.
[ "Create", "a", "new", "directory", "at", "the", "specified", "path", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L255-L267
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileContentsHandler.get
def get(self, filepath): """ Get the contents of the specified file. """ exists = self.fs.exists(filepath) if exists: mime = magic.Magic(mime=True) mime_type = mime.from_file(filepath) if mime_type in self.unsupported_types: sel...
python
def get(self, filepath): """ Get the contents of the specified file. """ exists = self.fs.exists(filepath) if exists: mime = magic.Magic(mime=True) mime_type = mime.from_file(filepath) if mime_type in self.unsupported_types: sel...
[ "def", "get", "(", "self", ",", "filepath", ")", ":", "exists", "=", "self", ".", "fs", ".", "exists", "(", "filepath", ")", "if", "exists", ":", "mime", "=", "magic", ".", "Magic", "(", "mime", "=", "True", ")", "mime_type", "=", "mime", ".", "f...
Get the contents of the specified file.
[ "Get", "the", "contents", "of", "the", "specified", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L277-L292
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileContentsHandler.post
def post(self, filepath): """ Write the given contents to the specified file. This is not an append, all file contents will be replaced by the contents given. """ try: content = self.get_body_argument('content') self.fs.write_file(filepath, content...
python
def post(self, filepath): """ Write the given contents to the specified file. This is not an append, all file contents will be replaced by the contents given. """ try: content = self.get_body_argument('content') self.fs.write_file(filepath, content...
[ "def", "post", "(", "self", ",", "filepath", ")", ":", "try", ":", "content", "=", "self", ".", "get_body_argument", "(", "'content'", ")", "self", ".", "fs", ".", "write_file", "(", "filepath", ",", "content", ")", "self", ".", "write", "(", "{", "'...
Write the given contents to the specified file. This is not an append, all file contents will be replaced by the contents given.
[ "Write", "the", "given", "contents", "to", "the", "specified", "file", ".", "This", "is", "not", "an", "append", "all", "file", "contents", "will", "be", "replaced", "by", "the", "contents", "given", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L295-L306
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileDownloadHandler.get_content
def get_content(self, start=None, end=None): """ Retrieve the content of the requested resource which is located at the given absolute path. This method should either return a byte string or an iterator of byte strings. The latter is preferred for large files as it helps...
python
def get_content(self, start=None, end=None): """ Retrieve the content of the requested resource which is located at the given absolute path. This method should either return a byte string or an iterator of byte strings. The latter is preferred for large files as it helps...
[ "def", "get_content", "(", "self", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "with", "open", "(", "self", ".", "filepath", ",", "\"rb\"", ")", "as", "file", ":", "if", "start", "is", "not", "None", ":", "file", ".", "seek", "(...
Retrieve the content of the requested resource which is located at the given absolute path. This method should either return a byte string or an iterator of byte strings. The latter is preferred for large files as it helps reduce memory fragmentation.
[ "Retrieve", "the", "content", "of", "the", "requested", "resource", "which", "is", "located", "at", "the", "given", "absolute", "path", ".", "This", "method", "should", "either", "return", "a", "byte", "string", "or", "an", "iterator", "of", "byte", "strings...
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L387-L414
train
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileDownloadHandler.set_headers
def set_headers(self): """ Sets the content headers on the response. """ self.set_header("Accept-Ranges", "bytes") content_type = self.get_content_type() if content_type: self.set_header("Content-Type", content_type)
python
def set_headers(self): """ Sets the content headers on the response. """ self.set_header("Accept-Ranges", "bytes") content_type = self.get_content_type() if content_type: self.set_header("Content-Type", content_type)
[ "def", "set_headers", "(", "self", ")", ":", "self", ".", "set_header", "(", "\"Accept-Ranges\"", ",", "\"bytes\"", ")", "content_type", "=", "self", ".", "get_content_type", "(", ")", "if", "content_type", ":", "self", ".", "set_header", "(", "\"Content-Type\...
Sets the content headers on the response.
[ "Sets", "the", "content", "headers", "on", "the", "response", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L416-L424
train
useblocks/groundwork
groundwork/patterns/gw_shared_objects_pattern.py
SharedObjectsListPlugin.__deactivate_shared_objects
def __deactivate_shared_objects(self, plugin, *args, **kwargs): """ Callback, which gets executed, if the signal "plugin_deactivate_post" was send by the plugin. """ shared_objects = self.get() for shared_object in shared_objects.keys(): self.unregister(shared_object)
python
def __deactivate_shared_objects(self, plugin, *args, **kwargs): """ Callback, which gets executed, if the signal "plugin_deactivate_post" was send by the plugin. """ shared_objects = self.get() for shared_object in shared_objects.keys(): self.unregister(shared_object)
[ "def", "__deactivate_shared_objects", "(", "self", ",", "plugin", ",", "*", "args", ",", "**", "kwargs", ")", ":", "shared_objects", "=", "self", ".", "get", "(", ")", "for", "shared_object", "in", "shared_objects", ".", "keys", "(", ")", ":", "self", "....
Callback, which gets executed, if the signal "plugin_deactivate_post" was send by the plugin.
[ "Callback", "which", "gets", "executed", "if", "the", "signal", "plugin_deactivate_post", "was", "send", "by", "the", "plugin", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_shared_objects_pattern.py#L59-L65
train
useblocks/groundwork
groundwork/patterns/gw_shared_objects_pattern.py
SharedObjectsListPlugin.get
def get(self, name=None): """ Returns requested shared objects, which were registered by the current plugin. If access to objects of other plugins are needed, use :func:`access` or perform get on application level:: my_app.shared_objects.get(name="...") :param name: Name o...
python
def get(self, name=None): """ Returns requested shared objects, which were registered by the current plugin. If access to objects of other plugins are needed, use :func:`access` or perform get on application level:: my_app.shared_objects.get(name="...") :param name: Name o...
[ "def", "get", "(", "self", ",", "name", "=", "None", ")", ":", "return", "self", ".", "app", ".", "shared_objects", ".", "get", "(", "name", ",", "self", ".", "plugin", ")" ]
Returns requested shared objects, which were registered by the current plugin. If access to objects of other plugins are needed, use :func:`access` or perform get on application level:: my_app.shared_objects.get(name="...") :param name: Name of a request shared object :type name: ...
[ "Returns", "requested", "shared", "objects", "which", "were", "registered", "by", "the", "current", "plugin", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_shared_objects_pattern.py#L89-L100
train
useblocks/groundwork
groundwork/patterns/gw_shared_objects_pattern.py
SharedObjectsListApplication.get
def get(self, name=None, plugin=None): """ Returns requested shared objects. :param name: Name of a request shared object :type name: str or None :param plugin: Plugin, which has registered the requested shared object :type plugin: GwBasePattern instance or None ...
python
def get(self, name=None, plugin=None): """ Returns requested shared objects. :param name: Name of a request shared object :type name: str or None :param plugin: Plugin, which has registered the requested shared object :type plugin: GwBasePattern instance or None ...
[ "def", "get", "(", "self", ",", "name", "=", "None", ",", "plugin", "=", "None", ")", ":", "if", "plugin", "is", "not", "None", ":", "if", "name", "is", "None", ":", "shared_objects_list", "=", "{", "}", "for", "key", "in", "self", ".", "_shared_ob...
Returns requested shared objects. :param name: Name of a request shared object :type name: str or None :param plugin: Plugin, which has registered the requested shared object :type plugin: GwBasePattern instance or None
[ "Returns", "requested", "shared", "objects", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_shared_objects_pattern.py#L127-L158
train
useblocks/groundwork
groundwork/patterns/gw_shared_objects_pattern.py
SharedObjectsListApplication.unregister
def unregister(self, shared_object): """ Unregisters an existing shared object, so that this shared object is no longer available. This function is mainly used during plugin deactivation. :param shared_object: Name of the shared_object """ if shared_object not in self._...
python
def unregister(self, shared_object): """ Unregisters an existing shared object, so that this shared object is no longer available. This function is mainly used during plugin deactivation. :param shared_object: Name of the shared_object """ if shared_object not in self._...
[ "def", "unregister", "(", "self", ",", "shared_object", ")", ":", "if", "shared_object", "not", "in", "self", ".", "_shared_objects", ".", "keys", "(", ")", ":", "self", ".", "log", ".", "warning", "(", "\"Can not unregister shared object %s\"", "%", "shared_o...
Unregisters an existing shared object, so that this shared object is no longer available. This function is mainly used during plugin deactivation. :param shared_object: Name of the shared_object
[ "Unregisters", "an", "existing", "shared", "object", "so", "that", "this", "shared", "object", "is", "no", "longer", "available", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_shared_objects_pattern.py#L193-L205
train
useblocks/groundwork
groundwork/plugins/gw_signals_info.py
GwSignalsInfo.list_signals
def list_signals(self): """ Prints a list of all registered signals. Including description and plugin name. """ print("Signal list") print("***********\n") for key, signal in self.app.signals.signals.items(): print("%s (%s)\n %s\n" % (signal.name, signal.plug...
python
def list_signals(self): """ Prints a list of all registered signals. Including description and plugin name. """ print("Signal list") print("***********\n") for key, signal in self.app.signals.signals.items(): print("%s (%s)\n %s\n" % (signal.name, signal.plug...
[ "def", "list_signals", "(", "self", ")", ":", "print", "(", "\"Signal list\"", ")", "print", "(", "\"***********\\n\"", ")", "for", "key", ",", "signal", "in", "self", ".", "app", ".", "signals", ".", "signals", ".", "items", "(", ")", ":", "print", "(...
Prints a list of all registered signals. Including description and plugin name.
[ "Prints", "a", "list", "of", "all", "registered", "signals", ".", "Including", "description", "and", "plugin", "name", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/plugins/gw_signals_info.py#L73-L80
train
useblocks/groundwork
groundwork/plugins/gw_signals_info.py
GwSignalsInfo.list_receivers
def list_receivers(self): """ Prints a list of all registered receivers. Including signal, plugin name and description. """ print("Receiver list") print("*************\n") for key, receiver in self.app.signals.receivers.items(): print("%s <-- %s (%s):\n %s\n"...
python
def list_receivers(self): """ Prints a list of all registered receivers. Including signal, plugin name and description. """ print("Receiver list") print("*************\n") for key, receiver in self.app.signals.receivers.items(): print("%s <-- %s (%s):\n %s\n"...
[ "def", "list_receivers", "(", "self", ")", ":", "print", "(", "\"Receiver list\"", ")", "print", "(", "\"*************\\n\"", ")", "for", "key", ",", "receiver", "in", "self", ".", "app", ".", "signals", ".", "receivers", ".", "items", "(", ")", ":", "pr...
Prints a list of all registered receivers. Including signal, plugin name and description.
[ "Prints", "a", "list", "of", "all", "registered", "receivers", ".", "Including", "signal", "plugin", "name", "and", "description", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/plugins/gw_signals_info.py#L82-L92
train
jenisys/parse_type
bin/toxcmd.py
toxcmd_main
def toxcmd_main(args=None): """Command util with subcommands for tox environments.""" usage = "USAGE: %(prog)s [OPTIONS] COMMAND args..." if args is None: args = sys.argv[1:] # -- STEP: Build command-line parser. parser = argparse.ArgumentParser(description=inspect.getdoc(toxcmd_main), ...
python
def toxcmd_main(args=None): """Command util with subcommands for tox environments.""" usage = "USAGE: %(prog)s [OPTIONS] COMMAND args..." if args is None: args = sys.argv[1:] # -- STEP: Build command-line parser. parser = argparse.ArgumentParser(description=inspect.getdoc(toxcmd_main), ...
[ "def", "toxcmd_main", "(", "args", "=", "None", ")", ":", "usage", "=", "\"USAGE: %(prog)s [OPTIONS] COMMAND args...\"", "if", "args", "is", "None", ":", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", "parser", "=", "argparse", ".", "ArgumentParser", ...
Command util with subcommands for tox environments.
[ "Command", "util", "with", "subcommands", "for", "tox", "environments", "." ]
7cad3a67a5ca725cb786da31f656fd473084289f
https://github.com/jenisys/parse_type/blob/7cad3a67a5ca725cb786da31f656fd473084289f/bin/toxcmd.py#L220-L245
train
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/bakery/_discharge.py
discharge
def discharge(ctx, id, caveat, key, checker, locator): ''' Creates a macaroon to discharge a third party caveat. The given parameters specify the caveat and how it should be checked. The condition implicit in the caveat is checked for validity using checker. If it is valid, a new macaroon is returned w...
python
def discharge(ctx, id, caveat, key, checker, locator): ''' Creates a macaroon to discharge a third party caveat. The given parameters specify the caveat and how it should be checked. The condition implicit in the caveat is checked for validity using checker. If it is valid, a new macaroon is returned w...
[ "def", "discharge", "(", "ctx", ",", "id", ",", "caveat", ",", "key", ",", "checker", ",", "locator", ")", ":", "caveat_id_prefix", "=", "[", "]", "if", "caveat", "is", "None", ":", "caveat", "=", "id", "else", ":", "caveat_id_prefix", "=", "id", "ca...
Creates a macaroon to discharge a third party caveat. The given parameters specify the caveat and how it should be checked. The condition implicit in the caveat is checked for validity using checker. If it is valid, a new macaroon is returned which discharges the caveat. The macaroon is created with a ...
[ "Creates", "a", "macaroon", "to", "discharge", "a", "third", "party", "caveat", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/bakery/_discharge.py#L116-L187
train
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/bakery/_discharge.py
local_third_party_caveat
def local_third_party_caveat(key, version): ''' Returns a third-party caveat that, when added to a macaroon with add_caveat, results in a caveat with the location "local", encrypted with the given PublicKey. This can be automatically discharged by discharge_all passing a local key. ''' if versio...
python
def local_third_party_caveat(key, version): ''' Returns a third-party caveat that, when added to a macaroon with add_caveat, results in a caveat with the location "local", encrypted with the given PublicKey. This can be automatically discharged by discharge_all passing a local key. ''' if versio...
[ "def", "local_third_party_caveat", "(", "key", ",", "version", ")", ":", "if", "version", ">=", "VERSION_2", ":", "loc", "=", "'local {} {}'", ".", "format", "(", "version", ",", "key", ")", "else", ":", "loc", "=", "'local {}'", ".", "format", "(", "key...
Returns a third-party caveat that, when added to a macaroon with add_caveat, results in a caveat with the location "local", encrypted with the given PublicKey. This can be automatically discharged by discharge_all passing a local key.
[ "Returns", "a", "third", "-", "party", "caveat", "that", "when", "added", "to", "a", "macaroon", "with", "add_caveat", "results", "in", "a", "caveat", "with", "the", "location", "local", "encrypted", "with", "the", "given", "PublicKey", ".", "This", "can", ...
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/bakery/_discharge.py#L234-L244
train
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/checkers/_namespace.py
deserialize_namespace
def deserialize_namespace(data): ''' Deserialize a Namespace object. :param data: bytes or str :return: namespace ''' if isinstance(data, bytes): data = data.decode('utf-8') kvs = data.split() uri_to_prefix = {} for kv in kvs: i = kv.rfind(':') if i == -1: ...
python
def deserialize_namespace(data): ''' Deserialize a Namespace object. :param data: bytes or str :return: namespace ''' if isinstance(data, bytes): data = data.decode('utf-8') kvs = data.split() uri_to_prefix = {} for kv in kvs: i = kv.rfind(':') if i == -1: ...
[ "def", "deserialize_namespace", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "bytes", ")", ":", "data", "=", "data", ".", "decode", "(", "'utf-8'", ")", "kvs", "=", "data", ".", "split", "(", ")", "uri_to_prefix", "=", "{", "}", "for"...
Deserialize a Namespace object. :param data: bytes or str :return: namespace
[ "Deserialize", "a", "Namespace", "object", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/checkers/_namespace.py#L134-L165
train
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/checkers/_namespace.py
Namespace.serialize_text
def serialize_text(self): '''Returns a serialized form of the Namepace. All the elements in the namespace are sorted by URI, joined to the associated prefix with a colon and separated with spaces. :return: bytes ''' if self._uri_to_prefix is None or len(self._uri...
python
def serialize_text(self): '''Returns a serialized form of the Namepace. All the elements in the namespace are sorted by URI, joined to the associated prefix with a colon and separated with spaces. :return: bytes ''' if self._uri_to_prefix is None or len(self._uri...
[ "def", "serialize_text", "(", "self", ")", ":", "if", "self", ".", "_uri_to_prefix", "is", "None", "or", "len", "(", "self", ".", "_uri_to_prefix", ")", "==", "0", ":", "return", "b''", "od", "=", "collections", ".", "OrderedDict", "(", "sorted", "(", ...
Returns a serialized form of the Namepace. All the elements in the namespace are sorted by URI, joined to the associated prefix with a colon and separated with spaces. :return: bytes
[ "Returns", "a", "serialized", "form", "of", "the", "Namepace", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/checkers/_namespace.py#L33-L47
train
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/checkers/_namespace.py
Namespace.register
def register(self, uri, prefix): '''Registers the given URI and associates it with the given prefix. If the URI has already been registered, this is a no-op. :param uri: string :param prefix: string ''' if not is_valid_schema_uri(uri): raise KeyError( ...
python
def register(self, uri, prefix): '''Registers the given URI and associates it with the given prefix. If the URI has already been registered, this is a no-op. :param uri: string :param prefix: string ''' if not is_valid_schema_uri(uri): raise KeyError( ...
[ "def", "register", "(", "self", ",", "uri", ",", "prefix", ")", ":", "if", "not", "is_valid_schema_uri", "(", "uri", ")", ":", "raise", "KeyError", "(", "'cannot register invalid URI {} (prefix {})'", ".", "format", "(", "uri", ",", "prefix", ")", ")", "if",...
Registers the given URI and associates it with the given prefix. If the URI has already been registered, this is a no-op. :param uri: string :param prefix: string
[ "Registers", "the", "given", "URI", "and", "associates", "it", "with", "the", "given", "prefix", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/checkers/_namespace.py#L49-L66
train
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/checkers/_auth_context.py
AuthContext.with_value
def with_value(self, key, val): ''' Return a copy of the AuthContext object with the given key and value added. ''' new_dict = dict(self._dict) new_dict[key] = val return AuthContext(new_dict)
python
def with_value(self, key, val): ''' Return a copy of the AuthContext object with the given key and value added. ''' new_dict = dict(self._dict) new_dict[key] = val return AuthContext(new_dict)
[ "def", "with_value", "(", "self", ",", "key", ",", "val", ")", ":", "new_dict", "=", "dict", "(", "self", ".", "_dict", ")", "new_dict", "[", "key", "]", "=", "val", "return", "AuthContext", "(", "new_dict", ")" ]
Return a copy of the AuthContext object with the given key and value added.
[ "Return", "a", "copy", "of", "the", "AuthContext", "object", "with", "the", "given", "key", "and", "value", "added", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/checkers/_auth_context.py#L19-L25
train
jenisys/parse_type
parse_type/cardinality.py
Cardinality.make_pattern
def make_pattern(self, pattern, listsep=','): """Make pattern for a data type with the specified cardinality. .. code-block:: python yes_no_pattern = r"yes|no" many_yes_no = Cardinality.one_or_more.make_pattern(yes_no_pattern) :param pattern: Regular expression for ty...
python
def make_pattern(self, pattern, listsep=','): """Make pattern for a data type with the specified cardinality. .. code-block:: python yes_no_pattern = r"yes|no" many_yes_no = Cardinality.one_or_more.make_pattern(yes_no_pattern) :param pattern: Regular expression for ty...
[ "def", "make_pattern", "(", "self", ",", "pattern", ",", "listsep", "=", "','", ")", ":", "if", "self", "is", "Cardinality", ".", "one", ":", "return", "pattern", "elif", "self", "is", "Cardinality", ".", "zero_or_one", ":", "return", "self", ".", "schem...
Make pattern for a data type with the specified cardinality. .. code-block:: python yes_no_pattern = r"yes|no" many_yes_no = Cardinality.one_or_more.make_pattern(yes_no_pattern) :param pattern: Regular expression for type (as string). :param listsep: List separator f...
[ "Make", "pattern", "for", "a", "data", "type", "with", "the", "specified", "cardinality", "." ]
7cad3a67a5ca725cb786da31f656fd473084289f
https://github.com/jenisys/parse_type/blob/7cad3a67a5ca725cb786da31f656fd473084289f/parse_type/cardinality.py#L48-L65
train
jenisys/parse_type
parse_type/cardinality.py
TypeBuilder.with_cardinality
def with_cardinality(cls, cardinality, converter, pattern=None, listsep=','): """Creates a type converter for the specified cardinality by using the type converter for T. :param cardinality: Cardinality to use (0..1, 0..*, 1..*). :param converter: Type converter...
python
def with_cardinality(cls, cardinality, converter, pattern=None, listsep=','): """Creates a type converter for the specified cardinality by using the type converter for T. :param cardinality: Cardinality to use (0..1, 0..*, 1..*). :param converter: Type converter...
[ "def", "with_cardinality", "(", "cls", ",", "cardinality", ",", "converter", ",", "pattern", "=", "None", ",", "listsep", "=", "','", ")", ":", "if", "cardinality", "is", "Cardinality", ".", "one", ":", "return", "converter", "builder_func", "=", "getattr", ...
Creates a type converter for the specified cardinality by using the type converter for T. :param cardinality: Cardinality to use (0..1, 0..*, 1..*). :param converter: Type converter (function) for data type T. :param pattern: Regexp pattern for an item (=converter.pattern). :re...
[ "Creates", "a", "type", "converter", "for", "the", "specified", "cardinality", "by", "using", "the", "type", "converter", "for", "T", "." ]
7cad3a67a5ca725cb786da31f656fd473084289f
https://github.com/jenisys/parse_type/blob/7cad3a67a5ca725cb786da31f656fd473084289f/parse_type/cardinality.py#L95-L113
train
jenisys/parse_type
parse_type/cardinality.py
TypeBuilder.with_zero_or_one
def with_zero_or_one(cls, converter, pattern=None): """Creates a type converter for a T with 0..1 times by using the type converter for one item of T. :param converter: Type converter (function) for data type T. :param pattern: Regexp pattern for an item (=converter.pattern). :...
python
def with_zero_or_one(cls, converter, pattern=None): """Creates a type converter for a T with 0..1 times by using the type converter for one item of T. :param converter: Type converter (function) for data type T. :param pattern: Regexp pattern for an item (=converter.pattern). :...
[ "def", "with_zero_or_one", "(", "cls", ",", "converter", ",", "pattern", "=", "None", ")", ":", "cardinality", "=", "Cardinality", ".", "zero_or_one", "if", "not", "pattern", ":", "pattern", "=", "getattr", "(", "converter", ",", "\"pattern\"", ",", "cls", ...
Creates a type converter for a T with 0..1 times by using the type converter for one item of T. :param converter: Type converter (function) for data type T. :param pattern: Regexp pattern for an item (=converter.pattern). :return: type-converter for optional<T> (T or None).
[ "Creates", "a", "type", "converter", "for", "a", "T", "with", "0", "..", "1", "times", "by", "using", "the", "type", "converter", "for", "one", "item", "of", "T", "." ]
7cad3a67a5ca725cb786da31f656fd473084289f
https://github.com/jenisys/parse_type/blob/7cad3a67a5ca725cb786da31f656fd473084289f/parse_type/cardinality.py#L116-L139
train
suurjaak/InputScope
inputscope/webui.py
server_static
def server_static(filepath): """Handler for serving static files.""" mimetype = "image/svg+xml" if filepath.endswith(".svg") else "auto" return bottle.static_file(filepath, root=conf.StaticPath, mimetype=mimetype)
python
def server_static(filepath): """Handler for serving static files.""" mimetype = "image/svg+xml" if filepath.endswith(".svg") else "auto" return bottle.static_file(filepath, root=conf.StaticPath, mimetype=mimetype)
[ "def", "server_static", "(", "filepath", ")", ":", "mimetype", "=", "\"image/svg+xml\"", "if", "filepath", ".", "endswith", "(", "\".svg\"", ")", "else", "\"auto\"", "return", "bottle", ".", "static_file", "(", "filepath", ",", "root", "=", "conf", ".", "Sta...
Handler for serving static files.
[ "Handler", "for", "serving", "static", "files", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/webui.py#L32-L35
train
suurjaak/InputScope
inputscope/webui.py
mouse
def mouse(table, day=None): """Handler for showing mouse statistics for specified type and day.""" where = (("day", day),) if day else () events = db.fetch(table, where=where, order="day") for e in events: e["dt"] = datetime.datetime.fromtimestamp(e["stamp"]) stats, positions, events = stats_mo...
python
def mouse(table, day=None): """Handler for showing mouse statistics for specified type and day.""" where = (("day", day),) if day else () events = db.fetch(table, where=where, order="day") for e in events: e["dt"] = datetime.datetime.fromtimestamp(e["stamp"]) stats, positions, events = stats_mo...
[ "def", "mouse", "(", "table", ",", "day", "=", "None", ")", ":", "where", "=", "(", "(", "\"day\"", ",", "day", ")", ",", ")", "if", "day", "else", "(", ")", "events", "=", "db", ".", "fetch", "(", "table", ",", "where", "=", "where", ",", "o...
Handler for showing mouse statistics for specified type and day.
[ "Handler", "for", "showing", "mouse", "statistics", "for", "specified", "type", "and", "day", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/webui.py#L40-L47
train
suurjaak/InputScope
inputscope/webui.py
keyboard
def keyboard(table, day=None): """Handler for showing the keyboard statistics page.""" cols, group = "realkey AS key, COUNT(*) AS count", "realkey" where = (("day", day),) if day else () counts_display = counts = db.fetch(table, cols, where, group, "count DESC") if "combos" == table: c...
python
def keyboard(table, day=None): """Handler for showing the keyboard statistics page.""" cols, group = "realkey AS key, COUNT(*) AS count", "realkey" where = (("day", day),) if day else () counts_display = counts = db.fetch(table, cols, where, group, "count DESC") if "combos" == table: c...
[ "def", "keyboard", "(", "table", ",", "day", "=", "None", ")", ":", "cols", ",", "group", "=", "\"realkey AS key, COUNT(*) AS count\"", ",", "\"realkey\"", "where", "=", "(", "(", "\"day\"", ",", "day", ")", ",", ")", "if", "day", "else", "(", ")", "co...
Handler for showing the keyboard statistics page.
[ "Handler", "for", "showing", "the", "keyboard", "statistics", "page", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/webui.py#L52-L64
train
suurjaak/InputScope
inputscope/webui.py
inputindex
def inputindex(input): """Handler for showing keyboard or mouse page with day and total links.""" stats = {} countminmax = "SUM(count) AS count, MIN(day) AS first, MAX(day) AS last" tables = ("moves", "clicks", "scrolls") if "mouse" == input else ("keys", "combos") for table in tables: ...
python
def inputindex(input): """Handler for showing keyboard or mouse page with day and total links.""" stats = {} countminmax = "SUM(count) AS count, MIN(day) AS first, MAX(day) AS last" tables = ("moves", "clicks", "scrolls") if "mouse" == input else ("keys", "combos") for table in tables: ...
[ "def", "inputindex", "(", "input", ")", ":", "stats", "=", "{", "}", "countminmax", "=", "\"SUM(count) AS count, MIN(day) AS first, MAX(day) AS last\"", "tables", "=", "(", "\"moves\"", ",", "\"clicks\"", ",", "\"scrolls\"", ")", "if", "\"mouse\"", "==", "input", ...
Handler for showing keyboard or mouse page with day and total links.
[ "Handler", "for", "showing", "keyboard", "or", "mouse", "page", "with", "day", "and", "total", "links", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/webui.py#L68-L76
train
suurjaak/InputScope
inputscope/webui.py
index
def index(): """Handler for showing the GUI index page.""" stats = dict((k, {"count": 0}) for k, tt in conf.InputTables) countminmax = "SUM(count) AS count, MIN(day) AS first, MAX(day) AS last" for input, table in [(x, t) for x, tt in conf.InputTables for t in tt]: row = db.fetchone("counts...
python
def index(): """Handler for showing the GUI index page.""" stats = dict((k, {"count": 0}) for k, tt in conf.InputTables) countminmax = "SUM(count) AS count, MIN(day) AS first, MAX(day) AS last" for input, table in [(x, t) for x, tt in conf.InputTables for t in tt]: row = db.fetchone("counts...
[ "def", "index", "(", ")", ":", "stats", "=", "dict", "(", "(", "k", ",", "{", "\"count\"", ":", "0", "}", ")", "for", "k", ",", "tt", "in", "conf", ".", "InputTables", ")", "countminmax", "=", "\"SUM(count) AS count, MIN(day) AS first, MAX(day) AS last\"", ...
Handler for showing the GUI index page.
[ "Handler", "for", "showing", "the", "GUI", "index", "page", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/webui.py#L80-L91
train
suurjaak/InputScope
inputscope/webui.py
stats_keyboard
def stats_keyboard(events, table): """Return statistics and collated events for keyboard events.""" if len(events) < 2: return [], [] deltas, prev_dt = [], None sessions, session = [], None UNBROKEN_DELTA = datetime.timedelta(seconds=conf.KeyboardSessionMaxDelta) blank = collections.defaul...
python
def stats_keyboard(events, table): """Return statistics and collated events for keyboard events.""" if len(events) < 2: return [], [] deltas, prev_dt = [], None sessions, session = [], None UNBROKEN_DELTA = datetime.timedelta(seconds=conf.KeyboardSessionMaxDelta) blank = collections.defaul...
[ "def", "stats_keyboard", "(", "events", ",", "table", ")", ":", "if", "len", "(", "events", ")", "<", "2", ":", "return", "[", "]", ",", "[", "]", "deltas", ",", "prev_dt", "=", "[", "]", ",", "None", "sessions", ",", "session", "=", "[", "]", ...
Return statistics and collated events for keyboard events.
[ "Return", "statistics", "and", "collated", "events", "for", "keyboard", "events", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/webui.py#L94-L141
train
suurjaak/InputScope
inputscope/webui.py
timedelta_seconds
def timedelta_seconds(timedelta): """Returns the total timedelta duration in seconds.""" return (timedelta.total_seconds() if hasattr(timedelta, "total_seconds") else timedelta.days * 24 * 3600 + timedelta.seconds + timedelta.microseconds / 1000000.)
python
def timedelta_seconds(timedelta): """Returns the total timedelta duration in seconds.""" return (timedelta.total_seconds() if hasattr(timedelta, "total_seconds") else timedelta.days * 24 * 3600 + timedelta.seconds + timedelta.microseconds / 1000000.)
[ "def", "timedelta_seconds", "(", "timedelta", ")", ":", "return", "(", "timedelta", ".", "total_seconds", "(", ")", "if", "hasattr", "(", "timedelta", ",", "\"total_seconds\"", ")", "else", "timedelta", ".", "days", "*", "24", "*", "3600", "+", "timedelta", ...
Returns the total timedelta duration in seconds.
[ "Returns", "the", "total", "timedelta", "duration", "in", "seconds", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/webui.py#L203-L207
train
suurjaak/InputScope
inputscope/webui.py
init
def init(): """Initialize configuration and web application.""" global app if app: return app conf.init(), db.init(conf.DbPath, conf.DbStatements) bottle.TEMPLATE_PATH.insert(0, conf.TemplatePath) app = bottle.default_app() bottle.BaseTemplate.defaults.update(get_url=app.get_url) ...
python
def init(): """Initialize configuration and web application.""" global app if app: return app conf.init(), db.init(conf.DbPath, conf.DbStatements) bottle.TEMPLATE_PATH.insert(0, conf.TemplatePath) app = bottle.default_app() bottle.BaseTemplate.defaults.update(get_url=app.get_url) ...
[ "def", "init", "(", ")", ":", "global", "app", "if", "app", ":", "return", "app", "conf", ".", "init", "(", ")", ",", "db", ".", "init", "(", "conf", ".", "DbPath", ",", "conf", ".", "DbStatements", ")", "bottle", ".", "TEMPLATE_PATH", ".", "insert...
Initialize configuration and web application.
[ "Initialize", "configuration", "and", "web", "application", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/webui.py#L210-L219
train
suurjaak/InputScope
inputscope/webui.py
start
def start(): """Starts the web server.""" global app bottle.run(app, host=conf.WebHost, port=conf.WebPort, debug=conf.WebAutoReload, reloader=conf.WebAutoReload, quiet=conf.WebQuiet)
python
def start(): """Starts the web server.""" global app bottle.run(app, host=conf.WebHost, port=conf.WebPort, debug=conf.WebAutoReload, reloader=conf.WebAutoReload, quiet=conf.WebQuiet)
[ "def", "start", "(", ")", ":", "global", "app", "bottle", ".", "run", "(", "app", ",", "host", "=", "conf", ".", "WebHost", ",", "port", "=", "conf", ".", "WebPort", ",", "debug", "=", "conf", ".", "WebAutoReload", ",", "reloader", "=", "conf", "."...
Starts the web server.
[ "Starts", "the", "web", "server", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/webui.py#L222-L227
train
Phyks/libbmc
libbmc/fetcher.py
download
def download(url, proxies=None): """ Download a PDF or DJVU document from a url, eventually using proxies. :params url: The URL to the PDF/DJVU document to fetch. :params proxies: An optional list of proxies to use. Proxies will be \ used sequentially. Proxies should be a list of proxy stri...
python
def download(url, proxies=None): """ Download a PDF or DJVU document from a url, eventually using proxies. :params url: The URL to the PDF/DJVU document to fetch. :params proxies: An optional list of proxies to use. Proxies will be \ used sequentially. Proxies should be a list of proxy stri...
[ "def", "download", "(", "url", ",", "proxies", "=", "None", ")", ":", "if", "proxies", "is", "None", ":", "proxies", "=", "[", "\"\"", "]", "for", "proxy", "in", "proxies", ":", "if", "proxy", "==", "\"\"", ":", "socket", ".", "socket", "=", "DEFAU...
Download a PDF or DJVU document from a url, eventually using proxies. :params url: The URL to the PDF/DJVU document to fetch. :params proxies: An optional list of proxies to use. Proxies will be \ used sequentially. Proxies should be a list of proxy strings. \ Do not forget to include `...
[ "Download", "a", "PDF", "or", "DJVU", "document", "from", "a", "url", "eventually", "using", "proxies", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/fetcher.py#L80-L132
train
jenisys/parse_type
parse_type/parse_util.py
Field.make_format
def make_format(format_spec): """Build format string from a format specification. :param format_spec: Format specification (as FormatSpec object). :return: Composed format (as string). """ fill = '' align = '' zero = '' width = format_spec.width ...
python
def make_format(format_spec): """Build format string from a format specification. :param format_spec: Format specification (as FormatSpec object). :return: Composed format (as string). """ fill = '' align = '' zero = '' width = format_spec.width ...
[ "def", "make_format", "(", "format_spec", ")", ":", "fill", "=", "''", "align", "=", "''", "zero", "=", "''", "width", "=", "format_spec", ".", "width", "if", "format_spec", ".", "align", ":", "align", "=", "format_spec", ".", "align", "[", "0", "]", ...
Build format string from a format specification. :param format_spec: Format specification (as FormatSpec object). :return: Composed format (as string).
[ "Build", "format", "string", "from", "a", "format", "specification", "." ]
7cad3a67a5ca725cb786da31f656fd473084289f
https://github.com/jenisys/parse_type/blob/7cad3a67a5ca725cb786da31f656fd473084289f/parse_type/parse_util.py#L78-L101
train
jenisys/parse_type
parse_type/parse_util.py
FieldParser.extract_fields
def extract_fields(cls, schema): """Extract fields in a parse expression schema. :param schema: Parse expression schema/format to use (as string). :return: Generator for fields in schema (as Field objects). """ # -- BASED-ON: parse.Parser._generate_expression() for part ...
python
def extract_fields(cls, schema): """Extract fields in a parse expression schema. :param schema: Parse expression schema/format to use (as string). :return: Generator for fields in schema (as Field objects). """ # -- BASED-ON: parse.Parser._generate_expression() for part ...
[ "def", "extract_fields", "(", "cls", ",", "schema", ")", ":", "for", "part", "in", "parse", ".", "PARSE_RE", ".", "split", "(", "schema", ")", ":", "if", "not", "part", "or", "part", "==", "'{{'", "or", "part", "==", "'}}'", ":", "continue", "elif", ...
Extract fields in a parse expression schema. :param schema: Parse expression schema/format to use (as string). :return: Generator for fields in schema (as Field objects).
[ "Extract", "fields", "in", "a", "parse", "expression", "schema", "." ]
7cad3a67a5ca725cb786da31f656fd473084289f
https://github.com/jenisys/parse_type/blob/7cad3a67a5ca725cb786da31f656fd473084289f/parse_type/parse_util.py#L175-L187
train
dbarsam/python-vsgen
vsgen/util/logger.py
VSGLogger._registerHandler
def _registerHandler(self, handler): """ Registers a handler. :param handler: A handler object. """ self._logger.addHandler(handler) self._handlers.append(handler)
python
def _registerHandler(self, handler): """ Registers a handler. :param handler: A handler object. """ self._logger.addHandler(handler) self._handlers.append(handler)
[ "def", "_registerHandler", "(", "self", ",", "handler", ")", ":", "self", ".", "_logger", ".", "addHandler", "(", "handler", ")", "self", ".", "_handlers", ".", "append", "(", "handler", ")" ]
Registers a handler. :param handler: A handler object.
[ "Registers", "a", "handler", "." ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/logger.py#L80-L87
train
dbarsam/python-vsgen
vsgen/util/logger.py
VSGLogger._unregisterHandler
def _unregisterHandler(self, handler, shutdown=True): """ Unregisters the logging handler. :param handler: A handler previously registered with this loggger. :param shutdown: Flag to shutdown the handler. """ if handler in self._handlers: self._handlers.remo...
python
def _unregisterHandler(self, handler, shutdown=True): """ Unregisters the logging handler. :param handler: A handler previously registered with this loggger. :param shutdown: Flag to shutdown the handler. """ if handler in self._handlers: self._handlers.remo...
[ "def", "_unregisterHandler", "(", "self", ",", "handler", ",", "shutdown", "=", "True", ")", ":", "if", "handler", "in", "self", ".", "_handlers", ":", "self", ".", "_handlers", ".", "remove", "(", "handler", ")", "self", ".", "_logger", ".", "removeHand...
Unregisters the logging handler. :param handler: A handler previously registered with this loggger. :param shutdown: Flag to shutdown the handler.
[ "Unregisters", "the", "logging", "handler", "." ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/logger.py#L89-L106
train
dbarsam/python-vsgen
vsgen/util/logger.py
VSGLogger.getLogger
def getLogger(cls, name=None): """ Retrieves the Python native logger :param name: The name of the logger instance in the VSG namespace (VSG.<name>); a None value will use the VSG root. :return: The instacne of the Python logger object. """ return logging.getLo...
python
def getLogger(cls, name=None): """ Retrieves the Python native logger :param name: The name of the logger instance in the VSG namespace (VSG.<name>); a None value will use the VSG root. :return: The instacne of the Python logger object. """ return logging.getLo...
[ "def", "getLogger", "(", "cls", ",", "name", "=", "None", ")", ":", "return", "logging", ".", "getLogger", "(", "\"{0}.{1}\"", ".", "format", "(", "cls", ".", "BASENAME", ",", "name", ")", "if", "name", "else", "cls", ".", "BASENAME", ")" ]
Retrieves the Python native logger :param name: The name of the logger instance in the VSG namespace (VSG.<name>); a None value will use the VSG root. :return: The instacne of the Python logger object.
[ "Retrieves", "the", "Python", "native", "logger" ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/logger.py#L109-L116
train
dbarsam/python-vsgen
vsgen/util/logger.py
VSGLogger.debug
def debug(cls, name, message, *args): """ Convenience function to log a message at the DEBUG level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into m...
python
def debug(cls, name, message, *args): """ Convenience function to log a message at the DEBUG level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into m...
[ "def", "debug", "(", "cls", ",", "name", ",", "message", ",", "*", "args", ")", ":", "cls", ".", "getLogger", "(", "name", ")", ".", "debug", "(", "message", ",", "*", "args", ")" ]
Convenience function to log a message at the DEBUG level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into msg using the string formatting operator. :..note: ...
[ "Convenience", "function", "to", "log", "a", "message", "at", "the", "DEBUG", "level", "." ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/logger.py#L119-L128
train
dbarsam/python-vsgen
vsgen/util/logger.py
VSGLogger.info
def info(cls, name, message, *args): """ Convenience function to log a message at the INFO level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into msg...
python
def info(cls, name, message, *args): """ Convenience function to log a message at the INFO level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into msg...
[ "def", "info", "(", "cls", ",", "name", ",", "message", ",", "*", "args", ")", ":", "cls", ".", "getLogger", "(", "name", ")", ".", "info", "(", "message", ",", "*", "args", ")" ]
Convenience function to log a message at the INFO level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into msg using the string formatting operator. :..note: ...
[ "Convenience", "function", "to", "log", "a", "message", "at", "the", "INFO", "level", "." ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/logger.py#L131-L140
train
dbarsam/python-vsgen
vsgen/util/logger.py
VSGLogger.warning
def warning(cls, name, message, *args): """ Convenience function to log a message at the WARNING level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged in...
python
def warning(cls, name, message, *args): """ Convenience function to log a message at the WARNING level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged in...
[ "def", "warning", "(", "cls", ",", "name", ",", "message", ",", "*", "args", ")", ":", "cls", ".", "getLogger", "(", "name", ")", ".", "warning", "(", "message", ",", "*", "args", ")" ]
Convenience function to log a message at the WARNING level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into msg using the string formatting operator. :..note...
[ "Convenience", "function", "to", "log", "a", "message", "at", "the", "WARNING", "level", "." ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/logger.py#L143-L152
train
dbarsam/python-vsgen
vsgen/util/logger.py
VSGLogger.error
def error(cls, name, message, *args): """ Convenience function to log a message at the ERROR level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into m...
python
def error(cls, name, message, *args): """ Convenience function to log a message at the ERROR level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into m...
[ "def", "error", "(", "cls", ",", "name", ",", "message", ",", "*", "args", ")", ":", "cls", ".", "getLogger", "(", "name", ")", ".", "error", "(", "message", ",", "*", "args", ")" ]
Convenience function to log a message at the ERROR level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into msg using the string formatting operator. :..note: ...
[ "Convenience", "function", "to", "log", "a", "message", "at", "the", "ERROR", "level", "." ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/logger.py#L155-L164
train
dbarsam/python-vsgen
vsgen/util/logger.py
VSGLogger.critical
def critical(cls, name, message, *args): """ Convenience function to log a message at the CRITICAL level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged ...
python
def critical(cls, name, message, *args): """ Convenience function to log a message at the CRITICAL level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged ...
[ "def", "critical", "(", "cls", ",", "name", ",", "message", ",", "*", "args", ")", ":", "cls", ".", "getLogger", "(", "name", ")", ".", "critical", "(", "message", ",", "*", "args", ")" ]
Convenience function to log a message at the CRITICAL level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into msg using the string formatting operator. :..not...
[ "Convenience", "function", "to", "log", "a", "message", "at", "the", "CRITICAL", "level", "." ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/logger.py#L167-L176
train
dbarsam/python-vsgen
vsgen/util/logger.py
VSGLogger.exception
def exception(cls, name, message, *args): """ Convenience function to log a message at the ERROR level with additonal exception information. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: ...
python
def exception(cls, name, message, *args): """ Convenience function to log a message at the ERROR level with additonal exception information. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: ...
[ "def", "exception", "(", "cls", ",", "name", ",", "message", ",", "*", "args", ")", ":", "cls", ".", "getLogger", "(", "name", ")", ".", "exception", "(", "message", ",", "*", "args", ")" ]
Convenience function to log a message at the ERROR level with additonal exception information. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into msg using the string f...
[ "Convenience", "function", "to", "log", "a", "message", "at", "the", "ERROR", "level", "with", "additonal", "exception", "information", "." ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/logger.py#L179-L188
train
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/bakery/_checker.py
AuthChecker.allow
def allow(self, ctx, ops): ''' Checks that the authorizer's request is authorized to perform all the given operations. Note that allow does not check first party caveats - if there is more than one macaroon that may authorize the request, it will choose the first one that does re...
python
def allow(self, ctx, ops): ''' Checks that the authorizer's request is authorized to perform all the given operations. Note that allow does not check first party caveats - if there is more than one macaroon that may authorize the request, it will choose the first one that does re...
[ "def", "allow", "(", "self", ",", "ctx", ",", "ops", ")", ":", "auth_info", ",", "_", "=", "self", ".", "allow_any", "(", "ctx", ",", "ops", ")", "return", "auth_info" ]
Checks that the authorizer's request is authorized to perform all the given operations. Note that allow does not check first party caveats - if there is more than one macaroon that may authorize the request, it will choose the first one that does regardless. If all the operation...
[ "Checks", "that", "the", "authorizer", "s", "request", "is", "authorized", "to", "perform", "all", "the", "given", "operations", ".", "Note", "that", "allow", "does", "not", "check", "first", "party", "caveats", "-", "if", "there", "is", "more", "than", "o...
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/bakery/_checker.py#L183-L212
train
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/bakery/_checker.py
AuthChecker.allow_any
def allow_any(self, ctx, ops): ''' like allow except that it will authorize as many of the operations as possible without requiring any to be authorized. If all the operations succeeded, the array will be nil. If any the operations failed, the returned error will be the same tha...
python
def allow_any(self, ctx, ops): ''' like allow except that it will authorize as many of the operations as possible without requiring any to be authorized. If all the operations succeeded, the array will be nil. If any the operations failed, the returned error will be the same tha...
[ "def", "allow_any", "(", "self", ",", "ctx", ",", "ops", ")", ":", "authed", ",", "used", "=", "self", ".", "_allow_any", "(", "ctx", ",", "ops", ")", "return", "self", ".", "_new_auth_info", "(", "used", ")", ",", "authed" ]
like allow except that it will authorize as many of the operations as possible without requiring any to be authorized. If all the operations succeeded, the array will be nil. If any the operations failed, the returned error will be the same that allow would return and each element in th...
[ "like", "allow", "except", "that", "it", "will", "authorize", "as", "many", "of", "the", "operations", "as", "possible", "without", "requiring", "any", "to", "be", "authorized", ".", "If", "all", "the", "operations", "succeeded", "the", "array", "will", "be"...
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/bakery/_checker.py#L214-L234
train
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/bakery/_checker.py
AuthChecker.allow_capability
def allow_capability(self, ctx, ops): '''Checks that the user is allowed to perform all the given operations. If not, a discharge error will be raised. If allow_capability succeeds, it returns a list of first party caveat conditions that must be applied to any macaroon granting capabilit...
python
def allow_capability(self, ctx, ops): '''Checks that the user is allowed to perform all the given operations. If not, a discharge error will be raised. If allow_capability succeeds, it returns a list of first party caveat conditions that must be applied to any macaroon granting capabilit...
[ "def", "allow_capability", "(", "self", ",", "ctx", ",", "ops", ")", ":", "nops", "=", "0", "for", "op", "in", "ops", ":", "if", "op", "!=", "LOGIN_OP", ":", "nops", "+=", "1", "if", "nops", "==", "0", ":", "raise", "ValueError", "(", "'no non-logi...
Checks that the user is allowed to perform all the given operations. If not, a discharge error will be raised. If allow_capability succeeds, it returns a list of first party caveat conditions that must be applied to any macaroon granting capability to execute the operations. Those caveat...
[ "Checks", "that", "the", "user", "is", "allowed", "to", "perform", "all", "the", "given", "operations", ".", "If", "not", "a", "discharge", "error", "will", "be", "raised", ".", "If", "allow_capability", "succeeds", "it", "returns", "a", "list", "of", "fir...
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/bakery/_checker.py#L317-L345
train
useblocks/groundwork
groundwork/patterns/gw_recipes_pattern.py
RecipesListPlugin.register
def register(self, name, path, description, final_words=None): """ Registers a new recipe in the context of the current plugin. :param name: Name of the recipe :param path: Absolute path of the recipe folder :param description: A meaningful description of the recipe :par...
python
def register(self, name, path, description, final_words=None): """ Registers a new recipe in the context of the current plugin. :param name: Name of the recipe :param path: Absolute path of the recipe folder :param description: A meaningful description of the recipe :par...
[ "def", "register", "(", "self", ",", "name", ",", "path", ",", "description", ",", "final_words", "=", "None", ")", ":", "return", "self", ".", "__app", ".", "recipes", ".", "register", "(", "name", ",", "path", ",", "self", ".", "_plugin", ",", "des...
Registers a new recipe in the context of the current plugin. :param name: Name of the recipe :param path: Absolute path of the recipe folder :param description: A meaningful description of the recipe :param final_words: A string, which gets printed after the recipe was build.
[ "Registers", "a", "new", "recipe", "in", "the", "context", "of", "the", "current", "plugin", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_recipes_pattern.py#L63-L72
train
useblocks/groundwork
groundwork/patterns/gw_recipes_pattern.py
RecipesListPlugin.get
def get(self, name=None): """ Gets a list of all recipes, which are registered by the current plugin. If a name is provided, only the requested recipe is returned or None. :param: name: Name of the recipe """ return self.__app.recipes.get(name, self._plugin)
python
def get(self, name=None): """ Gets a list of all recipes, which are registered by the current plugin. If a name is provided, only the requested recipe is returned or None. :param: name: Name of the recipe """ return self.__app.recipes.get(name, self._plugin)
[ "def", "get", "(", "self", ",", "name", "=", "None", ")", ":", "return", "self", ".", "__app", ".", "recipes", ".", "get", "(", "name", ",", "self", ".", "_plugin", ")" ]
Gets a list of all recipes, which are registered by the current plugin. If a name is provided, only the requested recipe is returned or None. :param: name: Name of the recipe
[ "Gets", "a", "list", "of", "all", "recipes", "which", "are", "registered", "by", "the", "current", "plugin", ".", "If", "a", "name", "is", "provided", "only", "the", "requested", "recipe", "is", "returned", "or", "None", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_recipes_pattern.py#L82-L89
train
useblocks/groundwork
groundwork/patterns/gw_recipes_pattern.py
RecipesListPlugin.build
def build(self, recipe): """ Builds a recipe :param recipe: Name of the recipe to build. """ return self.__app.recipes.build(recipe, self._plugin)
python
def build(self, recipe): """ Builds a recipe :param recipe: Name of the recipe to build. """ return self.__app.recipes.build(recipe, self._plugin)
[ "def", "build", "(", "self", ",", "recipe", ")", ":", "return", "self", ".", "__app", ".", "recipes", ".", "build", "(", "recipe", ",", "self", ".", "_plugin", ")" ]
Builds a recipe :param recipe: Name of the recipe to build.
[ "Builds", "a", "recipe" ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_recipes_pattern.py#L91-L97
train
useblocks/groundwork
groundwork/patterns/gw_recipes_pattern.py
RecipesListApplication.register
def register(self, name, path, plugin, description=None, final_words=None): """ Registers a new recipe. """ if name in self.recipes.keys(): raise RecipeExistsException("Recipe %s was already registered by %s" % (name, self.recipes["name...
python
def register(self, name, path, plugin, description=None, final_words=None): """ Registers a new recipe. """ if name in self.recipes.keys(): raise RecipeExistsException("Recipe %s was already registered by %s" % (name, self.recipes["name...
[ "def", "register", "(", "self", ",", "name", ",", "path", ",", "plugin", ",", "description", "=", "None", ",", "final_words", "=", "None", ")", ":", "if", "name", "in", "self", ".", "recipes", ".", "keys", "(", ")", ":", "raise", "RecipeExistsException...
Registers a new recipe.
[ "Registers", "a", "new", "recipe", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_recipes_pattern.py#L113-L123
train
useblocks/groundwork
groundwork/patterns/gw_recipes_pattern.py
RecipesListApplication.unregister
def unregister(self, recipe): """ Unregisters an existing recipe, so that this recipe is no longer available. This function is mainly used during plugin deactivation. :param recipe: Name of the recipe """ if recipe not in self.recipes.keys(): self.__log.warn...
python
def unregister(self, recipe): """ Unregisters an existing recipe, so that this recipe is no longer available. This function is mainly used during plugin deactivation. :param recipe: Name of the recipe """ if recipe not in self.recipes.keys(): self.__log.warn...
[ "def", "unregister", "(", "self", ",", "recipe", ")", ":", "if", "recipe", "not", "in", "self", ".", "recipes", ".", "keys", "(", ")", ":", "self", ".", "__log", ".", "warning", "(", "\"Can not unregister recipe %s\"", "%", "recipe", ")", "else", ":", ...
Unregisters an existing recipe, so that this recipe is no longer available. This function is mainly used during plugin deactivation. :param recipe: Name of the recipe
[ "Unregisters", "an", "existing", "recipe", "so", "that", "this", "recipe", "is", "no", "longer", "available", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_recipes_pattern.py#L125-L137
train
useblocks/groundwork
groundwork/patterns/gw_recipes_pattern.py
RecipesListApplication.get
def get(self, recipe=None, plugin=None): """ Get one or more recipes. :param recipe: Name of the recipe :type recipe: str :param plugin: Plugin object, under which the recipe was registered :type plugin: GwBasePattern """ if plugin is not None: ...
python
def get(self, recipe=None, plugin=None): """ Get one or more recipes. :param recipe: Name of the recipe :type recipe: str :param plugin: Plugin object, under which the recipe was registered :type plugin: GwBasePattern """ if plugin is not None: ...
[ "def", "get", "(", "self", ",", "recipe", "=", "None", ",", "plugin", "=", "None", ")", ":", "if", "plugin", "is", "not", "None", ":", "if", "recipe", "is", "None", ":", "recipes_list", "=", "{", "}", "for", "key", "in", "self", ".", "recipes", "...
Get one or more recipes. :param recipe: Name of the recipe :type recipe: str :param plugin: Plugin object, under which the recipe was registered :type plugin: GwBasePattern
[ "Get", "one", "or", "more", "recipes", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_recipes_pattern.py#L139-L170
train
useblocks/groundwork
groundwork/patterns/gw_recipes_pattern.py
RecipesListApplication.build
def build(self, recipe, plugin=None): """ Execute a recipe and creates new folder and files. :param recipe: Name of the recipe :param plugin: Name of the plugin, to which the recipe must belong. """ if recipe not in self.recipes.keys(): raise RecipeMissingExc...
python
def build(self, recipe, plugin=None): """ Execute a recipe and creates new folder and files. :param recipe: Name of the recipe :param plugin: Name of the plugin, to which the recipe must belong. """ if recipe not in self.recipes.keys(): raise RecipeMissingExc...
[ "def", "build", "(", "self", ",", "recipe", ",", "plugin", "=", "None", ")", ":", "if", "recipe", "not", "in", "self", ".", "recipes", ".", "keys", "(", ")", ":", "raise", "RecipeMissingException", "(", "\"Recipe %s unknown.\"", "%", "recipe", ")", "reci...
Execute a recipe and creates new folder and files. :param recipe: Name of the recipe :param plugin: Name of the plugin, to which the recipe must belong.
[ "Execute", "a", "recipe", "and", "creates", "new", "folder", "and", "files", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_recipes_pattern.py#L172-L190
train
useblocks/groundwork
groundwork/patterns/gw_recipes_pattern.py
Recipe.build
def build(self, output_dir=None, **kwargs): """ Buildes the recipe and creates needed folder and files. May ask the user for some parameter inputs. :param output_dir: Path, where the recipe shall be build. Default is the current working directory :return: location of the install...
python
def build(self, output_dir=None, **kwargs): """ Buildes the recipe and creates needed folder and files. May ask the user for some parameter inputs. :param output_dir: Path, where the recipe shall be build. Default is the current working directory :return: location of the install...
[ "def", "build", "(", "self", ",", "output_dir", "=", "None", ",", "**", "kwargs", ")", ":", "if", "output_dir", "is", "None", ":", "output_dir", "=", "os", ".", "getcwd", "(", ")", "target", "=", "cookiecutter", "(", "self", ".", "path", ",", "output...
Buildes the recipe and creates needed folder and files. May ask the user for some parameter inputs. :param output_dir: Path, where the recipe shall be build. Default is the current working directory :return: location of the installed recipe
[ "Buildes", "the", "recipe", "and", "creates", "needed", "folder", "and", "files", ".", "May", "ask", "the", "user", "for", "some", "parameter", "inputs", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_recipes_pattern.py#L213-L229
train
acutesoftware/AIKIF
aikif/lib/cls_context.py
where_am_i
def where_am_i(): """ high level function that can estimate where user is based on predefined setups. """ locations = {'Work':0, 'Home':0} for ssid in scan_for_ssids(): #print('checking scanned_ssid ', ssid) for l in logged_ssids: #print('checking logged_ssid ', l) ...
python
def where_am_i(): """ high level function that can estimate where user is based on predefined setups. """ locations = {'Work':0, 'Home':0} for ssid in scan_for_ssids(): #print('checking scanned_ssid ', ssid) for l in logged_ssids: #print('checking logged_ssid ', l) ...
[ "def", "where_am_i", "(", ")", ":", "locations", "=", "{", "'Work'", ":", "0", ",", "'Home'", ":", "0", "}", "for", "ssid", "in", "scan_for_ssids", "(", ")", ":", "for", "l", "in", "logged_ssids", ":", "if", "l", "[", "'name'", "]", "==", "ssid", ...
high level function that can estimate where user is based on predefined setups.
[ "high", "level", "function", "that", "can", "estimate", "where", "user", "is", "based", "on", "predefined", "setups", "." ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_context.py#L54-L69
train
acutesoftware/AIKIF
aikif/lib/cls_context.py
Context.summarise
def summarise(self): """ extrapolate a human readable summary of the contexts """ res = '' if self.user == 'Developer': if self.host == 'Home PC': res += 'At Home' else: res += 'Away from PC' elif self.user == 'Us...
python
def summarise(self): """ extrapolate a human readable summary of the contexts """ res = '' if self.user == 'Developer': if self.host == 'Home PC': res += 'At Home' else: res += 'Away from PC' elif self.user == 'Us...
[ "def", "summarise", "(", "self", ")", ":", "res", "=", "''", "if", "self", ".", "user", "==", "'Developer'", ":", "if", "self", ".", "host", "==", "'Home PC'", ":", "res", "+=", "'At Home'", "else", ":", "res", "+=", "'Away from PC'", "elif", "self", ...
extrapolate a human readable summary of the contexts
[ "extrapolate", "a", "human", "readable", "summary", "of", "the", "contexts" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_context.py#L127-L141
train
acutesoftware/AIKIF
aikif/lib/cls_context.py
Context.get_host
def get_host(self): """ returns the host computer running this program """ import socket host_name = socket.gethostname() for h in hosts: if h['name'] == host_name: return h['type'], h['name'] return dict(type='Unknown', name=host_nam...
python
def get_host(self): """ returns the host computer running this program """ import socket host_name = socket.gethostname() for h in hosts: if h['name'] == host_name: return h['type'], h['name'] return dict(type='Unknown', name=host_nam...
[ "def", "get_host", "(", "self", ")", ":", "import", "socket", "host_name", "=", "socket", ".", "gethostname", "(", ")", "for", "h", "in", "hosts", ":", "if", "h", "[", "'name'", "]", "==", "host_name", ":", "return", "h", "[", "'type'", "]", ",", "...
returns the host computer running this program
[ "returns", "the", "host", "computer", "running", "this", "program" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_context.py#L162-L171
train
acutesoftware/AIKIF
aikif/lib/cls_context.py
Context.get_user
def get_user(self): """ returns the username on this computer """ for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'): user = os.environ.get(name) if user: break for u in users: if u['name'] == user: retu...
python
def get_user(self): """ returns the username on this computer """ for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'): user = os.environ.get(name) if user: break for u in users: if u['name'] == user: retu...
[ "def", "get_user", "(", "self", ")", ":", "for", "name", "in", "(", "'LOGNAME'", ",", "'USER'", ",", "'LNAME'", ",", "'USERNAME'", ")", ":", "user", "=", "os", ".", "environ", ".", "get", "(", "name", ")", "if", "user", ":", "break", "for", "u", ...
returns the username on this computer
[ "returns", "the", "username", "on", "this", "computer" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_context.py#L173-L183
train
acutesoftware/AIKIF
aikif/lib/cls_context.py
Context.get_host_usage
def get_host_usage(self): """ get details of CPU, RAM usage of this PC """ import psutil process_names = [proc.name for proc in psutil.process_iter()] cpu_pct = psutil.cpu_percent(interval=1) mem = psutil.virtual_memory() return str(cpu_pct), str(len(pro...
python
def get_host_usage(self): """ get details of CPU, RAM usage of this PC """ import psutil process_names = [proc.name for proc in psutil.process_iter()] cpu_pct = psutil.cpu_percent(interval=1) mem = psutil.virtual_memory() return str(cpu_pct), str(len(pro...
[ "def", "get_host_usage", "(", "self", ")", ":", "import", "psutil", "process_names", "=", "[", "proc", ".", "name", "for", "proc", "in", "psutil", ".", "process_iter", "(", ")", "]", "cpu_pct", "=", "psutil", ".", "cpu_percent", "(", "interval", "=", "1"...
get details of CPU, RAM usage of this PC
[ "get", "details", "of", "CPU", "RAM", "usage", "of", "this", "PC" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_context.py#L229-L237
train
Nachtfeuer/pipeline
spline/components/config.py
ShellConfig.schema
def schema(): """Provide schema for shell configuration.""" return Schema({ 'script': And(Or(type(' '), type(u' ')), len), Optional('title', default=''): str, Optional('model', default={}): {Optional(And(str, len)): object}, Optional('env', default={}): {O...
python
def schema(): """Provide schema for shell configuration.""" return Schema({ 'script': And(Or(type(' '), type(u' ')), len), Optional('title', default=''): str, Optional('model', default={}): {Optional(And(str, len)): object}, Optional('env', default={}): {O...
[ "def", "schema", "(", ")", ":", "return", "Schema", "(", "{", "'script'", ":", "And", "(", "Or", "(", "type", "(", "' '", ")", ",", "type", "(", "u' '", ")", ")", ",", "len", ")", ",", "Optional", "(", "'title'", ",", "default", "=", "''", ")",...
Provide schema for shell configuration.
[ "Provide", "schema", "for", "shell", "configuration", "." ]
04ca18c4e95e4349532bb45b768206393e1f2c13
https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/components/config.py#L29-L46
train
acutesoftware/AIKIF
aikif/project.py
Projects.get_by_name
def get_by_name(self, name): """ returns an object Project which matches name """ for p in self.project_list: if p.nme == name: return p return None
python
def get_by_name(self, name): """ returns an object Project which matches name """ for p in self.project_list: if p.nme == name: return p return None
[ "def", "get_by_name", "(", "self", ",", "name", ")", ":", "for", "p", "in", "self", ".", "project_list", ":", "if", "p", ".", "nme", "==", "name", ":", "return", "p", "return", "None" ]
returns an object Project which matches name
[ "returns", "an", "object", "Project", "which", "matches", "name" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/project.py#L35-L40
train
acutesoftware/AIKIF
aikif/project.py
Project.execute_tasks
def execute_tasks(self): """ run execute on all tasks IFF prior task is successful """ for t in self.tasks: print('RUNNING ' + str(t.task_id) + ' = ' + t.name) t.execute() if t.success != '__IGNORE__RESULT__': print(t) p...
python
def execute_tasks(self): """ run execute on all tasks IFF prior task is successful """ for t in self.tasks: print('RUNNING ' + str(t.task_id) + ' = ' + t.name) t.execute() if t.success != '__IGNORE__RESULT__': print(t) p...
[ "def", "execute_tasks", "(", "self", ")", ":", "for", "t", "in", "self", ".", "tasks", ":", "print", "(", "'RUNNING '", "+", "str", "(", "t", ".", "task_id", ")", "+", "' = '", "+", "t", ".", "name", ")", "t", ".", "execute", "(", ")", "if", "t...
run execute on all tasks IFF prior task is successful
[ "run", "execute", "on", "all", "tasks", "IFF", "prior", "task", "is", "successful" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/project.py#L132-L145
train
acutesoftware/AIKIF
aikif/project.py
Project.build_report
def build_report(self, op_file, tpe='md'): """ create a report showing all project details """ if tpe == 'md': res = self.get_report_md() elif tpe == 'rst': res = self.get_report_rst() elif tpe == 'html': res = self.get_report_html() ...
python
def build_report(self, op_file, tpe='md'): """ create a report showing all project details """ if tpe == 'md': res = self.get_report_md() elif tpe == 'rst': res = self.get_report_rst() elif tpe == 'html': res = self.get_report_html() ...
[ "def", "build_report", "(", "self", ",", "op_file", ",", "tpe", "=", "'md'", ")", ":", "if", "tpe", "==", "'md'", ":", "res", "=", "self", ".", "get_report_md", "(", ")", "elif", "tpe", "==", "'rst'", ":", "res", "=", "self", ".", "get_report_rst", ...
create a report showing all project details
[ "create", "a", "report", "showing", "all", "project", "details" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/project.py#L149-L163
train
acutesoftware/AIKIF
aikif/project.py
Project.get_report_rst
def get_report_rst(self): """ formats the project into a report in RST format """ res = '' res += '-----------------------------------\n' res += self.nme + '\n' res += '-----------------------------------\n\n' res += self.desc + '\n' res += self....
python
def get_report_rst(self): """ formats the project into a report in RST format """ res = '' res += '-----------------------------------\n' res += self.nme + '\n' res += '-----------------------------------\n\n' res += self.desc + '\n' res += self....
[ "def", "get_report_rst", "(", "self", ")", ":", "res", "=", "''", "res", "+=", "'-----------------------------------\\n'", "res", "+=", "self", ".", "nme", "+", "'\\n'", "res", "+=", "'-----------------------------------\\n\\n'", "res", "+=", "self", ".", "desc", ...
formats the project into a report in RST format
[ "formats", "the", "project", "into", "a", "report", "in", "RST", "format" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/project.py#L165-L193
train
acutesoftware/AIKIF
aikif/project.py
Project.get_report_html
def get_report_html(self): """ formats the project into a report in MD format - WARNING - tables missing BR """ res = '<h2>Project:' + self.nme + '</h2>' res += '<p>' + self.desc + '</p>' res += '<p>' + self.fldr + '</p>' res += '<BR><h3>TABLES</h3>' ...
python
def get_report_html(self): """ formats the project into a report in MD format - WARNING - tables missing BR """ res = '<h2>Project:' + self.nme + '</h2>' res += '<p>' + self.desc + '</p>' res += '<p>' + self.fldr + '</p>' res += '<BR><h3>TABLES</h3>' ...
[ "def", "get_report_html", "(", "self", ")", ":", "res", "=", "'<h2>Project:'", "+", "self", ".", "nme", "+", "'</h2>'", "res", "+=", "'<p>'", "+", "self", ".", "desc", "+", "'</p>'", "res", "+=", "'<p>'", "+", "self", ".", "fldr", "+", "'</p>'", "res...
formats the project into a report in MD format - WARNING - tables missing BR
[ "formats", "the", "project", "into", "a", "report", "in", "MD", "format", "-", "WARNING", "-", "tables", "missing", "BR" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/project.py#L213-L226
train
acutesoftware/AIKIF
aikif/project.py
Task.add_param
def add_param(self, param_key, param_val): """ adds parameters as key value pairs """ self.params.append([param_key, param_val]) if param_key == '__success_test': self.success = param_val
python
def add_param(self, param_key, param_val): """ adds parameters as key value pairs """ self.params.append([param_key, param_val]) if param_key == '__success_test': self.success = param_val
[ "def", "add_param", "(", "self", ",", "param_key", ",", "param_val", ")", ":", "self", ".", "params", ".", "append", "(", "[", "param_key", ",", "param_val", "]", ")", "if", "param_key", "==", "'__success_test'", ":", "self", ".", "success", "=", "param_...
adds parameters as key value pairs
[ "adds", "parameters", "as", "key", "value", "pairs" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/project.py#L257-L263
train
acutesoftware/AIKIF
aikif/project.py
Task.execute
def execute(self): """ executes all automatic tasks in order of task id """ func_params = [] exec_str = self.func.__name__ + '(' for p in self.params: if p[0][0:2] != '__': # ignore custom param names exec_str += p[0] + '="' + self._force_st...
python
def execute(self): """ executes all automatic tasks in order of task id """ func_params = [] exec_str = self.func.__name__ + '(' for p in self.params: if p[0][0:2] != '__': # ignore custom param names exec_str += p[0] + '="' + self._force_st...
[ "def", "execute", "(", "self", ")", ":", "func_params", "=", "[", "]", "exec_str", "=", "self", ".", "func", ".", "__name__", "+", "'('", "for", "p", "in", "self", ".", "params", ":", "if", "p", "[", "0", "]", "[", "0", ":", "2", "]", "!=", "...
executes all automatic tasks in order of task id
[ "executes", "all", "automatic", "tasks", "in", "order", "of", "task", "id" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/project.py#L265-L280
train
cox-labs/perseuspy
perseuspy/io/perseus/matrix.py
create_column_index
def create_column_index(annotations): """ Create a pd.MultiIndex using the column names and any categorical rows. Note that also non-main columns will be assigned a default category ''. """ _column_index = OrderedDict({'Column Name' : annotations['Column Name']}) categorical_rows = annotation_ro...
python
def create_column_index(annotations): """ Create a pd.MultiIndex using the column names and any categorical rows. Note that also non-main columns will be assigned a default category ''. """ _column_index = OrderedDict({'Column Name' : annotations['Column Name']}) categorical_rows = annotation_ro...
[ "def", "create_column_index", "(", "annotations", ")", ":", "_column_index", "=", "OrderedDict", "(", "{", "'Column Name'", ":", "annotations", "[", "'Column Name'", "]", "}", ")", "categorical_rows", "=", "annotation_rows", "(", "'C:'", ",", "annotations", ")", ...
Create a pd.MultiIndex using the column names and any categorical rows. Note that also non-main columns will be assigned a default category ''.
[ "Create", "a", "pd", ".", "MultiIndex", "using", "the", "column", "names", "and", "any", "categorical", "rows", ".", "Note", "that", "also", "non", "-", "main", "columns", "will", "be", "assigned", "a", "default", "category", "." ]
3809c1bd46512605f9e7ca7f97e026e4940ed604
https://github.com/cox-labs/perseuspy/blob/3809c1bd46512605f9e7ca7f97e026e4940ed604/perseuspy/io/perseus/matrix.py#L61-L77
train
cox-labs/perseuspy
perseuspy/io/perseus/matrix.py
read_perseus
def read_perseus(path_or_file, **kwargs): """ Read a Perseus-formatted matrix into a pd.DataFrame. Annotation rows will be converted into a multi-index. By monkey-patching the returned pd.DataFrame a `to_perseus` method for exporting the pd.DataFrame is made available. :param path_or_file: Fil...
python
def read_perseus(path_or_file, **kwargs): """ Read a Perseus-formatted matrix into a pd.DataFrame. Annotation rows will be converted into a multi-index. By monkey-patching the returned pd.DataFrame a `to_perseus` method for exporting the pd.DataFrame is made available. :param path_or_file: Fil...
[ "def", "read_perseus", "(", "path_or_file", ",", "**", "kwargs", ")", ":", "annotations", "=", "read_annotations", "(", "path_or_file", ",", "separator", ")", "column_index", "=", "create_column_index", "(", "annotations", ")", "if", "'usecols'", "in", "kwargs", ...
Read a Perseus-formatted matrix into a pd.DataFrame. Annotation rows will be converted into a multi-index. By monkey-patching the returned pd.DataFrame a `to_perseus` method for exporting the pd.DataFrame is made available. :param path_or_file: File path or file-like object :param kwargs: Keyword ...
[ "Read", "a", "Perseus", "-", "formatted", "matrix", "into", "a", "pd", ".", "DataFrame", ".", "Annotation", "rows", "will", "be", "converted", "into", "a", "multi", "-", "index", "." ]
3809c1bd46512605f9e7ca7f97e026e4940ed604
https://github.com/cox-labs/perseuspy/blob/3809c1bd46512605f9e7ca7f97e026e4940ed604/perseuspy/io/perseus/matrix.py#L79-L102
train
cox-labs/perseuspy
perseuspy/io/perseus/matrix.py
to_perseus
def to_perseus(df, path_or_file, main_columns=None, separator=separator, convert_bool_to_category=True, numerical_annotation_rows = set([])): """ Save pd.DataFrame to Perseus text format. :param df: pd.DataFrame. :param path_or_file: File name or file-like object. :param mai...
python
def to_perseus(df, path_or_file, main_columns=None, separator=separator, convert_bool_to_category=True, numerical_annotation_rows = set([])): """ Save pd.DataFrame to Perseus text format. :param df: pd.DataFrame. :param path_or_file: File name or file-like object. :param mai...
[ "def", "to_perseus", "(", "df", ",", "path_or_file", ",", "main_columns", "=", "None", ",", "separator", "=", "separator", ",", "convert_bool_to_category", "=", "True", ",", "numerical_annotation_rows", "=", "set", "(", "[", "]", ")", ")", ":", "_df", "=", ...
Save pd.DataFrame to Perseus text format. :param df: pd.DataFrame. :param path_or_file: File name or file-like object. :param main_columns: Main columns. Will be infered if set to None. All numeric columns up-until the first non-numeric column are considered main columns. :param separator: For separati...
[ "Save", "pd", ".", "DataFrame", "to", "Perseus", "text", "format", "." ]
3809c1bd46512605f9e7ca7f97e026e4940ed604
https://github.com/cox-labs/perseuspy/blob/3809c1bd46512605f9e7ca7f97e026e4940ed604/perseuspy/io/perseus/matrix.py#L105-L147
train
acutesoftware/AIKIF
aikif/web_app/page_search.py
get_page
def get_page(search_text): """ formats the entire search result in a table output """ lst = search_aikif(search_text) txt = '<table class="as-table as-table-zebra as-table-horizontal">' for result in lst: txt += '<TR><TD>' + result + '</TD></TR>' txt += '</TABLE>\n\n' return txt
python
def get_page(search_text): """ formats the entire search result in a table output """ lst = search_aikif(search_text) txt = '<table class="as-table as-table-zebra as-table-horizontal">' for result in lst: txt += '<TR><TD>' + result + '</TD></TR>' txt += '</TABLE>\n\n' return txt
[ "def", "get_page", "(", "search_text", ")", ":", "lst", "=", "search_aikif", "(", "search_text", ")", "txt", "=", "'<table class=\"as-table as-table-zebra as-table-horizontal\">'", "for", "result", "in", "lst", ":", "txt", "+=", "'<TR><TD>'", "+", "result", "+", "...
formats the entire search result in a table output
[ "formats", "the", "entire", "search", "result", "in", "a", "table", "output" ]
fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/page_search.py#L12-L21
train