partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
MARCXMLQuery._parse_persons
Parse persons from given datafield. Args: datafield (str): code of datafield ("010", "730", etc..) subfield (char): code of subfield ("a", "z", "4", etc..) role (list of str): set to ["any"] for any role, ["aut"] for authors, etc.. For details see ...
src/marcxml_parser/query.py
def _parse_persons(self, datafield, subfield, roles=["aut"]): """ Parse persons from given datafield. Args: datafield (str): code of datafield ("010", "730", etc..) subfield (char): code of subfield ("a", "z", "4", etc..) role (list of str): set to ["any"] f...
def _parse_persons(self, datafield, subfield, roles=["aut"]): """ Parse persons from given datafield. Args: datafield (str): code of datafield ("010", "730", etc..) subfield (char): code of subfield ("a", "z", "4", etc..) role (list of str): set to ["any"] f...
[ "Parse", "persons", "from", "given", "datafield", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L95-L171
[ "def", "_parse_persons", "(", "self", ",", "datafield", ",", "subfield", ",", "roles", "=", "[", "\"aut\"", "]", ")", ":", "# parse authors", "parsed_persons", "=", "[", "]", "raw_persons", "=", "self", ".", "get_subfields", "(", "datafield", ",", "subfield"...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_subname
Args: undefined (optional): Argument, which will be returned if the `subname` record is not found. Returns: str: Subname of the book or `undefined` if `subname` is not \ found.
src/marcxml_parser/query.py
def get_subname(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `subname` record is not found. Returns: str: Subname of the book or `undefined` if `subname` is not \ found. """ ...
def get_subname(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `subname` record is not found. Returns: str: Subname of the book or `undefined` if `subname` is not \ found. """ ...
[ "Args", ":", "undefined", "(", "optional", ")", ":", "Argument", "which", "will", "be", "returned", "if", "the", "subname", "record", "is", "not", "found", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L185-L199
[ "def", "get_subname", "(", "self", ",", "undefined", "=", "\"\"", ")", ":", "return", "_undefined_pattern", "(", "\"\"", ".", "join", "(", "self", ".", "get_subfields", "(", "\"245\"", ",", "\"b\"", ")", ")", ",", "lambda", "x", ":", "x", ".", "strip",...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_price
Args: undefined (optional): Argument, which will be returned if the `price` record is not found. Returns: str: Price of the book (with currency) or `undefined` if `price` \ is not found.
src/marcxml_parser/query.py
def get_price(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `price` record is not found. Returns: str: Price of the book (with currency) or `undefined` if `price` \ is not found. ...
def get_price(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `price` record is not found. Returns: str: Price of the book (with currency) or `undefined` if `price` \ is not found. ...
[ "Args", ":", "undefined", "(", "optional", ")", ":", "Argument", "which", "will", "be", "returned", "if", "the", "price", "record", "is", "not", "found", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L202-L216
[ "def", "get_price", "(", "self", ",", "undefined", "=", "\"\"", ")", ":", "return", "_undefined_pattern", "(", "\"\"", ".", "join", "(", "self", ".", "get_subfields", "(", "\"020\"", ",", "\"c\"", ")", ")", ",", "lambda", "x", ":", "x", ".", "strip", ...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_part
Args: undefined (optional): Argument, which will be returned if the `part` record is not found. Returns: str: Which part of the book series is this record or `undefined` \ if `part` is not found.
src/marcxml_parser/query.py
def get_part(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `part` record is not found. Returns: str: Which part of the book series is this record or `undefined` \ if `part` is not found...
def get_part(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `part` record is not found. Returns: str: Which part of the book series is this record or `undefined` \ if `part` is not found...
[ "Args", ":", "undefined", "(", "optional", ")", ":", "Argument", "which", "will", "be", "returned", "if", "the", "part", "record", "is", "not", "found", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L219-L233
[ "def", "get_part", "(", "self", ",", "undefined", "=", "\"\"", ")", ":", "return", "_undefined_pattern", "(", "\"\"", ".", "join", "(", "self", ".", "get_subfields", "(", "\"245\"", ",", "\"p\"", ")", ")", ",", "lambda", "x", ":", "x", ".", "strip", ...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_part_name
Args: undefined (optional): Argument, which will be returned if the `part_name` record is not found. Returns: str: Name of the part of the series. or `undefined` if `part_name`\ is not found.
src/marcxml_parser/query.py
def get_part_name(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `part_name` record is not found. Returns: str: Name of the part of the series. or `undefined` if `part_name`\ is not foun...
def get_part_name(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `part_name` record is not found. Returns: str: Name of the part of the series. or `undefined` if `part_name`\ is not foun...
[ "Args", ":", "undefined", "(", "optional", ")", ":", "Argument", "which", "will", "be", "returned", "if", "the", "part_name", "record", "is", "not", "found", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L236-L250
[ "def", "get_part_name", "(", "self", ",", "undefined", "=", "\"\"", ")", ":", "return", "_undefined_pattern", "(", "\"\"", ".", "join", "(", "self", ".", "get_subfields", "(", "\"245\"", ",", "\"n\"", ")", ")", ",", "lambda", "x", ":", "x", ".", "strip...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_publisher
Args: undefined (optional): Argument, which will be returned if the `publisher` record is not found. Returns: str: Name of the publisher ("``Grada``" for example) or \ `undefined` if `publisher` is not found.
src/marcxml_parser/query.py
def get_publisher(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `publisher` record is not found. Returns: str: Name of the publisher ("``Grada``" for example) or \ `undefined` if `publi...
def get_publisher(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `publisher` record is not found. Returns: str: Name of the publisher ("``Grada``" for example) or \ `undefined` if `publi...
[ "Args", ":", "undefined", "(", "optional", ")", ":", "Argument", "which", "will", "be", "returned", "if", "the", "publisher", "record", "is", "not", "found", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L253-L272
[ "def", "get_publisher", "(", "self", ",", "undefined", "=", "\"\"", ")", ":", "publishers", "=", "set", "(", "[", "remove_hairs_fn", "(", "publisher", ")", "for", "publisher", "in", "self", "[", "\"260b \"", "]", "+", "self", "[", "\"264b\"", "]", "]", ...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_pub_date
Args: undefined (optional): Argument, which will be returned if the `pub_date` record is not found. Returns: str: Date of publication (month and year usually) or `undefined` \ if `pub_date` is not found.
src/marcxml_parser/query.py
def get_pub_date(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `pub_date` record is not found. Returns: str: Date of publication (month and year usually) or `undefined` \ if `pub_date` ...
def get_pub_date(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `pub_date` record is not found. Returns: str: Date of publication (month and year usually) or `undefined` \ if `pub_date` ...
[ "Args", ":", "undefined", "(", "optional", ")", ":", "Argument", "which", "will", "be", "returned", "if", "the", "pub_date", "record", "is", "not", "found", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L274-L315
[ "def", "get_pub_date", "(", "self", ",", "undefined", "=", "\"\"", ")", ":", "dates", "=", "self", "[", "\"260c \"", "]", "+", "self", "[", "\"264c\"", "]", "def", "clean_date", "(", "date", ")", ":", "\"\"\"\n Clean the `date` strings from special c...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_pub_order
Args: undefined (optional): Argument, which will be returned if the `pub_order` record is not found. Returns: str: Information about order in which was the book published or \ `undefined` if `pub_order` is not found.
src/marcxml_parser/query.py
def get_pub_order(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `pub_order` record is not found. Returns: str: Information about order in which was the book published or \ `undefined` i...
def get_pub_order(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `pub_order` record is not found. Returns: str: Information about order in which was the book published or \ `undefined` i...
[ "Args", ":", "undefined", "(", "optional", ")", ":", "Argument", "which", "will", "be", "returned", "if", "the", "pub_order", "record", "is", "not", "found", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L318-L332
[ "def", "get_pub_order", "(", "self", ",", "undefined", "=", "\"\"", ")", ":", "return", "_undefined_pattern", "(", "\"\"", ".", "join", "(", "self", ".", "get_subfields", "(", "\"901\"", ",", "\"f\"", ")", ")", ",", "lambda", "x", ":", "x", ".", "strip...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_pub_place
Args: undefined (optional): Argument, which will be returned if the `pub_place` record is not found. Returns: str: Name of city/country where the book was published or \ `undefined` if `pub_place` is not found.
src/marcxml_parser/query.py
def get_pub_place(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `pub_place` record is not found. Returns: str: Name of city/country where the book was published or \ `undefined` if `pub...
def get_pub_place(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `pub_place` record is not found. Returns: str: Name of city/country where the book was published or \ `undefined` if `pub...
[ "Args", ":", "undefined", "(", "optional", ")", ":", "Argument", "which", "will", "be", "returned", "if", "the", "pub_place", "record", "is", "not", "found", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L335-L354
[ "def", "get_pub_place", "(", "self", ",", "undefined", "=", "\"\"", ")", ":", "places", "=", "set", "(", "[", "remove_hairs_fn", "(", "place", ")", "for", "place", "in", "self", "[", "\"260a \"", "]", "+", "self", "[", "\"264a\"", "]", "]", ")", "re...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_format
Args: undefined (optional): Argument, which will be returned if the `format` record is not found. Returns: str: Dimensions of the book ('``23 cm``' for example) or `undefined` if `format` is not found.
src/marcxml_parser/query.py
def get_format(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `format` record is not found. Returns: str: Dimensions of the book ('``23 cm``' for example) or `undefined` if `format` is n...
def get_format(self, undefined=""): """ Args: undefined (optional): Argument, which will be returned if the `format` record is not found. Returns: str: Dimensions of the book ('``23 cm``' for example) or `undefined` if `format` is n...
[ "Args", ":", "undefined", "(", "optional", ")", ":", "Argument", "which", "will", "be", "returned", "if", "the", "format", "record", "is", "not", "found", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L357-L371
[ "def", "get_format", "(", "self", ",", "undefined", "=", "\"\"", ")", ":", "return", "_undefined_pattern", "(", "\"\"", ".", "join", "(", "self", ".", "get_subfields", "(", "\"300\"", ",", "\"c\"", ")", ")", ",", "lambda", "x", ":", "x", ".", "strip", ...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_authors
Returns: list: Authors represented as :class:`.Person` objects.
src/marcxml_parser/query.py
def get_authors(self): """ Returns: list: Authors represented as :class:`.Person` objects. """ authors = self._parse_persons("100", "a") authors += self._parse_persons("600", "a") authors += self._parse_persons("700", "a") authors += self._parse_person...
def get_authors(self): """ Returns: list: Authors represented as :class:`.Person` objects. """ authors = self._parse_persons("100", "a") authors += self._parse_persons("600", "a") authors += self._parse_persons("700", "a") authors += self._parse_person...
[ "Returns", ":", "list", ":", "Authors", "represented", "as", ":", "class", ":", ".", "Person", "objects", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L373-L383
[ "def", "get_authors", "(", "self", ")", ":", "authors", "=", "self", ".", "_parse_persons", "(", "\"100\"", ",", "\"a\"", ")", "authors", "+=", "self", ".", "_parse_persons", "(", "\"600\"", ",", "\"a\"", ")", "authors", "+=", "self", ".", "_parse_persons"...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_corporations
Args: roles (list, optional): Specify which types of corporations you need. Set to ``["any"]`` for any role, ``["dst"]`` for distributors, etc.. Note: See http://www.loc.gov/marc/relators/relaterm.html for details. Returns: list: ...
src/marcxml_parser/query.py
def get_corporations(self, roles=["dst"]): """ Args: roles (list, optional): Specify which types of corporations you need. Set to ``["any"]`` for any role, ``["dst"]`` for distributors, etc.. Note: See http://www.loc.gov/marc/relators/...
def get_corporations(self, roles=["dst"]): """ Args: roles (list, optional): Specify which types of corporations you need. Set to ``["any"]`` for any role, ``["dst"]`` for distributors, etc.. Note: See http://www.loc.gov/marc/relators/...
[ "Args", ":", "roles", "(", "list", "optional", ")", ":", "Specify", "which", "types", "of", "corporations", "you", "need", ".", "Set", "to", "[", "any", "]", "for", "any", "role", "[", "dst", "]", "for", "distributors", "etc", ".." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L385-L403
[ "def", "get_corporations", "(", "self", ",", "roles", "=", "[", "\"dst\"", "]", ")", ":", "corporations", "=", "self", ".", "_parse_corporations", "(", "\"110\"", ",", "\"a\"", ",", "roles", ")", "corporations", "+=", "self", ".", "_parse_corporations", "(",...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_ISBNs
Get list of VALID ISBN. Returns: list: List with *valid* ISBN strings.
src/marcxml_parser/query.py
def get_ISBNs(self): """ Get list of VALID ISBN. Returns: list: List with *valid* ISBN strings. """ invalid_isbns = set(self.get_invalid_ISBNs()) valid_isbns = [ self._clean_isbn(isbn) for isbn in self["020a"] if self._cle...
def get_ISBNs(self): """ Get list of VALID ISBN. Returns: list: List with *valid* ISBN strings. """ invalid_isbns = set(self.get_invalid_ISBNs()) valid_isbns = [ self._clean_isbn(isbn) for isbn in self["020a"] if self._cle...
[ "Get", "list", "of", "VALID", "ISBN", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L430-L452
[ "def", "get_ISBNs", "(", "self", ")", ":", "invalid_isbns", "=", "set", "(", "self", ".", "get_invalid_ISBNs", "(", ")", ")", "valid_isbns", "=", "[", "self", ".", "_clean_isbn", "(", "isbn", ")", "for", "isbn", "in", "self", "[", "\"020a\"", "]", "if"...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_ISSNs
Get list of VALID ISSNs (``022a``). Returns: list: List with *valid* ISSN strings.
src/marcxml_parser/query.py
def get_ISSNs(self): """ Get list of VALID ISSNs (``022a``). Returns: list: List with *valid* ISSN strings. """ invalid_issns = set(self.get_invalid_ISSNs()) return [ self._clean_isbn(issn) for issn in self["022a"] if self...
def get_ISSNs(self): """ Get list of VALID ISSNs (``022a``). Returns: list: List with *valid* ISSN strings. """ invalid_issns = set(self.get_invalid_ISSNs()) return [ self._clean_isbn(issn) for issn in self["022a"] if self...
[ "Get", "list", "of", "VALID", "ISSNs", "(", "022a", ")", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L466-L479
[ "def", "get_ISSNs", "(", "self", ")", ":", "invalid_issns", "=", "set", "(", "self", ".", "get_invalid_ISSNs", "(", ")", ")", "return", "[", "self", ".", "_clean_isbn", "(", "issn", ")", "for", "issn", "in", "self", "[", "\"022a\"", "]", "if", "self", ...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery._filter_binding
Filter binding from ISBN record. In MARC XML / OAI, the binding information is stored in same subrecord as ISBN. Example: ``<subfield code="a">80-251-0225-4 (brož.) :</subfield>`` -> ``brož.``.
src/marcxml_parser/query.py
def _filter_binding(self, binding): """ Filter binding from ISBN record. In MARC XML / OAI, the binding information is stored in same subrecord as ISBN. Example: ``<subfield code="a">80-251-0225-4 (brož.) :</subfield>`` -> ``brož.``. """ binding =...
def _filter_binding(self, binding): """ Filter binding from ISBN record. In MARC XML / OAI, the binding information is stored in same subrecord as ISBN. Example: ``<subfield code="a">80-251-0225-4 (brož.) :</subfield>`` -> ``brož.``. """ binding =...
[ "Filter", "binding", "from", "ISBN", "record", ".", "In", "MARC", "XML", "/", "OAI", "the", "binding", "information", "is", "stored", "in", "same", "subrecord", "as", "ISBN", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L493-L505
[ "def", "_filter_binding", "(", "self", ",", "binding", ")", ":", "binding", "=", "binding", ".", "strip", "(", ")", ".", "split", "(", "\" \"", ",", "1", ")", "[", "-", "1", "]", "# isolate bind. from ISBN", "binding", "=", "remove_hairs_fn", "(", "bindi...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_urls
Content of field ``856u42``. Typically URL pointing to producers homepage. Returns: list: List of URLs defined by producer.
src/marcxml_parser/query.py
def get_urls(self): """ Content of field ``856u42``. Typically URL pointing to producers homepage. Returns: list: List of URLs defined by producer. """ urls = self.get_subfields("856", "u", i1="4", i2="2") return map(lambda x: x.replace("&amp;", "&")...
def get_urls(self): """ Content of field ``856u42``. Typically URL pointing to producers homepage. Returns: list: List of URLs defined by producer. """ urls = self.get_subfields("856", "u", i1="4", i2="2") return map(lambda x: x.replace("&amp;", "&")...
[ "Content", "of", "field", "856u42", ".", "Typically", "URL", "pointing", "to", "producers", "homepage", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L527-L537
[ "def", "get_urls", "(", "self", ")", ":", "urls", "=", "self", ".", "get_subfields", "(", "\"856\"", ",", "\"u\"", ",", "i1", "=", "\"4\"", ",", "i2", "=", "\"2\"", ")", "return", "map", "(", "lambda", "x", ":", "x", ".", "replace", "(", "\"&amp;\"...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_internal_urls
URL's, which may point to edeposit, aleph, kramerius and so on. Fields ``856u40``, ``998a`` and ``URLu``. Returns: list: List of internal URLs.
src/marcxml_parser/query.py
def get_internal_urls(self): """ URL's, which may point to edeposit, aleph, kramerius and so on. Fields ``856u40``, ``998a`` and ``URLu``. Returns: list: List of internal URLs. """ internal_urls = self.get_subfields("856", "u", i1="4", i2="0") inter...
def get_internal_urls(self): """ URL's, which may point to edeposit, aleph, kramerius and so on. Fields ``856u40``, ``998a`` and ``URLu``. Returns: list: List of internal URLs. """ internal_urls = self.get_subfields("856", "u", i1="4", i2="0") inter...
[ "URL", "s", "which", "may", "point", "to", "edeposit", "aleph", "kramerius", "and", "so", "on", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L539-L552
[ "def", "get_internal_urls", "(", "self", ")", ":", "internal_urls", "=", "self", ".", "get_subfields", "(", "\"856\"", ",", "\"u\"", ",", "i1", "=", "\"4\"", ",", "i2", "=", "\"0\"", ")", "internal_urls", ".", "extend", "(", "self", ".", "get_subfields", ...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get_pub_type
Returns: PublicationType: :class:`.PublicationType` enum **value**.
src/marcxml_parser/query.py
def get_pub_type(self): """ Returns: PublicationType: :class:`.PublicationType` enum **value**. """ INFO_CHAR_INDEX = 6 SECOND_INFO_CHAR_I = 18 if not len(self.leader) >= INFO_CHAR_INDEX + 1: return PublicationType.monographic if self.con...
def get_pub_type(self): """ Returns: PublicationType: :class:`.PublicationType` enum **value**. """ INFO_CHAR_INDEX = 6 SECOND_INFO_CHAR_I = 18 if not len(self.leader) >= INFO_CHAR_INDEX + 1: return PublicationType.monographic if self.con...
[ "Returns", ":", "PublicationType", ":", ":", "class", ":", ".", "PublicationType", "enum", "**", "value", "**", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L554-L584
[ "def", "get_pub_type", "(", "self", ")", ":", "INFO_CHAR_INDEX", "=", "6", "SECOND_INFO_CHAR_I", "=", "18", "if", "not", "len", "(", "self", ".", "leader", ")", ">=", "INFO_CHAR_INDEX", "+", "1", ":", "return", "PublicationType", ".", "monographic", "if", ...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLQuery.get
Standard dict-like .get() method. Args: item (str): See :meth:`.__getitem__` for details. alt (default None): Alternative value, if item is not found. Returns: obj: `item` or `alt`, if item is not found.
src/marcxml_parser/query.py
def get(self, item, alt=None): """ Standard dict-like .get() method. Args: item (str): See :meth:`.__getitem__` for details. alt (default None): Alternative value, if item is not found. Returns: obj: `item` or `alt`, if item is not found. """...
def get(self, item, alt=None): """ Standard dict-like .get() method. Args: item (str): See :meth:`.__getitem__` for details. alt (default None): Alternative value, if item is not found. Returns: obj: `item` or `alt`, if item is not found. """...
[ "Standard", "dict", "-", "like", ".", "get", "()", "method", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L668-L684
[ "def", "get", "(", "self", ",", "item", ",", "alt", "=", "None", ")", ":", "try", ":", "val", "=", "self", "[", "item", "]", "except", "ValueError", ":", "return", "alt", "return", "val", "if", "val", "is", "not", "None", "else", "alt" ]
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
pid
r'''Create a callable that implements a PID controller. A PID controller returns a control signal :math:`u(t)` given a history of error measurements :math:`e(0) \dots e(t)`, using proportional (P), integral (I), and derivative (D) terms, according to: .. math:: u(t) = kp * e(t) + ki * \int_{s=...
pagoda/skeleton.py
def pid(kp=0., ki=0., kd=0., smooth=0.1): r'''Create a callable that implements a PID controller. A PID controller returns a control signal :math:`u(t)` given a history of error measurements :math:`e(0) \dots e(t)`, using proportional (P), integral (I), and derivative (D) terms, according to: .. m...
def pid(kp=0., ki=0., kd=0., smooth=0.1): r'''Create a callable that implements a PID controller. A PID controller returns a control signal :math:`u(t)` given a history of error measurements :math:`e(0) \dots e(t)`, using proportional (P), integral (I), and derivative (D) terms, according to: .. m...
[ "r", "Create", "a", "callable", "that", "implements", "a", "PID", "controller", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L11-L55
[ "def", "pid", "(", "kp", "=", "0.", ",", "ki", "=", "0.", ",", "kd", "=", "0.", ",", "smooth", "=", "0.1", ")", ":", "state", "=", "dict", "(", "p", "=", "0", ",", "i", "=", "0", ",", "d", "=", "0", ")", "def", "control", "(", "error", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
as_flat_array
Given a sequence of sequences, return a flat numpy array. Parameters ---------- iterables : sequence of sequence of number A sequence of tuples or lists containing numbers. Typically these come from something that represents each joint in a skeleton, like angle. Returns ------- ...
pagoda/skeleton.py
def as_flat_array(iterables): '''Given a sequence of sequences, return a flat numpy array. Parameters ---------- iterables : sequence of sequence of number A sequence of tuples or lists containing numbers. Typically these come from something that represents each joint in a skeleton, lik...
def as_flat_array(iterables): '''Given a sequence of sequences, return a flat numpy array. Parameters ---------- iterables : sequence of sequence of number A sequence of tuples or lists containing numbers. Typically these come from something that represents each joint in a skeleton, lik...
[ "Given", "a", "sequence", "of", "sequences", "return", "a", "flat", "numpy", "array", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L58-L75
[ "def", "as_flat_array", "(", "iterables", ")", ":", "arr", "=", "[", "]", "for", "x", "in", "iterables", ":", "arr", ".", "extend", "(", "x", ")", "return", "np", ".", "array", "(", "arr", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Skeleton.load
Load a skeleton definition from a file. Parameters ---------- source : str or file A filename or file-like object that contains text information describing a skeleton. See :class:`pagoda.parser.Parser` for more information about the format of the text file.
pagoda/skeleton.py
def load(self, source, **kwargs): '''Load a skeleton definition from a file. Parameters ---------- source : str or file A filename or file-like object that contains text information describing a skeleton. See :class:`pagoda.parser.Parser` for more inf...
def load(self, source, **kwargs): '''Load a skeleton definition from a file. Parameters ---------- source : str or file A filename or file-like object that contains text information describing a skeleton. See :class:`pagoda.parser.Parser` for more inf...
[ "Load", "a", "skeleton", "definition", "from", "a", "file", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L111-L124
[ "def", "load", "(", "self", ",", "source", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", "source", ",", "'endswith'", ")", "and", "source", ".", "lower", "(", ")", ".", "endswith", "(", "'.asf'", ")", ":", "self", ".", "load_asf", "(", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Skeleton.load_skel
Load a skeleton definition from a text file. Parameters ---------- source : str or file A filename or file-like object that contains text information describing a skeleton. See :class:`pagoda.parser.BodyParser` for more information about the format of the tex...
pagoda/skeleton.py
def load_skel(self, source, **kwargs): '''Load a skeleton definition from a text file. Parameters ---------- source : str or file A filename or file-like object that contains text information describing a skeleton. See :class:`pagoda.parser.BodyParser` for ...
def load_skel(self, source, **kwargs): '''Load a skeleton definition from a text file. Parameters ---------- source : str or file A filename or file-like object that contains text information describing a skeleton. See :class:`pagoda.parser.BodyParser` for ...
[ "Load", "a", "skeleton", "definition", "from", "a", "text", "file", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L126-L144
[ "def", "load_skel", "(", "self", ",", "source", ",", "*", "*", "kwargs", ")", ":", "logging", ".", "info", "(", "'%s: parsing skeleton configuration'", ",", "source", ")", "if", "hasattr", "(", "source", ",", "'read'", ")", ":", "p", "=", "parser", ".", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Skeleton.load_asf
Load a skeleton definition from an ASF text file. Parameters ---------- source : str or file A filename or file-like object that contains text information describing a skeleton, in ASF format.
pagoda/skeleton.py
def load_asf(self, source, **kwargs): '''Load a skeleton definition from an ASF text file. Parameters ---------- source : str or file A filename or file-like object that contains text information describing a skeleton, in ASF format. ''' if hasatt...
def load_asf(self, source, **kwargs): '''Load a skeleton definition from an ASF text file. Parameters ---------- source : str or file A filename or file-like object that contains text information describing a skeleton, in ASF format. ''' if hasatt...
[ "Load", "a", "skeleton", "definition", "from", "an", "ASF", "text", "file", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L146-L162
[ "def", "load_asf", "(", "self", ",", "source", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", "source", ",", "'read'", ")", ":", "p", "=", "parser", ".", "parse_asf", "(", "source", ",", "self", ".", "world", ",", "self", ".", "jointgroup...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Skeleton.set_pid_params
Set PID parameters for all joints in the skeleton. Parameters for this method are passed directly to the `pid` constructor.
pagoda/skeleton.py
def set_pid_params(self, *args, **kwargs): '''Set PID parameters for all joints in the skeleton. Parameters for this method are passed directly to the `pid` constructor. ''' for joint in self.joints: joint.target_angles = [None] * joint.ADOF joint.controllers = [...
def set_pid_params(self, *args, **kwargs): '''Set PID parameters for all joints in the skeleton. Parameters for this method are passed directly to the `pid` constructor. ''' for joint in self.joints: joint.target_angles = [None] * joint.ADOF joint.controllers = [...
[ "Set", "PID", "parameters", "for", "all", "joints", "in", "the", "skeleton", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L164-L171
[ "def", "set_pid_params", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "joint", "in", "self", ".", "joints", ":", "joint", ".", "target_angles", "=", "[", "None", "]", "*", "joint", ".", "ADOF", "joint", ".", "controllers",...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Skeleton.joint_torques
Get a list of all current joint torques in the skeleton.
pagoda/skeleton.py
def joint_torques(self): '''Get a list of all current joint torques in the skeleton.''' return as_flat_array(getattr(j, 'amotor', j).feedback[-1][:j.ADOF] for j in self.joints)
def joint_torques(self): '''Get a list of all current joint torques in the skeleton.''' return as_flat_array(getattr(j, 'amotor', j).feedback[-1][:j.ADOF] for j in self.joints)
[ "Get", "a", "list", "of", "all", "current", "joint", "torques", "in", "the", "skeleton", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L198-L201
[ "def", "joint_torques", "(", "self", ")", ":", "return", "as_flat_array", "(", "getattr", "(", "j", ",", "'amotor'", ",", "j", ")", ".", "feedback", "[", "-", "1", "]", "[", ":", "j", ".", "ADOF", "]", "for", "j", "in", "self", ".", "joints", ")"...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Skeleton.indices_for_joint
Get a list of the indices for a specific joint. Parameters ---------- name : str The name of the joint to look up. Returns ------- list of int : A list of the index values for quantities related to the named joint. Often useful for ge...
pagoda/skeleton.py
def indices_for_joint(self, name): '''Get a list of the indices for a specific joint. Parameters ---------- name : str The name of the joint to look up. Returns ------- list of int : A list of the index values for quantities related to th...
def indices_for_joint(self, name): '''Get a list of the indices for a specific joint. Parameters ---------- name : str The name of the joint to look up. Returns ------- list of int : A list of the index values for quantities related to th...
[ "Get", "a", "list", "of", "the", "indices", "for", "a", "specific", "joint", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L241-L261
[ "def", "indices_for_joint", "(", "self", ",", "name", ")", ":", "j", "=", "0", "for", "joint", "in", "self", ".", "joints", ":", "if", "joint", ".", "name", "==", "name", ":", "return", "list", "(", "range", "(", "j", ",", "j", "+", "joint", ".",...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Skeleton.indices_for_body
Get a list of the indices for a specific body. Parameters ---------- name : str The name of the body to look up. step : int, optional The number of numbers for each body. Defaults to 3, should be set to 4 for body rotation (since quaternions have 4 va...
pagoda/skeleton.py
def indices_for_body(self, name, step=3): '''Get a list of the indices for a specific body. Parameters ---------- name : str The name of the body to look up. step : int, optional The number of numbers for each body. Defaults to 3, should be set ...
def indices_for_body(self, name, step=3): '''Get a list of the indices for a specific body. Parameters ---------- name : str The name of the body to look up. step : int, optional The number of numbers for each body. Defaults to 3, should be set ...
[ "Get", "a", "list", "of", "the", "indices", "for", "a", "specific", "body", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L263-L282
[ "def", "indices_for_body", "(", "self", ",", "name", ",", "step", "=", "3", ")", ":", "for", "j", ",", "body", "in", "enumerate", "(", "self", ".", "bodies", ")", ":", "if", "body", ".", "name", "==", "name", ":", "return", "list", "(", "range", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Skeleton.joint_distances
Get the current joint separations for the skeleton. Returns ------- distances : list of float A list expressing the distance between the two joint anchor points, for each joint in the skeleton. These quantities describe how "exploded" the bodies in the skelet...
pagoda/skeleton.py
def joint_distances(self): '''Get the current joint separations for the skeleton. Returns ------- distances : list of float A list expressing the distance between the two joint anchor points, for each joint in the skeleton. These quantities describe how ...
def joint_distances(self): '''Get the current joint separations for the skeleton. Returns ------- distances : list of float A list expressing the distance between the two joint anchor points, for each joint in the skeleton. These quantities describe how ...
[ "Get", "the", "current", "joint", "separations", "for", "the", "skeleton", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L284-L295
[ "def", "joint_distances", "(", "self", ")", ":", "return", "[", "(", "(", "np", ".", "array", "(", "j", ".", "anchor", ")", "-", "j", ".", "anchor2", ")", "**", "2", ")", ".", "sum", "(", ")", "for", "j", "in", "self", ".", "joints", "]" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Skeleton.enable_motors
Enable the joint motors in this skeleton. This method sets the maximum force that can be applied by each joint to attain the desired target velocities. It also enables torque feedback for all joint motors. Parameters ---------- max_force : float The maximum ...
pagoda/skeleton.py
def enable_motors(self, max_force): '''Enable the joint motors in this skeleton. This method sets the maximum force that can be applied by each joint to attain the desired target velocities. It also enables torque feedback for all joint motors. Parameters ---------- ...
def enable_motors(self, max_force): '''Enable the joint motors in this skeleton. This method sets the maximum force that can be applied by each joint to attain the desired target velocities. It also enables torque feedback for all joint motors. Parameters ---------- ...
[ "Enable", "the", "joint", "motors", "in", "this", "skeleton", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L319-L338
[ "def", "enable_motors", "(", "self", ",", "max_force", ")", ":", "for", "joint", "in", "self", ".", "joints", ":", "amotor", "=", "getattr", "(", "joint", ",", "'amotor'", ",", "joint", ")", "amotor", ".", "max_forces", "=", "max_force", "if", "max_force...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Skeleton.set_target_angles
Move each joint toward a target angle. This method uses a PID controller to set a target angular velocity for each degree of freedom in the skeleton, based on the difference between the current and the target angle for the respective DOF. PID parameters are by default set to achieve a ...
pagoda/skeleton.py
def set_target_angles(self, angles): '''Move each joint toward a target angle. This method uses a PID controller to set a target angular velocity for each degree of freedom in the skeleton, based on the difference between the current and the target angle for the respective DOF. ...
def set_target_angles(self, angles): '''Move each joint toward a target angle. This method uses a PID controller to set a target angular velocity for each degree of freedom in the skeleton, based on the difference between the current and the target angle for the respective DOF. ...
[ "Move", "each", "joint", "toward", "a", "target", "angle", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L348-L372
[ "def", "set_target_angles", "(", "self", ",", "angles", ")", ":", "j", "=", "0", "for", "joint", "in", "self", ".", "joints", ":", "velocities", "=", "[", "ctrl", "(", "tgt", "-", "cur", ",", "self", ".", "world", ".", "dt", ")", "for", "cur", ",...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Skeleton.add_torques
Add torques for each degree of freedom in the skeleton. Parameters ---------- torques : list of float A list of the torques to add to each degree of freedom in the skeleton.
pagoda/skeleton.py
def add_torques(self, torques): '''Add torques for each degree of freedom in the skeleton. Parameters ---------- torques : list of float A list of the torques to add to each degree of freedom in the skeleton. ''' j = 0 for joint in self.jo...
def add_torques(self, torques): '''Add torques for each degree of freedom in the skeleton. Parameters ---------- torques : list of float A list of the torques to add to each degree of freedom in the skeleton. ''' j = 0 for joint in self.jo...
[ "Add", "torques", "for", "each", "degree", "of", "freedom", "in", "the", "skeleton", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/skeleton.py#L374-L387
[ "def", "add_torques", "(", "self", ",", "torques", ")", ":", "j", "=", "0", "for", "joint", "in", "self", ".", "joints", ":", "joint", ".", "add_torques", "(", "list", "(", "torques", "[", "j", ":", "j", "+", "joint", ".", "ADOF", "]", ")", "+", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Markers.labels
Return the names of our marker labels in canonical order.
pagoda/cooper.py
def labels(self): '''Return the names of our marker labels in canonical order.''' return sorted(self.channels, key=lambda c: self.channels[c])
def labels(self): '''Return the names of our marker labels in canonical order.''' return sorted(self.channels, key=lambda c: self.channels[c])
[ "Return", "the", "names", "of", "our", "marker", "labels", "in", "canonical", "order", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L63-L65
[ "def", "labels", "(", "self", ")", ":", "return", "sorted", "(", "self", ".", "channels", ",", "key", "=", "lambda", "c", ":", "self", ".", "channels", "[", "c", "]", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Markers.load_csv
Load marker data from a CSV file. The file will be imported using Pandas, which must be installed to use this method. (``pip install pandas``) The first line of the CSV file will be used for header information. The "time" column will be used as the index for the data frame. There must ...
pagoda/cooper.py
def load_csv(self, filename, start_frame=10, max_frames=int(1e300)): '''Load marker data from a CSV file. The file will be imported using Pandas, which must be installed to use this method. (``pip install pandas``) The first line of the CSV file will be used for header information. The...
def load_csv(self, filename, start_frame=10, max_frames=int(1e300)): '''Load marker data from a CSV file. The file will be imported using Pandas, which must be installed to use this method. (``pip install pandas``) The first line of the CSV file will be used for header information. The...
[ "Load", "marker", "data", "from", "a", "CSV", "file", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L80-L119
[ "def", "load_csv", "(", "self", ",", "filename", ",", "start_frame", "=", "10", ",", "max_frames", "=", "int", "(", "1e300", ")", ")", ":", "import", "pandas", "as", "pd", "compression", "=", "None", "if", "filename", ".", "endswith", "(", "'.gz'", ")"...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Markers.load_c3d
Load marker data from a C3D file. The file will be imported using the c3d module, which must be installed to use this method. (``pip install c3d``) Parameters ---------- filename : str Name of the C3D file to load. start_frame : int, optional Dis...
pagoda/cooper.py
def load_c3d(self, filename, start_frame=0, max_frames=int(1e300)): '''Load marker data from a C3D file. The file will be imported using the c3d module, which must be installed to use this method. (``pip install c3d``) Parameters ---------- filename : str Na...
def load_c3d(self, filename, start_frame=0, max_frames=int(1e300)): '''Load marker data from a C3D file. The file will be imported using the c3d module, which must be installed to use this method. (``pip install c3d``) Parameters ---------- filename : str Na...
[ "Load", "marker", "data", "from", "a", "C3D", "file", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L121-L164
[ "def", "load_c3d", "(", "self", ",", "filename", ",", "start_frame", "=", "0", ",", "max_frames", "=", "int", "(", "1e300", ")", ")", ":", "import", "c3d", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "handle", ":", "reader", "=", "c3d", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Markers.process_data
Process data to produce velocity and dropout information.
pagoda/cooper.py
def process_data(self): '''Process data to produce velocity and dropout information.''' self.visibility = self.data[:, :, 3] self.positions = self.data[:, :, :3] self.velocities = np.zeros_like(self.positions) + 1000 for frame_no in range(1, len(self.data) - 1): prev ...
def process_data(self): '''Process data to produce velocity and dropout information.''' self.visibility = self.data[:, :, 3] self.positions = self.data[:, :, :3] self.velocities = np.zeros_like(self.positions) + 1000 for frame_no in range(1, len(self.data) - 1): prev ...
[ "Process", "data", "to", "produce", "velocity", "and", "dropout", "information", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L166-L178
[ "def", "process_data", "(", "self", ")", ":", "self", ".", "visibility", "=", "self", ".", "data", "[", ":", ",", ":", ",", "3", "]", "self", ".", "positions", "=", "self", ".", "data", "[", ":", ",", ":", ",", ":", "3", "]", "self", ".", "ve...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Markers.create_bodies
Create physics bodies corresponding to each marker in our data.
pagoda/cooper.py
def create_bodies(self): '''Create physics bodies corresponding to each marker in our data.''' self.bodies = {} for label in self.channels: body = self.world.create_body( 'sphere', name='marker:{}'.format(label), radius=0.02) body.is_kinematic = True ...
def create_bodies(self): '''Create physics bodies corresponding to each marker in our data.''' self.bodies = {} for label in self.channels: body = self.world.create_body( 'sphere', name='marker:{}'.format(label), radius=0.02) body.is_kinematic = True ...
[ "Create", "physics", "bodies", "corresponding", "to", "each", "marker", "in", "our", "data", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L180-L188
[ "def", "create_bodies", "(", "self", ")", ":", "self", ".", "bodies", "=", "{", "}", "for", "label", "in", "self", ".", "channels", ":", "body", "=", "self", ".", "world", ".", "create_body", "(", "'sphere'", ",", "name", "=", "'marker:{}'", ".", "fo...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Markers.load_attachments
Load attachment configuration from the given text source. The attachment configuration file has a simple format. After discarding Unix-style comments (any part of a line that starts with the pound (#) character), each line in the file is then expected to have the following format:: ...
pagoda/cooper.py
def load_attachments(self, source, skeleton): '''Load attachment configuration from the given text source. The attachment configuration file has a simple format. After discarding Unix-style comments (any part of a line that starts with the pound (#) character), each line in the file is ...
def load_attachments(self, source, skeleton): '''Load attachment configuration from the given text source. The attachment configuration file has a simple format. After discarding Unix-style comments (any part of a line that starts with the pound (#) character), each line in the file is ...
[ "Load", "attachment", "configuration", "from", "the", "given", "text", "source", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L190-L246
[ "def", "load_attachments", "(", "self", ",", "source", ",", "skeleton", ")", ":", "self", ".", "targets", "=", "{", "}", "self", ".", "offsets", "=", "{", "}", "filename", "=", "source", "if", "isinstance", "(", "source", ",", "str", ")", ":", "sourc...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Markers.attach
Attach marker bodies to the corresponding skeleton bodies. Attachments are only made for markers that are not in a dropout state in the given frame. Parameters ---------- frame_no : int The frame of data we will use for attaching marker bodies.
pagoda/cooper.py
def attach(self, frame_no): '''Attach marker bodies to the corresponding skeleton bodies. Attachments are only made for markers that are not in a dropout state in the given frame. Parameters ---------- frame_no : int The frame of data we will use for attachi...
def attach(self, frame_no): '''Attach marker bodies to the corresponding skeleton bodies. Attachments are only made for markers that are not in a dropout state in the given frame. Parameters ---------- frame_no : int The frame of data we will use for attachi...
[ "Attach", "marker", "bodies", "to", "the", "corresponding", "skeleton", "bodies", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L253-L281
[ "def", "attach", "(", "self", ",", "frame_no", ")", ":", "assert", "not", "self", ".", "joints", "for", "label", ",", "j", "in", "self", ".", "channels", ".", "items", "(", ")", ":", "target", "=", "self", ".", "targets", ".", "get", "(", "label", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Markers.reposition
Reposition markers to a specific frame of data. Parameters ---------- frame_no : int The frame of data where we should reposition marker bodies. Markers will be positioned in the appropriate places in world coordinates. In addition, linear velocities of the m...
pagoda/cooper.py
def reposition(self, frame_no): '''Reposition markers to a specific frame of data. Parameters ---------- frame_no : int The frame of data where we should reposition marker bodies. Markers will be positioned in the appropriate places in world coordinates. ...
def reposition(self, frame_no): '''Reposition markers to a specific frame of data. Parameters ---------- frame_no : int The frame of data where we should reposition marker bodies. Markers will be positioned in the appropriate places in world coordinates. ...
[ "Reposition", "markers", "to", "a", "specific", "frame", "of", "data", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L283-L297
[ "def", "reposition", "(", "self", ",", "frame_no", ")", ":", "for", "label", ",", "j", "in", "self", ".", "channels", ".", "items", "(", ")", ":", "body", "=", "self", ".", "bodies", "[", "label", "]", "body", ".", "position", "=", "self", ".", "...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Markers.distances
Get a list of the distances between markers and their attachments. Returns ------- distances : ndarray of shape (num-markers, 3) Array of distances for each marker joint in our attachment setup. If a marker does not currently have an associated joint (e.g. because ...
pagoda/cooper.py
def distances(self): '''Get a list of the distances between markers and their attachments. Returns ------- distances : ndarray of shape (num-markers, 3) Array of distances for each marker joint in our attachment setup. If a marker does not currently have an assoc...
def distances(self): '''Get a list of the distances between markers and their attachments. Returns ------- distances : ndarray of shape (num-markers, 3) Array of distances for each marker joint in our attachment setup. If a marker does not currently have an assoc...
[ "Get", "a", "list", "of", "the", "distances", "between", "markers", "and", "their", "attachments", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L299-L314
[ "def", "distances", "(", "self", ")", ":", "distances", "=", "[", "]", "for", "label", "in", "self", ".", "labels", ":", "joint", "=", "self", ".", "joints", ".", "get", "(", "label", ")", "distances", ".", "append", "(", "[", "np", ".", "nan", "...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Markers.forces
Return an array of the forces exerted by marker springs. Notes ----- The forces exerted by the marker springs can be approximated by:: F = kp * dx where ``dx`` is the current array of marker distances. An even more accurate value is computed by approximating the vel...
pagoda/cooper.py
def forces(self, dx_tm1=None): '''Return an array of the forces exerted by marker springs. Notes ----- The forces exerted by the marker springs can be approximated by:: F = kp * dx where ``dx`` is the current array of marker distances. An even more accurate ...
def forces(self, dx_tm1=None): '''Return an array of the forces exerted by marker springs. Notes ----- The forces exerted by the marker springs can be approximated by:: F = kp * dx where ``dx`` is the current array of marker distances. An even more accurate ...
[ "Return", "an", "array", "of", "the", "forces", "exerted", "by", "marker", "springs", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L316-L353
[ "def", "forces", "(", "self", ",", "dx_tm1", "=", "None", ")", ":", "cfm", "=", "self", ".", "cfms", "[", "self", ".", "_frame_no", "]", "[", ":", ",", "None", "]", "kp", "=", "self", ".", "erp", "/", "(", "cfm", "*", "self", ".", "world", "....
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.load_skeleton
Create and configure a skeleton in our model. Parameters ---------- filename : str The name of a file containing skeleton configuration data. pid_params : dict, optional If given, use this dictionary to set the PID controller parameters on each joint ...
pagoda/cooper.py
def load_skeleton(self, filename, pid_params=None): '''Create and configure a skeleton in our model. Parameters ---------- filename : str The name of a file containing skeleton configuration data. pid_params : dict, optional If given, use this dictionary ...
def load_skeleton(self, filename, pid_params=None): '''Create and configure a skeleton in our model. Parameters ---------- filename : str The name of a file containing skeleton configuration data. pid_params : dict, optional If given, use this dictionary ...
[ "Create", "and", "configure", "a", "skeleton", "in", "our", "model", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L411-L428
[ "def", "load_skeleton", "(", "self", ",", "filename", ",", "pid_params", "=", "None", ")", ":", "self", ".", "skeleton", "=", "skeleton", ".", "Skeleton", "(", "self", ")", "self", ".", "skeleton", ".", "load", "(", "filename", ",", "color", "=", "(", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.load_markers
Load marker data and attachment preferences into the model. Parameters ---------- filename : str The name of a file containing marker data. This currently needs to be either a .C3D or a .CSV file. CSV files must adhere to a fairly strict column naming convent...
pagoda/cooper.py
def load_markers(self, filename, attachments, max_frames=1e100): '''Load marker data and attachment preferences into the model. Parameters ---------- filename : str The name of a file containing marker data. This currently needs to be either a .C3D or a .CSV file...
def load_markers(self, filename, attachments, max_frames=1e100): '''Load marker data and attachment preferences into the model. Parameters ---------- filename : str The name of a file containing marker data. This currently needs to be either a .C3D or a .CSV file...
[ "Load", "marker", "data", "and", "attachment", "preferences", "into", "the", "model", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L430-L461
[ "def", "load_markers", "(", "self", ",", "filename", ",", "attachments", ",", "max_frames", "=", "1e100", ")", ":", "self", ".", "markers", "=", "Markers", "(", "self", ")", "fn", "=", "filename", ".", "lower", "(", ")", "if", "fn", ".", "endswith", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.step
Advance the physics world by one step. Typically this is called as part of a :class:`pagoda.viewer.Viewer`, but it can also be called manually (or some other stepping mechanism entirely can be used).
pagoda/cooper.py
def step(self, substeps=2): '''Advance the physics world by one step. Typically this is called as part of a :class:`pagoda.viewer.Viewer`, but it can also be called manually (or some other stepping mechanism entirely can be used). ''' # by default we step by following ou...
def step(self, substeps=2): '''Advance the physics world by one step. Typically this is called as part of a :class:`pagoda.viewer.Viewer`, but it can also be called manually (or some other stepping mechanism entirely can be used). ''' # by default we step by following ou...
[ "Advance", "the", "physics", "world", "by", "one", "step", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L463-L475
[ "def", "step", "(", "self", ",", "substeps", "=", "2", ")", ":", "# by default we step by following our loaded marker data.", "self", ".", "frame_no", "+=", "1", "try", ":", "next", "(", "self", ".", "follower", ")", "except", "(", "AttributeError", ",", "Stop...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.settle_to_markers
Settle the skeleton to our marker data at a specific frame. Parameters ---------- frame_no : int, optional Settle the skeleton to marker data at this frame. Defaults to 0. max_distance : float, optional The settling process will stop when the mean marker distance...
pagoda/cooper.py
def settle_to_markers(self, frame_no=0, max_distance=0.05, max_iters=300, states=None): '''Settle the skeleton to our marker data at a specific frame. Parameters ---------- frame_no : int, optional Settle the skeleton to marker data at this frame. D...
def settle_to_markers(self, frame_no=0, max_distance=0.05, max_iters=300, states=None): '''Settle the skeleton to our marker data at a specific frame. Parameters ---------- frame_no : int, optional Settle the skeleton to marker data at this frame. D...
[ "Settle", "the", "skeleton", "to", "our", "marker", "data", "at", "a", "specific", "frame", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L487-L521
[ "def", "settle_to_markers", "(", "self", ",", "frame_no", "=", "0", ",", "max_distance", "=", "0.05", ",", "max_iters", "=", "300", ",", "states", "=", "None", ")", ":", "if", "states", "is", "not", "None", ":", "self", ".", "skeleton", ".", "set_body_...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.follow_markers
Iterate over a set of marker data, dragging its skeleton along. Parameters ---------- start : int, optional Start following marker data after this frame. Defaults to 0. end : int, optional Stop following marker data after this frame. Defaults to the end of ...
pagoda/cooper.py
def follow_markers(self, start=0, end=1e100, states=None): '''Iterate over a set of marker data, dragging its skeleton along. Parameters ---------- start : int, optional Start following marker data after this frame. Defaults to 0. end : int, optional Stop...
def follow_markers(self, start=0, end=1e100, states=None): '''Iterate over a set of marker data, dragging its skeleton along. Parameters ---------- start : int, optional Start following marker data after this frame. Defaults to 0. end : int, optional Stop...
[ "Iterate", "over", "a", "set", "of", "marker", "data", "dragging", "its", "skeleton", "along", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L523-L545
[ "def", "follow_markers", "(", "self", ",", "start", "=", "0", ",", "end", "=", "1e100", ",", "states", "=", "None", ")", ":", "if", "states", "is", "not", "None", ":", "self", ".", "skeleton", ".", "set_body_states", "(", "states", ")", "for", "frame...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World._step_to_marker_frame
Update the simulator to a specific frame of marker data. This method returns a generator of body states for the skeleton! This generator must be exhausted (e.g., by consuming this call in a for loop) for the simulator to work properly. This process involves the following steps: ...
pagoda/cooper.py
def _step_to_marker_frame(self, frame_no, dt=None): '''Update the simulator to a specific frame of marker data. This method returns a generator of body states for the skeleton! This generator must be exhausted (e.g., by consuming this call in a for loop) for the simulator to work proper...
def _step_to_marker_frame(self, frame_no, dt=None): '''Update the simulator to a specific frame of marker data. This method returns a generator of body states for the skeleton! This generator must be exhausted (e.g., by consuming this call in a for loop) for the simulator to work proper...
[ "Update", "the", "simulator", "to", "a", "specific", "frame", "of", "marker", "data", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L547-L596
[ "def", "_step_to_marker_frame", "(", "self", ",", "frame_no", ",", "dt", "=", "None", ")", ":", "# update the positions and velocities of the markers.", "self", ".", "markers", ".", "detach", "(", ")", "self", ".", "markers", ".", "reposition", "(", "frame_no", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.inverse_kinematics
Follow a set of marker data, yielding kinematic joint angles. Parameters ---------- start : int, optional Start following marker data after this frame. Defaults to 0. end : int, optional Stop following marker data after this frame. Defaults to the end of ...
pagoda/cooper.py
def inverse_kinematics(self, start=0, end=1e100, states=None, max_force=20): '''Follow a set of marker data, yielding kinematic joint angles. Parameters ---------- start : int, optional Start following marker data after this frame. Defaults to 0. end : int, optional ...
def inverse_kinematics(self, start=0, end=1e100, states=None, max_force=20): '''Follow a set of marker data, yielding kinematic joint angles. Parameters ---------- start : int, optional Start following marker data after this frame. Defaults to 0. end : int, optional ...
[ "Follow", "a", "set", "of", "marker", "data", "yielding", "kinematic", "joint", "angles", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L598-L631
[ "def", "inverse_kinematics", "(", "self", ",", "start", "=", "0", ",", "end", "=", "1e100", ",", "states", "=", "None", ",", "max_force", "=", "20", ")", ":", "zeros", "=", "None", "if", "max_force", ">", "0", ":", "self", ".", "skeleton", ".", "en...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.inverse_dynamics
Follow a set of angle data, yielding dynamic joint torques. Parameters ---------- angles : ndarray (num-frames x num-dofs) Follow angle data provided by this array of angle values. start : int, optional Start following angle data after this frame. Defaults to the...
pagoda/cooper.py
def inverse_dynamics(self, angles, start=0, end=1e100, states=None, max_force=100): '''Follow a set of angle data, yielding dynamic joint torques. Parameters ---------- angles : ndarray (num-frames x num-dofs) Follow angle data provided by this array of angle values. ...
def inverse_dynamics(self, angles, start=0, end=1e100, states=None, max_force=100): '''Follow a set of angle data, yielding dynamic joint torques. Parameters ---------- angles : ndarray (num-frames x num-dofs) Follow angle data provided by this array of angle values. ...
[ "Follow", "a", "set", "of", "angle", "data", "yielding", "dynamic", "joint", "torques", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L633-L694
[ "def", "inverse_dynamics", "(", "self", ",", "angles", ",", "start", "=", "0", ",", "end", "=", "1e100", ",", "states", "=", "None", ",", "max_force", "=", "100", ")", ":", "if", "states", "is", "not", "None", ":", "self", ".", "skeleton", ".", "se...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.forward_dynamics
Move the body according to a set of torque data.
pagoda/cooper.py
def forward_dynamics(self, torques, start=0, states=None): '''Move the body according to a set of torque data.''' if states is not None: self.skeleton.set_body_states(states) for frame_no, torque in enumerate(torques): if frame_no < start: continue ...
def forward_dynamics(self, torques, start=0, states=None): '''Move the body according to a set of torque data.''' if states is not None: self.skeleton.set_body_states(states) for frame_no, torque in enumerate(torques): if frame_no < start: continue ...
[ "Move", "the", "body", "according", "to", "a", "set", "of", "torque", "data", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L696-L709
[ "def", "forward_dynamics", "(", "self", ",", "torques", ",", "start", "=", "0", ",", "states", "=", "None", ")", ":", "if", "states", "is", "not", "None", ":", "self", ".", "skeleton", ".", "set_body_states", "(", "states", ")", "for", "frame_no", ",",...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
resorted
Sort values, but put numbers after alphabetically sorted words. This function is here to make outputs diff-compatible with Aleph. Example:: >>> sorted(["b", "1", "a"]) ['1', 'a', 'b'] >>> resorted(["b", "1", "a"]) ['a', 'b', '1'] Args: values (iterable): any iterab...
src/marcxml_parser/tools/resorted.py
def resorted(values): """ Sort values, but put numbers after alphabetically sorted words. This function is here to make outputs diff-compatible with Aleph. Example:: >>> sorted(["b", "1", "a"]) ['1', 'a', 'b'] >>> resorted(["b", "1", "a"]) ['a', 'b', '1'] Args: ...
def resorted(values): """ Sort values, but put numbers after alphabetically sorted words. This function is here to make outputs diff-compatible with Aleph. Example:: >>> sorted(["b", "1", "a"]) ['1', 'a', 'b'] >>> resorted(["b", "1", "a"]) ['a', 'b', '1'] Args: ...
[ "Sort", "values", "but", "put", "numbers", "after", "alphabetically", "sorted", "words", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/tools/resorted.py#L10-L47
[ "def", "resorted", "(", "values", ")", ":", "if", "not", "values", ":", "return", "values", "values", "=", "sorted", "(", "values", ")", "# look for first word", "first_word", "=", "next", "(", "(", "cnt", "for", "cnt", ",", "val", "in", "enumerate", "("...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
Viewer.render
Draw all bodies in the world.
pagoda/viewer.py
def render(self, dt): '''Draw all bodies in the world.''' for frame in self._frozen: for body in frame: self.draw_body(body) for body in self.world.bodies: self.draw_body(body) if hasattr(self.world, 'markers'): # draw line between anc...
def render(self, dt): '''Draw all bodies in the world.''' for frame in self._frozen: for body in frame: self.draw_body(body) for body in self.world.bodies: self.draw_body(body) if hasattr(self.world, 'markers'): # draw line between anc...
[ "Draw", "all", "bodies", "in", "the", "world", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/viewer.py#L94-L110
[ "def", "render", "(", "self", ",", "dt", ")", ":", "for", "frame", "in", "self", ".", "_frozen", ":", "for", "body", "in", "frame", ":", "self", ".", "draw_body", "(", "body", ")", "for", "body", "in", "self", ".", "world", ".", "bodies", ":", "s...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Room.get_stream
Get room stream to listen for messages. Kwargs: error_callback (func): Callback to call when an error occurred (parameters: exception) live (bool): If True, issue a live stream, otherwise an offline stream Returns: :class:`Stream`. Stream
pyfire/room.py
def get_stream(self, error_callback=None, live=True): """ Get room stream to listen for messages. Kwargs: error_callback (func): Callback to call when an error occurred (parameters: exception) live (bool): If True, issue a live stream, otherwise an offline stream Return...
def get_stream(self, error_callback=None, live=True): """ Get room stream to listen for messages. Kwargs: error_callback (func): Callback to call when an error occurred (parameters: exception) live (bool): If True, issue a live stream, otherwise an offline stream Return...
[ "Get", "room", "stream", "to", "listen", "for", "messages", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/room.py#L30-L41
[ "def", "get_stream", "(", "self", ",", "error_callback", "=", "None", ",", "live", "=", "True", ")", ":", "self", ".", "join", "(", ")", "return", "Stream", "(", "self", ",", "error_callback", "=", "error_callback", ",", "live", "=", "live", ")" ]
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Room.get_users
Get list of users in the room. Kwargs: sort (bool): If True, sort rooms by name Returns: array. List of users
pyfire/room.py
def get_users(self, sort=True): """ Get list of users in the room. Kwargs: sort (bool): If True, sort rooms by name Returns: array. List of users """ self._load() if sort: self.users.sort(key=operator.itemgetter("name")) retur...
def get_users(self, sort=True): """ Get list of users in the room. Kwargs: sort (bool): If True, sort rooms by name Returns: array. List of users """ self._load() if sort: self.users.sort(key=operator.itemgetter("name")) retur...
[ "Get", "list", "of", "users", "in", "the", "room", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/room.py#L51-L63
[ "def", "get_users", "(", "self", ",", "sort", "=", "True", ")", ":", "self", ".", "_load", "(", ")", "if", "sort", ":", "self", ".", "users", ".", "sort", "(", "key", "=", "operator", ".", "itemgetter", "(", "\"name\"", ")", ")", "return", "self", ...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Room.recent
Recent messages. Kwargs: message_id (int): If specified, return messages since the specified message ID limit (int): If specified, limit the number of messages Returns: array. Messages
pyfire/room.py
def recent(self, message_id=None, limit=None): """ Recent messages. Kwargs: message_id (int): If specified, return messages since the specified message ID limit (int): If specified, limit the number of messages Returns: array. Messages """ pa...
def recent(self, message_id=None, limit=None): """ Recent messages. Kwargs: message_id (int): If specified, return messages since the specified message ID limit (int): If specified, limit the number of messages Returns: array. Messages """ pa...
[ "Recent", "messages", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/room.py#L89-L107
[ "def", "recent", "(", "self", ",", "message_id", "=", "None", ",", "limit", "=", "None", ")", ":", "parameters", "=", "{", "}", "if", "message_id", ":", "parameters", "[", "\"since_message_id\"", "]", "=", "message_id", "if", "limit", ":", "parameters", ...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Room.set_name
Set the room name. Args: name (str): Name Returns: bool. Success
pyfire/room.py
def set_name(self, name): """ Set the room name. Args: name (str): Name Returns: bool. Success """ if not self._campfire.get_user().admin: return False result = self._connection.put("room/%s" % self.id, {"room": {"name": name}}) ...
def set_name(self, name): """ Set the room name. Args: name (str): Name Returns: bool. Success """ if not self._campfire.get_user().admin: return False result = self._connection.put("room/%s" % self.id, {"room": {"name": name}}) ...
[ "Set", "the", "room", "name", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/room.py#L109-L124
[ "def", "set_name", "(", "self", ",", "name", ")", ":", "if", "not", "self", ".", "_campfire", ".", "get_user", "(", ")", ".", "admin", ":", "return", "False", "result", "=", "self", ".", "_connection", ".", "put", "(", "\"room/%s\"", "%", "self", "."...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Room.set_topic
Set the room topic. Args: topic (str): Topic Returns: bool. Success
pyfire/room.py
def set_topic(self, topic): """ Set the room topic. Args: topic (str): Topic Returns: bool. Success """ if not topic: topic = '' result = self._connection.put("room/%s" % self.id, {"room": {"topic": topic}}) if result["success...
def set_topic(self, topic): """ Set the room topic. Args: topic (str): Topic Returns: bool. Success """ if not topic: topic = '' result = self._connection.put("room/%s" % self.id, {"room": {"topic": topic}}) if result["success...
[ "Set", "the", "room", "topic", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/room.py#L126-L141
[ "def", "set_topic", "(", "self", ",", "topic", ")", ":", "if", "not", "topic", ":", "topic", "=", "''", "result", "=", "self", ".", "_connection", ".", "put", "(", "\"room/%s\"", "%", "self", ".", "id", ",", "{", "\"room\"", ":", "{", "\"topic\"", ...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Room.speak
Post a message. Args: message (:class:`Message` or string): Message Returns: bool. Success
pyfire/room.py
def speak(self, message): """ Post a message. Args: message (:class:`Message` or string): Message Returns: bool. Success """ campfire = self.get_campfire() if not isinstance(message, Message): message = Message(campfire, message) ...
def speak(self, message): """ Post a message. Args: message (:class:`Message` or string): Message Returns: bool. Success """ campfire = self.get_campfire() if not isinstance(message, Message): message = Message(campfire, message) ...
[ "Post", "a", "message", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/room.py#L143-L165
[ "def", "speak", "(", "self", ",", "message", ")", ":", "campfire", "=", "self", ".", "get_campfire", "(", ")", "if", "not", "isinstance", "(", "message", ",", "Message", ")", ":", "message", "=", "Message", "(", "campfire", ",", "message", ")", "result...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Room.transcript
Recent messages. Kwargs: for_date (date): If specified, get the transcript for this specific date Returns: array. Messages
pyfire/room.py
def transcript(self, for_date=None): """ Recent messages. Kwargs: for_date (date): If specified, get the transcript for this specific date Returns: array. Messages """ url = "room/%s/transcript" % self.id if for_date: url = "%s/%d/%d/...
def transcript(self, for_date=None): """ Recent messages. Kwargs: for_date (date): If specified, get the transcript for this specific date Returns: array. Messages """ url = "room/%s/transcript" % self.id if for_date: url = "%s/%d/%d/...
[ "Recent", "messages", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/room.py#L167-L182
[ "def", "transcript", "(", "self", ",", "for_date", "=", "None", ")", ":", "url", "=", "\"room/%s/transcript\"", "%", "self", ".", "id", "if", "for_date", ":", "url", "=", "\"%s/%d/%d/%d\"", "%", "(", "url", ",", "for_date", ".", "year", ",", "for_date", ...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Room.upload
Create a new thread to upload a file (thread should be then started with start() to perform upload.) Args: path (str): Path to file Kwargs: progress_callback (func): Callback to call as file is uploaded (parameters: current, total) finished_callback (func): ...
pyfire/room.py
def upload(self, path, progress_callback=None, finished_callback=None, error_callback=None): """ Create a new thread to upload a file (thread should be then started with start() to perform upload.) Args: path (str): Path to file Kwargs: progress_callback (func):...
def upload(self, path, progress_callback=None, finished_callback=None, error_callback=None): """ Create a new thread to upload a file (thread should be then started with start() to perform upload.) Args: path (str): Path to file Kwargs: progress_callback (func):...
[ "Create", "a", "new", "thread", "to", "upload", "a", "file", "(", "thread", "should", "be", "then", "started", "with", "start", "()", "to", "perform", "upload", ".", ")" ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/room.py#L192-L213
[ "def", "upload", "(", "self", ",", "path", ",", "progress_callback", "=", "None", ",", "finished_callback", "=", "None", ",", "error_callback", "=", "None", ")", ":", "return", "Upload", "(", "self", ",", "{", "\"upload\"", ":", "path", "}", ",", "progre...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
get_new_call
Build a call to use the new ``get_config`` function from args passed to ``Config.__init__``.
config_resolver/core.py
def get_new_call(group_name, app_name, search_path, filename, require_load, version, secure): # type: (str, str, Optional[str], str, bool, Optional[str], bool) -> str ''' Build a call to use the new ``get_config`` function from args passed to ``Config.__init__``. ''' new_call_kw...
def get_new_call(group_name, app_name, search_path, filename, require_load, version, secure): # type: (str, str, Optional[str], str, bool, Optional[str], bool) -> str ''' Build a call to use the new ``get_config`` function from args passed to ``Config.__init__``. ''' new_call_kw...
[ "Build", "a", "call", "to", "use", "the", "new", "get_config", "function", "from", "args", "passed", "to", "Config", ".", "__init__", "." ]
exhuma/config_resolver
python
https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L63-L86
[ "def", "get_new_call", "(", "group_name", ",", "app_name", ",", "search_path", ",", "filename", ",", "require_load", ",", "version", ",", "secure", ")", ":", "# type: (str, str, Optional[str], str, bool, Optional[str], bool) -> str", "new_call_kwargs", "=", "{", "'group_n...
2614ae3d7a49e437954254846b2963ad249b418c
valid
build_call_str
Build a callable Python string for a function call. The output will be combined similar to this template:: <prefix>(<args>, <kwargs>) Example:: >>> build_call_str('foo', (1, 2), {'a': '10'}) "foo(1, 2, a='10')"
config_resolver/core.py
def build_call_str(prefix, args, kwargs): # type: (str, Any, Any) -> str ''' Build a callable Python string for a function call. The output will be combined similar to this template:: <prefix>(<args>, <kwargs>) Example:: >>> build_call_str('foo', (1, 2), {'a': '10'}) "foo(...
def build_call_str(prefix, args, kwargs): # type: (str, Any, Any) -> str ''' Build a callable Python string for a function call. The output will be combined similar to this template:: <prefix>(<args>, <kwargs>) Example:: >>> build_call_str('foo', (1, 2), {'a': '10'}) "foo(...
[ "Build", "a", "callable", "Python", "string", "for", "a", "function", "call", ".", "The", "output", "will", "be", "combined", "similar", "to", "this", "template", "::" ]
exhuma/config_resolver
python
https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L89-L113
[ "def", "build_call_str", "(", "prefix", ",", "args", ",", "kwargs", ")", ":", "# type: (str, Any, Any) -> str", "kwargs_str", "=", "', '", ".", "join", "(", "[", "'%s=%r'", "%", "(", "key", ",", "value", ")", "for", "key", ",", "value", "in", "kwargs", "...
2614ae3d7a49e437954254846b2963ad249b418c
valid
Config.get_xdg_dirs
Returns a list of paths specified by the XDG_CONFIG_DIRS environment variable or the appropriate default. The list is sorted by precedence, with the most important item coming *last* (required by the existing config_resolver logic).
config_resolver/core.py
def get_xdg_dirs(self): # type: () -> List[str] """ Returns a list of paths specified by the XDG_CONFIG_DIRS environment variable or the appropriate default. The list is sorted by precedence, with the most important item coming *last* (required by the existing config_res...
def get_xdg_dirs(self): # type: () -> List[str] """ Returns a list of paths specified by the XDG_CONFIG_DIRS environment variable or the appropriate default. The list is sorted by precedence, with the most important item coming *last* (required by the existing config_res...
[ "Returns", "a", "list", "of", "paths", "specified", "by", "the", "XDG_CONFIG_DIRS", "environment", "variable", "or", "the", "appropriate", "default", "." ]
exhuma/config_resolver
python
https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L204-L220
[ "def", "get_xdg_dirs", "(", "self", ")", ":", "# type: () -> List[str]", "config_dirs", "=", "getenv", "(", "'XDG_CONFIG_DIRS'", ",", "''", ")", "if", "config_dirs", ":", "self", ".", "_log", ".", "debug", "(", "'XDG_CONFIG_DIRS is set to %r'", ",", "config_dirs",...
2614ae3d7a49e437954254846b2963ad249b418c
valid
Config.get_xdg_home
Returns the value specified in the XDG_CONFIG_HOME environment variable or the appropriate default.
config_resolver/core.py
def get_xdg_home(self): # type: () -> str """ Returns the value specified in the XDG_CONFIG_HOME environment variable or the appropriate default. """ config_home = getenv('XDG_CONFIG_HOME', '') if config_home: self._log.debug('XDG_CONFIG_HOME is set to...
def get_xdg_home(self): # type: () -> str """ Returns the value specified in the XDG_CONFIG_HOME environment variable or the appropriate default. """ config_home = getenv('XDG_CONFIG_HOME', '') if config_home: self._log.debug('XDG_CONFIG_HOME is set to...
[ "Returns", "the", "value", "specified", "in", "the", "XDG_CONFIG_HOME", "environment", "variable", "or", "the", "appropriate", "default", "." ]
exhuma/config_resolver
python
https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L222-L232
[ "def", "get_xdg_home", "(", "self", ")", ":", "# type: () -> str", "config_home", "=", "getenv", "(", "'XDG_CONFIG_HOME'", ",", "''", ")", "if", "config_home", ":", "self", ".", "_log", ".", "debug", "(", "'XDG_CONFIG_HOME is set to %r'", ",", "config_home", ")"...
2614ae3d7a49e437954254846b2963ad249b418c
valid
Config._effective_filename
Returns the filename which is effectively used by the application. If overridden by an environment variable, it will return that filename.
config_resolver/core.py
def _effective_filename(self): # type: () -> str """ Returns the filename which is effectively used by the application. If overridden by an environment variable, it will return that filename. """ # same logic for the configuration filename. First, check if we were ...
def _effective_filename(self): # type: () -> str """ Returns the filename which is effectively used by the application. If overridden by an environment variable, it will return that filename. """ # same logic for the configuration filename. First, check if we were ...
[ "Returns", "the", "filename", "which", "is", "effectively", "used", "by", "the", "application", ".", "If", "overridden", "by", "an", "environment", "variable", "it", "will", "return", "that", "filename", "." ]
exhuma/config_resolver
python
https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L234-L255
[ "def", "_effective_filename", "(", "self", ")", ":", "# type: () -> str", "# same logic for the configuration filename. First, check if we were", "# initialized with a filename...", "config_filename", "=", "''", "if", "self", ".", "filename", ":", "config_filename", "=", "self"...
2614ae3d7a49e437954254846b2963ad249b418c
valid
Config._effective_path
Returns a list of paths to search for config files in reverse order of precedence. In other words: the last path element will override the settings from the first one.
config_resolver/core.py
def _effective_path(self): # type: () -> List[str] """ Returns a list of paths to search for config files in reverse order of precedence. In other words: the last path element will override the settings from the first one. """ # default search path path =...
def _effective_path(self): # type: () -> List[str] """ Returns a list of paths to search for config files in reverse order of precedence. In other words: the last path element will override the settings from the first one. """ # default search path path =...
[ "Returns", "a", "list", "of", "paths", "to", "search", "for", "config", "files", "in", "reverse", "order", "of", "precedence", ".", "In", "other", "words", ":", "the", "last", "path", "element", "will", "override", "the", "settings", "from", "the", "first"...
exhuma/config_resolver
python
https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L257-L294
[ "def", "_effective_path", "(", "self", ")", ":", "# type: () -> List[str]", "# default search path", "path", "=", "(", "[", "'/etc/%s/%s'", "%", "(", "self", ".", "group_name", ",", "self", ".", "app_name", ")", "]", "+", "self", ".", "get_xdg_dirs", "(", ")...
2614ae3d7a49e437954254846b2963ad249b418c
valid
Config.check_file
Check if ``filename`` can be read. Will return boolean which is True if the file can be read, False otherwise.
config_resolver/core.py
def check_file(self, filename): # type: (str) -> bool """ Check if ``filename`` can be read. Will return boolean which is True if the file can be read, False otherwise. """ if not exists(filename): return False # Check if the file is version-compatibl...
def check_file(self, filename): # type: (str) -> bool """ Check if ``filename`` can be read. Will return boolean which is True if the file can be read, False otherwise. """ if not exists(filename): return False # Check if the file is version-compatibl...
[ "Check", "if", "filename", "can", "be", "read", ".", "Will", "return", "boolean", "which", "is", "True", "if", "the", "file", "can", "be", "read", "False", "otherwise", "." ]
exhuma/config_resolver
python
https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L296-L346
[ "def", "check_file", "(", "self", ",", "filename", ")", ":", "# type: (str) -> bool", "if", "not", "exists", "(", "filename", ")", ":", "return", "False", "# Check if the file is version-compatible with this instance.", "new_config", "=", "ConfigResolverBase", "(", ")",...
2614ae3d7a49e437954254846b2963ad249b418c
valid
Config.get
Overrides :py:meth:`configparser.ConfigParser.get`. In addition to ``section`` and ``option``, this call takes an optional ``default`` value. This behaviour works in *addition* to the :py:class:`configparser.ConfigParser` default mechanism. Note that a default value from ``ConfigParser`...
config_resolver/core.py
def get(self, section, option, **kwargs): # type: ignore # type: (str, str, Any) -> Any """ Overrides :py:meth:`configparser.ConfigParser.get`. In addition to ``section`` and ``option``, this call takes an optional ``default`` value. This behaviour works in *addition* to the ...
def get(self, section, option, **kwargs): # type: ignore # type: (str, str, Any) -> Any """ Overrides :py:meth:`configparser.ConfigParser.get`. In addition to ``section`` and ``option``, this call takes an optional ``default`` value. This behaviour works in *addition* to the ...
[ "Overrides", ":", "py", ":", "meth", ":", "configparser", ".", "ConfigParser", ".", "get", "." ]
exhuma/config_resolver
python
https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L348-L396
[ "def", "get", "(", "self", ",", "section", ",", "option", ",", "*", "*", "kwargs", ")", ":", "# type: ignore", "# type: (str, str, Any) -> Any", "if", "\"default\"", "in", "kwargs", ":", "default", "=", "kwargs", ".", "pop", "(", "\"default\"", ")", "new_kwa...
2614ae3d7a49e437954254846b2963ad249b418c
valid
Config.load
Searches for an appropriate config file. If found, loads the file into the current instance. This method can also be used to reload a configuration. Note that you may want to set ``reload`` to ``True`` to clear the configuration before loading in that case. Without doing that, values wi...
config_resolver/core.py
def load(self, reload=False, require_load=False): # type: (bool, bool) -> None """ Searches for an appropriate config file. If found, loads the file into the current instance. This method can also be used to reload a configuration. Note that you may want to set ``reload`` to ``Tr...
def load(self, reload=False, require_load=False): # type: (bool, bool) -> None """ Searches for an appropriate config file. If found, loads the file into the current instance. This method can also be used to reload a configuration. Note that you may want to set ``reload`` to ``Tr...
[ "Searches", "for", "an", "appropriate", "config", "file", ".", "If", "found", "loads", "the", "file", "into", "the", "current", "instance", ".", "This", "method", "can", "also", "be", "used", "to", "reload", "a", "configuration", ".", "Note", "that", "you"...
exhuma/config_resolver
python
https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L398-L458
[ "def", "load", "(", "self", ",", "reload", "=", "False", ",", "require_load", "=", "False", ")", ":", "# type: (bool, bool) -> None", "if", "reload", ":", "# pragma: no cover", "self", ".", "config", "=", "None", "# only load the config if necessary (or explicitly req...
2614ae3d7a49e437954254846b2963ad249b418c
valid
SecuredConfig.check_file
Overrides :py:meth:`.Config.check_file`
config_resolver/core.py
def check_file(self, filename): # type: (str) -> bool """ Overrides :py:meth:`.Config.check_file` """ can_read = super(SecuredConfig, self).check_file(filename) if not can_read: return False mode = get_stat(filename).st_mode if (mode & stat.S_...
def check_file(self, filename): # type: (str) -> bool """ Overrides :py:meth:`.Config.check_file` """ can_read = super(SecuredConfig, self).check_file(filename) if not can_read: return False mode = get_stat(filename).st_mode if (mode & stat.S_...
[ "Overrides", ":", "py", ":", "meth", ":", ".", "Config", ".", "check_file" ]
exhuma/config_resolver
python
https://github.com/exhuma/config_resolver/blob/2614ae3d7a49e437954254846b2963ad249b418c/config_resolver/core.py#L467-L481
[ "def", "check_file", "(", "self", ",", "filename", ")", ":", "# type: (str) -> bool", "can_read", "=", "super", "(", "SecuredConfig", ",", "self", ")", ".", "check_file", "(", "filename", ")", "if", "not", "can_read", ":", "return", "False", "mode", "=", "...
2614ae3d7a49e437954254846b2963ad249b418c
valid
WSGIServer.setup_environ
https://www.python.org/dev/peps/pep-0333/#environ-variables
bustard/wsgi_server.py
def setup_environ(self): """https://www.python.org/dev/peps/pep-0333/#environ-variables""" # Set up base environment env = self.base_environ = {} env['SERVER_NAME'] = self.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PORT'] = str(self.server_port) ...
def setup_environ(self): """https://www.python.org/dev/peps/pep-0333/#environ-variables""" # Set up base environment env = self.base_environ = {} env['SERVER_NAME'] = self.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PORT'] = str(self.server_port) ...
[ "https", ":", "//", "www", ".", "python", ".", "org", "/", "dev", "/", "peps", "/", "pep", "-", "0333", "/", "#environ", "-", "variables" ]
mozillazg/bustard
python
https://github.com/mozillazg/bustard/blob/bd7b47f3ba5440cf6ea026c8b633060fedeb80b7/bustard/wsgi_server.py#L50-L59
[ "def", "setup_environ", "(", "self", ")", ":", "# Set up base environment", "env", "=", "self", ".", "base_environ", "=", "{", "}", "env", "[", "'SERVER_NAME'", "]", "=", "self", ".", "server_name", "env", "[", "'GATEWAY_INTERFACE'", "]", "=", "'CGI/1.1'", "...
bd7b47f3ba5440cf6ea026c8b633060fedeb80b7
valid
WSGIServer.get_environ
https://www.python.org/dev/peps/pep-0333/#environ-variables
bustard/wsgi_server.py
def get_environ(self): """https://www.python.org/dev/peps/pep-0333/#environ-variables""" env = self.base_environ.copy() env['REQUEST_METHOD'] = self.request_method if '?' in self.path: path, query = self.path.split('?', 1) else: path, query = self.path, '...
def get_environ(self): """https://www.python.org/dev/peps/pep-0333/#environ-variables""" env = self.base_environ.copy() env['REQUEST_METHOD'] = self.request_method if '?' in self.path: path, query = self.path.split('?', 1) else: path, query = self.path, '...
[ "https", ":", "//", "www", ".", "python", ".", "org", "/", "dev", "/", "peps", "/", "pep", "-", "0333", "/", "#environ", "-", "variables" ]
mozillazg/bustard
python
https://github.com/mozillazg/bustard/blob/bd7b47f3ba5440cf6ea026c8b633060fedeb80b7/bustard/wsgi_server.py#L112-L144
[ "def", "get_environ", "(", "self", ")", ":", "env", "=", "self", ".", "base_environ", ".", "copy", "(", ")", "env", "[", "'REQUEST_METHOD'", "]", "=", "self", ".", "request_method", "if", "'?'", "in", "self", ".", "path", ":", "path", ",", "query", "...
bd7b47f3ba5440cf6ea026c8b633060fedeb80b7
valid
StylesResource.get
Get styles.
invenio_csl_rest/views.py
def get(self, q=None, page=None): """Get styles.""" # Check cache to exit early if needed etag = generate_etag(current_ext.content_version.encode('utf8')) self.check_etag(etag, weak=True) # Build response res = jsonify(current_ext.styles) res.set_etag(etag) ...
def get(self, q=None, page=None): """Get styles.""" # Check cache to exit early if needed etag = generate_etag(current_ext.content_version.encode('utf8')) self.check_etag(etag, weak=True) # Build response res = jsonify(current_ext.styles) res.set_etag(etag) ...
[ "Get", "styles", "." ]
inveniosoftware/invenio-csl-rest
python
https://github.com/inveniosoftware/invenio-csl-rest/blob/a474a5b4caa9e6ae841a007fa52b30ad7e957560/invenio_csl_rest/views.py#L56-L66
[ "def", "get", "(", "self", ",", "q", "=", "None", ",", "page", "=", "None", ")", ":", "# Check cache to exit early if needed", "etag", "=", "generate_etag", "(", "current_ext", ".", "content_version", ".", "encode", "(", "'utf8'", ")", ")", "self", ".", "c...
a474a5b4caa9e6ae841a007fa52b30ad7e957560
valid
Connection.create_from_settings
Create a connection with given settings. Args: settings (dict): A dictionary of settings Returns: :class:`Connection`. The connection
pyfire/connection.py
def create_from_settings(settings): """ Create a connection with given settings. Args: settings (dict): A dictionary of settings Returns: :class:`Connection`. The connection """ return Connection( settings["url"], settings["base_...
def create_from_settings(settings): """ Create a connection with given settings. Args: settings (dict): A dictionary of settings Returns: :class:`Connection`. The connection """ return Connection( settings["url"], settings["base_...
[ "Create", "a", "connection", "with", "given", "settings", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L84-L100
[ "def", "create_from_settings", "(", "settings", ")", ":", "return", "Connection", "(", "settings", "[", "\"url\"", "]", ",", "settings", "[", "\"base_url\"", "]", ",", "settings", "[", "\"user\"", "]", ",", "settings", "[", "\"password\"", "]", ",", "authori...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Connection.delete
Issue a PUT request. Kwargs: url (str): Destination URL post_data (dict): Dictionary of parameter and values parse_data (bool): If true, parse response data key (string): If parse_data==True, look for this key when parsing data parameters (dict): Addi...
pyfire/connection.py
def delete(self, url=None, post_data={}, parse_data=False, key=None, parameters=None): """ Issue a PUT request. Kwargs: url (str): Destination URL post_data (dict): Dictionary of parameter and values parse_data (bool): If true, parse response data key (st...
def delete(self, url=None, post_data={}, parse_data=False, key=None, parameters=None): """ Issue a PUT request. Kwargs: url (str): Destination URL post_data (dict): Dictionary of parameter and values parse_data (bool): If true, parse response data key (st...
[ "Issue", "a", "PUT", "request", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L138-L154
[ "def", "delete", "(", "self", ",", "url", "=", "None", ",", "post_data", "=", "{", "}", ",", "parse_data", "=", "False", ",", "key", "=", "None", ",", "parameters", "=", "None", ")", ":", "return", "self", ".", "_fetch", "(", "\"DELETE\"", ",", "ur...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Connection.post
Issue a POST request. Kwargs: url (str): Destination URL post_data (dict): Dictionary of parameter and values parse_data (bool): If true, parse response data key (string): If parse_data==True, look for this key when parsing data parameters (dict): Add...
pyfire/connection.py
def post(self, url=None, post_data={}, parse_data=False, key=None, parameters=None, listener=None): """ Issue a POST request. Kwargs: url (str): Destination URL post_data (dict): Dictionary of parameter and values parse_data (bool): If true, parse response data ...
def post(self, url=None, post_data={}, parse_data=False, key=None, parameters=None, listener=None): """ Issue a POST request. Kwargs: url (str): Destination URL post_data (dict): Dictionary of parameter and values parse_data (bool): If true, parse response data ...
[ "Issue", "a", "POST", "request", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L174-L191
[ "def", "post", "(", "self", ",", "url", "=", "None", ",", "post_data", "=", "{", "}", ",", "parse_data", "=", "False", ",", "key", "=", "None", ",", "parameters", "=", "None", ",", "listener", "=", "None", ")", ":", "return", "self", ".", "_fetch",...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Connection.get
Issue a GET request. Kwargs: url (str): Destination URL parse_data (bool): If true, parse response data key (string): If parse_data==True, look for this key when parsing data parameters (dict): Additional GET parameters to append to the URL Returns: ...
pyfire/connection.py
def get(self, url=None, parse_data=True, key=None, parameters=None): """ Issue a GET request. Kwargs: url (str): Destination URL parse_data (bool): If true, parse response data key (string): If parse_data==True, look for this key when parsing data paramet...
def get(self, url=None, parse_data=True, key=None, parameters=None): """ Issue a GET request. Kwargs: url (str): Destination URL parse_data (bool): If true, parse response data key (string): If parse_data==True, look for this key when parsing data paramet...
[ "Issue", "a", "GET", "request", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L193-L208
[ "def", "get", "(", "self", ",", "url", "=", "None", ",", "parse_data", "=", "True", ",", "key", "=", "None", ",", "parameters", "=", "None", ")", ":", "return", "self", ".", "_fetch", "(", "\"GET\"", ",", "url", ",", "post_data", "=", "None", ",", ...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Connection.get_headers
Get headers. Returns: tuple: Headers
pyfire/connection.py
def get_headers(self): """ Get headers. Returns: tuple: Headers """ headers = { "User-Agent": "kFlame 1.0" } password_url = self._get_password_url() if password_url and password_url in self._settings["authorizations"]: headers...
def get_headers(self): """ Get headers. Returns: tuple: Headers """ headers = { "User-Agent": "kFlame 1.0" } password_url = self._get_password_url() if password_url and password_url in self._settings["authorizations"]: headers...
[ "Get", "headers", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L210-L224
[ "def", "get_headers", "(", "self", ")", ":", "headers", "=", "{", "\"User-Agent\"", ":", "\"kFlame 1.0\"", "}", "password_url", "=", "self", ".", "_get_password_url", "(", ")", "if", "password_url", "and", "password_url", "in", "self", ".", "_settings", "[", ...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Connection._get_password_url
Get URL used for authentication Returns: string: URL
pyfire/connection.py
def _get_password_url(self): """ Get URL used for authentication Returns: string: URL """ password_url = None if self._settings["user"] or self._settings["authorization"]: if self._settings["url"]: password_url = self._settings["url"] ...
def _get_password_url(self): """ Get URL used for authentication Returns: string: URL """ password_url = None if self._settings["user"] or self._settings["authorization"]: if self._settings["url"]: password_url = self._settings["url"] ...
[ "Get", "URL", "used", "for", "authentication" ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L226-L238
[ "def", "_get_password_url", "(", "self", ")", ":", "password_url", "=", "None", "if", "self", ".", "_settings", "[", "\"user\"", "]", "or", "self", ".", "_settings", "[", "\"authorization\"", "]", ":", "if", "self", ".", "_settings", "[", "\"url\"", "]", ...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Connection.parse
Parses a response. Args: text (str): Text to parse Kwargs: key (str): Key to look for, if any Returns: Parsed value Raises: ValueError
pyfire/connection.py
def parse(self, text, key=None): """ Parses a response. Args: text (str): Text to parse Kwargs: key (str): Key to look for, if any Returns: Parsed value Raises: ValueError """ try: data = json.loads(t...
def parse(self, text, key=None): """ Parses a response. Args: text (str): Text to parse Kwargs: key (str): Key to look for, if any Returns: Parsed value Raises: ValueError """ try: data = json.loads(t...
[ "Parses", "a", "response", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L240-L264
[ "def", "parse", "(", "self", ",", "text", ",", "key", "=", "None", ")", ":", "try", ":", "data", "=", "json", ".", "loads", "(", "text", ")", "except", "ValueError", "as", "e", ":", "raise", "ValueError", "(", "\"%s: Value: [%s]\"", "%", "(", "e", ...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Connection.build_twisted_request
Build a request for twisted Args: method (str): Request method (GET/POST/PUT/DELETE/etc.) If not specified, it will be POST if post_data is not None url (str): Destination URL (full, or relative) Kwargs: extra_headers (dict): Headers (override default connection hea...
pyfire/connection.py
def build_twisted_request(self, method, url, extra_headers={}, body_producer=None, full_url=False): """ Build a request for twisted Args: method (str): Request method (GET/POST/PUT/DELETE/etc.) If not specified, it will be POST if post_data is not None url (str): Destination URL...
def build_twisted_request(self, method, url, extra_headers={}, body_producer=None, full_url=False): """ Build a request for twisted Args: method (str): Request method (GET/POST/PUT/DELETE/etc.) If not specified, it will be POST if post_data is not None url (str): Destination URL...
[ "Build", "a", "request", "for", "twisted" ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L274-L302
[ "def", "build_twisted_request", "(", "self", ",", "method", ",", "url", ",", "extra_headers", "=", "{", "}", ",", "body_producer", "=", "None", ",", "full_url", "=", "False", ")", ":", "uri", "=", "url", "if", "full_url", "else", "self", ".", "_url", "...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Connection._fetch
Issue a request. Args: method (str): Request method (GET/POST/PUT/DELETE/etc.) If not specified, it will be POST if post_data is not None Kwargs: url (str): Destination URL post_data (str): A string of what to POST parse_data (bool): If true, parse respo...
pyfire/connection.py
def _fetch(self, method, url=None, post_data=None, parse_data=True, key=None, parameters=None, listener=None, full_return=False): """ Issue a request. Args: method (str): Request method (GET/POST/PUT/DELETE/etc.) If not specified, it will be POST if post_data is not None Kwargs: ...
def _fetch(self, method, url=None, post_data=None, parse_data=True, key=None, parameters=None, listener=None, full_return=False): """ Issue a request. Args: method (str): Request method (GET/POST/PUT/DELETE/etc.) If not specified, it will be POST if post_data is not None Kwargs: ...
[ "Issue", "a", "request", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L304-L394
[ "def", "_fetch", "(", "self", ",", "method", ",", "url", "=", "None", ",", "post_data", "=", "None", ",", "parse_data", "=", "True", ",", "key", "=", "None", ",", "parameters", "=", "None", ",", "listener", "=", "None", ",", "full_return", "=", "Fals...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Connection._url
Build destination URL. Kwargs: url (str): Destination URL parameters (dict): Additional GET parameters to append to the URL Returns: str. URL
pyfire/connection.py
def _url(self, url=None, parameters=None): """ Build destination URL. Kwargs: url (str): Destination URL parameters (dict): Additional GET parameters to append to the URL Returns: str. URL """ uri = url or self._settings["url"] if u...
def _url(self, url=None, parameters=None): """ Build destination URL. Kwargs: url (str): Destination URL parameters (dict): Additional GET parameters to append to the URL Returns: str. URL """ uri = url or self._settings["url"] if u...
[ "Build", "destination", "URL", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/connection.py#L396-L413
[ "def", "_url", "(", "self", ",", "url", "=", "None", ",", "parameters", "=", "None", ")", ":", "uri", "=", "url", "or", "self", ".", "_settings", "[", "\"url\"", "]", "if", "url", "and", "self", ".", "_settings", "[", "\"base_url\"", "]", ":", "uri...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Message.is_text
Tells if this message is a text message. Returns: bool. Success
pyfire/message.py
def is_text(self): """ Tells if this message is a text message. Returns: bool. Success """ return self.type in [ self._TYPE_PASTE, self._TYPE_TEXT, self._TYPE_TWEET ]
def is_text(self): """ Tells if this message is a text message. Returns: bool. Success """ return self.type in [ self._TYPE_PASTE, self._TYPE_TEXT, self._TYPE_TWEET ]
[ "Tells", "if", "this", "message", "is", "a", "text", "message", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/message.py#L121-L131
[ "def", "is_text", "(", "self", ")", ":", "return", "self", ".", "type", "in", "[", "self", ".", "_TYPE_PASTE", ",", "self", ".", "_TYPE_TEXT", ",", "self", ".", "_TYPE_TWEET", "]" ]
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Campfire.get_rooms
Get rooms list. Kwargs: sort (bool): If True, sort rooms by name Returns: array. List of rooms (each room is a dict)
pyfire/campfire.py
def get_rooms(self, sort=True): """ Get rooms list. Kwargs: sort (bool): If True, sort rooms by name Returns: array. List of rooms (each room is a dict) """ rooms = self._connection.get("rooms") if sort: rooms.sort(key=operator.itemge...
def get_rooms(self, sort=True): """ Get rooms list. Kwargs: sort (bool): If True, sort rooms by name Returns: array. List of rooms (each room is a dict) """ rooms = self._connection.get("rooms") if sort: rooms.sort(key=operator.itemge...
[ "Get", "rooms", "list", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/campfire.py#L76-L88
[ "def", "get_rooms", "(", "self", ",", "sort", "=", "True", ")", ":", "rooms", "=", "self", ".", "_connection", ".", "get", "(", "\"rooms\"", ")", "if", "sort", ":", "rooms", ".", "sort", "(", "key", "=", "operator", ".", "itemgetter", "(", "\"name\""...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Campfire.get_room_by_name
Get a room by name. Returns: :class:`Room`. Room Raises: RoomNotFoundException
pyfire/campfire.py
def get_room_by_name(self, name): """ Get a room by name. Returns: :class:`Room`. Room Raises: RoomNotFoundException """ rooms = self.get_rooms() for room in rooms or []: if room["name"] == name: return self.get_room(r...
def get_room_by_name(self, name): """ Get a room by name. Returns: :class:`Room`. Room Raises: RoomNotFoundException """ rooms = self.get_rooms() for room in rooms or []: if room["name"] == name: return self.get_room(r...
[ "Get", "a", "room", "by", "name", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/campfire.py#L90-L103
[ "def", "get_room_by_name", "(", "self", ",", "name", ")", ":", "rooms", "=", "self", ".", "get_rooms", "(", ")", "for", "room", "in", "rooms", "or", "[", "]", ":", "if", "room", "[", "\"name\"", "]", "==", "name", ":", "return", "self", ".", "get_r...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Campfire.get_room
Get room. Returns: :class:`Room`. Room
pyfire/campfire.py
def get_room(self, id): """ Get room. Returns: :class:`Room`. Room """ if id not in self._rooms: self._rooms[id] = Room(self, id) return self._rooms[id]
def get_room(self, id): """ Get room. Returns: :class:`Room`. Room """ if id not in self._rooms: self._rooms[id] = Room(self, id) return self._rooms[id]
[ "Get", "room", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/campfire.py#L105-L113
[ "def", "get_room", "(", "self", ",", "id", ")", ":", "if", "id", "not", "in", "self", ".", "_rooms", ":", "self", ".", "_rooms", "[", "id", "]", "=", "Room", "(", "self", ",", "id", ")", "return", "self", ".", "_rooms", "[", "id", "]" ]
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Campfire.get_user
Get user. Returns: :class:`User`. User
pyfire/campfire.py
def get_user(self, id = None): """ Get user. Returns: :class:`User`. User """ if not id: id = self._user.id if id not in self._users: self._users[id] = self._user if id == self._user.id else User(self, id) return self._users[id]
def get_user(self, id = None): """ Get user. Returns: :class:`User`. User """ if not id: id = self._user.id if id not in self._users: self._users[id] = self._user if id == self._user.id else User(self, id) return self._users[id]
[ "Get", "user", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/campfire.py#L115-L127
[ "def", "get_user", "(", "self", ",", "id", "=", "None", ")", ":", "if", "not", "id", ":", "id", "=", "self", ".", "_user", ".", "id", "if", "id", "not", "in", "self", ".", "_users", ":", "self", ".", "_users", "[", "id", "]", "=", "self", "."...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Campfire.search
Search transcripts. Args: terms (str): Terms for search Returns: array. Messages
pyfire/campfire.py
def search(self, terms): """ Search transcripts. Args: terms (str): Terms for search Returns: array. Messages """ messages = self._connection.get("search/%s" % urllib.quote_plus(terms), key="messages") if messages: messages = [Message...
def search(self, terms): """ Search transcripts. Args: terms (str): Terms for search Returns: array. Messages """ messages = self._connection.get("search/%s" % urllib.quote_plus(terms), key="messages") if messages: messages = [Message...
[ "Search", "transcripts", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/campfire.py#L129-L141
[ "def", "search", "(", "self", ",", "terms", ")", ":", "messages", "=", "self", ".", "_connection", ".", "get", "(", "\"search/%s\"", "%", "urllib", ".", "quote_plus", "(", "terms", ")", ",", "key", "=", "\"messages\"", ")", "if", "messages", ":", "mess...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
cookie_dump
:rtype: ``Cookie.SimpleCookie``
bustard/http.py
def cookie_dump(key, value='', max_age=None, expires=None, path='/', domain=None, secure=False, httponly=False): """ :rtype: ``Cookie.SimpleCookie`` """ cookie = SimpleCookie() cookie[key] = value for attr in ('max_age', 'expires', 'path', 'domain', 'secure', 'ht...
def cookie_dump(key, value='', max_age=None, expires=None, path='/', domain=None, secure=False, httponly=False): """ :rtype: ``Cookie.SimpleCookie`` """ cookie = SimpleCookie() cookie[key] = value for attr in ('max_age', 'expires', 'path', 'domain', 'secure', 'ht...
[ ":", "rtype", ":", "Cookie", ".", "SimpleCookie" ]
mozillazg/bustard
python
https://github.com/mozillazg/bustard/blob/bd7b47f3ba5440cf6ea026c8b633060fedeb80b7/bustard/http.py#L291-L304
[ "def", "cookie_dump", "(", "key", ",", "value", "=", "''", ",", "max_age", "=", "None", ",", "expires", "=", "None", ",", "path", "=", "'/'", ",", "domain", "=", "None", ",", "secure", "=", "False", ",", "httponly", "=", "False", ")", ":", "cookie"...
bd7b47f3ba5440cf6ea026c8b633060fedeb80b7
valid
response_status_string
e.g. ``200 OK``
bustard/http.py
def response_status_string(code): """e.g. ``200 OK`` """ mean = HTTP_STATUS_CODES.get(code, 'unknown').upper() return '{code} {mean}'.format(code=code, mean=mean)
def response_status_string(code): """e.g. ``200 OK`` """ mean = HTTP_STATUS_CODES.get(code, 'unknown').upper() return '{code} {mean}'.format(code=code, mean=mean)
[ "e", ".", "g", ".", "200", "OK" ]
mozillazg/bustard
python
https://github.com/mozillazg/bustard/blob/bd7b47f3ba5440cf6ea026c8b633060fedeb80b7/bustard/http.py#L307-L310
[ "def", "response_status_string", "(", "code", ")", ":", "mean", "=", "HTTP_STATUS_CODES", ".", "get", "(", "code", ",", "'unknown'", ")", ".", "upper", "(", ")", "return", "'{code} {mean}'", ".", "format", "(", "code", "=", "code", ",", "mean", "=", "mea...
bd7b47f3ba5440cf6ea026c8b633060fedeb80b7
valid
Request.cookies
Request cookies :rtype: dict
bustard/http.py
def cookies(self): """Request cookies :rtype: dict """ http_cookie = self.environ.get('HTTP_COOKIE', '') _cookies = { k: v.value for (k, v) in SimpleCookie(http_cookie).items() } return _cookies
def cookies(self): """Request cookies :rtype: dict """ http_cookie = self.environ.get('HTTP_COOKIE', '') _cookies = { k: v.value for (k, v) in SimpleCookie(http_cookie).items() } return _cookies
[ "Request", "cookies" ]
mozillazg/bustard
python
https://github.com/mozillazg/bustard/blob/bd7b47f3ba5440cf6ea026c8b633060fedeb80b7/bustard/http.py#L90-L100
[ "def", "cookies", "(", "self", ")", ":", "http_cookie", "=", "self", ".", "environ", ".", "get", "(", "'HTTP_COOKIE'", ",", "''", ")", "_cookies", "=", "{", "k", ":", "v", ".", "value", "for", "(", "k", ",", "v", ")", "in", "SimpleCookie", "(", "...
bd7b47f3ba5440cf6ea026c8b633060fedeb80b7
valid
Stream.attach
Attach an observer. Args: observer (func): A function to be called when new messages arrive Returns: :class:`Stream`. Current instance to allow chaining
pyfire/stream.py
def attach(self, observer): """ Attach an observer. Args: observer (func): A function to be called when new messages arrive Returns: :class:`Stream`. Current instance to allow chaining """ if not observer in self._observers: self._observers.a...
def attach(self, observer): """ Attach an observer. Args: observer (func): A function to be called when new messages arrive Returns: :class:`Stream`. Current instance to allow chaining """ if not observer in self._observers: self._observers.a...
[ "Attach", "an", "observer", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/stream.py#L52-L63
[ "def", "attach", "(", "self", ",", "observer", ")", ":", "if", "not", "observer", "in", "self", ".", "_observers", ":", "self", ".", "_observers", ".", "append", "(", "observer", ")", "return", "self" ]
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Stream.incoming
Called when incoming messages arrive. Args: messages (tuple): Messages (each message is a dict)
pyfire/stream.py
def incoming(self, messages): """ Called when incoming messages arrive. Args: messages (tuple): Messages (each message is a dict) """ if self._observers: campfire = self._room.get_campfire() for message in messages: for observer in sel...
def incoming(self, messages): """ Called when incoming messages arrive. Args: messages (tuple): Messages (each message is a dict) """ if self._observers: campfire = self._room.get_campfire() for message in messages: for observer in sel...
[ "Called", "when", "incoming", "messages", "arrive", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/stream.py#L80-L90
[ "def", "incoming", "(", "self", ",", "messages", ")", ":", "if", "self", ".", "_observers", ":", "campfire", "=", "self", ".", "_room", ".", "get_campfire", "(", ")", "for", "message", "in", "messages", ":", "for", "observer", "in", "self", ".", "_obse...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
Stream.run
Called by the thread, it runs the process. NEVER call this method directly. Instead call start() to start the thread. To stop, call stop(), and then join()
pyfire/stream.py
def run(self): """ Called by the thread, it runs the process. NEVER call this method directly. Instead call start() to start the thread. To stop, call stop(), and then join() """ if self._live: self._use_process = True self._abort = False campfire ...
def run(self): """ Called by the thread, it runs the process. NEVER call this method directly. Instead call start() to start the thread. To stop, call stop(), and then join() """ if self._live: self._use_process = True self._abort = False campfire ...
[ "Called", "by", "the", "thread", "it", "runs", "the", "process", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/stream.py#L111-L173
[ "def", "run", "(", "self", ")", ":", "if", "self", ".", "_live", ":", "self", ".", "_use_process", "=", "True", "self", ".", "_abort", "=", "False", "campfire", "=", "self", ".", "_room", ".", "get_campfire", "(", ")", "if", "self", ".", "_live", "...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
StreamProcess.run
Called by the process, it runs it. NEVER call this method directly. Instead call start() to start the separate process. If you don't want to use a second process, then call fetch() directly on this istance. To stop, call terminate()
pyfire/stream.py
def run(self): """ Called by the process, it runs it. NEVER call this method directly. Instead call start() to start the separate process. If you don't want to use a second process, then call fetch() directly on this istance. To stop, call terminate() """ if not self._q...
def run(self): """ Called by the process, it runs it. NEVER call this method directly. Instead call start() to start the separate process. If you don't want to use a second process, then call fetch() directly on this istance. To stop, call terminate() """ if not self._q...
[ "Called", "by", "the", "process", "it", "runs", "it", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/stream.py#L220-L233
[ "def", "run", "(", "self", ")", ":", "if", "not", "self", ".", "_queue", ":", "raise", "Exception", "(", "\"No queue available to send messages\"", ")", "while", "True", ":", "self", ".", "fetch", "(", ")", "time", ".", "sleep", "(", "self", ".", "_pause...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
StreamProcess.fetch
Fetch new messages.
pyfire/stream.py
def fetch(self): """ Fetch new messages. """ try: if not self._last_message_id: messages = self._connection.get("room/%s/recent" % self._room_id, key="messages", parameters={ "limit": 1 }) self._last_message_id = messages[-1...
def fetch(self): """ Fetch new messages. """ try: if not self._last_message_id: messages = self._connection.get("room/%s/recent" % self._room_id, key="messages", parameters={ "limit": 1 }) self._last_message_id = messages[-1...
[ "Fetch", "new", "messages", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/stream.py#L235-L253
[ "def", "fetch", "(", "self", ")", ":", "try", ":", "if", "not", "self", ".", "_last_message_id", ":", "messages", "=", "self", ".", "_connection", ".", "get", "(", "\"room/%s/recent\"", "%", "self", ".", "_room_id", ",", "key", "=", "\"messages\"", ",", ...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
StreamProcess.received
Called when new messages arrive. Args: messages (tuple): Messages
pyfire/stream.py
def received(self, messages): """ Called when new messages arrive. Args: messages (tuple): Messages """ if messages: if self._queue: self._queue.put_nowait(messages) if self._callback: self._callback(messages)
def received(self, messages): """ Called when new messages arrive. Args: messages (tuple): Messages """ if messages: if self._queue: self._queue.put_nowait(messages) if self._callback: self._callback(messages)
[ "Called", "when", "new", "messages", "arrive", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/stream.py#L258-L269
[ "def", "received", "(", "self", ",", "messages", ")", ":", "if", "messages", ":", "if", "self", ".", "_queue", ":", "self", ".", "_queue", ".", "put_nowait", "(", "messages", ")", "if", "self", ".", "_callback", ":", "self", ".", "_callback", "(", "m...
42e3490c138abc8e10f2e9f8f8f3b40240a80412
valid
LiveStreamProcess.run
Called by the process, it runs it. NEVER call this method directly. Instead call start() to start the separate process. If you don't want to use a second process, then call fetch() directly on this istance. To stop, call terminate()
pyfire/stream.py
def run(self): """ Called by the process, it runs it. NEVER call this method directly. Instead call start() to start the separate process. If you don't want to use a second process, then call fetch() directly on this istance. To stop, call terminate() """ if not self._q...
def run(self): """ Called by the process, it runs it. NEVER call this method directly. Instead call start() to start the separate process. If you don't want to use a second process, then call fetch() directly on this istance. To stop, call terminate() """ if not self._q...
[ "Called", "by", "the", "process", "it", "runs", "it", "." ]
mariano/pyfire
python
https://github.com/mariano/pyfire/blob/42e3490c138abc8e10f2e9f8f8f3b40240a80412/pyfire/stream.py#L301-L314
[ "def", "run", "(", "self", ")", ":", "if", "not", "self", ".", "_queue", ":", "raise", "Exception", "(", "\"No queue available to send messages\"", ")", "factory", "=", "LiveStreamFactory", "(", "self", ")", "self", ".", "_reactor", ".", "connectSSL", "(", "...
42e3490c138abc8e10f2e9f8f8f3b40240a80412