repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
globocom/GloboNetworkAPI-client-python
networkapiclient/Ip.py
Ip.find_ips_by_equip
def find_ips_by_equip(self, id_equip): """ Get Ips related to equipment by its identifier :param id_equip: Equipment identifier. Integer value and greater than zero. :return: Dictionary with the following structure: { ips: { ipv4:[ id: <id_ip4>, oct...
python
def find_ips_by_equip(self, id_equip): """ Get Ips related to equipment by its identifier :param id_equip: Equipment identifier. Integer value and greater than zero. :return: Dictionary with the following structure: { ips: { ipv4:[ id: <id_ip4>, oct...
[ "def", "find_ips_by_equip", "(", "self", ",", "id_equip", ")", ":", "url", "=", "'ip/getbyequip/'", "+", "str", "(", "id_equip", ")", "+", "\"/\"", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", ...
Get Ips related to equipment by its identifier :param id_equip: Equipment identifier. Integer value and greater than zero. :return: Dictionary with the following structure: { ips: { ipv4:[ id: <id_ip4>, oct1: <oct1>, oct2: <oct2>, oct3: <oct...
[ "Get", "Ips", "related", "to", "equipment", "by", "its", "identifier" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ip.py#L535-L572
globocom/GloboNetworkAPI-client-python
networkapiclient/Ip.py
Ip.find_ip6_by_id
def find_ip6_by_id(self, id_ip): """ Get an IP6 by ID :param id_ip: IP6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip': {'id': < id >, 'block1': <block1>, 'block2': <block2>, ...
python
def find_ip6_by_id(self, id_ip): """ Get an IP6 by ID :param id_ip: IP6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip': {'id': < id >, 'block1': <block1>, 'block2': <block2>, ...
[ "def", "find_ip6_by_id", "(", "self", ",", "id_ip", ")", ":", "if", "not", "is_valid_int_param", "(", "id_ip", ")", ":", "raise", "InvalidParameterError", "(", "u'Ipv6 identifier is invalid or was not informed.'", ")", "url", "=", "'ipv6/get/'", "+", "str", "(", "...
Get an IP6 by ID :param id_ip: IP6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip': {'id': < id >, 'block1': <block1>, 'block2': <block2>, 'block3': <block3>, 'block4': <bl...
[ "Get", "an", "IP6", "by", "ID" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ip.py#L574-L614
globocom/GloboNetworkAPI-client-python
networkapiclient/Ip.py
Ip.save_ipv6
def save_ipv6(self, ip6, id_equip, descricao, id_net): """ Save an IP6 and associate with equipment :param ip6: An IP6 available to save in format xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx. :param id_equip: Equipment identifier. Integer value and greater than zero. :param descrica...
python
def save_ipv6(self, ip6, id_equip, descricao, id_net): """ Save an IP6 and associate with equipment :param ip6: An IP6 available to save in format xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx. :param id_equip: Equipment identifier. Integer value and greater than zero. :param descrica...
[ "def", "save_ipv6", "(", "self", ",", "ip6", ",", "id_equip", ",", "descricao", ",", "id_net", ")", ":", "if", "not", "is_valid_int_param", "(", "id_net", ")", ":", "raise", "InvalidParameterError", "(", "u'Network identifier is invalid or was not informed.'", ")", ...
Save an IP6 and associate with equipment :param ip6: An IP6 available to save in format xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx. :param id_equip: Equipment identifier. Integer value and greater than zero. :param descricao: IPv6 description. :param id_net: Network identifier. Integer val...
[ "Save", "an", "IP6", "and", "associate", "with", "equipment" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ip.py#L616-L663
globocom/GloboNetworkAPI-client-python
networkapiclient/Ip.py
Ip.delete_ip4
def delete_ip4(self, id_ip): """ Delete an IP4 :param id_ip: Ipv4 identifier. Integer value and greater than zero. :return: None :raise IpNotFoundError: IP is not registered. :raise DataBaseError: Networkapi failed to access the database. """ if not i...
python
def delete_ip4(self, id_ip): """ Delete an IP4 :param id_ip: Ipv4 identifier. Integer value and greater than zero. :return: None :raise IpNotFoundError: IP is not registered. :raise DataBaseError: Networkapi failed to access the database. """ if not i...
[ "def", "delete_ip4", "(", "self", ",", "id_ip", ")", ":", "if", "not", "is_valid_int_param", "(", "id_ip", ")", ":", "raise", "InvalidParameterError", "(", "u'Ipv4 identifier is invalid or was not informed.'", ")", "url", "=", "'ip4/delete/'", "+", "str", "(", "id...
Delete an IP4 :param id_ip: Ipv4 identifier. Integer value and greater than zero. :return: None :raise IpNotFoundError: IP is not registered. :raise DataBaseError: Networkapi failed to access the database.
[ "Delete", "an", "IP4" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ip.py#L665-L684
globocom/GloboNetworkAPI-client-python
networkapiclient/Ip.py
Ip.find_ip6_by_network
def find_ip6_by_network(self, id_network): """List IPv6 from network. :param id_network: Network ipv6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip': {'id': < id >, 'id_vlan': < id_vlan >, ...
python
def find_ip6_by_network(self, id_network): """List IPv6 from network. :param id_network: Network ipv6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip': {'id': < id >, 'id_vlan': < id_vlan >, ...
[ "def", "find_ip6_by_network", "(", "self", ",", "id_network", ")", ":", "if", "not", "is_valid_int_param", "(", "id_network", ")", ":", "raise", "InvalidParameterError", "(", "u'Network identifier is invalid or was not informed.'", ")", "url", "=", "'ip/id_network_ipv6/'"...
List IPv6 from network. :param id_network: Network ipv6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip': {'id': < id >, 'id_vlan': < id_vlan >, 'block1': <block1>, 'block2': <block2>, ...
[ "List", "IPv6", "from", "network", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ip.py#L743-L779
globocom/GloboNetworkAPI-client-python
networkapiclient/Ip.py
Ip.search_ipv6_environment
def search_ipv6_environment(self, ipv6, id_environment): """Get IPv6 with an associated environment. :param ipv6: IPv6 address in the format x1:x2:x3:x4:x5:x6:x7:x8. :param id_environment: Environment identifier. Integer value and greater than zero. :return: Dictionary with the followi...
python
def search_ipv6_environment(self, ipv6, id_environment): """Get IPv6 with an associated environment. :param ipv6: IPv6 address in the format x1:x2:x3:x4:x5:x6:x7:x8. :param id_environment: Environment identifier. Integer value and greater than zero. :return: Dictionary with the followi...
[ "def", "search_ipv6_environment", "(", "self", ",", "ipv6", ",", "id_environment", ")", ":", "if", "not", "is_valid_int_param", "(", "id_environment", ")", ":", "raise", "InvalidParameterError", "(", "u'Environment identifier is invalid or was not informed.'", ")", "ipv6_...
Get IPv6 with an associated environment. :param ipv6: IPv6 address in the format x1:x2:x3:x4:x5:x6:x7:x8. :param id_environment: Environment identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ipv6': {'id': < id >, ...
[ "Get", "IPv6", "with", "an", "associated", "environment", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ip.py#L781-L822
globocom/GloboNetworkAPI-client-python
networkapiclient/Ip.py
Ip.assoc_ipv4
def assoc_ipv4(self, id_ip, id_equip, id_net): """ Associate an IP4 with equipment. :param id_ip: IPv4 identifier. :param id_equip: Equipment identifier. Integer value and greater than zero. :param id_net: Network identifier. Integer value and greater than zero. :return...
python
def assoc_ipv4(self, id_ip, id_equip, id_net): """ Associate an IP4 with equipment. :param id_ip: IPv4 identifier. :param id_equip: Equipment identifier. Integer value and greater than zero. :param id_net: Network identifier. Integer value and greater than zero. :return...
[ "def", "assoc_ipv4", "(", "self", ",", "id_ip", ",", "id_equip", ",", "id_net", ")", ":", "if", "not", "is_valid_int_param", "(", "id_ip", ")", ":", "raise", "InvalidParameterError", "(", "u'Ip identifier is invalid or was not informed.'", ")", "if", "not", "is_va...
Associate an IP4 with equipment. :param id_ip: IPv4 identifier. :param id_equip: Equipment identifier. Integer value and greater than zero. :param id_net: Network identifier. Integer value and greater than zero. :return: None :raise InvalidParameterError: IPv4, Equipment or Ne...
[ "Associate", "an", "IP4", "with", "equipment", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ip.py#L824-L860
globocom/GloboNetworkAPI-client-python
networkapiclient/Ip.py
Ip.assoc_ipv6
def assoc_ipv6(self, id_ip, id_equip, id_net): """ Associate an IP6 with equipment. :param id_ip: IPv6 identifier. :param id_equip: Equipment identifier. Integer value and greater than zero. :param id_net: Network identifier. Integer value and greater than zero. :return...
python
def assoc_ipv6(self, id_ip, id_equip, id_net): """ Associate an IP6 with equipment. :param id_ip: IPv6 identifier. :param id_equip: Equipment identifier. Integer value and greater than zero. :param id_net: Network identifier. Integer value and greater than zero. :return...
[ "def", "assoc_ipv6", "(", "self", ",", "id_ip", ",", "id_equip", ",", "id_net", ")", ":", "if", "not", "is_valid_int_param", "(", "id_ip", ")", ":", "raise", "InvalidParameterError", "(", "u'Ipv6 identifier is invalid or was not informed.'", ")", "if", "not", "is_...
Associate an IP6 with equipment. :param id_ip: IPv6 identifier. :param id_equip: Equipment identifier. Integer value and greater than zero. :param id_net: Network identifier. Integer value and greater than zero. :return: None :raise InvalidParameterError: IPv6, Equipment or Ne...
[ "Associate", "an", "IP6", "with", "equipment", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ip.py#L862-L898
globocom/GloboNetworkAPI-client-python
networkapiclient/TipoRede.py
TipoRede.listar
def listar(self): """List all network types. :return: Following dictionary: :: {'net_type': [{'id': < id_tipo_rede >, 'name': < nome_tipo_rede >}, ... other network types ...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLE...
python
def listar(self): """List all network types. :return: Following dictionary: :: {'net_type': [{'id': < id_tipo_rede >, 'name': < nome_tipo_rede >}, ... other network types ...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLE...
[ "def", "listar", "(", "self", ")", ":", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "'net_type/'", ")", "key", "=", "'net_type'", "return", "get_list_map", "(", "self", ".", "response", "(", "code", ",", "xml", ","...
List all network types. :return: Following dictionary: :: {'net_type': [{'id': < id_tipo_rede >, 'name': < nome_tipo_rede >}, ... other network types ...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to ge...
[ "List", "all", "network", "types", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/TipoRede.py#L38-L55
globocom/GloboNetworkAPI-client-python
networkapiclient/TipoRede.py
TipoRede.inserir
def inserir(self, name): """Insert new network type and return its identifier. :param name: Network type name. :return: Following dictionary: {'net_type': {'id': < id >}} :raise InvalidParameterError: Network type is none or invalid. :raise NomeTipoRedeDuplicadoError: A networ...
python
def inserir(self, name): """Insert new network type and return its identifier. :param name: Network type name. :return: Following dictionary: {'net_type': {'id': < id >}} :raise InvalidParameterError: Network type is none or invalid. :raise NomeTipoRedeDuplicadoError: A networ...
[ "def", "inserir", "(", "self", ",", "name", ")", ":", "net_type_map", "=", "dict", "(", ")", "net_type_map", "[", "'name'", "]", "=", "name", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'net_type'", ":", "net_type_map", "}", ",", "'POS...
Insert new network type and return its identifier. :param name: Network type name. :return: Following dictionary: {'net_type': {'id': < id >}} :raise InvalidParameterError: Network type is none or invalid. :raise NomeTipoRedeDuplicadoError: A network type with this name already exists...
[ "Insert", "new", "network", "type", "and", "return", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/TipoRede.py#L57-L76
globocom/GloboNetworkAPI-client-python
networkapiclient/TipoRede.py
TipoRede.alterar
def alterar(self, id_net_type, name): """Edit network type by its identifier. :param id_net_type: Network type identifier. :param name: Network type name. :return: None :raise InvalidParameterError: Network type identifier and/or name is(are) none or invalid. :raise Ti...
python
def alterar(self, id_net_type, name): """Edit network type by its identifier. :param id_net_type: Network type identifier. :param name: Network type name. :return: None :raise InvalidParameterError: Network type identifier and/or name is(are) none or invalid. :raise Ti...
[ "def", "alterar", "(", "self", ",", "id_net_type", ",", "name", ")", ":", "if", "not", "is_valid_int_param", "(", "id_net_type", ")", ":", "raise", "InvalidParameterError", "(", "u'Network type is invalid or was not informed.'", ")", "url", "=", "'net_type/'", "+", ...
Edit network type by its identifier. :param id_net_type: Network type identifier. :param name: Network type name. :return: None :raise InvalidParameterError: Network type identifier and/or name is(are) none or invalid. :raise TipoRedeNaoExisteError: Network type does not exist...
[ "Edit", "network", "type", "by", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/TipoRede.py#L78-L104
globocom/GloboNetworkAPI-client-python
networkapiclient/TipoRede.py
TipoRede.remover
def remover(self, id_net_type): """Remove network type by its identifier. :param id_net_type: Network type identifier. :return: None :raise TipoRedeNaoExisteError: Network type does not exist. :raise TipoRedeError: Network type is associated with network. :raise Invali...
python
def remover(self, id_net_type): """Remove network type by its identifier. :param id_net_type: Network type identifier. :return: None :raise TipoRedeNaoExisteError: Network type does not exist. :raise TipoRedeError: Network type is associated with network. :raise Invali...
[ "def", "remover", "(", "self", ",", "id_net_type", ")", ":", "if", "not", "is_valid_int_param", "(", "id_net_type", ")", ":", "raise", "InvalidParameterError", "(", "u'Network type is invalid or was not informed.'", ")", "url", "=", "'net_type/'", "+", "str", "(", ...
Remove network type by its identifier. :param id_net_type: Network type identifier. :return: None :raise TipoRedeNaoExisteError: Network type does not exist. :raise TipoRedeError: Network type is associated with network. :raise InvalidParameterError: Network type is none or in...
[ "Remove", "network", "type", "by", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/TipoRede.py#L106-L127
thautwarm/RBNF
rbnf/cli.py
cc
def cc(filename: 'input source file', output: 'output file name. default to be replacing input file\'s suffix with ".py"' = None, name: 'name of language' = 'unname'): """ rbnf source code compiler. """ lang = Language(name) with Path(filename).open('r') as fr: build_l...
python
def cc(filename: 'input source file', output: 'output file name. default to be replacing input file\'s suffix with ".py"' = None, name: 'name of language' = 'unname'): """ rbnf source code compiler. """ lang = Language(name) with Path(filename).open('r') as fr: build_l...
[ "def", "cc", "(", "filename", ":", "'input source file'", ",", "output", ":", "'output file name. default to be replacing input file\\'s suffix with \".py\"'", "=", "None", ",", "name", ":", "'name of language'", "=", "'unname'", ")", ":", "lang", "=", "Language", "(", ...
rbnf source code compiler.
[ "rbnf", "source", "code", "compiler", "." ]
train
https://github.com/thautwarm/RBNF/blob/cceec88c90f7ec95c160cfda01bfc532610985e0/rbnf/cli.py#L11-L28
thautwarm/RBNF
rbnf/cli.py
run
def run(filename: 'python file generated by `rbnf` command, or rbnf sour file', opt: 'optimize switch' = False): """ You can apply immediate tests on your parser. P.S: use `--opt` option takes longer starting time. """ from rbnf.easy import build_parser import importlib.util import t...
python
def run(filename: 'python file generated by `rbnf` command, or rbnf sour file', opt: 'optimize switch' = False): """ You can apply immediate tests on your parser. P.S: use `--opt` option takes longer starting time. """ from rbnf.easy import build_parser import importlib.util import t...
[ "def", "run", "(", "filename", ":", "'python file generated by `rbnf` command, or rbnf sour file'", ",", "opt", ":", "'optimize switch'", "=", "False", ")", ":", "from", "rbnf", ".", "easy", "import", "build_parser", "import", "importlib", ".", "util", "import", "tr...
You can apply immediate tests on your parser. P.S: use `--opt` option takes longer starting time.
[ "You", "can", "apply", "immediate", "tests", "on", "your", "parser", ".", "P", ".", "S", ":", "use", "--", "opt", "option", "takes", "longer", "starting", "time", "." ]
train
https://github.com/thautwarm/RBNF/blob/cceec88c90f7ec95c160cfda01bfc532610985e0/rbnf/cli.py#L32-L103
thautwarm/RBNF
rbnf/auto_lexer/rbnf_lexer.py
rbnf_lexing
def rbnf_lexing(text: str): """Read loudly for documentation.""" cast_map: const = _cast_map lexer_table: const = _lexer_table keyword: const = _keyword drop_table: const = _DropTable end: const = _END unknown: const = _UNKNOWN text_length = len(text) colno ...
python
def rbnf_lexing(text: str): """Read loudly for documentation.""" cast_map: const = _cast_map lexer_table: const = _lexer_table keyword: const = _keyword drop_table: const = _DropTable end: const = _END unknown: const = _UNKNOWN text_length = len(text) colno ...
[ "def", "rbnf_lexing", "(", "text", ":", "str", ")", ":", "cast_map", ":", "const", "=", "_cast_map", "lexer_table", ":", "const", "=", "_lexer_table", "keyword", ":", "const", "=", "_keyword", "drop_table", ":", "const", "=", "_DropTable", "end", ":", "con...
Read loudly for documentation.
[ "Read", "loudly", "for", "documentation", "." ]
train
https://github.com/thautwarm/RBNF/blob/cceec88c90f7ec95c160cfda01bfc532610985e0/rbnf/auto_lexer/rbnf_lexer.py#L30-L96
thautwarm/RBNF
rbnf/std/common.py
recover_codes
def recover_codes(tokens: Iterator[Tokenizer]) -> str: """ from a series of tokenizers to code string. (preserve the indentation) """ tokens = iter(tokens) s = [] try: head = next(tokens) except StopIteration: return s append = s.append lineno = head.lineno ...
python
def recover_codes(tokens: Iterator[Tokenizer]) -> str: """ from a series of tokenizers to code string. (preserve the indentation) """ tokens = iter(tokens) s = [] try: head = next(tokens) except StopIteration: return s append = s.append lineno = head.lineno ...
[ "def", "recover_codes", "(", "tokens", ":", "Iterator", "[", "Tokenizer", "]", ")", "->", "str", ":", "tokens", "=", "iter", "(", "tokens", ")", "s", "=", "[", "]", "try", ":", "head", "=", "next", "(", "tokens", ")", "except", "StopIteration", ":", ...
from a series of tokenizers to code string. (preserve the indentation)
[ "from", "a", "series", "of", "tokenizers", "to", "code", "string", ".", "(", "preserve", "the", "indentation", ")" ]
train
https://github.com/thautwarm/RBNF/blob/cceec88c90f7ec95c160cfda01bfc532610985e0/rbnf/std/common.py#L14-L60
thautwarm/RBNF
rbnf/auto_lexer/__init__.py
str_lexer
def str_lexer(mode): """ generate token strings' cache """ cast_to_const = ConstStrPool.cast_to_const def f_raw(inp_str, pos): return cast_to_const(mode) if inp_str.startswith(mode, pos) else None def f_collection(inp_str, pos): for each in mode: if inp_str.startswi...
python
def str_lexer(mode): """ generate token strings' cache """ cast_to_const = ConstStrPool.cast_to_const def f_raw(inp_str, pos): return cast_to_const(mode) if inp_str.startswith(mode, pos) else None def f_collection(inp_str, pos): for each in mode: if inp_str.startswi...
[ "def", "str_lexer", "(", "mode", ")", ":", "cast_to_const", "=", "ConstStrPool", ".", "cast_to_const", "def", "f_raw", "(", "inp_str", ",", "pos", ")", ":", "return", "cast_to_const", "(", "mode", ")", "if", "inp_str", ".", "startswith", "(", "mode", ",", ...
generate token strings' cache
[ "generate", "token", "strings", "cache" ]
train
https://github.com/thautwarm/RBNF/blob/cceec88c90f7ec95c160cfda01bfc532610985e0/rbnf/auto_lexer/__init__.py#L221-L243
thautwarm/RBNF
rbnf/auto_lexer/__init__.py
regex_lexer
def regex_lexer(regex_pat): """ generate token names' cache """ if isinstance(regex_pat, str): regex_pat = re.compile(regex_pat) def f(inp_str, pos): m = regex_pat.match(inp_str, pos) return m.group() if m else None elif hasattr(regex_pat, 'match'): ...
python
def regex_lexer(regex_pat): """ generate token names' cache """ if isinstance(regex_pat, str): regex_pat = re.compile(regex_pat) def f(inp_str, pos): m = regex_pat.match(inp_str, pos) return m.group() if m else None elif hasattr(regex_pat, 'match'): ...
[ "def", "regex_lexer", "(", "regex_pat", ")", ":", "if", "isinstance", "(", "regex_pat", ",", "str", ")", ":", "regex_pat", "=", "re", ".", "compile", "(", "regex_pat", ")", "def", "f", "(", "inp_str", ",", "pos", ")", ":", "m", "=", "regex_pat", ".",...
generate token names' cache
[ "generate", "token", "names", "cache" ]
train
https://github.com/thautwarm/RBNF/blob/cceec88c90f7ec95c160cfda01bfc532610985e0/rbnf/auto_lexer/__init__.py#L246-L270
thautwarm/RBNF
rbnf/py_tools/unparse.py
Unparser.dispatch
def dispatch(self, tree): "Dispatcher function, dispatching tree type T to method _T." if isinstance(tree, list): for t in tree: self.dispatch(t) return meth = getattr(self, "_" + tree.__class__.__name__) meth(tree)
python
def dispatch(self, tree): "Dispatcher function, dispatching tree type T to method _T." if isinstance(tree, list): for t in tree: self.dispatch(t) return meth = getattr(self, "_" + tree.__class__.__name__) meth(tree)
[ "def", "dispatch", "(", "self", ",", "tree", ")", ":", "if", "isinstance", "(", "tree", ",", "list", ")", ":", "for", "t", "in", "tree", ":", "self", ".", "dispatch", "(", "t", ")", "return", "meth", "=", "getattr", "(", "self", ",", "\"_\"", "+"...
Dispatcher function, dispatching tree type T to method _T.
[ "Dispatcher", "function", "dispatching", "tree", "type", "T", "to", "method", "_T", "." ]
train
https://github.com/thautwarm/RBNF/blob/cceec88c90f7ec95c160cfda01bfc532610985e0/rbnf/py_tools/unparse.py#L101-L108
thautwarm/RBNF
rbnf/edsl/core.py
process
def process(fn, bound_names): """ process automatic context variable capturing. return the transformed function and its ast. """ if isinstance(fn, _AutoContext): fn = fn.fn # noinspection PyArgumentList,PyArgumentList if isinstance(fn, _FnCodeStr): if bound_names: ...
python
def process(fn, bound_names): """ process automatic context variable capturing. return the transformed function and its ast. """ if isinstance(fn, _AutoContext): fn = fn.fn # noinspection PyArgumentList,PyArgumentList if isinstance(fn, _FnCodeStr): if bound_names: ...
[ "def", "process", "(", "fn", ",", "bound_names", ")", ":", "if", "isinstance", "(", "fn", ",", "_AutoContext", ")", ":", "fn", "=", "fn", ".", "fn", "# noinspection PyArgumentList,PyArgumentList", "if", "isinstance", "(", "fn", ",", "_FnCodeStr", ")", ":", ...
process automatic context variable capturing. return the transformed function and its ast.
[ "process", "automatic", "context", "variable", "capturing", ".", "return", "the", "transformed", "function", "and", "its", "ast", "." ]
train
https://github.com/thautwarm/RBNF/blob/cceec88c90f7ec95c160cfda01bfc532610985e0/rbnf/edsl/core.py#L107-L184
thautwarm/RBNF
rbnf/edsl/core.py
Language.ignore
def ignore(self, *ignore_lst: str): """ ignore a set of tokens with specific names """ def stream(): for each in ignore_lst: each = ConstStrPool.cast_to_const(each) yield id(each), each self.ignore_lst.update(stream())
python
def ignore(self, *ignore_lst: str): """ ignore a set of tokens with specific names """ def stream(): for each in ignore_lst: each = ConstStrPool.cast_to_const(each) yield id(each), each self.ignore_lst.update(stream())
[ "def", "ignore", "(", "self", ",", "*", "ignore_lst", ":", "str", ")", ":", "def", "stream", "(", ")", ":", "for", "each", "in", "ignore_lst", ":", "each", "=", "ConstStrPool", ".", "cast_to_const", "(", "each", ")", "yield", "id", "(", "each", ")", ...
ignore a set of tokens with specific names
[ "ignore", "a", "set", "of", "tokens", "with", "specific", "names" ]
train
https://github.com/thautwarm/RBNF/blob/cceec88c90f7ec95c160cfda01bfc532610985e0/rbnf/edsl/core.py#L324-L334
thautwarm/RBNF
rbnf/bootstrap/rbnf.py
build_language
def build_language(source_code: str, lang: Language, filename: str): """ lang: language object represents your language. """ state = MetaState(rbnf.implementation, requires=_Wild(), filename=filename) state.data = lang _build_language(source_code, state) lang.build()
python
def build_language(source_code: str, lang: Language, filename: str): """ lang: language object represents your language. """ state = MetaState(rbnf.implementation, requires=_Wild(), filename=filename) state.data = lang _build_language(source_code, state) lang.build()
[ "def", "build_language", "(", "source_code", ":", "str", ",", "lang", ":", "Language", ",", "filename", ":", "str", ")", ":", "state", "=", "MetaState", "(", "rbnf", ".", "implementation", ",", "requires", "=", "_Wild", "(", ")", ",", "filename", "=", ...
lang: language object represents your language.
[ "lang", ":", "language", "object", "represents", "your", "language", "." ]
train
https://github.com/thautwarm/RBNF/blob/cceec88c90f7ec95c160cfda01bfc532610985e0/rbnf/bootstrap/rbnf.py#L536-L543
yunojuno-archive/django-inbound-email
inbound_email/backends/sendgrid.py
_decode_POST_value
def _decode_POST_value(request, field_name, default=None): """Helper to decode a request field into unicode based on charsets encoding. Args: request: the HttpRequest object. field_name: the field expected in the request.POST Kwargs: default: if passed in then field is optional and...
python
def _decode_POST_value(request, field_name, default=None): """Helper to decode a request field into unicode based on charsets encoding. Args: request: the HttpRequest object. field_name: the field expected in the request.POST Kwargs: default: if passed in then field is optional and...
[ "def", "_decode_POST_value", "(", "request", ",", "field_name", ",", "default", "=", "None", ")", ":", "if", "default", "is", "None", ":", "value", "=", "request", ".", "POST", "[", "field_name", "]", "else", ":", "value", "=", "request", ".", "POST", ...
Helper to decode a request field into unicode based on charsets encoding. Args: request: the HttpRequest object. field_name: the field expected in the request.POST Kwargs: default: if passed in then field is optional and default is used if not found; if None, then assume fi...
[ "Helper", "to", "decode", "a", "request", "field", "into", "unicode", "based", "on", "charsets", "encoding", "." ]
train
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/sendgrid.py#L17-L45
yunojuno-archive/django-inbound-email
inbound_email/backends/sendgrid.py
SendGridRequestParser._get_addresses
def _get_addresses(self, address_data, retain_name=False): """ Takes RFC-compliant email addresses in both terse (email only) and verbose (name + email) forms and returns a list of email address strings (TODO: breaking change that returns a tuple of (name, email) per string) ...
python
def _get_addresses(self, address_data, retain_name=False): """ Takes RFC-compliant email addresses in both terse (email only) and verbose (name + email) forms and returns a list of email address strings (TODO: breaking change that returns a tuple of (name, email) per string) ...
[ "def", "_get_addresses", "(", "self", ",", "address_data", ",", "retain_name", "=", "False", ")", ":", "if", "retain_name", ":", "raise", "NotImplementedError", "(", "\"Not yet implemented, but will need client-code changes too\"", ")", "# We trust than an email address conta...
Takes RFC-compliant email addresses in both terse (email only) and verbose (name + email) forms and returns a list of email address strings (TODO: breaking change that returns a tuple of (name, email) per string)
[ "Takes", "RFC", "-", "compliant", "email", "addresses", "in", "both", "terse", "(", "email", "only", ")", "and", "verbose", "(", "name", "+", "email", ")", "forms", "and", "returns", "a", "list", "of", "email", "address", "strings" ]
train
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/sendgrid.py#L51-L76
yunojuno-archive/django-inbound-email
inbound_email/backends/sendgrid.py
SendGridRequestParser.parse
def parse(self, request): """Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing the forwarded email, as per the SendGrid specification for inbound emails. Returns: an EmailMultiAlternatives instance, con...
python
def parse(self, request): """Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing the forwarded email, as per the SendGrid specification for inbound emails. Returns: an EmailMultiAlternatives instance, con...
[ "def", "parse", "(", "self", ",", "request", ")", ":", "assert", "isinstance", "(", "request", ",", "HttpRequest", ")", ",", "\"Invalid request type: %s\"", "%", "type", "(", "request", ")", "try", ":", "# from_email should never be a list (unless we change our API)",...
Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing the forwarded email, as per the SendGrid specification for inbound emails. Returns: an EmailMultiAlternatives instance, containing the parsed contents ...
[ "Parse", "incoming", "request", "and", "return", "an", "email", "instance", "." ]
train
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/sendgrid.py#L78-L146
yunojuno-archive/django-inbound-email
inbound_email/backends/mailgun.py
MailgunRequestParser.parse
def parse(self, request): """Parse incoming request and return an email instance. Mailgun does a lot of the heavy lifting at their end - requests come in from them UTF-8 encoded, and with the message reply and signature stripped out for you. Args: request: an HttpRe...
python
def parse(self, request): """Parse incoming request and return an email instance. Mailgun does a lot of the heavy lifting at their end - requests come in from them UTF-8 encoded, and with the message reply and signature stripped out for you. Args: request: an HttpRe...
[ "def", "parse", "(", "self", ",", "request", ")", ":", "assert", "isinstance", "(", "request", ",", "HttpRequest", ")", ",", "\"Invalid request type: %s\"", "%", "type", "(", "request", ")", "try", ":", "subject", "=", "request", ".", "POST", ".", "get", ...
Parse incoming request and return an email instance. Mailgun does a lot of the heavy lifting at their end - requests come in from them UTF-8 encoded, and with the message reply and signature stripped out for you. Args: request: an HttpRequest object, containing the forwarde...
[ "Parse", "incoming", "request", "and", "return", "an", "email", "instance", "." ]
train
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/mailgun.py#L16-L82
yunojuno-archive/django-inbound-email
inbound_email/backends/mandrill.py
MandrillRequestParser._get_recipients
def _get_recipients(self, array): """Returns an iterator of objects in the form ["Name <address@example.com", ...] from the array [["address@example.com", "Name"]] """ for address, name in array: if not name: yield address else: ...
python
def _get_recipients(self, array): """Returns an iterator of objects in the form ["Name <address@example.com", ...] from the array [["address@example.com", "Name"]] """ for address, name in array: if not name: yield address else: ...
[ "def", "_get_recipients", "(", "self", ",", "array", ")", ":", "for", "address", ",", "name", "in", "array", ":", "if", "not", "name", ":", "yield", "address", "else", ":", "yield", "\"\\\"%s\\\" <%s>\"", "%", "(", "name", ",", "address", ")" ]
Returns an iterator of objects in the form ["Name <address@example.com", ...] from the array [["address@example.com", "Name"]]
[ "Returns", "an", "iterator", "of", "objects", "in", "the", "form", "[", "Name", "<address" ]
train
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/mandrill.py#L90-L99
yunojuno-archive/django-inbound-email
inbound_email/backends/mandrill.py
MandrillRequestParser.parse
def parse(self, request): """Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing a list of forwarded emails, as per Mandrill specification for inbound emails. Returns: a list of EmailMultiAlternatives ins...
python
def parse(self, request): """Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing a list of forwarded emails, as per Mandrill specification for inbound emails. Returns: a list of EmailMultiAlternatives ins...
[ "def", "parse", "(", "self", ",", "request", ")", ":", "assert", "isinstance", "(", "request", ",", "HttpRequest", ")", ",", "\"Invalid request type: %s\"", "%", "type", "(", "request", ")", "if", "settings", ".", "INBOUND_MANDRILL_AUTHENTICATION_KEY", ":", "_ch...
Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing a list of forwarded emails, as per Mandrill specification for inbound emails. Returns: a list of EmailMultiAlternatives instances
[ "Parse", "incoming", "request", "and", "return", "an", "email", "instance", "." ]
train
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/mandrill.py#L107-L176
yunojuno-archive/django-inbound-email
inbound_email/views.py
_log_request
def _log_request(request): """Helper function to dump out debug info.""" logger.debug("Inbound email received") for k, v in list(request.POST.items()): logger.debug("- POST['%s']='%s'" % (k, v)) for n, f in list(request.FILES.items()): logger.debug("- FILES['%s']: '%s', %sB", n, f.cont...
python
def _log_request(request): """Helper function to dump out debug info.""" logger.debug("Inbound email received") for k, v in list(request.POST.items()): logger.debug("- POST['%s']='%s'" % (k, v)) for n, f in list(request.FILES.items()): logger.debug("- FILES['%s']: '%s', %sB", n, f.cont...
[ "def", "_log_request", "(", "request", ")", ":", "logger", ".", "debug", "(", "\"Inbound email received\"", ")", "for", "k", ",", "v", "in", "list", "(", "request", ".", "POST", ".", "items", "(", ")", ")", ":", "logger", ".", "debug", "(", "\"- POST['...
Helper function to dump out debug info.
[ "Helper", "function", "to", "dump", "out", "debug", "info", "." ]
train
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/views.py#L23-L31
yunojuno-archive/django-inbound-email
inbound_email/views.py
receive_inbound_email
def receive_inbound_email(request): """Receives inbound email from SendGrid. This view receives the email from SendGrid, parses the contents, logs the message and the fires the inbound_email signal. """ # log the request.POST and request.FILES contents if log_requests is True: _log_req...
python
def receive_inbound_email(request): """Receives inbound email from SendGrid. This view receives the email from SendGrid, parses the contents, logs the message and the fires the inbound_email signal. """ # log the request.POST and request.FILES contents if log_requests is True: _log_req...
[ "def", "receive_inbound_email", "(", "request", ")", ":", "# log the request.POST and request.FILES contents", "if", "log_requests", "is", "True", ":", "_log_request", "(", "request", ")", "# HEAD requests are used by some backends to validate the route", "if", "request", ".", ...
Receives inbound email from SendGrid. This view receives the email from SendGrid, parses the contents, logs the message and the fires the inbound_email signal.
[ "Receives", "inbound", "email", "from", "SendGrid", "." ]
train
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/views.py#L36-L97
yunojuno-archive/django-inbound-email
inbound_email/backends/__init__.py
get_backend_class
def get_backend_class(): """Return reference to the configured backed class.""" # this will (intentionally) blow up if the setting does not exist assert hasattr(settings, 'INBOUND_EMAIL_PARSER') assert getattr(settings, 'INBOUND_EMAIL_PARSER') is not None package, klass = settings.INBOUND_EMAIL_PAR...
python
def get_backend_class(): """Return reference to the configured backed class.""" # this will (intentionally) blow up if the setting does not exist assert hasattr(settings, 'INBOUND_EMAIL_PARSER') assert getattr(settings, 'INBOUND_EMAIL_PARSER') is not None package, klass = settings.INBOUND_EMAIL_PAR...
[ "def", "get_backend_class", "(", ")", ":", "# this will (intentionally) blow up if the setting does not exist", "assert", "hasattr", "(", "settings", ",", "'INBOUND_EMAIL_PARSER'", ")", "assert", "getattr", "(", "settings", ",", "'INBOUND_EMAIL_PARSER'", ")", "is", "not", ...
Return reference to the configured backed class.
[ "Return", "reference", "to", "the", "configured", "backed", "class", "." ]
train
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/__init__.py#L6-L14
rsheftel/raccoon
raccoon/sort_utils.py
sorted_exists
def sorted_exists(values, x): """ For list, values, returns the insert position for item x and whether the item already exists in the list. This allows one function call to return either the index to overwrite an existing value in the list, or the index to insert a new item in the list and keep the list...
python
def sorted_exists(values, x): """ For list, values, returns the insert position for item x and whether the item already exists in the list. This allows one function call to return either the index to overwrite an existing value in the list, or the index to insert a new item in the list and keep the list...
[ "def", "sorted_exists", "(", "values", ",", "x", ")", ":", "i", "=", "bisect_left", "(", "values", ",", "x", ")", "j", "=", "bisect_right", "(", "values", ",", "x", ")", "exists", "=", "x", "in", "values", "[", "i", ":", "j", "]", "return", "exis...
For list, values, returns the insert position for item x and whether the item already exists in the list. This allows one function call to return either the index to overwrite an existing value in the list, or the index to insert a new item in the list and keep the list in sorted order. :param values: list...
[ "For", "list", "values", "returns", "the", "insert", "position", "for", "item", "x", "and", "whether", "the", "item", "already", "exists", "in", "the", "list", ".", "This", "allows", "one", "function", "call", "to", "return", "either", "the", "index", "to"...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/sort_utils.py#L8-L21
rsheftel/raccoon
raccoon/sort_utils.py
sorted_index
def sorted_index(values, x): """ For list, values, returns the index location of element x. If x does not exist will raise an error. :param values: list :param x: item :return: integer index """ i = bisect_left(values, x) j = bisect_right(values, x) return values[i:j].index(x) + i
python
def sorted_index(values, x): """ For list, values, returns the index location of element x. If x does not exist will raise an error. :param values: list :param x: item :return: integer index """ i = bisect_left(values, x) j = bisect_right(values, x) return values[i:j].index(x) + i
[ "def", "sorted_index", "(", "values", ",", "x", ")", ":", "i", "=", "bisect_left", "(", "values", ",", "x", ")", "j", "=", "bisect_right", "(", "values", ",", "x", ")", "return", "values", "[", "i", ":", "j", "]", ".", "index", "(", "x", ")", "...
For list, values, returns the index location of element x. If x does not exist will raise an error. :param values: list :param x: item :return: integer index
[ "For", "list", "values", "returns", "the", "index", "location", "of", "element", "x", ".", "If", "x", "does", "not", "exist", "will", "raise", "an", "error", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/sort_utils.py#L24-L34
rsheftel/raccoon
raccoon/sort_utils.py
sorted_list_indexes
def sorted_list_indexes(list_to_sort, key=None, reverse=False): """ Sorts a list but returns the order of the index values of the list for the sort and not the values themselves. For example is the list provided is ['b', 'a', 'c'] then the result will be [2, 1, 3] :param list_to_sort: list to sort ...
python
def sorted_list_indexes(list_to_sort, key=None, reverse=False): """ Sorts a list but returns the order of the index values of the list for the sort and not the values themselves. For example is the list provided is ['b', 'a', 'c'] then the result will be [2, 1, 3] :param list_to_sort: list to sort ...
[ "def", "sorted_list_indexes", "(", "list_to_sort", ",", "key", "=", "None", ",", "reverse", "=", "False", ")", ":", "if", "key", "is", "not", "None", ":", "def", "key_func", "(", "i", ")", ":", "return", "key", "(", "list_to_sort", ".", "__getitem__", ...
Sorts a list but returns the order of the index values of the list for the sort and not the values themselves. For example is the list provided is ['b', 'a', 'c'] then the result will be [2, 1, 3] :param list_to_sort: list to sort :param key: if not None then a function of one argument that is used to extr...
[ "Sorts", "a", "list", "but", "returns", "the", "order", "of", "the", "index", "values", "of", "the", "list", "for", "the", "sort", "and", "not", "the", "values", "themselves", ".", "For", "example", "is", "the", "list", "provided", "is", "[", "b", "a",...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/sort_utils.py#L37-L53
vmlaker/mpipe
doc/create.py
runDia
def runDia(diagram): """Generate the diagrams using Dia.""" ifname = '{}.dia'.format(diagram) ofname = '{}.png'.format(diagram) cmd = 'dia -t png-libart -e {} {}'.format(ofname, ifname) print(' {}'.format(cmd)) subprocess.call(cmd, shell=True) return True
python
def runDia(diagram): """Generate the diagrams using Dia.""" ifname = '{}.dia'.format(diagram) ofname = '{}.png'.format(diagram) cmd = 'dia -t png-libart -e {} {}'.format(ofname, ifname) print(' {}'.format(cmd)) subprocess.call(cmd, shell=True) return True
[ "def", "runDia", "(", "diagram", ")", ":", "ifname", "=", "'{}.dia'", ".", "format", "(", "diagram", ")", "ofname", "=", "'{}.png'", ".", "format", "(", "diagram", ")", "cmd", "=", "'dia -t png-libart -e {} {}'", ".", "format", "(", "ofname", ",", "ifname"...
Generate the diagrams using Dia.
[ "Generate", "the", "diagrams", "using", "Dia", "." ]
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/doc/create.py#L37-L44
vmlaker/mpipe
src/OrderedWorker.py
OrderedWorker.init2
def init2( self, input_tube, # Read task from the input tube. output_tubes, # Send result on all the output tubes. num_workers, # Total number of workers in the stage. disable_result, # Whether to override any result with None. do_stop_task, # Whether to ...
python
def init2( self, input_tube, # Read task from the input tube. output_tubes, # Send result on all the output tubes. num_workers, # Total number of workers in the stage. disable_result, # Whether to override any result with None. do_stop_task, # Whether to ...
[ "def", "init2", "(", "self", ",", "input_tube", ",", "# Read task from the input tube.", "output_tubes", ",", "# Send result on all the output tubes.", "num_workers", ",", "# Total number of workers in the stage.", "disable_result", ",", "# Whether to override any result with None.",...
Create *num_workers* worker objects with *input_tube* and an iterable of *output_tubes*. The worker reads a task from *input_tube* and writes the result to *output_tubes*.
[ "Create", "*", "num_workers", "*", "worker", "objects", "with", "*", "input_tube", "*", "and", "an", "iterable", "of", "*", "output_tubes", "*", ".", "The", "worker", "reads", "a", "task", "from", "*", "input_tube", "*", "and", "writes", "the", "result", ...
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/OrderedWorker.py#L19-L45
vmlaker/mpipe
src/OrderedWorker.py
OrderedWorker.assemble
def assemble( cls, args, input_tube, output_tubes, size, disable_result=False, do_stop_task=False, ): """Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result com...
python
def assemble( cls, args, input_tube, output_tubes, size, disable_result=False, do_stop_task=False, ): """Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result com...
[ "def", "assemble", "(", "cls", ",", "args", ",", "input_tube", ",", "output_tubes", ",", "size", ",", "disable_result", "=", "False", ",", "do_stop_task", "=", "False", ",", ")", ":", "# Create the workers.", "workers", "=", "[", "]", "for", "ii", "in", ...
Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result communication channels *input_tube* and *output_tubes*. The number of workers created is according to *size* parameter. *do_stop_task* indicates whether doTask() will be...
[ "Create", "assemble", "and", "start", "workers", ".", "Workers", "are", "created", "of", "class", "*", "cls", "*", "initialized", "with", "*", "args", "*", "and", "given", "task", "/", "result", "communication", "channels", "*", "input_tube", "*", "and", "...
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/OrderedWorker.py#L53-L93
vmlaker/mpipe
src/OrderedWorker.py
OrderedWorker._link
def _link(self, next_worker, next_is_first=False): """Link the worker to the given next worker object, connecting the two workers with communication tubes.""" lock = multiprocessing.Lock() next_worker._lock_prev_input = lock self._lock_next_input = lock lock.acquire() ...
python
def _link(self, next_worker, next_is_first=False): """Link the worker to the given next worker object, connecting the two workers with communication tubes.""" lock = multiprocessing.Lock() next_worker._lock_prev_input = lock self._lock_next_input = lock lock.acquire() ...
[ "def", "_link", "(", "self", ",", "next_worker", ",", "next_is_first", "=", "False", ")", ":", "lock", "=", "multiprocessing", ".", "Lock", "(", ")", "next_worker", ".", "_lock_prev_input", "=", "lock", "self", ".", "_lock_next_input", "=", "lock", "lock", ...
Link the worker to the given next worker object, connecting the two workers with communication tubes.
[ "Link", "the", "worker", "to", "the", "given", "next", "worker", "object", "connecting", "the", "two", "workers", "with", "communication", "tubes", "." ]
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/OrderedWorker.py#L95-L112
vmlaker/mpipe
src/OrderedWorker.py
OrderedWorker.putResult
def putResult(self, result): """Register the *result* by putting it on all the output tubes.""" self._lock_prev_output.acquire() for tube in self._tubes_result_output: tube.put((result, 0)) self._lock_next_output.release()
python
def putResult(self, result): """Register the *result* by putting it on all the output tubes.""" self._lock_prev_output.acquire() for tube in self._tubes_result_output: tube.put((result, 0)) self._lock_next_output.release()
[ "def", "putResult", "(", "self", ",", "result", ")", ":", "self", ".", "_lock_prev_output", ".", "acquire", "(", ")", "for", "tube", "in", "self", ".", "_tubes_result_output", ":", "tube", ".", "put", "(", "(", "result", ",", "0", ")", ")", "self", "...
Register the *result* by putting it on all the output tubes.
[ "Register", "the", "*", "result", "*", "by", "putting", "it", "on", "all", "the", "output", "tubes", "." ]
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/OrderedWorker.py#L114-L119
vmlaker/mpipe
src/UnorderedWorker.py
UnorderedWorker.init2
def init2( self, input_tube, # Read task from the input tube. output_tubes, # Send result on all the output tubes. num_workers, # Total number of workers in the stage. disable_result, # Whether to override any result with None. do_stop_task, # Whether to ...
python
def init2( self, input_tube, # Read task from the input tube. output_tubes, # Send result on all the output tubes. num_workers, # Total number of workers in the stage. disable_result, # Whether to override any result with None. do_stop_task, # Whether to ...
[ "def", "init2", "(", "self", ",", "input_tube", ",", "# Read task from the input tube.", "output_tubes", ",", "# Send result on all the output tubes.", "num_workers", ",", "# Total number of workers in the stage.", "disable_result", ",", "# Whether to override any result with None.",...
Create *num_workers* worker objects with *input_tube* and an iterable of *output_tubes*. The worker reads a task from *input_tube* and writes the result to *output_tubes*.
[ "Create", "*", "num_workers", "*", "worker", "objects", "with", "*", "input_tube", "*", "and", "an", "iterable", "of", "*", "output_tubes", "*", ".", "The", "worker", "reads", "a", "task", "from", "*", "input_tube", "*", "and", "writes", "the", "result", ...
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/UnorderedWorker.py#L17-L34
vmlaker/mpipe
src/UnorderedWorker.py
UnorderedWorker.assemble
def assemble( cls, args, input_tube, output_tubes, size, disable_result, do_stop_task, ): """Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result communication c...
python
def assemble( cls, args, input_tube, output_tubes, size, disable_result, do_stop_task, ): """Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result communication c...
[ "def", "assemble", "(", "cls", ",", "args", ",", "input_tube", ",", "output_tubes", ",", "size", ",", "disable_result", ",", "do_stop_task", ",", ")", ":", "# Create the workers.", "workers", "=", "[", "]", "for", "ii", "in", "range", "(", "size", ")", "...
Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result communication channels *input_tube* and *output_tubes*. The number of workers created is according to *size* parameter. *do_stop_task* indicates whether doTask() will be...
[ "Create", "assemble", "and", "start", "workers", ".", "Workers", "are", "created", "of", "class", "*", "cls", "*", "initialized", "with", "*", "args", "*", "and", "given", "task", "/", "result", "communication", "channels", "*", "input_tube", "*", "and", "...
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/UnorderedWorker.py#L42-L73
rsheftel/raccoon
raccoon/series.py
SeriesBase.show
def show(self, index=True, **kwargs): """ Print the contents of the Series. This method uses the tabulate function from the tabulate package. Use the kwargs to pass along any arguments to the tabulate function. :param index: If True then include the indexes as a column in the output, if...
python
def show(self, index=True, **kwargs): """ Print the contents of the Series. This method uses the tabulate function from the tabulate package. Use the kwargs to pass along any arguments to the tabulate function. :param index: If True then include the indexes as a column in the output, if...
[ "def", "show", "(", "self", ",", "index", "=", "True", ",", "*", "*", "kwargs", ")", ":", "print", "(", "self", ".", "_make_table", "(", "index", "=", "index", ",", "*", "*", "kwargs", ")", ")" ]
Print the contents of the Series. This method uses the tabulate function from the tabulate package. Use the kwargs to pass along any arguments to the tabulate function. :param index: If True then include the indexes as a column in the output, if False ignore the index :param kwargs: Parameters ...
[ "Print", "the", "contents", "of", "the", "Series", ".", "This", "method", "uses", "the", "tabulate", "function", "from", "the", "tabulate", "package", ".", "Use", "the", "kwargs", "to", "pass", "along", "any", "arguments", "to", "the", "tabulate", "function"...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L50-L59
rsheftel/raccoon
raccoon/series.py
SeriesBase.get
def get(self, indexes, as_list=False): """ Given indexes will return a sub-set of the Series. This method will direct to the specific methods based on what types are passed in for the indexes. The type of the return is determined by the types of the parameters. :param indexes: i...
python
def get(self, indexes, as_list=False): """ Given indexes will return a sub-set of the Series. This method will direct to the specific methods based on what types are passed in for the indexes. The type of the return is determined by the types of the parameters. :param indexes: i...
[ "def", "get", "(", "self", ",", "indexes", ",", "as_list", "=", "False", ")", ":", "if", "isinstance", "(", "indexes", ",", "(", "list", ",", "blist", ")", ")", ":", "return", "self", ".", "get_rows", "(", "indexes", ",", "as_list", ")", "else", ":...
Given indexes will return a sub-set of the Series. This method will direct to the specific methods based on what types are passed in for the indexes. The type of the return is determined by the types of the parameters. :param indexes: index value, list of index values, or a list of booleans. ...
[ "Given", "indexes", "will", "return", "a", "sub", "-", "set", "of", "the", "Series", ".", "This", "method", "will", "direct", "to", "the", "specific", "methods", "based", "on", "what", "types", "are", "passed", "in", "for", "the", "indexes", ".", "The", ...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L97-L110
rsheftel/raccoon
raccoon/series.py
SeriesBase.get_cell
def get_cell(self, index): """ For a single index and return the value :param index: index value :return: value """ i = sorted_index(self._index, index) if self._sort else self._index.index(index) return self._data[i]
python
def get_cell(self, index): """ For a single index and return the value :param index: index value :return: value """ i = sorted_index(self._index, index) if self._sort else self._index.index(index) return self._data[i]
[ "def", "get_cell", "(", "self", ",", "index", ")", ":", "i", "=", "sorted_index", "(", "self", ".", "_index", ",", "index", ")", "if", "self", ".", "_sort", "else", "self", ".", "_index", ".", "index", "(", "index", ")", "return", "self", ".", "_da...
For a single index and return the value :param index: index value :return: value
[ "For", "a", "single", "index", "and", "return", "the", "value" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L112-L120
rsheftel/raccoon
raccoon/series.py
SeriesBase.get_rows
def get_rows(self, indexes, as_list=False): """ For a list of indexes return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param as_list: if True return a list, if False return Series ...
python
def get_rows(self, indexes, as_list=False): """ For a list of indexes return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param as_list: if True return a list, if False return Series ...
[ "def", "get_rows", "(", "self", ",", "indexes", ",", "as_list", "=", "False", ")", ":", "if", "all", "(", "[", "isinstance", "(", "i", ",", "bool", ")", "for", "i", "in", "indexes", "]", ")", ":", "# boolean list", "if", "len", "(", "indexes", ")",...
For a list of indexes return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param as_list: if True return a list, if False return Series :return: Series if as_list if False, a list if as_list is True
[ "For", "a", "list", "of", "indexes", "return", "the", "values", "of", "the", "indexes", "in", "that", "column", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L122-L145
rsheftel/raccoon
raccoon/series.py
SeriesBase.get_location
def get_location(self, location): """ For an index location return a dict of the index and value. This is optimized for speed because it does not need to lookup the index location with a search. Also can accept relative indexing from the end of the SEries in standard python notation [-3,...
python
def get_location(self, location): """ For an index location return a dict of the index and value. This is optimized for speed because it does not need to lookup the index location with a search. Also can accept relative indexing from the end of the SEries in standard python notation [-3,...
[ "def", "get_location", "(", "self", ",", "location", ")", ":", "return", "{", "self", ".", "index_name", ":", "self", ".", "_index", "[", "location", "]", ",", "self", ".", "data_name", ":", "self", ".", "_data", "[", "location", "]", "}" ]
For an index location return a dict of the index and value. This is optimized for speed because it does not need to lookup the index location with a search. Also can accept relative indexing from the end of the SEries in standard python notation [-3, -2, -1] :param location: index location in s...
[ "For", "an", "index", "location", "return", "a", "dict", "of", "the", "index", "and", "value", ".", "This", "is", "optimized", "for", "speed", "because", "it", "does", "not", "need", "to", "lookup", "the", "index", "location", "with", "a", "search", ".",...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L147-L156
rsheftel/raccoon
raccoon/series.py
SeriesBase.get_locations
def get_locations(self, locations, as_list=False): """ For list of locations return a Series or list of the values. :param locations: list of index locations :param as_list: True to return a list of values :return: Series or list """ indexes = [self._index[x] fo...
python
def get_locations(self, locations, as_list=False): """ For list of locations return a Series or list of the values. :param locations: list of index locations :param as_list: True to return a list of values :return: Series or list """ indexes = [self._index[x] fo...
[ "def", "get_locations", "(", "self", ",", "locations", ",", "as_list", "=", "False", ")", ":", "indexes", "=", "[", "self", ".", "_index", "[", "x", "]", "for", "x", "in", "locations", "]", "return", "self", ".", "get", "(", "indexes", ",", "as_list"...
For list of locations return a Series or list of the values. :param locations: list of index locations :param as_list: True to return a list of values :return: Series or list
[ "For", "list", "of", "locations", "return", "a", "Series", "or", "list", "of", "the", "values", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L158-L168
rsheftel/raccoon
raccoon/series.py
SeriesBase.get_slice
def get_slice(self, start_index=None, stop_index=None, as_list=False): """ For sorted Series will return either a Series or list of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. If either the ...
python
def get_slice(self, start_index=None, stop_index=None, as_list=False): """ For sorted Series will return either a Series or list of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. If either the ...
[ "def", "get_slice", "(", "self", ",", "start_index", "=", "None", ",", "stop_index", "=", "None", ",", "as_list", "=", "False", ")", ":", "if", "not", "self", ".", "_sort", ":", "raise", "RuntimeError", "(", "'Can only use get_slice on sorted Series'", ")", ...
For sorted Series will return either a Series or list of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. If either the start or stop index is None then will include from the first or last element, similar to st...
[ "For", "sorted", "Series", "will", "return", "either", "a", "Series", "or", "list", "of", "all", "of", "the", "rows", "where", "the", "index", "is", "greater", "than", "or", "equal", "to", "the", "start_index", "if", "provided", "and", "less", "than", "o...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L170-L195
rsheftel/raccoon
raccoon/series.py
SeriesBase.to_dict
def to_dict(self, index=True, ordered=False): """ Returns a dict where the keys are the data and index names and the values are list of the data and index. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an Orde...
python
def to_dict(self, index=True, ordered=False): """ Returns a dict where the keys are the data and index names and the values are list of the data and index. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an Orde...
[ "def", "to_dict", "(", "self", ",", "index", "=", "True", ",", "ordered", "=", "False", ")", ":", "result", "=", "OrderedDict", "(", ")", "if", "ordered", "else", "dict", "(", ")", "if", "index", ":", "result", ".", "update", "(", "{", "self", ".",...
Returns a dict where the keys are the data and index names and the values are list of the data and index. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an OrderedDict() to preserve the order of the columns in the Series ...
[ "Returns", "a", "dict", "where", "the", "keys", "are", "the", "data", "and", "index", "names", "and", "the", "values", "are", "list", "of", "the", "data", "and", "index", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L235-L251
rsheftel/raccoon
raccoon/series.py
SeriesBase.head
def head(self, rows): """ Return a Series of the first N rows :param rows: number of rows :return: Series """ rows_bool = [True] * min(rows, len(self._index)) rows_bool.extend([False] * max(0, len(self._index) - rows)) return self.get(indexes=rows_bool)
python
def head(self, rows): """ Return a Series of the first N rows :param rows: number of rows :return: Series """ rows_bool = [True] * min(rows, len(self._index)) rows_bool.extend([False] * max(0, len(self._index) - rows)) return self.get(indexes=rows_bool)
[ "def", "head", "(", "self", ",", "rows", ")", ":", "rows_bool", "=", "[", "True", "]", "*", "min", "(", "rows", ",", "len", "(", "self", ".", "_index", ")", ")", "rows_bool", ".", "extend", "(", "[", "False", "]", "*", "max", "(", "0", ",", "...
Return a Series of the first N rows :param rows: number of rows :return: Series
[ "Return", "a", "Series", "of", "the", "first", "N", "rows" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L253-L262
rsheftel/raccoon
raccoon/series.py
SeriesBase.select_index
def select_index(self, compare, result='boolean'): """ Finds the elements in the index that match the compare parameter and returns either a list of the values that match, of a boolean list the length of the index with True to each index that matches. If the indexes are tuples then the c...
python
def select_index(self, compare, result='boolean'): """ Finds the elements in the index that match the compare parameter and returns either a list of the values that match, of a boolean list the length of the index with True to each index that matches. If the indexes are tuples then the c...
[ "def", "select_index", "(", "self", ",", "compare", ",", "result", "=", "'boolean'", ")", ":", "if", "isinstance", "(", "compare", ",", "tuple", ")", ":", "# this crazy list comprehension will match all the tuples in the list with None being an * wildcard", "booleans", "=...
Finds the elements in the index that match the compare parameter and returns either a list of the values that match, of a boolean list the length of the index with True to each index that matches. If the indexes are tuples then the compare is a tuple where None in any field of the tuple will be treated ...
[ "Finds", "the", "elements", "in", "the", "index", "that", "match", "the", "compare", "parameter", "and", "returns", "either", "a", "list", "of", "the", "values", "that", "match", "of", "a", "boolean", "list", "the", "length", "of", "the", "index", "with", ...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L275-L301
rsheftel/raccoon
raccoon/series.py
SeriesBase.equality
def equality(self, indexes=None, value=None): """ Math helper method. Given a column and optional indexes will return a list of booleans on the equality of the value for that index in the DataFrame to the value parameter. :param indexes: list of index values or list of booleans. If a li...
python
def equality(self, indexes=None, value=None): """ Math helper method. Given a column and optional indexes will return a list of booleans on the equality of the value for that index in the DataFrame to the value parameter. :param indexes: list of index values or list of booleans. If a li...
[ "def", "equality", "(", "self", ",", "indexes", "=", "None", ",", "value", "=", "None", ")", ":", "indexes", "=", "[", "True", "]", "*", "len", "(", "self", ".", "_index", ")", "if", "indexes", "is", "None", "else", "indexes", "compare_list", "=", ...
Math helper method. Given a column and optional indexes will return a list of booleans on the equality of the value for that index in the DataFrame to the value parameter. :param indexes: list of index values or list of booleans. If a list of booleans then the list must be the same\ length as t...
[ "Math", "helper", "method", ".", "Given", "a", "column", "and", "optional", "indexes", "will", "return", "a", "list", "of", "booleans", "on", "the", "equality", "of", "the", "value", "for", "that", "index", "in", "the", "DataFrame", "to", "the", "value", ...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L312-L324
rsheftel/raccoon
raccoon/series.py
Series._pad_data
def _pad_data(self, index_len): """ Pad the data in Series with [None] to ensure that data is the same length as index :param index_len: length of index to extend data to :return: nothing """ self._data.extend([None] * (index_len - len(self._data)))
python
def _pad_data(self, index_len): """ Pad the data in Series with [None] to ensure that data is the same length as index :param index_len: length of index to extend data to :return: nothing """ self._data.extend([None] * (index_len - len(self._data)))
[ "def", "_pad_data", "(", "self", ",", "index_len", ")", ":", "self", ".", "_data", ".", "extend", "(", "[", "None", "]", "*", "(", "index_len", "-", "len", "(", "self", ".", "_data", ")", ")", ")" ]
Pad the data in Series with [None] to ensure that data is the same length as index :param index_len: length of index to extend data to :return: nothing
[ "Pad", "the", "data", "in", "Series", "with", "[", "None", "]", "to", "ensure", "that", "data", "is", "the", "same", "length", "as", "index" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L382-L389
rsheftel/raccoon
raccoon/series.py
Series.sort_index
def sort_index(self): """ Sort the Series by the index. The sort modifies the Series inplace :return: nothing """ sort = sorted_list_indexes(self._index) # sort index self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] for x in...
python
def sort_index(self): """ Sort the Series by the index. The sort modifies the Series inplace :return: nothing """ sort = sorted_list_indexes(self._index) # sort index self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] for x in...
[ "def", "sort_index", "(", "self", ")", ":", "sort", "=", "sorted_list_indexes", "(", "self", ".", "_index", ")", "# sort index", "self", ".", "_index", "=", "blist", "(", "[", "self", ".", "_index", "[", "x", "]", "for", "x", "in", "sort", "]", ")", ...
Sort the Series by the index. The sort modifies the Series inplace :return: nothing
[ "Sort", "the", "Series", "by", "the", "index", ".", "The", "sort", "modifies", "the", "Series", "inplace" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L418-L428
rsheftel/raccoon
raccoon/series.py
Series.set
def set(self, indexes, values=None): """ Given indexes will set a sub-set of the Series to the values provided. This method will direct to the below methods based on what types are passed in for the indexes. If the indexes contains values not in the Series then new rows or columns will...
python
def set(self, indexes, values=None): """ Given indexes will set a sub-set of the Series to the values provided. This method will direct to the below methods based on what types are passed in for the indexes. If the indexes contains values not in the Series then new rows or columns will...
[ "def", "set", "(", "self", ",", "indexes", ",", "values", "=", "None", ")", ":", "if", "isinstance", "(", "indexes", ",", "(", "list", ",", "blist", ")", ")", ":", "self", ".", "set_rows", "(", "indexes", ",", "values", ")", "else", ":", "self", ...
Given indexes will set a sub-set of the Series to the values provided. This method will direct to the below methods based on what types are passed in for the indexes. If the indexes contains values not in the Series then new rows or columns will be added. :param indexes: indexes value, list o...
[ "Given", "indexes", "will", "set", "a", "sub", "-", "set", "of", "the", "Series", "to", "the", "values", "provided", ".", "This", "method", "will", "direct", "to", "the", "below", "methods", "based", "on", "what", "types", "are", "passed", "in", "for", ...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L430-L443
rsheftel/raccoon
raccoon/series.py
Series._add_row
def _add_row(self, index): """ Add a new row to the Series :param index: index of the new row :return: nothing """ self._index.append(index) self._data.append(None)
python
def _add_row(self, index): """ Add a new row to the Series :param index: index of the new row :return: nothing """ self._index.append(index) self._data.append(None)
[ "def", "_add_row", "(", "self", ",", "index", ")", ":", "self", ".", "_index", ".", "append", "(", "index", ")", "self", ".", "_data", ".", "append", "(", "None", ")" ]
Add a new row to the Series :param index: index of the new row :return: nothing
[ "Add", "a", "new", "row", "to", "the", "Series" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L445-L453
rsheftel/raccoon
raccoon/series.py
Series._insert_row
def _insert_row(self, i, index): """ Insert a new row in the Series. :param i: index location to insert :param index: index value to insert into the index list :return: nothing """ if i == len(self._index): self._add_row(index) else: ...
python
def _insert_row(self, i, index): """ Insert a new row in the Series. :param i: index location to insert :param index: index value to insert into the index list :return: nothing """ if i == len(self._index): self._add_row(index) else: ...
[ "def", "_insert_row", "(", "self", ",", "i", ",", "index", ")", ":", "if", "i", "==", "len", "(", "self", ".", "_index", ")", ":", "self", ".", "_add_row", "(", "index", ")", "else", ":", "self", ".", "_index", ".", "insert", "(", "i", ",", "in...
Insert a new row in the Series. :param i: index location to insert :param index: index value to insert into the index list :return: nothing
[ "Insert", "a", "new", "row", "in", "the", "Series", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L455-L467
rsheftel/raccoon
raccoon/series.py
Series._add_missing_rows
def _add_missing_rows(self, indexes): """ Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index by appending to the Series. This does not maintain sorted order for the index. :param indexes: list of indexes :return: ...
python
def _add_missing_rows(self, indexes): """ Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index by appending to the Series. This does not maintain sorted order for the index. :param indexes: list of indexes :return: ...
[ "def", "_add_missing_rows", "(", "self", ",", "indexes", ")", ":", "new_indexes", "=", "[", "x", "for", "x", "in", "indexes", "if", "x", "not", "in", "self", ".", "_index", "]", "for", "x", "in", "new_indexes", ":", "self", ".", "_add_row", "(", "x",...
Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index by appending to the Series. This does not maintain sorted order for the index. :param indexes: list of indexes :return: nothing
[ "Given", "a", "list", "of", "indexes", "find", "all", "the", "indexes", "that", "are", "not", "currently", "in", "the", "Series", "and", "make", "a", "new", "row", "for", "that", "index", "by", "appending", "to", "the", "Series", ".", "This", "does", "...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L469-L479
rsheftel/raccoon
raccoon/series.py
Series._insert_missing_rows
def _insert_missing_rows(self, indexes): """ Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index, inserting into the index. This requires the Series to be sorted=True :param indexes: list of indexes :return: nothin...
python
def _insert_missing_rows(self, indexes): """ Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index, inserting into the index. This requires the Series to be sorted=True :param indexes: list of indexes :return: nothin...
[ "def", "_insert_missing_rows", "(", "self", ",", "indexes", ")", ":", "new_indexes", "=", "[", "x", "for", "x", "in", "indexes", "if", "x", "not", "in", "self", ".", "_index", "]", "for", "x", "in", "new_indexes", ":", "self", ".", "_insert_row", "(", ...
Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index, inserting into the index. This requires the Series to be sorted=True :param indexes: list of indexes :return: nothing
[ "Given", "a", "list", "of", "indexes", "find", "all", "the", "indexes", "that", "are", "not", "currently", "in", "the", "Series", "and", "make", "a", "new", "row", "for", "that", "index", "inserting", "into", "the", "index", ".", "This", "requires", "the...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L481-L491
rsheftel/raccoon
raccoon/series.py
Series.set_cell
def set_cell(self, index, value): """ Sets the value of a single cell. If the index is not in the current index then a new index will be created. :param index: index value :param value: value to set :return: nothing """ if self._sort: exists, i = sort...
python
def set_cell(self, index, value): """ Sets the value of a single cell. If the index is not in the current index then a new index will be created. :param index: index value :param value: value to set :return: nothing """ if self._sort: exists, i = sort...
[ "def", "set_cell", "(", "self", ",", "index", ",", "value", ")", ":", "if", "self", ".", "_sort", ":", "exists", ",", "i", "=", "sorted_exists", "(", "self", ".", "_index", ",", "index", ")", "if", "not", "exists", ":", "self", ".", "_insert_row", ...
Sets the value of a single cell. If the index is not in the current index then a new index will be created. :param index: index value :param value: value to set :return: nothing
[ "Sets", "the", "value", "of", "a", "single", "cell", ".", "If", "the", "index", "is", "not", "in", "the", "current", "index", "then", "a", "new", "index", "will", "be", "created", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L493-L511
rsheftel/raccoon
raccoon/series.py
Series.set_rows
def set_rows(self, index, values=None): """ Set rows to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then the list must be the sam...
python
def set_rows(self, index, values=None): """ Set rows to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then the list must be the sam...
[ "def", "set_rows", "(", "self", ",", "index", ",", "values", "=", "None", ")", ":", "if", "all", "(", "[", "isinstance", "(", "i", ",", "bool", ")", "for", "i", "in", "index", "]", ")", ":", "# boolean list", "if", "not", "isinstance", "(", "values...
Set rows to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then the list must be the same\ length as the Series :param values: eithe...
[ "Set", "rows", "to", "a", "single", "value", "or", "list", "of", "values", ".", "If", "any", "of", "the", "index", "values", "are", "not", "in", "the", "current", "indexes", "then", "a", "new", "row", "will", "be", "created", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L513-L554
rsheftel/raccoon
raccoon/series.py
Series.set_locations
def set_locations(self, locations, values): """ For a list of locations set the values. :param locations: list of index locations :param values: list of values or a single value :return: nothing """ indexes = [self._index[x] for x in locations] self.set(...
python
def set_locations(self, locations, values): """ For a list of locations set the values. :param locations: list of index locations :param values: list of values or a single value :return: nothing """ indexes = [self._index[x] for x in locations] self.set(...
[ "def", "set_locations", "(", "self", ",", "locations", ",", "values", ")", ":", "indexes", "=", "[", "self", ".", "_index", "[", "x", "]", "for", "x", "in", "locations", "]", "self", ".", "set", "(", "indexes", ",", "values", ")" ]
For a list of locations set the values. :param locations: list of index locations :param values: list of values or a single value :return: nothing
[ "For", "a", "list", "of", "locations", "set", "the", "values", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L566-L576
rsheftel/raccoon
raccoon/series.py
Series.append_row
def append_row(self, index, value): """ Appends a row of value to the end of the data. Be very careful with this function as for sorted Series it will not enforce sort order. Use this only for speed when needed, be careful. :param index: index :param value: value :retur...
python
def append_row(self, index, value): """ Appends a row of value to the end of the data. Be very careful with this function as for sorted Series it will not enforce sort order. Use this only for speed when needed, be careful. :param index: index :param value: value :retur...
[ "def", "append_row", "(", "self", ",", "index", ",", "value", ")", ":", "if", "index", "in", "self", ".", "_index", ":", "raise", "IndexError", "(", "'index already in Series'", ")", "self", ".", "_index", ".", "append", "(", "index", ")", "self", ".", ...
Appends a row of value to the end of the data. Be very careful with this function as for sorted Series it will not enforce sort order. Use this only for speed when needed, be careful. :param index: index :param value: value :return: nothing
[ "Appends", "a", "row", "of", "value", "to", "the", "end", "of", "the", "data", ".", "Be", "very", "careful", "with", "this", "function", "as", "for", "sorted", "Series", "it", "will", "not", "enforce", "sort", "order", ".", "Use", "this", "only", "for"...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L614-L627
rsheftel/raccoon
raccoon/series.py
Series.append_rows
def append_rows(self, indexes, values): """ Appends values to the end of the data. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only for speed when needed, be careful. :param indexes: list of indexes to append :param values:...
python
def append_rows(self, indexes, values): """ Appends values to the end of the data. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only for speed when needed, be careful. :param indexes: list of indexes to append :param values:...
[ "def", "append_rows", "(", "self", ",", "indexes", ",", "values", ")", ":", "# check that the values data is less than or equal to the length of the indexes", "if", "len", "(", "values", ")", "!=", "len", "(", "indexes", ")", ":", "raise", "ValueError", "(", "'lengt...
Appends values to the end of the data. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only for speed when needed, be careful. :param indexes: list of indexes to append :param values: list of values to append :return: nothing
[ "Appends", "values", "to", "the", "end", "of", "the", "data", ".", "Be", "very", "careful", "with", "this", "function", "as", "for", "sort", "DataFrames", "it", "will", "not", "enforce", "sort", "order", ".", "Use", "this", "only", "for", "speed", "when"...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L629-L650
rsheftel/raccoon
raccoon/series.py
Series.delete
def delete(self, indexes): """ Delete rows from the DataFrame :param indexes: either a list of values or list of booleans for the rows to delete :return: nothing """ indexes = [indexes] if not isinstance(indexes, (list, blist)) else indexes if all([isinstance(i, ...
python
def delete(self, indexes): """ Delete rows from the DataFrame :param indexes: either a list of values or list of booleans for the rows to delete :return: nothing """ indexes = [indexes] if not isinstance(indexes, (list, blist)) else indexes if all([isinstance(i, ...
[ "def", "delete", "(", "self", ",", "indexes", ")", ":", "indexes", "=", "[", "indexes", "]", "if", "not", "isinstance", "(", "indexes", ",", "(", "list", ",", "blist", ")", ")", "else", "indexes", "if", "all", "(", "[", "isinstance", "(", "i", ",",...
Delete rows from the DataFrame :param indexes: either a list of values or list of booleans for the rows to delete :return: nothing
[ "Delete", "rows", "from", "the", "DataFrame" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L652-L672
rsheftel/raccoon
raccoon/series.py
Series.reset_index
def reset_index(self): """ Resets the index of the Series to simple integer list and the index name to 'index'. :return: nothing """ self.index = list(range(self.__len__())) self.index_name = 'index'
python
def reset_index(self): """ Resets the index of the Series to simple integer list and the index name to 'index'. :return: nothing """ self.index = list(range(self.__len__())) self.index_name = 'index'
[ "def", "reset_index", "(", "self", ")", ":", "self", ".", "index", "=", "list", "(", "range", "(", "self", ".", "__len__", "(", ")", ")", ")", "self", ".", "index_name", "=", "'index'" ]
Resets the index of the Series to simple integer list and the index name to 'index'. :return: nothing
[ "Resets", "the", "index", "of", "the", "Series", "to", "simple", "integer", "list", "and", "the", "index", "name", "to", "index", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L674-L681
rsheftel/raccoon
raccoon/series.py
ViewSeries.value
def value(self, indexes, int_as_index=False): """ Wrapper function for get. It will return a list, no index. If the indexes are integers it will be assumed that they are locations unless int_as_index = True. If the indexes are locations then they will be rotated to the left by offset nu...
python
def value(self, indexes, int_as_index=False): """ Wrapper function for get. It will return a list, no index. If the indexes are integers it will be assumed that they are locations unless int_as_index = True. If the indexes are locations then they will be rotated to the left by offset nu...
[ "def", "value", "(", "self", ",", "indexes", ",", "int_as_index", "=", "False", ")", ":", "# single integer value", "if", "isinstance", "(", "indexes", ",", "int", ")", ":", "if", "int_as_index", ":", "return", "self", ".", "get", "(", "indexes", ",", "a...
Wrapper function for get. It will return a list, no index. If the indexes are integers it will be assumed that they are locations unless int_as_index = True. If the indexes are locations then they will be rotated to the left by offset number of locations. :param indexes: integer location, sing...
[ "Wrapper", "function", "for", "get", ".", "It", "will", "return", "a", "list", "no", "index", ".", "If", "the", "indexes", "are", "integers", "it", "will", "be", "assumed", "that", "they", "are", "locations", "unless", "int_as_index", "=", "True", ".", "...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L738-L788
rsheftel/raccoon
raccoon/series.py
ViewSeries.from_dataframe
def from_dataframe(cls, dataframe, column, offset=0): """ Creates and return a Series from a DataFrame and specific column :param dataframe: raccoon DataFrame :param column: column name :param offset: offset value must be provided as there is no equivalent for a DataFrame ...
python
def from_dataframe(cls, dataframe, column, offset=0): """ Creates and return a Series from a DataFrame and specific column :param dataframe: raccoon DataFrame :param column: column name :param offset: offset value must be provided as there is no equivalent for a DataFrame ...
[ "def", "from_dataframe", "(", "cls", ",", "dataframe", ",", "column", ",", "offset", "=", "0", ")", ":", "return", "cls", "(", "data", "=", "dataframe", ".", "get_entire_column", "(", "column", ",", "as_list", "=", "True", ")", ",", "index", "=", "data...
Creates and return a Series from a DataFrame and specific column :param dataframe: raccoon DataFrame :param column: column name :param offset: offset value must be provided as there is no equivalent for a DataFrame :return: Series
[ "Creates", "and", "return", "a", "Series", "from", "a", "DataFrame", "and", "specific", "column" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L807-L817
rsheftel/raccoon
raccoon/series.py
ViewSeries.from_series
def from_series(cls, series, offset=0): """ Creates and return a Series from a Series :param series: raccoon Series :param offset: offset value must be provided as there is no equivalent for a DataFrame :return: Series """ return cls(data=series.data, index=serie...
python
def from_series(cls, series, offset=0): """ Creates and return a Series from a Series :param series: raccoon Series :param offset: offset value must be provided as there is no equivalent for a DataFrame :return: Series """ return cls(data=series.data, index=serie...
[ "def", "from_series", "(", "cls", ",", "series", ",", "offset", "=", "0", ")", ":", "return", "cls", "(", "data", "=", "series", ".", "data", ",", "index", "=", "series", ".", "index", ",", "data_name", "=", "series", ".", "data_name", ",", "index_na...
Creates and return a Series from a Series :param series: raccoon Series :param offset: offset value must be provided as there is no equivalent for a DataFrame :return: Series
[ "Creates", "and", "return", "a", "Series", "from", "a", "Series" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L820-L829
vmlaker/mpipe
src/TubeQ.py
TubeQ.get
def get(self, timeout=None): """Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.""" if timeout: try: result = self._queue.get(True, timeout) except multiprocessing.Queue.Empty: ...
python
def get(self, timeout=None): """Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.""" if timeout: try: result = self._queue.get(True, timeout) except multiprocessing.Queue.Empty: ...
[ "def", "get", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", ":", "try", ":", "result", "=", "self", ".", "_queue", ".", "get", "(", "True", ",", "timeout", ")", "except", "multiprocessing", ".", "Queue", ".", "Empty", ":", "r...
Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.
[ "Return", "the", "next", "available", "item", "from", "the", "tube", "." ]
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/TubeQ.py#L16-L26
vmlaker/mpipe
src/Stage.py
Stage.get
def get(self, timeout=None): """Retrieve results from all the output tubes.""" valid = False result = None for tube in self._output_tubes: if timeout: valid, result = tube.get(timeout) if valid: result = result[0] ...
python
def get(self, timeout=None): """Retrieve results from all the output tubes.""" valid = False result = None for tube in self._output_tubes: if timeout: valid, result = tube.get(timeout) if valid: result = result[0] ...
[ "def", "get", "(", "self", ",", "timeout", "=", "None", ")", ":", "valid", "=", "False", "result", "=", "None", "for", "tube", "in", "self", ".", "_output_tubes", ":", "if", "timeout", ":", "valid", ",", "result", "=", "tube", ".", "get", "(", "tim...
Retrieve results from all the output tubes.
[ "Retrieve", "results", "from", "all", "the", "output", "tubes", "." ]
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/Stage.py#L42-L55
vmlaker/mpipe
src/Stage.py
Stage.link
def link(self, next_stage): """Link to the given downstream stage *next_stage* by adding its input tube to the list of this stage's output tubes. Return this stage.""" if next_stage is self: raise ValueError('cannot link stage to itself') self._output_tubes.append(next_stage._inp...
python
def link(self, next_stage): """Link to the given downstream stage *next_stage* by adding its input tube to the list of this stage's output tubes. Return this stage.""" if next_stage is self: raise ValueError('cannot link stage to itself') self._output_tubes.append(next_stage._inp...
[ "def", "link", "(", "self", ",", "next_stage", ")", ":", "if", "next_stage", "is", "self", ":", "raise", "ValueError", "(", "'cannot link stage to itself'", ")", "self", ".", "_output_tubes", ".", "append", "(", "next_stage", ".", "_input_tube", ")", "self", ...
Link to the given downstream stage *next_stage* by adding its input tube to the list of this stage's output tubes. Return this stage.
[ "Link", "to", "the", "given", "downstream", "stage", "*", "next_stage", "*", "by", "adding", "its", "input", "tube", "to", "the", "list", "of", "this", "stage", "s", "output", "tubes", ".", "Return", "this", "stage", "." ]
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/Stage.py#L64-L71
vmlaker/mpipe
src/Stage.py
Stage.getLeaves
def getLeaves(self): """Return the downstream leaf stages of this stage.""" result = list() if not self._next_stages: result.append(self) else: for stage in self._next_stages: leaves = stage.getLeaves() result += leaves retu...
python
def getLeaves(self): """Return the downstream leaf stages of this stage.""" result = list() if not self._next_stages: result.append(self) else: for stage in self._next_stages: leaves = stage.getLeaves() result += leaves retu...
[ "def", "getLeaves", "(", "self", ")", ":", "result", "=", "list", "(", ")", "if", "not", "self", ".", "_next_stages", ":", "result", ".", "append", "(", "self", ")", "else", ":", "for", "stage", "in", "self", ".", "_next_stages", ":", "leaves", "=", ...
Return the downstream leaf stages of this stage.
[ "Return", "the", "downstream", "leaf", "stages", "of", "this", "stage", "." ]
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/Stage.py#L73-L82
vmlaker/mpipe
src/Stage.py
Stage.build
def build(self): """Create and start up the internal workers.""" # If there's no output tube, it means that this stage # is at the end of a fork (hasn't been linked to any stage downstream). # Therefore, create one output tube. if not self._output_tubes: self._output...
python
def build(self): """Create and start up the internal workers.""" # If there's no output tube, it means that this stage # is at the end of a fork (hasn't been linked to any stage downstream). # Therefore, create one output tube. if not self._output_tubes: self._output...
[ "def", "build", "(", "self", ")", ":", "# If there's no output tube, it means that this stage", "# is at the end of a fork (hasn't been linked to any stage downstream).", "# Therefore, create one output tube.", "if", "not", "self", ".", "_output_tubes", ":", "self", ".", "_output_t...
Create and start up the internal workers.
[ "Create", "and", "start", "up", "the", "internal", "workers", "." ]
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/Stage.py#L84-L104
vmlaker/mpipe
src/TubeP.py
TubeP.get
def get(self, timeout=None): """Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.""" if timeout: # Todo: Consider locking the poll/recv block. # Otherwise, this method is not thread safe. ...
python
def get(self, timeout=None): """Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.""" if timeout: # Todo: Consider locking the poll/recv block. # Otherwise, this method is not thread safe. ...
[ "def", "get", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", ":", "# Todo: Consider locking the poll/recv block.", "# Otherwise, this method is not thread safe.", "if", "self", ".", "_conn1", ".", "poll", "(", "timeout", ")", ":", "return", "...
Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.
[ "Return", "the", "next", "available", "item", "from", "the", "tube", "." ]
train
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/TubeP.py#L17-L28
rsheftel/raccoon
raccoon/dataframe.py
DataFrame._sort_columns
def _sort_columns(self, columns_list): """ Given a list of column names will sort the DataFrame columns to match the given order :param columns_list: list of column names. Must include all column names :return: nothing """ if not (all([x in columns_list for x in self._co...
python
def _sort_columns(self, columns_list): """ Given a list of column names will sort the DataFrame columns to match the given order :param columns_list: list of column names. Must include all column names :return: nothing """ if not (all([x in columns_list for x in self._co...
[ "def", "_sort_columns", "(", "self", ",", "columns_list", ")", ":", "if", "not", "(", "all", "(", "[", "x", "in", "columns_list", "for", "x", "in", "self", ".", "_columns", "]", ")", "and", "all", "(", "[", "x", "in", "self", ".", "_columns", "for"...
Given a list of column names will sort the DataFrame columns to match the given order :param columns_list: list of column names. Must include all column names :return: nothing
[ "Given", "a", "list", "of", "column", "names", "will", "sort", "the", "DataFrame", "columns", "to", "match", "the", "given", "order" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L126-L139
rsheftel/raccoon
raccoon/dataframe.py
DataFrame._pad_data
def _pad_data(self, max_len=None): """ Pad the data in DataFrame with [None} to ensure that all columns have the same length. :param max_len: If provided will extend all columns to this length, if not then will use the longest column :return: nothing """ if not max_len: ...
python
def _pad_data(self, max_len=None): """ Pad the data in DataFrame with [None} to ensure that all columns have the same length. :param max_len: If provided will extend all columns to this length, if not then will use the longest column :return: nothing """ if not max_len: ...
[ "def", "_pad_data", "(", "self", ",", "max_len", "=", "None", ")", ":", "if", "not", "max_len", ":", "max_len", "=", "max", "(", "[", "len", "(", "x", ")", "for", "x", "in", "self", ".", "_data", "]", ")", "for", "_", ",", "col", "in", "enumera...
Pad the data in DataFrame with [None} to ensure that all columns have the same length. :param max_len: If provided will extend all columns to this length, if not then will use the longest column :return: nothing
[ "Pad", "the", "data", "in", "DataFrame", "with", "[", "None", "}", "to", "ensure", "that", "all", "columns", "have", "the", "same", "length", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L141-L151
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get
def get(self, indexes=None, columns=None, as_list=False, as_dict=False): """ Given indexes and columns will return a sub-set of the DataFrame. This method will direct to the below methods based on what types are passed in for the indexes and columns. The type of the return is determined by the ...
python
def get(self, indexes=None, columns=None, as_list=False, as_dict=False): """ Given indexes and columns will return a sub-set of the DataFrame. This method will direct to the below methods based on what types are passed in for the indexes and columns. The type of the return is determined by the ...
[ "def", "get", "(", "self", ",", "indexes", "=", "None", ",", "columns", "=", "None", ",", "as_list", "=", "False", ",", "as_dict", "=", "False", ")", ":", "if", "(", "indexes", "is", "None", ")", "and", "(", "columns", "is", "not", "None", ")", "...
Given indexes and columns will return a sub-set of the DataFrame. This method will direct to the below methods based on what types are passed in for the indexes and columns. The type of the return is determined by the types of the parameters. :param indexes: index value, list of index values, o...
[ "Given", "indexes", "and", "columns", "will", "return", "a", "sub", "-", "set", "of", "the", "DataFrame", ".", "This", "method", "will", "direct", "to", "the", "below", "methods", "based", "on", "what", "types", "are", "passed", "in", "for", "the", "inde...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L240-L269
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_cell
def get_cell(self, index, column): """ For a single index and column value return the value of the cell :param index: index value :param column: column name :return: value """ i = sorted_index(self._index, index) if self._sort else self._index.index(index) ...
python
def get_cell(self, index, column): """ For a single index and column value return the value of the cell :param index: index value :param column: column name :return: value """ i = sorted_index(self._index, index) if self._sort else self._index.index(index) ...
[ "def", "get_cell", "(", "self", ",", "index", ",", "column", ")", ":", "i", "=", "sorted_index", "(", "self", ".", "_index", ",", "index", ")", "if", "self", ".", "_sort", "else", "self", ".", "_index", ".", "index", "(", "index", ")", "c", "=", ...
For a single index and column value return the value of the cell :param index: index value :param column: column name :return: value
[ "For", "a", "single", "index", "and", "column", "value", "return", "the", "value", "of", "the", "cell" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L271-L281
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_rows
def get_rows(self, indexes, column, as_list=False): """ For a list of indexes and a single column name return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param column: single column name ...
python
def get_rows(self, indexes, column, as_list=False): """ For a list of indexes and a single column name return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param column: single column name ...
[ "def", "get_rows", "(", "self", ",", "indexes", ",", "column", ",", "as_list", "=", "False", ")", ":", "c", "=", "self", ".", "_columns", ".", "index", "(", "column", ")", "if", "all", "(", "[", "isinstance", "(", "i", ",", "bool", ")", "for", "i...
For a list of indexes and a single column name return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param column: single column name :param as_list: if True return a list, if False return DataFrame ...
[ "For", "a", "list", "of", "indexes", "and", "a", "single", "column", "name", "return", "the", "values", "of", "the", "indexes", "in", "that", "column", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L283-L308
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_columns
def get_columns(self, index, columns=None, as_dict=False): """ For a single index and list of column names return a DataFrame of the values in that index as either a dict or a DataFrame :param index: single index value :param columns: list of column names :param as_dict:...
python
def get_columns(self, index, columns=None, as_dict=False): """ For a single index and list of column names return a DataFrame of the values in that index as either a dict or a DataFrame :param index: single index value :param columns: list of column names :param as_dict:...
[ "def", "get_columns", "(", "self", ",", "index", ",", "columns", "=", "None", ",", "as_dict", "=", "False", ")", ":", "i", "=", "sorted_index", "(", "self", ".", "_index", ",", "index", ")", "if", "self", ".", "_sort", "else", "self", ".", "_index", ...
For a single index and list of column names return a DataFrame of the values in that index as either a dict or a DataFrame :param index: single index value :param columns: list of column names :param as_dict: if True then return the result as a dictionary :return: DataFrame or d...
[ "For", "a", "single", "index", "and", "list", "of", "column", "names", "return", "a", "DataFrame", "of", "the", "values", "in", "that", "index", "as", "either", "a", "dict", "or", "a", "DataFrame" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L310-L321
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_entire_column
def get_entire_column(self, column, as_list=False): """ Shortcut method to retrieve a single column all rows. Since this is a common use case this method will be faster than the more general method. :param column: single column name :param as_list: if True return a list, if Fals...
python
def get_entire_column(self, column, as_list=False): """ Shortcut method to retrieve a single column all rows. Since this is a common use case this method will be faster than the more general method. :param column: single column name :param as_list: if True return a list, if Fals...
[ "def", "get_entire_column", "(", "self", ",", "column", ",", "as_list", "=", "False", ")", ":", "c", "=", "self", ".", "_columns", ".", "index", "(", "column", ")", "data", "=", "self", ".", "_data", "[", "c", "]", "return", "data", "if", "as_list", ...
Shortcut method to retrieve a single column all rows. Since this is a common use case this method will be faster than the more general method. :param column: single column name :param as_list: if True return a list, if False return DataFrame :return: DataFrame is as_list if False, a lis...
[ "Shortcut", "method", "to", "retrieve", "a", "single", "column", "all", "rows", ".", "Since", "this", "is", "a", "common", "use", "case", "this", "method", "will", "be", "faster", "than", "the", "more", "general", "method", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L323-L335
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_matrix
def get_matrix(self, indexes, columns): """ For a list of indexes and list of columns return a DataFrame of the values. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param columns: list of column names :return: DataFrame ...
python
def get_matrix(self, indexes, columns): """ For a list of indexes and list of columns return a DataFrame of the values. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param columns: list of column names :return: DataFrame ...
[ "def", "get_matrix", "(", "self", ",", "indexes", ",", "columns", ")", ":", "if", "all", "(", "[", "isinstance", "(", "i", ",", "bool", ")", "for", "i", "in", "indexes", "]", ")", ":", "# boolean list", "is_bool_indexes", "=", "True", "if", "len", "(...
For a list of indexes and list of columns return a DataFrame of the values. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param columns: list of column names :return: DataFrame
[ "For", "a", "list", "of", "indexes", "and", "list", "of", "columns", "return", "a", "DataFrame", "of", "the", "values", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L337-L369
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_location
def get_location(self, location, columns=None, as_dict=False, index=True): """ For an index location and either (1) list of columns return a DataFrame or dictionary of the values or (2) single column name and return the value of that cell. This is optimized for speed because it does not need ...
python
def get_location(self, location, columns=None, as_dict=False, index=True): """ For an index location and either (1) list of columns return a DataFrame or dictionary of the values or (2) single column name and return the value of that cell. This is optimized for speed because it does not need ...
[ "def", "get_location", "(", "self", ",", "location", ",", "columns", "=", "None", ",", "as_dict", "=", "False", ",", "index", "=", "True", ")", ":", "if", "columns", "is", "None", ":", "columns", "=", "self", ".", "_columns", "elif", "not", "isinstance...
For an index location and either (1) list of columns return a DataFrame or dictionary of the values or (2) single column name and return the value of that cell. This is optimized for speed because it does not need to lookup the index location with a search. Also can accept relative indexing from the end...
[ "For", "an", "index", "location", "and", "either", "(", "1", ")", "list", "of", "columns", "return", "a", "DataFrame", "or", "dictionary", "of", "the", "values", "or", "(", "2", ")", "single", "column", "name", "and", "return", "the", "value", "of", "t...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L371-L405
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_locations
def get_locations(self, locations, columns=None, **kwargs): """ For list of locations and list of columns return a DataFrame of the values. :param locations: list of index locations :param columns: list of column names :param kwargs: will pass along these parameters to the get()...
python
def get_locations(self, locations, columns=None, **kwargs): """ For list of locations and list of columns return a DataFrame of the values. :param locations: list of index locations :param columns: list of column names :param kwargs: will pass along these parameters to the get()...
[ "def", "get_locations", "(", "self", ",", "locations", ",", "columns", "=", "None", ",", "*", "*", "kwargs", ")", ":", "indexes", "=", "[", "self", ".", "_index", "[", "x", "]", "for", "x", "in", "locations", "]", "return", "self", ".", "get", "(",...
For list of locations and list of columns return a DataFrame of the values. :param locations: list of index locations :param columns: list of column names :param kwargs: will pass along these parameters to the get() method :return: DataFrame
[ "For", "list", "of", "locations", "and", "list", "of", "columns", "return", "a", "DataFrame", "of", "the", "values", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L407-L418
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_slice
def get_slice(self, start_index=None, stop_index=None, columns=None, as_dict=False): """ For sorted DataFrames will return either a DataFrame or dict of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. I...
python
def get_slice(self, start_index=None, stop_index=None, columns=None, as_dict=False): """ For sorted DataFrames will return either a DataFrame or dict of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. I...
[ "def", "get_slice", "(", "self", ",", "start_index", "=", "None", ",", "stop_index", "=", "None", ",", "columns", "=", "None", ",", "as_dict", "=", "False", ")", ":", "if", "not", "self", ".", "_sort", ":", "raise", "RuntimeError", "(", "'Can only use ge...
For sorted DataFrames will return either a DataFrame or dict of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. If either the start or stop index is None then will include from the first or last element, simila...
[ "For", "sorted", "DataFrames", "will", "return", "either", "a", "DataFrame", "or", "dict", "of", "all", "of", "the", "rows", "where", "the", "index", "is", "greater", "than", "or", "equal", "to", "the", "start_index", "if", "provided", "and", "less", "than...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L420-L457
rsheftel/raccoon
raccoon/dataframe.py
DataFrame._insert_row
def _insert_row(self, i, index): """ Insert a new row in the DataFrame. :param i: index location to insert :param index: index value to insert into the index list :return: nothing """ if i == len(self._index): self._add_row(index) else: ...
python
def _insert_row(self, i, index): """ Insert a new row in the DataFrame. :param i: index location to insert :param index: index value to insert into the index list :return: nothing """ if i == len(self._index): self._add_row(index) else: ...
[ "def", "_insert_row", "(", "self", ",", "i", ",", "index", ")", ":", "if", "i", "==", "len", "(", "self", ".", "_index", ")", ":", "self", ".", "_add_row", "(", "index", ")", "else", ":", "self", ".", "_index", ".", "insert", "(", "i", ",", "in...
Insert a new row in the DataFrame. :param i: index location to insert :param index: index value to insert into the index list :return: nothing
[ "Insert", "a", "new", "row", "in", "the", "DataFrame", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L459-L472
rsheftel/raccoon
raccoon/dataframe.py
DataFrame._add_row
def _add_row(self, index): """ Add a new row to the DataFrame :param index: index of the new row :return: nothing """ self._index.append(index) for c, _ in enumerate(self._columns): self._data[c].append(None)
python
def _add_row(self, index): """ Add a new row to the DataFrame :param index: index of the new row :return: nothing """ self._index.append(index) for c, _ in enumerate(self._columns): self._data[c].append(None)
[ "def", "_add_row", "(", "self", ",", "index", ")", ":", "self", ".", "_index", ".", "append", "(", "index", ")", "for", "c", ",", "_", "in", "enumerate", "(", "self", ".", "_columns", ")", ":", "self", ".", "_data", "[", "c", "]", ".", "append", ...
Add a new row to the DataFrame :param index: index of the new row :return: nothing
[ "Add", "a", "new", "row", "to", "the", "DataFrame" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L486-L495
rsheftel/raccoon
raccoon/dataframe.py
DataFrame._add_column
def _add_column(self, column): """ Add a new column to the DataFrame :param column: column name :return: nothing """ self._columns.append(column) if self._blist: self._data.append(blist([None] * len(self._index))) else: self._data....
python
def _add_column(self, column): """ Add a new column to the DataFrame :param column: column name :return: nothing """ self._columns.append(column) if self._blist: self._data.append(blist([None] * len(self._index))) else: self._data....
[ "def", "_add_column", "(", "self", ",", "column", ")", ":", "self", ".", "_columns", ".", "append", "(", "column", ")", "if", "self", ".", "_blist", ":", "self", ".", "_data", ".", "append", "(", "blist", "(", "[", "None", "]", "*", "len", "(", "...
Add a new column to the DataFrame :param column: column name :return: nothing
[ "Add", "a", "new", "column", "to", "the", "DataFrame" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L509-L520
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.set
def set(self, indexes=None, columns=None, values=None): """ Given indexes and columns will set a sub-set of the DataFrame to the values provided. This method will direct to the below methods based on what types are passed in for the indexes and columns. If the indexes or columns contains...
python
def set(self, indexes=None, columns=None, values=None): """ Given indexes and columns will set a sub-set of the DataFrame to the values provided. This method will direct to the below methods based on what types are passed in for the indexes and columns. If the indexes or columns contains...
[ "def", "set", "(", "self", ",", "indexes", "=", "None", ",", "columns", "=", "None", ",", "values", "=", "None", ")", ":", "if", "(", "indexes", "is", "not", "None", ")", "and", "(", "columns", "is", "not", "None", ")", ":", "if", "isinstance", "...
Given indexes and columns will set a sub-set of the DataFrame to the values provided. This method will direct to the below methods based on what types are passed in for the indexes and columns. If the indexes or columns contains values not in the DataFrame then new rows or columns will be added. ...
[ "Given", "indexes", "and", "columns", "will", "set", "a", "sub", "-", "set", "of", "the", "DataFrame", "to", "the", "values", "provided", ".", "This", "method", "will", "direct", "to", "the", "below", "methods", "based", "on", "what", "types", "are", "pa...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L522-L546
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.set_cell
def set_cell(self, index, column, value): """ Sets the value of a single cell. If the index and/or column is not in the current index/columns then a new index and/or column will be created. :param index: index value :param column: column name :param value: value to set ...
python
def set_cell(self, index, column, value): """ Sets the value of a single cell. If the index and/or column is not in the current index/columns then a new index and/or column will be created. :param index: index value :param column: column name :param value: value to set ...
[ "def", "set_cell", "(", "self", ",", "index", ",", "column", ",", "value", ")", ":", "if", "self", ".", "_sort", ":", "exists", ",", "i", "=", "sorted_exists", "(", "self", ".", "_index", ",", "index", ")", "if", "not", "exists", ":", "self", ".", ...
Sets the value of a single cell. If the index and/or column is not in the current index/columns then a new index and/or column will be created. :param index: index value :param column: column name :param value: value to set :return: nothing
[ "Sets", "the", "value", "of", "a", "single", "cell", ".", "If", "the", "index", "and", "/", "or", "column", "is", "not", "in", "the", "current", "index", "/", "columns", "then", "a", "new", "index", "and", "/", "or", "column", "will", "be", "created"...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L548-L573
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.set_row
def set_row(self, index, values): """ Sets the values of the columns in a single row. :param index: index value :param values: dict with the keys as the column names and the values what to set that column to :return: nothing """ if self._sort: exists,...
python
def set_row(self, index, values): """ Sets the values of the columns in a single row. :param index: index value :param values: dict with the keys as the column names and the values what to set that column to :return: nothing """ if self._sort: exists,...
[ "def", "set_row", "(", "self", ",", "index", ",", "values", ")", ":", "if", "self", ".", "_sort", ":", "exists", ",", "i", "=", "sorted_exists", "(", "self", ".", "_index", ",", "index", ")", "if", "not", "exists", ":", "self", ".", "_insert_row", ...
Sets the values of the columns in a single row. :param index: index value :param values: dict with the keys as the column names and the values what to set that column to :return: nothing
[ "Sets", "the", "values", "of", "the", "columns", "in", "a", "single", "row", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L575-L599
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.set_column
def set_column(self, index=None, column=None, values=None): """ Set a column to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then ...
python
def set_column(self, index=None, column=None, values=None): """ Set a column to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then ...
[ "def", "set_column", "(", "self", ",", "index", "=", "None", ",", "column", "=", "None", ",", "values", "=", "None", ")", ":", "try", ":", "c", "=", "self", ".", "_columns", ".", "index", "(", "column", ")", "except", "ValueError", ":", "# new column...
Set a column to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then the list must be the same\ length as the DataFrame :param column...
[ "Set", "a", "column", "to", "a", "single", "value", "or", "list", "of", "values", ".", "If", "any", "of", "the", "index", "values", "are", "not", "in", "the", "current", "indexes", "then", "a", "new", "row", "will", "be", "created", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L601-L656
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.set_location
def set_location(self, location, values, missing_to_none=False): """ Sets the column values, as given by the keys of the values dict, for the row at location to the values of the values dict. If missing_to_none is False then columns not in the values dict will be left unchanged, if it is ...
python
def set_location(self, location, values, missing_to_none=False): """ Sets the column values, as given by the keys of the values dict, for the row at location to the values of the values dict. If missing_to_none is False then columns not in the values dict will be left unchanged, if it is ...
[ "def", "set_location", "(", "self", ",", "location", ",", "values", ",", "missing_to_none", "=", "False", ")", ":", "if", "missing_to_none", ":", "# populate the dict with None in any column missing", "for", "column", "in", "self", ".", "_columns", ":", "if", "col...
Sets the column values, as given by the keys of the values dict, for the row at location to the values of the values dict. If missing_to_none is False then columns not in the values dict will be left unchanged, if it is True then they are set to None. This method does not add new columns and raises an e...
[ "Sets", "the", "column", "values", "as", "given", "by", "the", "keys", "of", "the", "values", "dict", "for", "the", "row", "at", "location", "to", "the", "values", "of", "the", "values", "dict", ".", "If", "missing_to_none", "is", "False", "then", "colum...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L658-L677
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.append_row
def append_row(self, index, values, new_cols=True): """ Appends a row of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only...
python
def append_row(self, index, values, new_cols=True): """ Appends a row of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only...
[ "def", "append_row", "(", "self", ",", "index", ",", "values", ",", "new_cols", "=", "True", ")", ":", "if", "index", "in", "self", ".", "_index", ":", "raise", "IndexError", "(", "'index already in DataFrame'", ")", "if", "new_cols", ":", "for", "col", ...
Appends a row of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only for speed when needed, be careful. :param index: value of the ...
[ "Appends", "a", "row", "of", "values", "to", "the", "end", "of", "the", "data", ".", "If", "there", "are", "new", "columns", "in", "the", "values", "and", "new_cols", "is", "True", "they", "will", "be", "added", ".", "Be", "very", "careful", "with", ...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L691-L716
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.append_rows
def append_rows(self, indexes, values, new_cols=True): """ Appends rows of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this on...
python
def append_rows(self, indexes, values, new_cols=True): """ Appends rows of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this on...
[ "def", "append_rows", "(", "self", ",", "indexes", ",", "values", ",", "new_cols", "=", "True", ")", ":", "# check that the values data is less than or equal to the length of the indexes", "for", "column", "in", "values", ":", "if", "len", "(", "values", "[", "colum...
Appends rows of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only for speed when needed, be careful. :param indexes: list of inde...
[ "Appends", "rows", "of", "values", "to", "the", "end", "of", "the", "data", ".", "If", "there", "are", "new", "columns", "in", "the", "values", "and", "new_cols", "is", "True", "they", "will", "be", "added", ".", "Be", "very", "careful", "with", "this"...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L718-L751
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.to_dict
def to_dict(self, index=True, ordered=False): """ Returns a dict where the keys are the column names and the values are lists of the values for that column. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an Ord...
python
def to_dict(self, index=True, ordered=False): """ Returns a dict where the keys are the column names and the values are lists of the values for that column. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an Ord...
[ "def", "to_dict", "(", "self", ",", "index", "=", "True", ",", "ordered", "=", "False", ")", ":", "result", "=", "OrderedDict", "(", ")", "if", "ordered", "else", "dict", "(", ")", "if", "index", ":", "result", ".", "update", "(", "{", "self", ".",...
Returns a dict where the keys are the column names and the values are lists of the values for that column. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an OrderedDict() to preserve the order of the columns in the DataFrame ...
[ "Returns", "a", "dict", "where", "the", "keys", "are", "the", "column", "names", "and", "the", "values", "are", "lists", "of", "the", "values", "for", "that", "column", "." ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L833-L849
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.to_json
def to_json(self): """ Returns a JSON of the entire DataFrame that can be reconstructed back with raccoon.from_json(input). Any object that cannot be serialized will be replaced with the representation of the object using repr(). In that instance the DataFrame will have a string represen...
python
def to_json(self): """ Returns a JSON of the entire DataFrame that can be reconstructed back with raccoon.from_json(input). Any object that cannot be serialized will be replaced with the representation of the object using repr(). In that instance the DataFrame will have a string represen...
[ "def", "to_json", "(", "self", ")", ":", "input_dict", "=", "{", "'data'", ":", "self", ".", "to_dict", "(", "index", "=", "False", ")", ",", "'index'", ":", "list", "(", "self", ".", "_index", ")", "}", "# if blist, turn into lists", "if", "self", "."...
Returns a JSON of the entire DataFrame that can be reconstructed back with raccoon.from_json(input). Any object that cannot be serialized will be replaced with the representation of the object using repr(). In that instance the DataFrame will have a string representation in place of the object and will ...
[ "Returns", "a", "JSON", "of", "the", "entire", "DataFrame", "that", "can", "be", "reconstructed", "back", "with", "raccoon", ".", "from_json", "(", "input", ")", ".", "Any", "object", "that", "cannot", "be", "serialized", "will", "be", "replaced", "with", ...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L851-L874
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.rename_columns
def rename_columns(self, rename_dict): """ Renames the columns :param rename_dict: dict where the keys are the current column names and the values are the new names :return: nothing """ if not all([x in self._columns for x in rename_dict.keys()]): raise Value...
python
def rename_columns(self, rename_dict): """ Renames the columns :param rename_dict: dict where the keys are the current column names and the values are the new names :return: nothing """ if not all([x in self._columns for x in rename_dict.keys()]): raise Value...
[ "def", "rename_columns", "(", "self", ",", "rename_dict", ")", ":", "if", "not", "all", "(", "[", "x", "in", "self", ".", "_columns", "for", "x", "in", "rename_dict", ".", "keys", "(", ")", "]", ")", ":", "raise", "ValueError", "(", "'all dictionary ke...
Renames the columns :param rename_dict: dict where the keys are the current column names and the values are the new names :return: nothing
[ "Renames", "the", "columns" ]
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L876-L886
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.delete_all_rows
def delete_all_rows(self): """ Deletes the contents of all rows in the DataFrame. This function is faster than delete_rows() to remove all information, and at the same time it keeps the container lists for the columns and index so if there is another object that references this DataFrame...
python
def delete_all_rows(self): """ Deletes the contents of all rows in the DataFrame. This function is faster than delete_rows() to remove all information, and at the same time it keeps the container lists for the columns and index so if there is another object that references this DataFrame...
[ "def", "delete_all_rows", "(", "self", ")", ":", "del", "self", ".", "_index", "[", ":", "]", "for", "c", "in", "range", "(", "len", "(", "self", ".", "_columns", ")", ")", ":", "del", "self", ".", "_data", "[", "c", "]", "[", ":", "]" ]
Deletes the contents of all rows in the DataFrame. This function is faster than delete_rows() to remove all information, and at the same time it keeps the container lists for the columns and index so if there is another object that references this DataFrame, like a ViewSeries, the reference remains in t...
[ "Deletes", "the", "contents", "of", "all", "rows", "in", "the", "DataFrame", ".", "This", "function", "is", "faster", "than", "delete_rows", "()", "to", "remove", "all", "information", "and", "at", "the", "same", "time", "it", "keeps", "the", "container", ...
train
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L933-L943