partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
scan
from elist.elist import * from elist.jprint import pobj l = [1,[4],2,[3,[5,6]]] desc = description(l) l = [1,2,[4],[3,[5,6]]] desc = description(l)
elist/elist.py
def scan(l,**kwargs): ''' from elist.elist import * from elist.jprint import pobj l = [1,[4],2,[3,[5,6]]] desc = description(l) l = [1,2,[4],[3,[5,6]]] desc = description(l) ''' if('itermode' in kwargs): itermode = True else: itermode = Fal...
def scan(l,**kwargs): ''' from elist.elist import * from elist.jprint import pobj l = [1,[4],2,[3,[5,6]]] desc = description(l) l = [1,2,[4],[3,[5,6]]] desc = description(l) ''' if('itermode' in kwargs): itermode = True else: itermode = Fal...
[ "from", "elist", ".", "elist", "import", "*", "from", "elist", ".", "jprint", "import", "pobj", "l", "=", "[", "1", "[", "4", "]", "2", "[", "3", "[", "5", "6", "]]]", "desc", "=", "description", "(", "l", ")", "l", "=", "[", "1", "2", "[", ...
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6400-L6435
[ "def", "scan", "(", "l", ",", "*", "*", "kwargs", ")", ":", "if", "(", "'itermode'", "in", "kwargs", ")", ":", "itermode", "=", "True", "else", ":", "itermode", "=", "False", "####level == 0", "desc_matrix", "=", "init_desc_matrix", "(", "l", ")", "if...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
fullfill_descendants_info
flat_offset
elist/elist.py
def fullfill_descendants_info(desc_matrix): ''' flat_offset ''' pathloc_mapping = {} locpath_mapping = {} #def leaf_handler(desc,pdesc,offset): def leaf_handler(desc,pdesc): #desc['flat_offset'] = (offset,offset+1) desc['non_leaf_son_paths'] = [] desc['leaf_son_pat...
def fullfill_descendants_info(desc_matrix): ''' flat_offset ''' pathloc_mapping = {} locpath_mapping = {} #def leaf_handler(desc,pdesc,offset): def leaf_handler(desc,pdesc): #desc['flat_offset'] = (offset,offset+1) desc['non_leaf_son_paths'] = [] desc['leaf_son_pat...
[ "flat_offset" ]
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6460-L6536
[ "def", "fullfill_descendants_info", "(", "desc_matrix", ")", ":", "pathloc_mapping", "=", "{", "}", "locpath_mapping", "=", "{", "}", "#def leaf_handler(desc,pdesc,offset):", "def", "leaf_handler", "(", "desc", ",", "pdesc", ")", ":", "#desc['flat_offset'] = (offset,off...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
pathlist_to_getStr
>>> pathlist_to_getStr([1, '1', 2]) "[1]['1'][2]" >>>
elist/elist.py
def pathlist_to_getStr(path_list): ''' >>> pathlist_to_getStr([1, '1', 2]) "[1]['1'][2]" >>> ''' t1 = path_list.__repr__() t1 = t1.lstrip('[') t1 = t1.rstrip(']') t2 = t1.split(", ") s = '' for i in range(0,t2.__len__()): s = ''.join((s,'[',t2[i],']'))...
def pathlist_to_getStr(path_list): ''' >>> pathlist_to_getStr([1, '1', 2]) "[1]['1'][2]" >>> ''' t1 = path_list.__repr__() t1 = t1.lstrip('[') t1 = t1.rstrip(']') t2 = t1.split(", ") s = '' for i in range(0,t2.__len__()): s = ''.join((s,'[',t2[i],']'))...
[ ">>>", "pathlist_to_getStr", "(", "[", "1", "1", "2", "]", ")", "[", "1", "]", "[", "1", "]", "[", "2", "]", ">>>" ]
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6538-L6551
[ "def", "pathlist_to_getStr", "(", "path_list", ")", ":", "t1", "=", "path_list", ".", "__repr__", "(", ")", "t1", "=", "t1", ".", "lstrip", "(", "'['", ")", "t1", "=", "t1", ".", "rstrip", "(", "']'", ")", "t2", "=", "t1", ".", "split", "(", "\",...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
getStr_to_pathlist
gs = "[1]['1'][2]" getStr_to_pathlist(gs) gs = "['u']['u1']" getStr_to_pathlist(gs)
elist/elist.py
def getStr_to_pathlist(gs): ''' gs = "[1]['1'][2]" getStr_to_pathlist(gs) gs = "['u']['u1']" getStr_to_pathlist(gs) ''' def numize(w): try: int(w) except: try: float(w) except: return(w) ...
def getStr_to_pathlist(gs): ''' gs = "[1]['1'][2]" getStr_to_pathlist(gs) gs = "['u']['u1']" getStr_to_pathlist(gs) ''' def numize(w): try: int(w) except: try: float(w) except: return(w) ...
[ "gs", "=", "[", "1", "]", "[", "1", "]", "[", "2", "]", "getStr_to_pathlist", "(", "gs", ")", "gs", "=", "[", "u", "]", "[", "u1", "]", "getStr_to_pathlist", "(", "gs", ")" ]
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6561-L6595
[ "def", "getStr_to_pathlist", "(", "gs", ")", ":", "def", "numize", "(", "w", ")", ":", "try", ":", "int", "(", "w", ")", "except", ":", "try", ":", "float", "(", "w", ")", "except", ":", "return", "(", "w", ")", "else", ":", "return", "(", "flo...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
get_block_op_pairs
# >>> get_block_op_pairs("{}[]") # {1: ('{', '}'), 2: ('[', ']')} # >>> get_block_op_pairs("{}[]()") # {1: ('{', '}'), 2: ('[', ']'), 3: ('(', ')')} # >>> get_block_op_pairs("{}[]()<>") # {1: ('{', '}'), 2: ('[', ']'), 3: ('(', ')'), 4: ('<', '>')}
elist/elist.py
def get_block_op_pairs(pairs_str): ''' # >>> get_block_op_pairs("{}[]") # {1: ('{', '}'), 2: ('[', ']')} # >>> get_block_op_pairs("{}[]()") # {1: ('{', '}'), 2: ('[', ']'), 3: ('(', ')')} # >>> get_block_op_pairs("{}[]()<>") # {1: ('{', '}'), 2: ('[', ']'), 3: ('(',...
def get_block_op_pairs(pairs_str): ''' # >>> get_block_op_pairs("{}[]") # {1: ('{', '}'), 2: ('[', ']')} # >>> get_block_op_pairs("{}[]()") # {1: ('{', '}'), 2: ('[', ']'), 3: ('(', ')')} # >>> get_block_op_pairs("{}[]()<>") # {1: ('{', '}'), 2: ('[', ']'), 3: ('(',...
[ "#", ">>>", "get_block_op_pairs", "(", "{}", "[]", ")", "#", "{", "1", ":", "(", "{", "}", ")", "2", ":", "(", "[", "]", ")", "}", "#", ">>>", "get_block_op_pairs", "(", "{}", "[]", "()", ")", "#", "{", "1", ":", "(", "{", "}", ")", "2", ...
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6601-L6615
[ "def", "get_block_op_pairs", "(", "pairs_str", ")", ":", "pairs_str_len", "=", "pairs_str", ".", "__len__", "(", ")", "pairs_len", "=", "pairs_str_len", "//", "2", "pairs_dict", "=", "{", "}", "for", "i", "in", "range", "(", "1", ",", "pairs_len", "+", "...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
is_lop
# is_lop('{',block_op_pairs_dict) # is_lop('[',block_op_pairs_dict) # is_lop('}',block_op_pairs_dict) # is_lop(']',block_op_pairs_dict) # is_lop('a',block_op_pairs_dict)
elist/elist.py
def is_lop(ch,block_op_pairs_dict=get_block_op_pairs('{}[]()')): ''' # is_lop('{',block_op_pairs_dict) # is_lop('[',block_op_pairs_dict) # is_lop('}',block_op_pairs_dict) # is_lop(']',block_op_pairs_dict) # is_lop('a',block_op_pairs_dict) ''' for i in range(1,block_op_pairs_dict.__len__(...
def is_lop(ch,block_op_pairs_dict=get_block_op_pairs('{}[]()')): ''' # is_lop('{',block_op_pairs_dict) # is_lop('[',block_op_pairs_dict) # is_lop('}',block_op_pairs_dict) # is_lop(']',block_op_pairs_dict) # is_lop('a',block_op_pairs_dict) ''' for i in range(1,block_op_pairs_dict.__len__(...
[ "#", "is_lop", "(", "{", "block_op_pairs_dict", ")", "#", "is_lop", "(", "[", "block_op_pairs_dict", ")", "#", "is_lop", "(", "}", "block_op_pairs_dict", ")", "#", "is_lop", "(", "]", "block_op_pairs_dict", ")", "#", "is_lop", "(", "a", "block_op_pairs_dict", ...
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6617-L6630
[ "def", "is_lop", "(", "ch", ",", "block_op_pairs_dict", "=", "get_block_op_pairs", "(", "'{}[]()'", ")", ")", ":", "for", "i", "in", "range", "(", "1", ",", "block_op_pairs_dict", ".", "__len__", "(", ")", "+", "1", ")", ":", "if", "(", "ch", "==", "...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
get_next_char_level_in_j_str
the first-char is level-1 when current is non-op, next-char-level = curr-level when current is lop, non-paired-rop-next-char-level = lop-level+1; when current is lop, paired-rop-next-char-level = lop-level when current is rop, next-char-level = rop-level - 1 # {"key_4_UF0a...
elist/elist.py
def get_next_char_level_in_j_str(curr_lv,curr_seq,j_str,block_op_pairs_dict=get_block_op_pairs("{}[]()")): ''' the first-char is level-1 when current is non-op, next-char-level = curr-level when current is lop, non-paired-rop-next-char-level = lop-level+1; when current is lop, paired-ro...
def get_next_char_level_in_j_str(curr_lv,curr_seq,j_str,block_op_pairs_dict=get_block_op_pairs("{}[]()")): ''' the first-char is level-1 when current is non-op, next-char-level = curr-level when current is lop, non-paired-rop-next-char-level = lop-level+1; when current is lop, paired-ro...
[ "the", "first", "-", "char", "is", "level", "-", "1", "when", "current", "is", "non", "-", "op", "next", "-", "char", "-", "level", "=", "curr", "-", "level", "when", "current", "is", "lop", "non", "-", "paired", "-", "rop", "-", "next", "-", "ch...
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6647-L6686
[ "def", "get_next_char_level_in_j_str", "(", "curr_lv", ",", "curr_seq", ",", "j_str", ",", "block_op_pairs_dict", "=", "get_block_op_pairs", "(", "\"{}[]()\"", ")", ")", ":", "curr_ch", "=", "j_str", "[", "curr_seq", "]", "next_ch", "=", "j_str", "[", "curr_seq"...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
str_display_width
from elist.utils import * str_display_width('a') str_display_width('去')
elist/elist.py
def str_display_width(s): ''' from elist.utils import * str_display_width('a') str_display_width('去') ''' s= str(s) width = 0 len = s.__len__() for i in range(0,len): sublen = s[i].encode().__len__() sublen = int(sublen/2 + 1/2) width = width + sub...
def str_display_width(s): ''' from elist.utils import * str_display_width('a') str_display_width('去') ''' s= str(s) width = 0 len = s.__len__() for i in range(0,len): sublen = s[i].encode().__len__() sublen = int(sublen/2 + 1/2) width = width + sub...
[ "from", "elist", ".", "utils", "import", "*", "str_display_width", "(", "a", ")", "str_display_width", "(", "去", ")" ]
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6709-L6722
[ "def", "str_display_width", "(", "s", ")", ":", "s", "=", "str", "(", "s", ")", "width", "=", "0", "len", "=", "s", ".", "__len__", "(", ")", "for", "i", "in", "range", "(", "0", ",", "len", ")", ":", "sublen", "=", "s", "[", "i", "]", ".",...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
get_wfsmat
l = ['v_7', 'v_3', 'v_1', 'v_4', ['v_4', 'v_2'], 'v_5', 'v_6', 'v_1', 'v_6', 'v_7', 'v_5', ['v_4', ['v_1', 'v_8', 'v_3', 'v_4', 'v_2', 'v_7', [['v_3', 'v_2'], 'v_4', 'v_5', 'v_1', 'v_3', 'v_1', 'v_2', 'v_5', 'v_8', 'v_8', 'v_7'], 'v_5', 'v_8', 'v_7', 'v_1', 'v_5'], 'v_6'], 'v_4', 'v_5', 'v_8', 'v_5'] get_wfs(l)
elist/elist.py
def get_wfsmat(l): ''' l = ['v_7', 'v_3', 'v_1', 'v_4', ['v_4', 'v_2'], 'v_5', 'v_6', 'v_1', 'v_6', 'v_7', 'v_5', ['v_4', ['v_1', 'v_8', 'v_3', 'v_4', 'v_2', 'v_7', [['v_3', 'v_2'], 'v_4', 'v_5', 'v_1', 'v_3', 'v_1', 'v_2', 'v_5', 'v_8', 'v_8', 'v_7'], 'v_5', 'v_8', 'v_7', 'v_1', 'v_5'], 'v_6'], 'v_4', 'v_5'...
def get_wfsmat(l): ''' l = ['v_7', 'v_3', 'v_1', 'v_4', ['v_4', 'v_2'], 'v_5', 'v_6', 'v_1', 'v_6', 'v_7', 'v_5', ['v_4', ['v_1', 'v_8', 'v_3', 'v_4', 'v_2', 'v_7', [['v_3', 'v_2'], 'v_4', 'v_5', 'v_1', 'v_3', 'v_1', 'v_2', 'v_5', 'v_8', 'v_8', 'v_7'], 'v_5', 'v_8', 'v_7', 'v_1', 'v_5'], 'v_6'], 'v_4', 'v_5'...
[ "l", "=", "[", "v_7", "v_3", "v_1", "v_4", "[", "v_4", "v_2", "]", "v_5", "v_6", "v_1", "v_6", "v_7", "v_5", "[", "v_4", "[", "v_1", "v_8", "v_3", "v_4", "v_2", "v_7", "[[", "v_3", "v_2", "]", "v_4", "v_5", "v_1", "v_3", "v_1", "v_2", "v_5", ...
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6851-L6860
[ "def", "get_wfsmat", "(", "l", ")", ":", "ltree", "=", "ListTree", "(", "l", ")", "vdescmat", "=", "ltree", ".", "desc", "wfsmat", "=", "matrix_map", "(", "vdescmat", ",", "lambda", "v", ",", "ix", ",", "iy", ":", "v", "[", "'path'", "]", ")", "w...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
wfs2mat
wfs = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [4, 0], [4, 1], [11, 0], [11, 1], [11, 2], [11, 1, 0], [11, 1, 1], [11, 1, 2], [11, 1, 3], [11, 1, 4], [11, 1, 5], [11, 1, 6], [11, 1, 7], [11, 1, 8], [11, 1, 9], [11, 1, 10], [11, 1, 11], [11, 1, 6, 0], [11, 1, 6, 1], [11, 1, ...
elist/elist.py
def wfs2mat(wfs): ''' wfs = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [4, 0], [4, 1], [11, 0], [11, 1], [11, 2], [11, 1, 0], [11, 1, 1], [11, 1, 2], [11, 1, 3], [11, 1, 4], [11, 1, 5], [11, 1, 6], [11, 1, 7], [11, 1, 8], [11, 1, 9], [11, 1, 10], [11, 1, 11], [11,...
def wfs2mat(wfs): ''' wfs = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [4, 0], [4, 1], [11, 0], [11, 1], [11, 2], [11, 1, 0], [11, 1, 1], [11, 1, 2], [11, 1, 3], [11, 1, 4], [11, 1, 5], [11, 1, 6], [11, 1, 7], [11, 1, 8], [11, 1, 9], [11, 1, 10], [11, 1, 11], [11,...
[ "wfs", "=", "[[", "0", "]", "[", "1", "]", "[", "2", "]", "[", "3", "]", "[", "4", "]", "[", "5", "]", "[", "6", "]", "[", "7", "]", "[", "8", "]", "[", "9", "]", "[", "10", "]", "[", "11", "]", "[", "12", "]", "[", "13", "]", "...
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6870-L6882
[ "def", "wfs2mat", "(", "wfs", ")", ":", "wfsmat", "=", "[", "]", "depth", "=", "0", "level", "=", "filter", "(", "wfs", ",", "lambda", "ele", ":", "ele", ".", "__len__", "(", ")", "==", "1", ")", "while", "(", "level", ".", "__len__", "(", ")",...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
dfs2wfsmat
dfs = [[0], [1], [2], [3], [4], [4, 0], [4, 1], [5], [6], [7], [8], [9], [10], [11], [11, 0], [11, 1], [11, 1, 0], [11, 1, 1], [11, 1, 2], [11, 1, 3], [11, 1, 4], [11, 1, 5], [11, 1, 6], [11, 1, 6, 0], [11, 1, 6, 0, 0], [11, 1, 6, 0, 1], [11, 1, 6, 1], [11, 1, 6, 2], [11, 1, 6, 3], [11, 1, 6, 4], [11, 1, 6, 5], [11, 1,...
elist/elist.py
def dfs2wfsmat(dfs): ''' dfs = [[0], [1], [2], [3], [4], [4, 0], [4, 1], [5], [6], [7], [8], [9], [10], [11], [11, 0], [11, 1], [11, 1, 0], [11, 1, 1], [11, 1, 2], [11, 1, 3], [11, 1, 4], [11, 1, 5], [11, 1, 6], [11, 1, 6, 0], [11, 1, 6, 0, 0], [11, 1, 6, 0, 1], [11, 1, 6, 1], [11, 1, 6, 2], [11, 1, 6, 3], ...
def dfs2wfsmat(dfs): ''' dfs = [[0], [1], [2], [3], [4], [4, 0], [4, 1], [5], [6], [7], [8], [9], [10], [11], [11, 0], [11, 1], [11, 1, 0], [11, 1, 1], [11, 1, 2], [11, 1, 3], [11, 1, 4], [11, 1, 5], [11, 1, 6], [11, 1, 6, 0], [11, 1, 6, 0, 0], [11, 1, 6, 0, 1], [11, 1, 6, 1], [11, 1, 6, 2], [11, 1, 6, 3], ...
[ "dfs", "=", "[[", "0", "]", "[", "1", "]", "[", "2", "]", "[", "3", "]", "[", "4", "]", "[", "4", "0", "]", "[", "4", "1", "]", "[", "5", "]", "[", "6", "]", "[", "7", "]", "[", "8", "]", "[", "9", "]", "[", "10", "]", "[", "11"...
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6891-L6905
[ "def", "dfs2wfsmat", "(", "dfs", ")", ":", "wfsmat", "=", "[", "]", "depth", "=", "0", "level", "=", "filter", "(", "dfs", ",", "lambda", "ele", ":", "ele", ".", "__len__", "(", ")", "==", "1", ")", "while", "(", "level", ".", "__len__", "(", "...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
PointerCache.parent_handler
_update_pdesc_sons_info
elist/elist.py
def parent_handler(self,lcache,i,*args): ''' _update_pdesc_sons_info ''' pdesc = lcache.desc[i] pdesc['sons_count'] = self.sibs_len pdesc['leaf_son_paths'] = [] pdesc['non_leaf_son_paths'] = [] pdesc['leaf_descendant_paths'] = [] pdesc['non_lea...
def parent_handler(self,lcache,i,*args): ''' _update_pdesc_sons_info ''' pdesc = lcache.desc[i] pdesc['sons_count'] = self.sibs_len pdesc['leaf_son_paths'] = [] pdesc['non_leaf_son_paths'] = [] pdesc['leaf_descendant_paths'] = [] pdesc['non_lea...
[ "_update_pdesc_sons_info" ]
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6058-L6068
[ "def", "parent_handler", "(", "self", ",", "lcache", ",", "i", ",", "*", "args", ")", ":", "pdesc", "=", "lcache", ".", "desc", "[", "i", "]", "pdesc", "[", "'sons_count'", "]", "=", "self", ".", "sibs_len", "pdesc", "[", "'leaf_son_paths'", "]", "="...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
PointerCache.child_begin_handler
_creat_child_desc update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path
elist/elist.py
def child_begin_handler(self,scache,*args): ''' _creat_child_desc update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path ''' pdesc = self.pdesc depth = scache.depth sib_seq = self.sib_seq sibs_len = self.s...
def child_begin_handler(self,scache,*args): ''' _creat_child_desc update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path ''' pdesc = self.pdesc depth = scache.depth sib_seq = self.sib_seq sibs_len = self.s...
[ "_creat_child_desc", "update", "depth", "parent_breadth_path", "parent_path", "sib_seq", "path", "lsib_path", "rsib_path", "lcin_path", "rcin_path" ]
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6069-L6093
[ "def", "child_begin_handler", "(", "self", ",", "scache", ",", "*", "args", ")", ":", "pdesc", "=", "self", ".", "pdesc", "depth", "=", "scache", ".", "depth", "sib_seq", "=", "self", ".", "sib_seq", "sibs_len", "=", "self", ".", "sibs_len", "pdesc_level...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
PointerCache.leaf_handler
#leaf child handler
elist/elist.py
def leaf_handler(self,*args): '''#leaf child handler''' desc = self.desc pdesc = self.pdesc desc['leaf'] = True desc['sons_count'] = 0 pdesc['leaf_son_paths'].append(copy.deepcopy(desc['path'])) pdesc['leaf_descendant_paths'].append(copy.deepcopy(desc['path']))
def leaf_handler(self,*args): '''#leaf child handler''' desc = self.desc pdesc = self.pdesc desc['leaf'] = True desc['sons_count'] = 0 pdesc['leaf_son_paths'].append(copy.deepcopy(desc['path'])) pdesc['leaf_descendant_paths'].append(copy.deepcopy(desc['path']))
[ "#leaf", "child", "handler" ]
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6094-L6101
[ "def", "leaf_handler", "(", "self", ",", "*", "args", ")", ":", "desc", "=", "self", ".", "desc", "pdesc", "=", "self", ".", "pdesc", "desc", "[", "'leaf'", "]", "=", "True", "desc", "[", "'sons_count'", "]", "=", "0", "pdesc", "[", "'leaf_son_paths'...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
PointerCache.non_leaf_handler
#nonleaf child handler
elist/elist.py
def non_leaf_handler(self,lcache): '''#nonleaf child handler''' desc = self.desc pdesc = self.pdesc desc['leaf'] = False pdesc['non_leaf_son_paths'].append(copy.deepcopy(desc['path'])) pdesc['non_leaf_descendant_paths'].append(copy.deepcopy(desc['path'])) lcache.n...
def non_leaf_handler(self,lcache): '''#nonleaf child handler''' desc = self.desc pdesc = self.pdesc desc['leaf'] = False pdesc['non_leaf_son_paths'].append(copy.deepcopy(desc['path'])) pdesc['non_leaf_descendant_paths'].append(copy.deepcopy(desc['path'])) lcache.n...
[ "#nonleaf", "child", "handler" ]
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6102-L6110
[ "def", "non_leaf_handler", "(", "self", ",", "lcache", ")", ":", "desc", "=", "self", ".", "desc", "pdesc", "=", "self", ".", "pdesc", "desc", "[", "'leaf'", "]", "=", "False", "pdesc", "[", "'non_leaf_son_paths'", "]", ".", "append", "(", "copy", ".",...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
PointerCache.child_end_handler
_upgrade_breadth_info update breadth, breadth_path, and add desc to desc_level
elist/elist.py
def child_end_handler(self,scache): ''' _upgrade_breadth_info update breadth, breadth_path, and add desc to desc_level ''' desc = self.desc desc_level = scache.desc_level breadth = desc_level.__len__() desc['breadth'] = breadth desc['breadt...
def child_end_handler(self,scache): ''' _upgrade_breadth_info update breadth, breadth_path, and add desc to desc_level ''' desc = self.desc desc_level = scache.desc_level breadth = desc_level.__len__() desc['breadth'] = breadth desc['breadt...
[ "_upgrade_breadth_info", "update", "breadth", "breadth_path", "and", "add", "desc", "to", "desc_level" ]
ihgazni2/elist
python
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6111-L6121
[ "def", "child_end_handler", "(", "self", ",", "scache", ")", ":", "desc", "=", "self", ".", "desc", "desc_level", "=", "scache", ".", "desc_level", "breadth", "=", "desc_level", ".", "__len__", "(", ")", "desc", "[", "'breadth'", "]", "=", "breadth", "de...
8c07b5029bda34ead60ce10335ceb145f209263c
valid
LatexCommand.parse
Parse command content from the LaTeX source. Parameters ---------- source : `str` The full source of the tex document. Yields ------ parsed_command : `ParsedCommand` Yields parsed commands instances for each occurence of the command i...
lsstprojectmeta/tex/commandparser.py
def parse(self, source): """Parse command content from the LaTeX source. Parameters ---------- source : `str` The full source of the tex document. Yields ------ parsed_command : `ParsedCommand` Yields parsed commands instances for each oc...
def parse(self, source): """Parse command content from the LaTeX source. Parameters ---------- source : `str` The full source of the tex document. Yields ------ parsed_command : `ParsedCommand` Yields parsed commands instances for each oc...
[ "Parse", "command", "content", "from", "the", "LaTeX", "source", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/commandparser.py#L46-L64
[ "def", "parse", "(", "self", ",", "source", ")", ":", "command_regex", "=", "self", ".", "_make_command_regex", "(", "self", ".", "name", ")", "for", "match", "in", "re", ".", "finditer", "(", "command_regex", ",", "source", ")", ":", "self", ".", "_lo...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LatexCommand._parse_command
Parse a single command. Parameters ---------- source : `str` The full source of the tex document. start_index : `int` Character index in ``source`` where the command begins. Returns ------- parsed_command : `ParsedCommand` The...
lsstprojectmeta/tex/commandparser.py
def _parse_command(self, source, start_index): """Parse a single command. Parameters ---------- source : `str` The full source of the tex document. start_index : `int` Character index in ``source`` where the command begins. Returns ------...
def _parse_command(self, source, start_index): """Parse a single command. Parameters ---------- source : `str` The full source of the tex document. start_index : `int` Character index in ``source`` where the command begins. Returns ------...
[ "Parse", "a", "single", "command", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/commandparser.py#L88-L188
[ "def", "_parse_command", "(", "self", ",", "source", ",", "start_index", ")", ":", "parsed_elements", "=", "[", "]", "# Index of the parser in the source", "running_index", "=", "start_index", "for", "element", "in", "self", ".", "elements", ":", "opening_bracket", ...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
LatexCommand._parse_whitespace_argument
r"""Attempt to parse a single token on the first line of this source. This method is used for parsing whitespace-delimited arguments, like ``\input file``. The source should ideally contain `` file`` along with a newline character. >>> source = 'Line 1\n' r'\input test.tex' '\nLine 2' ...
lsstprojectmeta/tex/commandparser.py
def _parse_whitespace_argument(source, name): r"""Attempt to parse a single token on the first line of this source. This method is used for parsing whitespace-delimited arguments, like ``\input file``. The source should ideally contain `` file`` along with a newline character. ...
def _parse_whitespace_argument(source, name): r"""Attempt to parse a single token on the first line of this source. This method is used for parsing whitespace-delimited arguments, like ``\input file``. The source should ideally contain `` file`` along with a newline character. ...
[ "r", "Attempt", "to", "parse", "a", "single", "token", "on", "the", "first", "line", "of", "this", "source", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/commandparser.py#L191-L224
[ "def", "_parse_whitespace_argument", "(", "source", ",", "name", ")", ":", "# First match the command name itself so that we find the argument", "# *after* the command", "command_pattern", "=", "r'\\\\('", "+", "name", "+", "r')(?:[\\s{[%])'", "command_match", "=", "re", ".",...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
_tmdd_datetime_to_iso
dt is an xml Element with <date>, <time>, and optionally <offset> children. returns an ISO8601 string
open511/converter/tmdd.py
def _tmdd_datetime_to_iso(dt, include_offset=True, include_seconds=True): """ dt is an xml Element with <date>, <time>, and optionally <offset> children. returns an ISO8601 string """ datestring = dt.findtext('date') timestring = dt.findtext('time') assert len(datestring) == 8 assert len...
def _tmdd_datetime_to_iso(dt, include_offset=True, include_seconds=True): """ dt is an xml Element with <date>, <time>, and optionally <offset> children. returns an ISO8601 string """ datestring = dt.findtext('date') timestring = dt.findtext('time') assert len(datestring) == 8 assert len...
[ "dt", "is", "an", "xml", "Element", "with", "<date", ">", "<time", ">", "and", "optionally", "<offset", ">", "children", ".", "returns", "an", "ISO8601", "string" ]
open511/open511
python
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/tmdd.py#L21-L41
[ "def", "_tmdd_datetime_to_iso", "(", "dt", ",", "include_offset", "=", "True", ",", "include_seconds", "=", "True", ")", ":", "datestring", "=", "dt", ".", "findtext", "(", "'date'", ")", "timestring", "=", "dt", ".", "findtext", "(", "'time'", ")", "asser...
3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8
valid
_generate_automatic_headline
The only field that maps closely to Open511 <headline>, a required field, is optional in TMDD. So we sometimes need to generate our own.
open511/converter/tmdd.py
def _generate_automatic_headline(c): """The only field that maps closely to Open511 <headline>, a required field, is optional in TMDD. So we sometimes need to generate our own.""" # Start with the event type, e.g. "Incident" headline = c.data['event_type'].replace('_', ' ').title() if c.data['roads'...
def _generate_automatic_headline(c): """The only field that maps closely to Open511 <headline>, a required field, is optional in TMDD. So we sometimes need to generate our own.""" # Start with the event type, e.g. "Incident" headline = c.data['event_type'].replace('_', ' ').title() if c.data['roads'...
[ "The", "only", "field", "that", "maps", "closely", "to", "Open511", "<headline", ">", "a", "required", "field", "is", "optional", "in", "TMDD", ".", "So", "we", "sometimes", "need", "to", "generate", "our", "own", "." ]
open511/open511
python
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/tmdd.py#L64-L75
[ "def", "_generate_automatic_headline", "(", "c", ")", ":", "# Start with the event type, e.g. \"Incident\"", "headline", "=", "c", ".", "data", "[", "'event_type'", "]", ".", "replace", "(", "'_'", ",", "' '", ")", ".", "title", "(", ")", "if", "c", ".", "da...
3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8
valid
_get_severity
1. Collect all <severity> and <impact-level> values. 2. Convert impact-level of 1-3 to MINOR, 4-7 to MODERATE, 8-10 to MAJOR 3. Map severity -> none to MINOR, natural-disaster to MAJOR, other to UNKNOWN 4. Pick the highest severity.
open511/converter/tmdd.py
def _get_severity(c): """ 1. Collect all <severity> and <impact-level> values. 2. Convert impact-level of 1-3 to MINOR, 4-7 to MODERATE, 8-10 to MAJOR 3. Map severity -> none to MINOR, natural-disaster to MAJOR, other to UNKNOWN 4. Pick the highest severity. """ severities = c.feu.xpath('eve...
def _get_severity(c): """ 1. Collect all <severity> and <impact-level> values. 2. Convert impact-level of 1-3 to MINOR, 4-7 to MODERATE, 8-10 to MAJOR 3. Map severity -> none to MINOR, natural-disaster to MAJOR, other to UNKNOWN 4. Pick the highest severity. """ severities = c.feu.xpath('eve...
[ "1", ".", "Collect", "all", "<severity", ">", "and", "<impact", "-", "level", ">", "values", ".", "2", ".", "Convert", "impact", "-", "level", "of", "1", "-", "3", "to", "MINOR", "4", "-", "7", "to", "MODERATE", "8", "-", "10", "to", "MAJOR", "3"...
open511/open511
python
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/tmdd.py#L239-L252
[ "def", "_get_severity", "(", "c", ")", ":", "severities", "=", "c", ".", "feu", ".", "xpath", "(", "'event-indicators/event-indicator/event-severity/text()|event-indicators/event-indicator/severity/text()'", ")", "impacts", "=", "c", ".", "feu", ".", "xpath", "(", "'e...
3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8
valid
TMDDEventConverter.list_from_document
Returns a list of TMDDEventConverter elements. doc is an XML Element containing one or more <FEU> events
open511/converter/tmdd.py
def list_from_document(cls, doc): """Returns a list of TMDDEventConverter elements. doc is an XML Element containing one or more <FEU> events """ objs = [] for feu in doc.xpath('//FEU'): detail_els = feu.xpath('event-element-details/event-element-detail') ...
def list_from_document(cls, doc): """Returns a list of TMDDEventConverter elements. doc is an XML Element containing one or more <FEU> events """ objs = [] for feu in doc.xpath('//FEU'): detail_els = feu.xpath('event-element-details/event-element-detail') ...
[ "Returns", "a", "list", "of", "TMDDEventConverter", "elements", "." ]
open511/open511
python
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/tmdd.py#L364-L374
[ "def", "list_from_document", "(", "cls", ",", "doc", ")", ":", "objs", "=", "[", "]", "for", "feu", "in", "doc", ".", "xpath", "(", "'//FEU'", ")", ":", "detail_els", "=", "feu", ".", "xpath", "(", "'event-element-details/event-element-detail'", ")", "for"...
3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8
valid
TMDDEventConverter.add_geo
Saves a <geo-location> Element, to be incoporated into the Open511 geometry field.
open511/converter/tmdd.py
def add_geo(self, geo_location): """ Saves a <geo-location> Element, to be incoporated into the Open511 geometry field. """ if not geo_location.xpath('latitude') and geo_location.xpath('longitude'): raise Exception("Invalid geo-location %s" % etree.tostring(geo_locati...
def add_geo(self, geo_location): """ Saves a <geo-location> Element, to be incoporated into the Open511 geometry field. """ if not geo_location.xpath('latitude') and geo_location.xpath('longitude'): raise Exception("Invalid geo-location %s" % etree.tostring(geo_locati...
[ "Saves", "a", "<geo", "-", "location", ">", "Element", "to", "be", "incoporated", "into", "the", "Open511", "geometry", "field", "." ]
open511/open511
python
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/tmdd.py#L386-L400
[ "def", "add_geo", "(", "self", ",", "geo_location", ")", ":", "if", "not", "geo_location", ".", "xpath", "(", "'latitude'", ")", "and", "geo_location", ".", "xpath", "(", "'longitude'", ")", ":", "raise", "Exception", "(", "\"Invalid geo-location %s\"", "%", ...
3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8
valid
clone
Mostly ripped from nc3tonc4 in netCDF4-python. Added ability to skip dimension and variables. Removed all of the unpacking logic for shorts.
pyaxiom/netcdf/clone.py
def clone(src, dst_path, skip_globals, skip_dimensions, skip_variables): """ Mostly ripped from nc3tonc4 in netCDF4-python. Added ability to skip dimension and variables. Removed all of the unpacking logic for shorts. """ if os.path.exists(dst_path): os.unlink(dst_path) ...
def clone(src, dst_path, skip_globals, skip_dimensions, skip_variables): """ Mostly ripped from nc3tonc4 in netCDF4-python. Added ability to skip dimension and variables. Removed all of the unpacking logic for shorts. """ if os.path.exists(dst_path): os.unlink(dst_path) ...
[ "Mostly", "ripped", "from", "nc3tonc4", "in", "netCDF4", "-", "python", ".", "Added", "ability", "to", "skip", "dimension", "and", "variables", ".", "Removed", "all", "of", "the", "unpacking", "logic", "for", "shorts", "." ]
axiom-data-science/pyaxiom
python
https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/netcdf/clone.py#L8-L92
[ "def", "clone", "(", "src", ",", "dst_path", ",", "skip_globals", ",", "skip_dimensions", ",", "skip_variables", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "dst_path", ")", ":", "os", ".", "unlink", "(", "dst_path", ")", "dst", "=", "netCDF...
7ea7626695abf095df6a67f66e5b3e9ae91b16df
valid
get_dataframe_from_variable
Returns a Pandas DataFrame of the data. This always returns positive down depths
pyaxiom/netcdf/sensors/timeseries.py
def get_dataframe_from_variable(nc, data_var): """ Returns a Pandas DataFrame of the data. This always returns positive down depths """ time_var = nc.get_variables_by_attributes(standard_name='time')[0] depth_vars = nc.get_variables_by_attributes(axis=lambda v: v is not None and v.lower() == 'z...
def get_dataframe_from_variable(nc, data_var): """ Returns a Pandas DataFrame of the data. This always returns positive down depths """ time_var = nc.get_variables_by_attributes(standard_name='time')[0] depth_vars = nc.get_variables_by_attributes(axis=lambda v: v is not None and v.lower() == 'z...
[ "Returns", "a", "Pandas", "DataFrame", "of", "the", "data", ".", "This", "always", "returns", "positive", "down", "depths" ]
axiom-data-science/pyaxiom
python
https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/netcdf/sensors/timeseries.py#L612-L670
[ "def", "get_dataframe_from_variable", "(", "nc", ",", "data_var", ")", ":", "time_var", "=", "nc", ".", "get_variables_by_attributes", "(", "standard_name", "=", "'time'", ")", "[", "0", "]", "depth_vars", "=", "nc", ".", "get_variables_by_attributes", "(", "axi...
7ea7626695abf095df6a67f66e5b3e9ae91b16df
valid
github_request
Send a request to the GitHub v4 (GraphQL) API. The request is asynchronous, with asyncio. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp client session. api_token : `str` A GitHub personal API token. See the `GitHub personal access token ...
lsstprojectmeta/github/graphql.py
async def github_request(session, api_token, query=None, mutation=None, variables=None): """Send a request to the GitHub v4 (GraphQL) API. The request is asynchronous, with asyncio. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp ...
async def github_request(session, api_token, query=None, mutation=None, variables=None): """Send a request to the GitHub v4 (GraphQL) API. The request is asynchronous, with asyncio. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp ...
[ "Send", "a", "request", "to", "the", "GitHub", "v4", "(", "GraphQL", ")", "API", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/github/graphql.py#L11-L58
[ "async", "def", "github_request", "(", "session", ",", "api_token", ",", "query", "=", "None", ",", "mutation", "=", "None", ",", "variables", "=", "None", ")", ":", "payload", "=", "{", "}", "if", "query", "is", "not", "None", ":", "payload", "[", "...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
GitHubQuery.load
Load a pre-made query. These queries are distributed with lsstprojectmeta. See :file:`lsstrojectmeta/data/githubv4/README.rst` inside the package repository for details on available queries. Parameters ---------- query_name : `str` Name of the query, such as...
lsstprojectmeta/github/graphql.py
def load(cls, query_name): """Load a pre-made query. These queries are distributed with lsstprojectmeta. See :file:`lsstrojectmeta/data/githubv4/README.rst` inside the package repository for details on available queries. Parameters ---------- query_name : `str` ...
def load(cls, query_name): """Load a pre-made query. These queries are distributed with lsstprojectmeta. See :file:`lsstrojectmeta/data/githubv4/README.rst` inside the package repository for details on available queries. Parameters ---------- query_name : `str` ...
[ "Load", "a", "pre", "-", "made", "query", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/github/graphql.py#L80-L106
[ "def", "load", "(", "cls", ",", "query_name", ")", ":", "template_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'../data/githubv4'", ",", "query_name", "+", "'.graphql'", ")", "with", "o...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
read_git_commit_timestamp_for_file
Obtain the timestamp for the most recent commit to a given file in a Git repository. Parameters ---------- filepath : `str` Absolute or repository-relative path for a file. repo_path : `str`, optional Path to the Git repository. Leave as `None` to use the current working dir...
lsstprojectmeta/git/timestamp.py
def read_git_commit_timestamp_for_file(filepath, repo_path=None, repo=None): """Obtain the timestamp for the most recent commit to a given file in a Git repository. Parameters ---------- filepath : `str` Absolute or repository-relative path for a file. repo_path : `str`, optional ...
def read_git_commit_timestamp_for_file(filepath, repo_path=None, repo=None): """Obtain the timestamp for the most recent commit to a given file in a Git repository. Parameters ---------- filepath : `str` Absolute or repository-relative path for a file. repo_path : `str`, optional ...
[ "Obtain", "the", "timestamp", "for", "the", "most", "recent", "commit", "to", "a", "given", "file", "in", "a", "Git", "repository", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/git/timestamp.py#L35-L85
[ "def", "read_git_commit_timestamp_for_file", "(", "filepath", ",", "repo_path", "=", "None", ",", "repo", "=", "None", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "if", "repo", "is", "None", ":", "repo", "=", "git", ".", "...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
get_content_commit_date
Get the datetime for the most recent commit to a project that affected certain types of content. Parameters ---------- extensions : sequence of 'str' Extensions of files to consider in getting the most recent commit date. For example, ``('rst', 'svg', 'png')`` are content extensions ...
lsstprojectmeta/git/timestamp.py
def get_content_commit_date(extensions, acceptance_callback=None, root_dir='.'): """Get the datetime for the most recent commit to a project that affected certain types of content. Parameters ---------- extensions : sequence of 'str' Extensions of files to consid...
def get_content_commit_date(extensions, acceptance_callback=None, root_dir='.'): """Get the datetime for the most recent commit to a project that affected certain types of content. Parameters ---------- extensions : sequence of 'str' Extensions of files to consid...
[ "Get", "the", "datetime", "for", "the", "most", "recent", "commit", "to", "a", "project", "that", "affected", "certain", "types", "of", "content", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/git/timestamp.py#L88-L165
[ "def", "get_content_commit_date", "(", "extensions", ",", "acceptance_callback", "=", "None", ",", "root_dir", "=", "'.'", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "def", "_null_callback", "(", "_", ")", ":", "return", "Tru...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
_iter_filepaths_with_extension
Iterative over relative filepaths of files in a directory, and sub-directories, with the given extension. Parameters ---------- extname : `str` Extension name (such as 'txt' or 'rst'). Extension comparison is case sensitive. root_dir : 'str`, optional Root directory. Current...
lsstprojectmeta/git/timestamp.py
def _iter_filepaths_with_extension(extname, root_dir='.'): """Iterative over relative filepaths of files in a directory, and sub-directories, with the given extension. Parameters ---------- extname : `str` Extension name (such as 'txt' or 'rst'). Extension comparison is case sensiti...
def _iter_filepaths_with_extension(extname, root_dir='.'): """Iterative over relative filepaths of files in a directory, and sub-directories, with the given extension. Parameters ---------- extname : `str` Extension name (such as 'txt' or 'rst'). Extension comparison is case sensiti...
[ "Iterative", "over", "relative", "filepaths", "of", "files", "in", "a", "directory", "and", "sub", "-", "directories", "with", "the", "given", "extension", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/git/timestamp.py#L168-L196
[ "def", "_iter_filepaths_with_extension", "(", "extname", ",", "root_dir", "=", "'.'", ")", ":", "# needed for comparison with os.path.splitext", "if", "not", "extname", ".", "startswith", "(", "'.'", ")", ":", "extname", "=", "'.'", "+", "extname", "root_dir", "="...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
EnhancedDataset.get_variables_by_attributes
Returns variables that match specific conditions. * Can pass in key=value parameters and variables are returned that contain all of the matches. For example, >>> # Get variables with x-axis attribute. >>> vs = nc.get_variables_by_attributes(axis='X') >>> # Get variables with m...
pyaxiom/netcdf/dataset.py
def get_variables_by_attributes(self, **kwargs): """ Returns variables that match specific conditions. * Can pass in key=value parameters and variables are returned that contain all of the matches. For example, >>> # Get variables with x-axis attribute. >>> vs = nc.get_variabl...
def get_variables_by_attributes(self, **kwargs): """ Returns variables that match specific conditions. * Can pass in key=value parameters and variables are returned that contain all of the matches. For example, >>> # Get variables with x-axis attribute. >>> vs = nc.get_variabl...
[ "Returns", "variables", "that", "match", "specific", "conditions", "." ]
axiom-data-science/pyaxiom
python
https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/netcdf/dataset.py#L12-L55
[ "def", "get_variables_by_attributes", "(", "self", ",", "*", "*", "kwargs", ")", ":", "vs", "=", "[", "]", "has_value_flag", "=", "False", "for", "vname", "in", "self", ".", "variables", ":", "var", "=", "self", ".", "variables", "[", "vname", "]", "fo...
7ea7626695abf095df6a67f66e5b3e9ae91b16df
valid
EnhancedDataset.json_attributes
vfuncs can be any callable that accepts a single argument, the Variable object, and returns a dictionary of new attributes to set. These will overwrite existing attributes
pyaxiom/netcdf/dataset.py
def json_attributes(self, vfuncs=None): """ vfuncs can be any callable that accepts a single argument, the Variable object, and returns a dictionary of new attributes to set. These will overwrite existing attributes """ vfuncs = vfuncs or [] js = {'global': {}} ...
def json_attributes(self, vfuncs=None): """ vfuncs can be any callable that accepts a single argument, the Variable object, and returns a dictionary of new attributes to set. These will overwrite existing attributes """ vfuncs = vfuncs or [] js = {'global': {}} ...
[ "vfuncs", "can", "be", "any", "callable", "that", "accepts", "a", "single", "argument", "the", "Variable", "object", "and", "returns", "a", "dictionary", "of", "new", "attributes", "to", "set", ".", "These", "will", "overwrite", "existing", "attributes" ]
axiom-data-science/pyaxiom
python
https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/netcdf/dataset.py#L85-L117
[ "def", "json_attributes", "(", "self", ",", "vfuncs", "=", "None", ")", ":", "vfuncs", "=", "vfuncs", "or", "[", "]", "js", "=", "{", "'global'", ":", "{", "}", "}", "for", "k", "in", "self", ".", "ncattrs", "(", ")", ":", "js", "[", "'global'", ...
7ea7626695abf095df6a67f66e5b3e9ae91b16df
valid
ensure_pandoc
Decorate a function that uses pypandoc to ensure that pandoc is installed if necessary.
lsstprojectmeta/pandoc/convert.py
def ensure_pandoc(func): """Decorate a function that uses pypandoc to ensure that pandoc is installed if necessary. """ logger = logging.getLogger(__name__) @functools.wraps(func) def _install_and_run(*args, **kwargs): try: # First try to run pypandoc function re...
def ensure_pandoc(func): """Decorate a function that uses pypandoc to ensure that pandoc is installed if necessary. """ logger = logging.getLogger(__name__) @functools.wraps(func) def _install_and_run(*args, **kwargs): try: # First try to run pypandoc function re...
[ "Decorate", "a", "function", "that", "uses", "pypandoc", "to", "ensure", "that", "pandoc", "is", "installed", "if", "necessary", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/pandoc/convert.py#L14-L40
[ "def", "ensure_pandoc", "(", "func", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "@", "functools", ".", "wraps", "(", "func", ")", "def", "_install_and_run", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
convert_text
Convert text from one markup format to another using pandoc. This function is a thin wrapper around `pypandoc.convert_text`. Parameters ---------- content : `str` Original content. from_fmt : `str` Format of the original ``content``. Format identifier must be one of those ...
lsstprojectmeta/pandoc/convert.py
def convert_text(content, from_fmt, to_fmt, deparagraph=False, mathjax=False, smart=True, extra_args=None): """Convert text from one markup format to another using pandoc. This function is a thin wrapper around `pypandoc.convert_text`. Parameters ---------- content : `str` ...
def convert_text(content, from_fmt, to_fmt, deparagraph=False, mathjax=False, smart=True, extra_args=None): """Convert text from one markup format to another using pandoc. This function is a thin wrapper around `pypandoc.convert_text`. Parameters ---------- content : `str` ...
[ "Convert", "text", "from", "one", "markup", "format", "to", "another", "using", "pandoc", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/pandoc/convert.py#L44-L129
[ "def", "convert_text", "(", "content", ",", "from_fmt", ",", "to_fmt", ",", "deparagraph", "=", "False", ",", "mathjax", "=", "False", ",", "smart", "=", "True", ",", "extra_args", "=", "None", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", ...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
convert_lsstdoc_tex
Convert lsstdoc-class LaTeX to another markup format. This function is a thin wrapper around `convert_text` that automatically includes common lsstdoc LaTeX macros. Parameters ---------- content : `str` Original content. to_fmt : `str` Output format for the content (see https:...
lsstprojectmeta/pandoc/convert.py
def convert_lsstdoc_tex( content, to_fmt, deparagraph=False, mathjax=False, smart=True, extra_args=None): """Convert lsstdoc-class LaTeX to another markup format. This function is a thin wrapper around `convert_text` that automatically includes common lsstdoc LaTeX macros. Parameters ...
def convert_lsstdoc_tex( content, to_fmt, deparagraph=False, mathjax=False, smart=True, extra_args=None): """Convert lsstdoc-class LaTeX to another markup format. This function is a thin wrapper around `convert_text` that automatically includes common lsstdoc LaTeX macros. Parameters ...
[ "Convert", "lsstdoc", "-", "class", "LaTeX", "to", "another", "markup", "format", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/pandoc/convert.py#L132-L194
[ "def", "convert_lsstdoc_tex", "(", "content", ",", "to_fmt", ",", "deparagraph", "=", "False", ",", "mathjax", "=", "False", ",", "smart", "=", "True", ",", "extra_args", "=", "None", ")", ":", "augmented_content", "=", "'\\n'", ".", "join", "(", "(", "L...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
decode_jsonld
Decode a JSON-LD dataset, including decoding datetime strings into `datetime.datetime` objects. Parameters ---------- encoded_dataset : `str` The JSON-LD dataset encoded as a string. Returns ------- jsonld_dataset : `dict` A JSON-LD dataset. Examples -------- ...
lsstprojectmeta/jsonld.py
def decode_jsonld(jsonld_text): """Decode a JSON-LD dataset, including decoding datetime strings into `datetime.datetime` objects. Parameters ---------- encoded_dataset : `str` The JSON-LD dataset encoded as a string. Returns ------- jsonld_dataset : `dict` A JSON-LD da...
def decode_jsonld(jsonld_text): """Decode a JSON-LD dataset, including decoding datetime strings into `datetime.datetime` objects. Parameters ---------- encoded_dataset : `str` The JSON-LD dataset encoded as a string. Returns ------- jsonld_dataset : `dict` A JSON-LD da...
[ "Decode", "a", "JSON", "-", "LD", "dataset", "including", "decoding", "datetime", "strings", "into", "datetime", ".", "datetime", "objects", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/jsonld.py#L63-L85
[ "def", "decode_jsonld", "(", "jsonld_text", ")", ":", "decoder", "=", "json", ".", "JSONDecoder", "(", "object_pairs_hook", "=", "_decode_object_pairs", ")", "return", "decoder", ".", "decode", "(", "jsonld_text", ")" ]
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
JsonLdEncoder.default
Encode values as JSON strings. This method overrides the default implementation from `json.JSONEncoder`.
lsstprojectmeta/jsonld.py
def default(self, obj): """Encode values as JSON strings. This method overrides the default implementation from `json.JSONEncoder`. """ if isinstance(obj, datetime.datetime): return self._encode_datetime(obj) # Fallback to the default encoding return...
def default(self, obj): """Encode values as JSON strings. This method overrides the default implementation from `json.JSONEncoder`. """ if isinstance(obj, datetime.datetime): return self._encode_datetime(obj) # Fallback to the default encoding return...
[ "Encode", "values", "as", "JSON", "strings", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/jsonld.py#L34-L44
[ "def", "default", "(", "self", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "datetime", ".", "datetime", ")", ":", "return", "self", ".", "_encode_datetime", "(", "obj", ")", "# Fallback to the default encoding", "return", "json", ".", "JSONEnc...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
JsonLdEncoder._encode_datetime
Encode a datetime in the format '%Y-%m-%dT%H:%M:%SZ'. The datetime can be naieve (doesn't have timezone info) or aware (it does have a tzinfo attribute set). Regardless, the datetime is transformed into UTC.
lsstprojectmeta/jsonld.py
def _encode_datetime(self, dt): """Encode a datetime in the format '%Y-%m-%dT%H:%M:%SZ'. The datetime can be naieve (doesn't have timezone info) or aware (it does have a tzinfo attribute set). Regardless, the datetime is transformed into UTC. """ if dt.tzinfo is None: ...
def _encode_datetime(self, dt): """Encode a datetime in the format '%Y-%m-%dT%H:%M:%SZ'. The datetime can be naieve (doesn't have timezone info) or aware (it does have a tzinfo attribute set). Regardless, the datetime is transformed into UTC. """ if dt.tzinfo is None: ...
[ "Encode", "a", "datetime", "in", "the", "format", "%Y", "-", "%m", "-", "%dT%H", ":", "%M", ":", "%SZ", "." ]
lsst-sqre/lsst-projectmeta-kit
python
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/jsonld.py#L46-L60
[ "def", "_encode_datetime", "(", "self", ",", "dt", ")", ":", "if", "dt", ".", "tzinfo", "is", "None", ":", "# Force it to be a UTC datetime", "dt", "=", "dt", ".", "replace", "(", "tzinfo", "=", "datetime", ".", "timezone", ".", "utc", ")", "# Convert to U...
ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14
valid
Git.find_repos
Get all git repositories within this environment
cpenv/deps.py
def find_repos(self, depth=10): '''Get all git repositories within this environment''' repos = [] for root, subdirs, files in walk_dn(self.root, depth=depth): if 'modules' in root: continue if '.git' in subdirs: repos.append(root) ...
def find_repos(self, depth=10): '''Get all git repositories within this environment''' repos = [] for root, subdirs, files in walk_dn(self.root, depth=depth): if 'modules' in root: continue if '.git' in subdirs: repos.append(root) ...
[ "Get", "all", "git", "repositories", "within", "this", "environment" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/deps.py#L14-L25
[ "def", "find_repos", "(", "self", ",", "depth", "=", "10", ")", ":", "repos", "=", "[", "]", "for", "root", ",", "subdirs", ",", "files", "in", "walk_dn", "(", "self", ".", "root", ",", "depth", "=", "depth", ")", ":", "if", "'modules'", "in", "r...
afbb569ae04002743db041d3629a5be8c290bd89
valid
Git.clone
Clone a repository to a destination relative to envrionment root
cpenv/deps.py
def clone(self, repo_path, destination, branch=None): '''Clone a repository to a destination relative to envrionment root''' logger.debug('Installing ' + repo_path) if not destination.startswith(self.env_path): destination = unipath(self.env_path, destination) if branch: ...
def clone(self, repo_path, destination, branch=None): '''Clone a repository to a destination relative to envrionment root''' logger.debug('Installing ' + repo_path) if not destination.startswith(self.env_path): destination = unipath(self.env_path, destination) if branch: ...
[ "Clone", "a", "repository", "to", "a", "destination", "relative", "to", "envrionment", "root" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/deps.py#L27-L38
[ "def", "clone", "(", "self", ",", "repo_path", ",", "destination", ",", "branch", "=", "None", ")", ":", "logger", ".", "debug", "(", "'Installing '", "+", "repo_path", ")", "if", "not", "destination", ".", "startswith", "(", "self", ".", "env_path", ")"...
afbb569ae04002743db041d3629a5be8c290bd89
valid
Git.pull
Clone a repository to a destination relative to envrionment root
cpenv/deps.py
def pull(self, repo_path, *args): '''Clone a repository to a destination relative to envrionment root''' logger.debug('Pulling ' + repo_path) if not repo_path.startswith(self.env_path): repo_path = unipath(self.env_path, repo_path) return shell.run('git', 'pull', *args, **{...
def pull(self, repo_path, *args): '''Clone a repository to a destination relative to envrionment root''' logger.debug('Pulling ' + repo_path) if not repo_path.startswith(self.env_path): repo_path = unipath(self.env_path, repo_path) return shell.run('git', 'pull', *args, **{...
[ "Clone", "a", "repository", "to", "a", "destination", "relative", "to", "envrionment", "root" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/deps.py#L40-L47
[ "def", "pull", "(", "self", ",", "repo_path", ",", "*", "args", ")", ":", "logger", ".", "debug", "(", "'Pulling '", "+", "repo_path", ")", "if", "not", "repo_path", ".", "startswith", "(", "self", ".", "env_path", ")", ":", "repo_path", "=", "unipath"...
afbb569ae04002743db041d3629a5be8c290bd89
valid
Pip.install
Install a python package using pip
cpenv/deps.py
def install(self, package): '''Install a python package using pip''' logger.debug('Installing ' + package) shell.run(self.pip_path, 'install', package)
def install(self, package): '''Install a python package using pip''' logger.debug('Installing ' + package) shell.run(self.pip_path, 'install', package)
[ "Install", "a", "python", "package", "using", "pip" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/deps.py#L61-L65
[ "def", "install", "(", "self", ",", "package", ")", ":", "logger", ".", "debug", "(", "'Installing '", "+", "package", ")", "shell", ".", "run", "(", "self", ".", "pip_path", ",", "'install'", ",", "package", ")" ]
afbb569ae04002743db041d3629a5be8c290bd89
valid
Pip.upgrade
Update a python package using pip
cpenv/deps.py
def upgrade(self, package): '''Update a python package using pip''' logger.debug('Upgrading ' + package) shell.run(self.pip_path, 'install', '--upgrade', '--no-deps', package) shell.run(self.pip_path, 'install', package)
def upgrade(self, package): '''Update a python package using pip''' logger.debug('Upgrading ' + package) shell.run(self.pip_path, 'install', '--upgrade', '--no-deps', package) shell.run(self.pip_path, 'install', package)
[ "Update", "a", "python", "package", "using", "pip" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/deps.py#L67-L72
[ "def", "upgrade", "(", "self", ",", "package", ")", ":", "logger", ".", "debug", "(", "'Upgrading '", "+", "package", ")", "shell", ".", "run", "(", "self", ".", "pip_path", ",", "'install'", ",", "'--upgrade'", ",", "'--no-deps'", ",", "package", ")", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
df_quantile
Returns the nb quantiles for datas in a dataframe
pyair/stats.py
def df_quantile(df, nb=100): """Returns the nb quantiles for datas in a dataframe """ quantiles = np.linspace(0, 1., nb) res = pd.DataFrame() for q in quantiles: res = res.append(df.quantile(q), ignore_index=True) return res
def df_quantile(df, nb=100): """Returns the nb quantiles for datas in a dataframe """ quantiles = np.linspace(0, 1., nb) res = pd.DataFrame() for q in quantiles: res = res.append(df.quantile(q), ignore_index=True) return res
[ "Returns", "the", "nb", "quantiles", "for", "datas", "in", "a", "dataframe" ]
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L21-L28
[ "def", "df_quantile", "(", "df", ",", "nb", "=", "100", ")", ":", "quantiles", "=", "np", ".", "linspace", "(", "0", ",", "1.", ",", "nb", ")", "res", "=", "pd", ".", "DataFrame", "(", ")", "for", "q", "in", "quantiles", ":", "res", "=", "res",...
467e8a843ca9f882f8bb2958805b7293591996ad
valid
mean
Compute the average along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value
pyair/stats.py
def mean(a, rep=0.75, **kwargs): """Compute the average along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value """ return rfunc(a, ma.mean, rep, **kwargs)
def mean(a, rep=0.75, **kwargs): """Compute the average along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value """ return rfunc(a, ma.mean, rep, **kwargs)
[ "Compute", "the", "average", "along", "a", "1D", "array", "like", "ma", ".", "mean", "but", "with", "a", "representativity", "coefficient", ":", "if", "ma", ".", "count", "(", "a", ")", "/", "ma", ".", "size", "(", "a", ")", ">", "=", "rep", "then"...
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L31-L36
[ "def", "mean", "(", "a", ",", "rep", "=", "0.75", ",", "*", "*", "kwargs", ")", ":", "return", "rfunc", "(", "a", ",", "ma", ".", "mean", ",", "rep", ",", "*", "*", "kwargs", ")" ]
467e8a843ca9f882f8bb2958805b7293591996ad
valid
max
Compute the max along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value
pyair/stats.py
def max(a, rep=0.75, **kwargs): """Compute the max along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value """ return rfunc(a, ma.max, rep, **kwargs)
def max(a, rep=0.75, **kwargs): """Compute the max along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value """ return rfunc(a, ma.max, rep, **kwargs)
[ "Compute", "the", "max", "along", "a", "1D", "array", "like", "ma", ".", "mean", "but", "with", "a", "representativity", "coefficient", ":", "if", "ma", ".", "count", "(", "a", ")", "/", "ma", ".", "size", "(", "a", ")", ">", "=", "rep", "then", ...
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L39-L44
[ "def", "max", "(", "a", ",", "rep", "=", "0.75", ",", "*", "*", "kwargs", ")", ":", "return", "rfunc", "(", "a", ",", "ma", ".", "max", ",", "rep", ",", "*", "*", "kwargs", ")" ]
467e8a843ca9f882f8bb2958805b7293591996ad
valid
min
Compute the min along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value
pyair/stats.py
def min(a, rep=0.75, **kwargs): """Compute the min along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value """ return rfunc(a, ma.min, rep, **kwargs)
def min(a, rep=0.75, **kwargs): """Compute the min along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value """ return rfunc(a, ma.min, rep, **kwargs)
[ "Compute", "the", "min", "along", "a", "1D", "array", "like", "ma", ".", "mean", "but", "with", "a", "representativity", "coefficient", ":", "if", "ma", ".", "count", "(", "a", ")", "/", "ma", ".", "size", "(", "a", ")", ">", "=", "rep", "then", ...
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L47-L52
[ "def", "min", "(", "a", ",", "rep", "=", "0.75", ",", "*", "*", "kwargs", ")", ":", "return", "rfunc", "(", "a", ",", "ma", ".", "min", ",", "rep", ",", "*", "*", "kwargs", ")" ]
467e8a843ca9f882f8bb2958805b7293591996ad
valid
rfunc
Applies func on a if a comes with a representativity coefficient rep, i.e. ma.count(a)/ma.size(a)>=rep. If not, returns a masked array
pyair/stats.py
def rfunc(a, rfunc=None, rep=0.75, **kwargs): """Applies func on a if a comes with a representativity coefficient rep, i.e. ma.count(a)/ma.size(a)>=rep. If not, returns a masked array """ if float(ma.count(a)) / ma.size(a) < rep: return ma.masked else: if rfunc is None: r...
def rfunc(a, rfunc=None, rep=0.75, **kwargs): """Applies func on a if a comes with a representativity coefficient rep, i.e. ma.count(a)/ma.size(a)>=rep. If not, returns a masked array """ if float(ma.count(a)) / ma.size(a) < rep: return ma.masked else: if rfunc is None: r...
[ "Applies", "func", "on", "a", "if", "a", "comes", "with", "a", "representativity", "coefficient", "rep", "i", ".", "e", ".", "ma", ".", "count", "(", "a", ")", "/", "ma", ".", "size", "(", "a", ")", ">", "=", "rep", ".", "If", "not", "returns", ...
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L55-L64
[ "def", "rfunc", "(", "a", ",", "rfunc", "=", "None", ",", "rep", "=", "0.75", ",", "*", "*", "kwargs", ")", ":", "if", "float", "(", "ma", ".", "count", "(", "a", ")", ")", "/", "ma", ".", "size", "(", "a", ")", "<", "rep", ":", "return", ...
467e8a843ca9f882f8bb2958805b7293591996ad
valid
rmse
Returns the root mean square error betwwen a and b
pyair/stats.py
def rmse(a, b): """Returns the root mean square error betwwen a and b """ return np.sqrt(np.square(a - b).mean())
def rmse(a, b): """Returns the root mean square error betwwen a and b """ return np.sqrt(np.square(a - b).mean())
[ "Returns", "the", "root", "mean", "square", "error", "betwwen", "a", "and", "b" ]
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L85-L88
[ "def", "rmse", "(", "a", ",", "b", ")", ":", "return", "np", ".", "sqrt", "(", "np", ".", "square", "(", "a", "-", "b", ")", ".", "mean", "(", ")", ")" ]
467e8a843ca9f882f8bb2958805b7293591996ad
valid
nmse
Returns the normalized mean square error of a and b
pyair/stats.py
def nmse(a, b): """Returns the normalized mean square error of a and b """ return np.square(a - b).mean() / (a.mean() * b.mean())
def nmse(a, b): """Returns the normalized mean square error of a and b """ return np.square(a - b).mean() / (a.mean() * b.mean())
[ "Returns", "the", "normalized", "mean", "square", "error", "of", "a", "and", "b" ]
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L91-L94
[ "def", "nmse", "(", "a", ",", "b", ")", ":", "return", "np", ".", "square", "(", "a", "-", "b", ")", ".", "mean", "(", ")", "/", "(", "a", ".", "mean", "(", ")", "*", "b", ".", "mean", "(", ")", ")" ]
467e8a843ca9f882f8bb2958805b7293591996ad
valid
mfbe
Returns the mean fractionalized bias error
pyair/stats.py
def mfbe(a, b): """Returns the mean fractionalized bias error """ return 2 * bias(a, b) / (a.mean() + b.mean())
def mfbe(a, b): """Returns the mean fractionalized bias error """ return 2 * bias(a, b) / (a.mean() + b.mean())
[ "Returns", "the", "mean", "fractionalized", "bias", "error" ]
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L97-L100
[ "def", "mfbe", "(", "a", ",", "b", ")", ":", "return", "2", "*", "bias", "(", "a", ",", "b", ")", "/", "(", "a", ".", "mean", "(", ")", "+", "b", ".", "mean", "(", ")", ")" ]
467e8a843ca9f882f8bb2958805b7293591996ad
valid
fa
Returns the factor of 'alpha' (2 or 5 normally)
pyair/stats.py
def fa(a, b, alpha=2): """Returns the factor of 'alpha' (2 or 5 normally) """ return np.sum((a > b / alpha) & (a < b * alpha), dtype=float) / len(a) * 100
def fa(a, b, alpha=2): """Returns the factor of 'alpha' (2 or 5 normally) """ return np.sum((a > b / alpha) & (a < b * alpha), dtype=float) / len(a) * 100
[ "Returns", "the", "factor", "of", "alpha", "(", "2", "or", "5", "normally", ")" ]
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L107-L110
[ "def", "fa", "(", "a", ",", "b", ",", "alpha", "=", "2", ")", ":", "return", "np", ".", "sum", "(", "(", "a", ">", "b", "/", "alpha", ")", "&", "(", "a", "<", "b", "*", "alpha", ")", ",", "dtype", "=", "float", ")", "/", "len", "(", "a"...
467e8a843ca9f882f8bb2958805b7293591996ad
valid
foex
Returns the factor of exceedance
pyair/stats.py
def foex(a, b): """Returns the factor of exceedance """ return (np.sum(a > b, dtype=float) / len(a) - 0.5) * 100
def foex(a, b): """Returns the factor of exceedance """ return (np.sum(a > b, dtype=float) / len(a) - 0.5) * 100
[ "Returns", "the", "factor", "of", "exceedance" ]
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L113-L116
[ "def", "foex", "(", "a", ",", "b", ")", ":", "return", "(", "np", ".", "sum", "(", "a", ">", "b", ",", "dtype", "=", "float", ")", "/", "len", "(", "a", ")", "-", "0.5", ")", "*", "100" ]
467e8a843ca9f882f8bb2958805b7293591996ad
valid
correlation
Computes the correlation between a and b, says the Pearson's correlation coefficient R
pyair/stats.py
def correlation(a, b): """Computes the correlation between a and b, says the Pearson's correlation coefficient R """ diff1 = a - a.mean() diff2 = b - b.mean() return (diff1 * diff2).mean() / (np.sqrt(np.square(diff1).mean() * np.square(diff2).mean()))
def correlation(a, b): """Computes the correlation between a and b, says the Pearson's correlation coefficient R """ diff1 = a - a.mean() diff2 = b - b.mean() return (diff1 * diff2).mean() / (np.sqrt(np.square(diff1).mean() * np.square(diff2).mean()))
[ "Computes", "the", "correlation", "between", "a", "and", "b", "says", "the", "Pearson", "s", "correlation", "coefficient", "R" ]
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L119-L125
[ "def", "correlation", "(", "a", ",", "b", ")", ":", "diff1", "=", "a", "-", "a", ".", "mean", "(", ")", "diff2", "=", "b", "-", "b", ".", "mean", "(", ")", "return", "(", "diff1", "*", "diff2", ")", ".", "mean", "(", ")", "/", "(", "np", ...
467e8a843ca9f882f8bb2958805b7293591996ad
valid
gmb
Geometric mean bias
pyair/stats.py
def gmb(a, b): """Geometric mean bias """ return np.exp(np.log(a).mean() - np.log(b).mean())
def gmb(a, b): """Geometric mean bias """ return np.exp(np.log(a).mean() - np.log(b).mean())
[ "Geometric", "mean", "bias" ]
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L134-L137
[ "def", "gmb", "(", "a", ",", "b", ")", ":", "return", "np", ".", "exp", "(", "np", ".", "log", "(", "a", ")", ".", "mean", "(", ")", "-", "np", ".", "log", "(", "b", ")", ".", "mean", "(", ")", ")" ]
467e8a843ca9f882f8bb2958805b7293591996ad
valid
gmv
Geometric mean variance
pyair/stats.py
def gmv(a, b): """Geometric mean variance """ return np.exp(np.square(np.log(a) - np.log(b)).mean())
def gmv(a, b): """Geometric mean variance """ return np.exp(np.square(np.log(a) - np.log(b)).mean())
[ "Geometric", "mean", "variance" ]
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L140-L143
[ "def", "gmv", "(", "a", ",", "b", ")", ":", "return", "np", ".", "exp", "(", "np", ".", "square", "(", "np", ".", "log", "(", "a", ")", "-", "np", ".", "log", "(", "b", ")", ")", ".", "mean", "(", ")", ")" ]
467e8a843ca9f882f8bb2958805b7293591996ad
valid
fmt
Figure of merit in time
pyair/stats.py
def fmt(a, b): """Figure of merit in time """ return 100 * np.min([a, b], axis=0).sum() / np.max([a, b], axis=0).sum()
def fmt(a, b): """Figure of merit in time """ return 100 * np.min([a, b], axis=0).sum() / np.max([a, b], axis=0).sum()
[ "Figure", "of", "merit", "in", "time" ]
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L146-L149
[ "def", "fmt", "(", "a", ",", "b", ")", ":", "return", "100", "*", "np", ".", "min", "(", "[", "a", ",", "b", "]", ",", "axis", "=", "0", ")", ".", "sum", "(", ")", "/", "np", ".", "max", "(", "[", "a", ",", "b", "]", ",", "axis", "=",...
467e8a843ca9f882f8bb2958805b7293591996ad
valid
fullStats
Performs several stats on a against b, typically a is the predictions array, and b the observations array Returns: A dataFrame of stat name, stat description, result
pyair/stats.py
def fullStats(a, b): """Performs several stats on a against b, typically a is the predictions array, and b the observations array Returns: A dataFrame of stat name, stat description, result """ stats = [ ['bias', 'Bias', bias(a, b)], ['stderr', 'Standard Deviation Error', s...
def fullStats(a, b): """Performs several stats on a against b, typically a is the predictions array, and b the observations array Returns: A dataFrame of stat name, stat description, result """ stats = [ ['bias', 'Bias', bias(a, b)], ['stderr', 'Standard Deviation Error', s...
[ "Performs", "several", "stats", "on", "a", "against", "b", "typically", "a", "is", "the", "predictions", "array", "and", "b", "the", "observations", "array" ]
LionelR/pyair
python
https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/stats.py#L152-L177
[ "def", "fullStats", "(", "a", ",", "b", ")", ":", "stats", "=", "[", "[", "'bias'", ",", "'Bias'", ",", "bias", "(", "a", ",", "b", ")", "]", ",", "[", "'stderr'", ",", "'Standard Deviation Error'", ",", "stderr", "(", "a", ",", "b", ")", "]", ...
467e8a843ca9f882f8bb2958805b7293591996ad
valid
VirtualEnvironment.site_path
Path to environments site-packages
cpenv/models.py
def site_path(self): '''Path to environments site-packages''' if platform == 'win': return unipath(self.path, 'Lib', 'site-packages') py_ver = 'python{0}'.format(sys.version[:3]) return unipath(self.path, 'lib', py_ver, 'site-packages')
def site_path(self): '''Path to environments site-packages''' if platform == 'win': return unipath(self.path, 'Lib', 'site-packages') py_ver = 'python{0}'.format(sys.version[:3]) return unipath(self.path, 'lib', py_ver, 'site-packages')
[ "Path", "to", "environments", "site", "-", "packages" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/models.py#L204-L211
[ "def", "site_path", "(", "self", ")", ":", "if", "platform", "==", "'win'", ":", "return", "unipath", "(", "self", ".", "path", ",", "'Lib'", ",", "'site-packages'", ")", "py_ver", "=", "'python{0}'", ".", "format", "(", "sys", ".", "version", "[", ":"...
afbb569ae04002743db041d3629a5be8c290bd89
valid
VirtualEnvironment._pre_activate
Prior to activating, store everything necessary to deactivate this environment.
cpenv/models.py
def _pre_activate(self): ''' Prior to activating, store everything necessary to deactivate this environment. ''' if 'CPENV_CLEAN_ENV' not in os.environ: if platform == 'win': os.environ['PROMPT'] = '$P$G' else: os.environ['...
def _pre_activate(self): ''' Prior to activating, store everything necessary to deactivate this environment. ''' if 'CPENV_CLEAN_ENV' not in os.environ: if platform == 'win': os.environ['PROMPT'] = '$P$G' else: os.environ['...
[ "Prior", "to", "activating", "store", "everything", "necessary", "to", "deactivate", "this", "environment", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/models.py#L222-L237
[ "def", "_pre_activate", "(", "self", ")", ":", "if", "'CPENV_CLEAN_ENV'", "not", "in", "os", ".", "environ", ":", "if", "platform", "==", "'win'", ":", "os", ".", "environ", "[", "'PROMPT'", "]", "=", "'$P$G'", "else", ":", "os", ".", "environ", "[", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
VirtualEnvironment._activate
Do some serious mangling to the current python environment... This is necessary to activate an environment via python.
cpenv/models.py
def _activate(self): ''' Do some serious mangling to the current python environment... This is necessary to activate an environment via python. ''' old_syspath = set(sys.path) site.addsitedir(self.site_path) site.addsitedir(self.bin_path) new_syspaths = s...
def _activate(self): ''' Do some serious mangling to the current python environment... This is necessary to activate an environment via python. ''' old_syspath = set(sys.path) site.addsitedir(self.site_path) site.addsitedir(self.bin_path) new_syspaths = s...
[ "Do", "some", "serious", "mangling", "to", "the", "current", "python", "environment", "...", "This", "is", "necessary", "to", "activate", "an", "environment", "via", "python", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/models.py#L239-L256
[ "def", "_activate", "(", "self", ")", ":", "old_syspath", "=", "set", "(", "sys", ".", "path", ")", "site", ".", "addsitedir", "(", "self", ".", "site_path", ")", "site", ".", "addsitedir", "(", "self", ".", "bin_path", ")", "new_syspaths", "=", "set",...
afbb569ae04002743db041d3629a5be8c290bd89
valid
VirtualEnvironment.remove
Remove this environment
cpenv/models.py
def remove(self): ''' Remove this environment ''' self.run_hook('preremove') utils.rmtree(self.path) self.run_hook('postremove')
def remove(self): ''' Remove this environment ''' self.run_hook('preremove') utils.rmtree(self.path) self.run_hook('postremove')
[ "Remove", "this", "environment" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/models.py#L264-L270
[ "def", "remove", "(", "self", ")", ":", "self", ".", "run_hook", "(", "'preremove'", ")", "utils", ".", "rmtree", "(", "self", ".", "path", ")", "self", ".", "run_hook", "(", "'postremove'", ")" ]
afbb569ae04002743db041d3629a5be8c290bd89
valid
Module.command
Command used to launch this application module
cpenv/models.py
def command(self): '''Command used to launch this application module''' cmd = self.config.get('command', None) if cmd is None: return cmd = cmd[platform] return cmd['path'], cmd['args']
def command(self): '''Command used to launch this application module''' cmd = self.config.get('command', None) if cmd is None: return cmd = cmd[platform] return cmd['path'], cmd['args']
[ "Command", "used", "to", "launch", "this", "application", "module" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/models.py#L355-L363
[ "def", "command", "(", "self", ")", ":", "cmd", "=", "self", ".", "config", ".", "get", "(", "'command'", ",", "None", ")", "if", "cmd", "is", "None", ":", "return", "cmd", "=", "cmd", "[", "platform", "]", "return", "cmd", "[", "'path'", "]", ",...
afbb569ae04002743db041d3629a5be8c290bd89
valid
create
Create a virtual environment. You can pass either the name of a new environment to create in your CPENV_HOME directory OR specify a full path to create an environment outisde your CPENV_HOME. Create an environment in CPENV_HOME:: >>> cpenv.create('myenv') Create an environment elsewhere:: ...
cpenv/api.py
def create(name_or_path=None, config=None): '''Create a virtual environment. You can pass either the name of a new environment to create in your CPENV_HOME directory OR specify a full path to create an environment outisde your CPENV_HOME. Create an environment in CPENV_HOME:: >>> cpenv.create(...
def create(name_or_path=None, config=None): '''Create a virtual environment. You can pass either the name of a new environment to create in your CPENV_HOME directory OR specify a full path to create an environment outisde your CPENV_HOME. Create an environment in CPENV_HOME:: >>> cpenv.create(...
[ "Create", "a", "virtual", "environment", ".", "You", "can", "pass", "either", "the", "name", "of", "a", "new", "environment", "to", "create", "in", "your", "CPENV_HOME", "directory", "OR", "specify", "a", "full", "path", "to", "create", "an", "environment", ...
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L22-L79
[ "def", "create", "(", "name_or_path", "=", "None", ",", "config", "=", "None", ")", ":", "# Get the real path of the environment", "if", "utils", ".", "is_system_path", "(", "name_or_path", ")", ":", "path", "=", "unipath", "(", "name_or_path", ")", "else", ":...
afbb569ae04002743db041d3629a5be8c290bd89
valid
remove
Remove an environment or module :param name_or_path: name or path to environment or module
cpenv/api.py
def remove(name_or_path): '''Remove an environment or module :param name_or_path: name or path to environment or module ''' r = resolve(name_or_path) r.resolved[0].remove() EnvironmentCache.discard(r.resolved[0]) EnvironmentCache.save()
def remove(name_or_path): '''Remove an environment or module :param name_or_path: name or path to environment or module ''' r = resolve(name_or_path) r.resolved[0].remove() EnvironmentCache.discard(r.resolved[0]) EnvironmentCache.save()
[ "Remove", "an", "environment", "or", "module" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L82-L92
[ "def", "remove", "(", "name_or_path", ")", ":", "r", "=", "resolve", "(", "name_or_path", ")", "r", ".", "resolved", "[", "0", "]", ".", "remove", "(", ")", "EnvironmentCache", ".", "discard", "(", "r", ".", "resolved", "[", "0", "]", ")", "Environme...
afbb569ae04002743db041d3629a5be8c290bd89
valid
launch
Activates and launches a module :param module_name: name of module to launch
cpenv/api.py
def launch(module_name, *args, **kwargs): '''Activates and launches a module :param module_name: name of module to launch ''' r = resolve(module_name) r.activate() mod = r.resolved[0] mod.launch(*args, **kwargs)
def launch(module_name, *args, **kwargs): '''Activates and launches a module :param module_name: name of module to launch ''' r = resolve(module_name) r.activate() mod = r.resolved[0] mod.launch(*args, **kwargs)
[ "Activates", "and", "launches", "a", "module" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L127-L136
[ "def", "launch", "(", "module_name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "r", "=", "resolve", "(", "module_name", ")", "r", ".", "activate", "(", ")", "mod", "=", "r", ".", "resolved", "[", "0", "]", "mod", ".", "launch", "(", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
deactivate
Deactivates an environment by restoring all env vars to a clean state stored prior to activating environments
cpenv/api.py
def deactivate(): '''Deactivates an environment by restoring all env vars to a clean state stored prior to activating environments ''' if 'CPENV_ACTIVE' not in os.environ or 'CPENV_CLEAN_ENV' not in os.environ: raise EnvironmentError('Can not deactivate environment...') utils.restore_env_f...
def deactivate(): '''Deactivates an environment by restoring all env vars to a clean state stored prior to activating environments ''' if 'CPENV_ACTIVE' not in os.environ or 'CPENV_CLEAN_ENV' not in os.environ: raise EnvironmentError('Can not deactivate environment...') utils.restore_env_f...
[ "Deactivates", "an", "environment", "by", "restoring", "all", "env", "vars", "to", "a", "clean", "state", "stored", "prior", "to", "activating", "environments" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L139-L147
[ "def", "deactivate", "(", ")", ":", "if", "'CPENV_ACTIVE'", "not", "in", "os", ".", "environ", "or", "'CPENV_CLEAN_ENV'", "not", "in", "os", ".", "environ", ":", "raise", "EnvironmentError", "(", "'Can not deactivate environment...'", ")", "utils", ".", "restore...
afbb569ae04002743db041d3629a5be8c290bd89
valid
get_home_path
:returns: your home path...CPENV_HOME env var OR ~/.cpenv
cpenv/api.py
def get_home_path(): ''':returns: your home path...CPENV_HOME env var OR ~/.cpenv''' home = unipath(os.environ.get('CPENV_HOME', '~/.cpenv')) home_modules = unipath(home, 'modules') if not os.path.exists(home): os.makedirs(home) if not os.path.exists(home_modules): os.makedirs(home_...
def get_home_path(): ''':returns: your home path...CPENV_HOME env var OR ~/.cpenv''' home = unipath(os.environ.get('CPENV_HOME', '~/.cpenv')) home_modules = unipath(home, 'modules') if not os.path.exists(home): os.makedirs(home) if not os.path.exists(home_modules): os.makedirs(home_...
[ ":", "returns", ":", "your", "home", "path", "...", "CPENV_HOME", "env", "var", "OR", "~", "/", ".", "cpenv" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L150-L159
[ "def", "get_home_path", "(", ")", ":", "home", "=", "unipath", "(", "os", ".", "environ", ".", "get", "(", "'CPENV_HOME'", ",", "'~/.cpenv'", ")", ")", "home_modules", "=", "unipath", "(", "home", ",", "'modules'", ")", "if", "not", "os", ".", "path", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
get_module_paths
:returns: paths in CPENV_MODULES env var and CPENV_HOME/modules
cpenv/api.py
def get_module_paths(): ''':returns: paths in CPENV_MODULES env var and CPENV_HOME/modules''' module_paths = [] cpenv_modules_path = os.environ.get('CPENV_MODULES', None) if cpenv_modules_path: module_paths.extend(cpenv_modules_path.split(os.pathsep)) module_paths.append(unipath(get_home_...
def get_module_paths(): ''':returns: paths in CPENV_MODULES env var and CPENV_HOME/modules''' module_paths = [] cpenv_modules_path = os.environ.get('CPENV_MODULES', None) if cpenv_modules_path: module_paths.extend(cpenv_modules_path.split(os.pathsep)) module_paths.append(unipath(get_home_...
[ ":", "returns", ":", "paths", "in", "CPENV_MODULES", "env", "var", "and", "CPENV_HOME", "/", "modules" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L162-L173
[ "def", "get_module_paths", "(", ")", ":", "module_paths", "=", "[", "]", "cpenv_modules_path", "=", "os", ".", "environ", ".", "get", "(", "'CPENV_MODULES'", ",", "None", ")", "if", "cpenv_modules_path", ":", "module_paths", ".", "extend", "(", "cpenv_modules_...
afbb569ae04002743db041d3629a5be8c290bd89
valid
get_environments
Returns a list of all known virtual environments as :class:`VirtualEnvironment` instances. This includes those in CPENV_HOME and any others that are cached(created by the current user or activated once by full path.)
cpenv/api.py
def get_environments(): '''Returns a list of all known virtual environments as :class:`VirtualEnvironment` instances. This includes those in CPENV_HOME and any others that are cached(created by the current user or activated once by full path.) ''' environments = set() cwd = os.getcwd() ...
def get_environments(): '''Returns a list of all known virtual environments as :class:`VirtualEnvironment` instances. This includes those in CPENV_HOME and any others that are cached(created by the current user or activated once by full path.) ''' environments = set() cwd = os.getcwd() ...
[ "Returns", "a", "list", "of", "all", "known", "virtual", "environments", "as", ":", "class", ":", "VirtualEnvironment", "instances", ".", "This", "includes", "those", "in", "CPENV_HOME", "and", "any", "others", "that", "are", "cached", "(", "created", "by", ...
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L193-L223
[ "def", "get_environments", "(", ")", ":", "environments", "=", "set", "(", ")", "cwd", "=", "os", ".", "getcwd", "(", ")", "for", "d", "in", "os", ".", "listdir", "(", "cwd", ")", ":", "if", "d", "==", "'environment.yml'", ":", "environments", ".", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
get_modules
Returns a list of available modules.
cpenv/api.py
def get_modules(): '''Returns a list of available modules.''' modules = set() cwd = os.getcwd() for d in os.listdir(cwd): if d == 'module.yml': modules.add(Module(cwd)) path = unipath(cwd, d) if utils.is_module(path): modules.add(Module(cwd)) modu...
def get_modules(): '''Returns a list of available modules.''' modules = set() cwd = os.getcwd() for d in os.listdir(cwd): if d == 'module.yml': modules.add(Module(cwd)) path = unipath(cwd, d) if utils.is_module(path): modules.add(Module(cwd)) modu...
[ "Returns", "a", "list", "of", "available", "modules", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L226-L249
[ "def", "get_modules", "(", ")", ":", "modules", "=", "set", "(", ")", "cwd", "=", "os", ".", "getcwd", "(", ")", "for", "d", "in", "os", ".", "listdir", "(", "cwd", ")", ":", "if", "d", "==", "'module.yml'", ":", "modules", ".", "add", "(", "Mo...
afbb569ae04002743db041d3629a5be8c290bd89
valid
get_active_modules
:returns: a list of active :class:`Module` s or []
cpenv/api.py
def get_active_modules(): ''':returns: a list of active :class:`Module` s or []''' modules = os.environ.get('CPENV_ACTIVE_MODULES', None) if modules: modules = modules.split(os.pathsep) return [Module(module) for module in modules] return []
def get_active_modules(): ''':returns: a list of active :class:`Module` s or []''' modules = os.environ.get('CPENV_ACTIVE_MODULES', None) if modules: modules = modules.split(os.pathsep) return [Module(module) for module in modules] return []
[ ":", "returns", ":", "a", "list", "of", "active", ":", "class", ":", "Module", "s", "or", "[]" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L252-L260
[ "def", "get_active_modules", "(", ")", ":", "modules", "=", "os", ".", "environ", ".", "get", "(", "'CPENV_ACTIVE_MODULES'", ",", "None", ")", "if", "modules", ":", "modules", "=", "modules", ".", "split", "(", "os", ".", "pathsep", ")", "return", "[", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
add_active_module
Add a module to CPENV_ACTIVE_MODULES environment variable
cpenv/api.py
def add_active_module(module): '''Add a module to CPENV_ACTIVE_MODULES environment variable''' modules = set(get_active_modules()) modules.add(module) new_modules_path = os.pathsep.join([m.path for m in modules]) os.environ['CPENV_ACTIVE_MODULES'] = str(new_modules_path)
def add_active_module(module): '''Add a module to CPENV_ACTIVE_MODULES environment variable''' modules = set(get_active_modules()) modules.add(module) new_modules_path = os.pathsep.join([m.path for m in modules]) os.environ['CPENV_ACTIVE_MODULES'] = str(new_modules_path)
[ "Add", "a", "module", "to", "CPENV_ACTIVE_MODULES", "environment", "variable" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L263-L269
[ "def", "add_active_module", "(", "module", ")", ":", "modules", "=", "set", "(", "get_active_modules", "(", ")", ")", "modules", ".", "add", "(", "module", ")", "new_modules_path", "=", "os", ".", "pathsep", ".", "join", "(", "[", "m", ".", "path", "fo...
afbb569ae04002743db041d3629a5be8c290bd89
valid
rem_active_module
Remove a module from CPENV_ACTIVE_MODULES environment variable
cpenv/api.py
def rem_active_module(module): '''Remove a module from CPENV_ACTIVE_MODULES environment variable''' modules = set(get_active_modules()) modules.discard(module) new_modules_path = os.pathsep.join([m.path for m in modules]) os.environ['CPENV_ACTIVE_MODULES'] = str(new_modules_path)
def rem_active_module(module): '''Remove a module from CPENV_ACTIVE_MODULES environment variable''' modules = set(get_active_modules()) modules.discard(module) new_modules_path = os.pathsep.join([m.path for m in modules]) os.environ['CPENV_ACTIVE_MODULES'] = str(new_modules_path)
[ "Remove", "a", "module", "from", "CPENV_ACTIVE_MODULES", "environment", "variable" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L272-L278
[ "def", "rem_active_module", "(", "module", ")", ":", "modules", "=", "set", "(", "get_active_modules", "(", ")", ")", "modules", ".", "discard", "(", "module", ")", "new_modules_path", "=", "os", ".", "pathsep", ".", "join", "(", "[", "m", ".", "path", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
format_objects
Format a list of environments and modules for terminal output
cpenv/cli.py
def format_objects(objects, children=False, columns=None, header=True): '''Format a list of environments and modules for terminal output''' columns = columns or ('NAME', 'TYPE', 'PATH') objects = sorted(objects, key=_type_and_name) data = [] for obj in objects: if isinstance(obj, cpenv.Virt...
def format_objects(objects, children=False, columns=None, header=True): '''Format a list of environments and modules for terminal output''' columns = columns or ('NAME', 'TYPE', 'PATH') objects = sorted(objects, key=_type_and_name) data = [] for obj in objects: if isinstance(obj, cpenv.Virt...
[ "Format", "a", "list", "of", "environments", "and", "modules", "for", "terminal", "output" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L59-L84
[ "def", "format_objects", "(", "objects", ",", "children", "=", "False", ",", "columns", "=", "None", ",", "header", "=", "True", ")", ":", "columns", "=", "columns", "or", "(", "'NAME'", ",", "'TYPE'", ",", "'PATH'", ")", "objects", "=", "sorted", "(",...
afbb569ae04002743db041d3629a5be8c290bd89
valid
info
Show context info
cpenv/cli.py
def info(): '''Show context info''' env = cpenv.get_active_env() modules = [] if env: modules = env.get_modules() active_modules = cpenv.get_active_modules() if not env and not modules and not active_modules: click.echo('\nNo active modules...') return click.echo(b...
def info(): '''Show context info''' env = cpenv.get_active_env() modules = [] if env: modules = env.get_modules() active_modules = cpenv.get_active_modules() if not env and not modules and not active_modules: click.echo('\nNo active modules...') return click.echo(b...
[ "Show", "context", "info" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L95-L128
[ "def", "info", "(", ")", ":", "env", "=", "cpenv", ".", "get_active_env", "(", ")", "modules", "=", "[", "]", "if", "env", ":", "modules", "=", "env", ".", "get_modules", "(", ")", "active_modules", "=", "cpenv", ".", "get_active_modules", "(", ")", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
list_
List available environments and modules
cpenv/cli.py
def list_(): '''List available environments and modules''' environments = cpenv.get_environments() modules = cpenv.get_modules() click.echo(format_objects(environments + modules, children=True))
def list_(): '''List available environments and modules''' environments = cpenv.get_environments() modules = cpenv.get_modules() click.echo(format_objects(environments + modules, children=True))
[ "List", "available", "environments", "and", "modules" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L132-L137
[ "def", "list_", "(", ")", ":", "environments", "=", "cpenv", ".", "get_environments", "(", ")", "modules", "=", "cpenv", ".", "get_modules", "(", ")", "click", ".", "echo", "(", "format_objects", "(", "environments", "+", "modules", ",", "children", "=", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
activate
Activate an environment
cpenv/cli.py
def activate(paths, skip_local, skip_shared): '''Activate an environment''' if not paths: ctx = click.get_current_context() if cpenv.get_active_env(): ctx.invoke(info) return click.echo(ctx.get_help()) examples = ( '\nExamples: \n' ...
def activate(paths, skip_local, skip_shared): '''Activate an environment''' if not paths: ctx = click.get_current_context() if cpenv.get_active_env(): ctx.invoke(info) return click.echo(ctx.get_help()) examples = ( '\nExamples: \n' ...
[ "Activate", "an", "environment" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L144-L205
[ "def", "activate", "(", "paths", ",", "skip_local", ",", "skip_shared", ")", ":", "if", "not", "paths", ":", "ctx", "=", "click", ".", "get_current_context", "(", ")", "if", "cpenv", ".", "get_active_env", "(", ")", ":", "ctx", ".", "invoke", "(", "inf...
afbb569ae04002743db041d3629a5be8c290bd89
valid
create
Create a new environment.
cpenv/cli.py
def create(name_or_path, config): '''Create a new environment.''' if not name_or_path: ctx = click.get_current_context() click.echo(ctx.get_help()) examples = ( '\nExamples:\n' ' cpenv create my_env\n' ' cpenv create ./relative/path/to/my_env\n'...
def create(name_or_path, config): '''Create a new environment.''' if not name_or_path: ctx = click.get_current_context() click.echo(ctx.get_help()) examples = ( '\nExamples:\n' ' cpenv create my_env\n' ' cpenv create ./relative/path/to/my_env\n'...
[ "Create", "a", "new", "environment", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L211-L240
[ "def", "create", "(", "name_or_path", ",", "config", ")", ":", "if", "not", "name_or_path", ":", "ctx", "=", "click", ".", "get_current_context", "(", ")", "click", ".", "echo", "(", "ctx", ".", "get_help", "(", ")", ")", "examples", "=", "(", "'\\nExa...
afbb569ae04002743db041d3629a5be8c290bd89
valid
remove
Remove an environment
cpenv/cli.py
def remove(name_or_path): '''Remove an environment''' click.echo() try: r = cpenv.resolve(name_or_path) except cpenv.ResolveError as e: click.echo(e) return obj = r.resolved[0] if not isinstance(obj, cpenv.VirtualEnvironment): click.echo('{} is a module. Use `cp...
def remove(name_or_path): '''Remove an environment''' click.echo() try: r = cpenv.resolve(name_or_path) except cpenv.ResolveError as e: click.echo(e) return obj = r.resolved[0] if not isinstance(obj, cpenv.VirtualEnvironment): click.echo('{} is a module. Use `cp...
[ "Remove", "an", "environment" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L245-L275
[ "def", "remove", "(", "name_or_path", ")", ":", "click", ".", "echo", "(", ")", "try", ":", "r", "=", "cpenv", ".", "resolve", "(", "name_or_path", ")", "except", "cpenv", ".", "ResolveError", "as", "e", ":", "click", ".", "echo", "(", "e", ")", "r...
afbb569ae04002743db041d3629a5be8c290bd89
valid
list_
List available environments and modules
cpenv/cli.py
def list_(): '''List available environments and modules''' click.echo('Cached Environments') environments = list(EnvironmentCache) click.echo(format_objects(environments, children=False))
def list_(): '''List available environments and modules''' click.echo('Cached Environments') environments = list(EnvironmentCache) click.echo(format_objects(environments, children=False))
[ "List", "available", "environments", "and", "modules" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L284-L290
[ "def", "list_", "(", ")", ":", "click", ".", "echo", "(", "'Cached Environments'", ")", "environments", "=", "list", "(", "EnvironmentCache", ")", "click", ".", "echo", "(", "format_objects", "(", "environments", ",", "children", "=", "False", ")", ")" ]
afbb569ae04002743db041d3629a5be8c290bd89
valid
add
Add an environment to the cache. Allows you to activate the environment by name instead of by full path
cpenv/cli.py
def add(path): '''Add an environment to the cache. Allows you to activate the environment by name instead of by full path''' click.echo('\nAdding {} to cache......'.format(path), nl=False) try: r = cpenv.resolve(path) except Exception as e: click.echo(bold_red('FAILED')) cli...
def add(path): '''Add an environment to the cache. Allows you to activate the environment by name instead of by full path''' click.echo('\nAdding {} to cache......'.format(path), nl=False) try: r = cpenv.resolve(path) except Exception as e: click.echo(bold_red('FAILED')) cli...
[ "Add", "an", "environment", "to", "the", "cache", ".", "Allows", "you", "to", "activate", "the", "environment", "by", "name", "instead", "of", "by", "full", "path" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L295-L310
[ "def", "add", "(", "path", ")", ":", "click", ".", "echo", "(", "'\\nAdding {} to cache......'", ".", "format", "(", "path", ")", ",", "nl", "=", "False", ")", "try", ":", "r", "=", "cpenv", ".", "resolve", "(", "path", ")", "except", "Exception", "a...
afbb569ae04002743db041d3629a5be8c290bd89
valid
remove
Remove a cached environment. Removed paths will no longer be able to be activated by name
cpenv/cli.py
def remove(path): '''Remove a cached environment. Removed paths will no longer be able to be activated by name''' r = cpenv.resolve(path) if isinstance(r.resolved[0], cpenv.VirtualEnvironment): EnvironmentCache.discard(r.resolved[0]) EnvironmentCache.save()
def remove(path): '''Remove a cached environment. Removed paths will no longer be able to be activated by name''' r = cpenv.resolve(path) if isinstance(r.resolved[0], cpenv.VirtualEnvironment): EnvironmentCache.discard(r.resolved[0]) EnvironmentCache.save()
[ "Remove", "a", "cached", "environment", ".", "Removed", "paths", "will", "no", "longer", "be", "able", "to", "be", "activated", "by", "name" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L315-L322
[ "def", "remove", "(", "path", ")", ":", "r", "=", "cpenv", ".", "resolve", "(", "path", ")", "if", "isinstance", "(", "r", ".", "resolved", "[", "0", "]", ",", "cpenv", ".", "VirtualEnvironment", ")", ":", "EnvironmentCache", ".", "discard", "(", "r"...
afbb569ae04002743db041d3629a5be8c290bd89
valid
create
Create a new template module. You can also specify a filesystem path like "./modules/new_module"
cpenv/cli.py
def create(name_or_path, config): '''Create a new template module. You can also specify a filesystem path like "./modules/new_module" ''' click.echo('Creating module {}...'.format(name_or_path), nl=False) try: module = cpenv.create_module(name_or_path, config) except Exception as e: ...
def create(name_or_path, config): '''Create a new template module. You can also specify a filesystem path like "./modules/new_module" ''' click.echo('Creating module {}...'.format(name_or_path), nl=False) try: module = cpenv.create_module(name_or_path, config) except Exception as e: ...
[ "Create", "a", "new", "template", "module", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L342-L360
[ "def", "create", "(", "name_or_path", ",", "config", ")", ":", "click", ".", "echo", "(", "'Creating module {}...'", ".", "format", "(", "name_or_path", ")", ",", "nl", "=", "False", ")", "try", ":", "module", "=", "cpenv", ".", "create_module", "(", "na...
afbb569ae04002743db041d3629a5be8c290bd89
valid
add
Add a module to an environment. PATH can be a git repository path or a filesystem path.
cpenv/cli.py
def add(name, path, branch, type): '''Add a module to an environment. PATH can be a git repository path or a filesystem path. ''' if not name and not path: ctx = click.get_current_context() click.echo(ctx.get_help()) examples = ( '\nExamples:\n' ' cpenv mo...
def add(name, path, branch, type): '''Add a module to an environment. PATH can be a git repository path or a filesystem path. ''' if not name and not path: ctx = click.get_current_context() click.echo(ctx.get_help()) examples = ( '\nExamples:\n' ' cpenv mo...
[ "Add", "a", "module", "to", "an", "environment", ".", "PATH", "can", "be", "a", "git", "repository", "path", "or", "a", "filesystem", "path", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L373-L432
[ "def", "add", "(", "name", ",", "path", ",", "branch", ",", "type", ")", ":", "if", "not", "name", "and", "not", "path", ":", "ctx", "=", "click", ".", "get_current_context", "(", ")", "click", ".", "echo", "(", "ctx", ".", "get_help", "(", ")", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
remove
Remove a module named NAME. Will remove the first resolved module named NAME. You can also specify a full path to a module. Use the --local option to ensure removal of modules local to the currently active environment.
cpenv/cli.py
def remove(name, local): '''Remove a module named NAME. Will remove the first resolved module named NAME. You can also specify a full path to a module. Use the --local option to ensure removal of modules local to the currently active environment.''' click.echo() if not local: # Use resolver to find mod...
def remove(name, local): '''Remove a module named NAME. Will remove the first resolved module named NAME. You can also specify a full path to a module. Use the --local option to ensure removal of modules local to the currently active environment.''' click.echo() if not local: # Use resolver to find mod...
[ "Remove", "a", "module", "named", "NAME", ".", "Will", "remove", "the", "first", "resolved", "module", "named", "NAME", ".", "You", "can", "also", "specify", "a", "full", "path", "to", "a", "module", ".", "Use", "the", "--", "local", "option", "to", "e...
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L438-L483
[ "def", "remove", "(", "name", ",", "local", ")", ":", "click", ".", "echo", "(", ")", "if", "not", "local", ":", "# Use resolver to find module", "try", ":", "r", "=", "cpenv", ".", "resolve", "(", "name", ")", "except", "cpenv", ".", "ResolveError", "...
afbb569ae04002743db041d3629a5be8c290bd89
valid
localize
Copy a global module to the active environment.
cpenv/cli.py
def localize(name): '''Copy a global module to the active environment.''' env = cpenv.get_active_env() if not env: click.echo('You need to activate an environment first.') return try: r = cpenv.resolve(name) except cpenv.ResolveError as e: click.echo('\n' + str(e)) ...
def localize(name): '''Copy a global module to the active environment.''' env = cpenv.get_active_env() if not env: click.echo('You need to activate an environment first.') return try: r = cpenv.resolve(name) except cpenv.ResolveError as e: click.echo('\n' + str(e)) ...
[ "Copy", "a", "global", "module", "to", "the", "active", "environment", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L488-L526
[ "def", "localize", "(", "name", ")", ":", "env", "=", "cpenv", ".", "get_active_env", "(", ")", "if", "not", "env", ":", "click", ".", "echo", "(", "'You need to activate an environment first.'", ")", "return", "try", ":", "r", "=", "cpenv", ".", "resolve"...
afbb569ae04002743db041d3629a5be8c290bd89
valid
path_resolver
Resolves VirtualEnvironments with a relative or absolute path
cpenv/resolver.py
def path_resolver(resolver, path): '''Resolves VirtualEnvironments with a relative or absolute path''' path = unipath(path) if is_environment(path): return VirtualEnvironment(path) raise ResolveError
def path_resolver(resolver, path): '''Resolves VirtualEnvironments with a relative or absolute path''' path = unipath(path) if is_environment(path): return VirtualEnvironment(path) raise ResolveError
[ "Resolves", "VirtualEnvironments", "with", "a", "relative", "or", "absolute", "path" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/resolver.py#L119-L127
[ "def", "path_resolver", "(", "resolver", ",", "path", ")", ":", "path", "=", "unipath", "(", "path", ")", "if", "is_environment", "(", "path", ")", ":", "return", "VirtualEnvironment", "(", "path", ")", "raise", "ResolveError" ]
afbb569ae04002743db041d3629a5be8c290bd89
valid
home_resolver
Resolves VirtualEnvironments in CPENV_HOME
cpenv/resolver.py
def home_resolver(resolver, path): '''Resolves VirtualEnvironments in CPENV_HOME''' from .api import get_home_path path = unipath(get_home_path(), path) if is_environment(path): return VirtualEnvironment(path) raise ResolveError
def home_resolver(resolver, path): '''Resolves VirtualEnvironments in CPENV_HOME''' from .api import get_home_path path = unipath(get_home_path(), path) if is_environment(path): return VirtualEnvironment(path) raise ResolveError
[ "Resolves", "VirtualEnvironments", "in", "CPENV_HOME" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/resolver.py#L130-L140
[ "def", "home_resolver", "(", "resolver", ",", "path", ")", ":", "from", ".", "api", "import", "get_home_path", "path", "=", "unipath", "(", "get_home_path", "(", ")", ",", "path", ")", "if", "is_environment", "(", "path", ")", ":", "return", "VirtualEnviro...
afbb569ae04002743db041d3629a5be8c290bd89
valid
cache_resolver
Resolves VirtualEnvironments in EnvironmentCache
cpenv/resolver.py
def cache_resolver(resolver, path): '''Resolves VirtualEnvironments in EnvironmentCache''' env = resolver.cache.find(path) if env: return env raise ResolveError
def cache_resolver(resolver, path): '''Resolves VirtualEnvironments in EnvironmentCache''' env = resolver.cache.find(path) if env: return env raise ResolveError
[ "Resolves", "VirtualEnvironments", "in", "EnvironmentCache" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/resolver.py#L143-L150
[ "def", "cache_resolver", "(", "resolver", ",", "path", ")", ":", "env", "=", "resolver", ".", "cache", ".", "find", "(", "path", ")", "if", "env", ":", "return", "env", "raise", "ResolveError" ]
afbb569ae04002743db041d3629a5be8c290bd89
valid
module_resolver
Resolves module in previously resolved environment.
cpenv/resolver.py
def module_resolver(resolver, path): '''Resolves module in previously resolved environment.''' if resolver.resolved: if isinstance(resolver.resolved[0], VirtualEnvironment): env = resolver.resolved[0] mod = env.get_module(path) if mod: return mod ...
def module_resolver(resolver, path): '''Resolves module in previously resolved environment.''' if resolver.resolved: if isinstance(resolver.resolved[0], VirtualEnvironment): env = resolver.resolved[0] mod = env.get_module(path) if mod: return mod ...
[ "Resolves", "module", "in", "previously", "resolved", "environment", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/resolver.py#L162-L174
[ "def", "module_resolver", "(", "resolver", ",", "path", ")", ":", "if", "resolver", ".", "resolved", ":", "if", "isinstance", "(", "resolver", ".", "resolved", "[", "0", "]", ",", "VirtualEnvironment", ")", ":", "env", "=", "resolver", ".", "resolved", "...
afbb569ae04002743db041d3629a5be8c290bd89
valid
modules_path_resolver
Resolves modules in CPENV_MODULES path and CPENV_HOME/modules
cpenv/resolver.py
def modules_path_resolver(resolver, path): '''Resolves modules in CPENV_MODULES path and CPENV_HOME/modules''' from .api import get_module_paths for module_dir in get_module_paths(): mod_path = unipath(module_dir, path) if is_module(mod_path): return Module(mod_path) rais...
def modules_path_resolver(resolver, path): '''Resolves modules in CPENV_MODULES path and CPENV_HOME/modules''' from .api import get_module_paths for module_dir in get_module_paths(): mod_path = unipath(module_dir, path) if is_module(mod_path): return Module(mod_path) rais...
[ "Resolves", "modules", "in", "CPENV_MODULES", "path", "and", "CPENV_HOME", "/", "modules" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/resolver.py#L177-L188
[ "def", "modules_path_resolver", "(", "resolver", ",", "path", ")", ":", "from", ".", "api", "import", "get_module_paths", "for", "module_dir", "in", "get_module_paths", "(", ")", ":", "mod_path", "=", "unipath", "(", "module_dir", ",", "path", ")", "if", "is...
afbb569ae04002743db041d3629a5be8c290bd89
valid
active_env_module_resolver
Resolves modules in currently active environment.
cpenv/resolver.py
def active_env_module_resolver(resolver, path): '''Resolves modules in currently active environment.''' from .api import get_active_env env = get_active_env() if not env: raise ResolveError mod = env.get_module(path) if not mod: raise ResolveError return mod
def active_env_module_resolver(resolver, path): '''Resolves modules in currently active environment.''' from .api import get_active_env env = get_active_env() if not env: raise ResolveError mod = env.get_module(path) if not mod: raise ResolveError return mod
[ "Resolves", "modules", "in", "currently", "active", "environment", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/resolver.py#L191-L204
[ "def", "active_env_module_resolver", "(", "resolver", ",", "path", ")", ":", "from", ".", "api", "import", "get_active_env", "env", "=", "get_active_env", "(", ")", "if", "not", "env", ":", "raise", "ResolveError", "mod", "=", "env", ".", "get_module", "(", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
redirect_resolver
Resolves environment from .cpenv file...recursively walks up the tree in attempt to find a .cpenv file
cpenv/resolver.py
def redirect_resolver(resolver, path): '''Resolves environment from .cpenv file...recursively walks up the tree in attempt to find a .cpenv file''' if not os.path.exists(path): raise ResolveError if os.path.isfile(path): path = os.path.dirname(path) for root, _, _ in walk_up(path)...
def redirect_resolver(resolver, path): '''Resolves environment from .cpenv file...recursively walks up the tree in attempt to find a .cpenv file''' if not os.path.exists(path): raise ResolveError if os.path.isfile(path): path = os.path.dirname(path) for root, _, _ in walk_up(path)...
[ "Resolves", "environment", "from", ".", "cpenv", "file", "...", "recursively", "walks", "up", "the", "tree", "in", "attempt", "to", "find", "a", ".", "cpenv", "file" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/resolver.py#L207-L223
[ "def", "redirect_resolver", "(", "resolver", ",", "path", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "raise", "ResolveError", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "path", "=", "os", "."...
afbb569ae04002743db041d3629a5be8c290bd89
valid
_engine_affinity
Which engine or engines are preferred for processing this object Returns: (location, weight) location (integer or tuple): engine id (or in the case of a distributed array a tuple (engine_id_list, distaxis)). weight(integer): Proportional to the cost of moving the object to a different engi...
distob/arrays.py
def _engine_affinity(obj): """Which engine or engines are preferred for processing this object Returns: (location, weight) location (integer or tuple): engine id (or in the case of a distributed array a tuple (engine_id_list, distaxis)). weight(integer): Proportional to the cost of moving the ...
def _engine_affinity(obj): """Which engine or engines are preferred for processing this object Returns: (location, weight) location (integer or tuple): engine id (or in the case of a distributed array a tuple (engine_id_list, distaxis)). weight(integer): Proportional to the cost of moving the ...
[ "Which", "engine", "or", "engines", "are", "preferred", "for", "processing", "this", "object", "Returns", ":", "(", "location", "weight", ")", "location", "(", "integer", "or", "tuple", ")", ":", "engine", "id", "(", "or", "in", "the", "case", "of", "a",...
mattja/distob
python
https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1279-L1295
[ "def", "_engine_affinity", "(", "obj", ")", ":", "from", "distob", "import", "engine", "this_engine", "=", "engine", ".", "eid", "if", "isinstance", "(", "obj", ",", "numbers", ".", "Number", ")", "or", "obj", "is", "None", ":", "return", "(", "this_engi...
b0fc49e157189932c70231077ed35e1aa5717da9
valid
_ufunc_move_input
Copy ufunc input `obj` to new engine location(s) unless obj is scalar. If the input is requested to be distributed to multiple engines, this function will also take care of broadcasting along the distributed axis. If the input obj is a scalar, it will be passed through unchanged. Args: obj (arr...
distob/arrays.py
def _ufunc_move_input(obj, location, bshape): """Copy ufunc input `obj` to new engine location(s) unless obj is scalar. If the input is requested to be distributed to multiple engines, this function will also take care of broadcasting along the distributed axis. If the input obj is a scalar, it will b...
def _ufunc_move_input(obj, location, bshape): """Copy ufunc input `obj` to new engine location(s) unless obj is scalar. If the input is requested to be distributed to multiple engines, this function will also take care of broadcasting along the distributed axis. If the input obj is a scalar, it will b...
[ "Copy", "ufunc", "input", "obj", "to", "new", "engine", "location", "(", "s", ")", "unless", "obj", "is", "scalar", "." ]
mattja/distob
python
https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1298-L1359
[ "def", "_ufunc_move_input", "(", "obj", ",", "location", ",", "bshape", ")", ":", "if", "(", "not", "hasattr", "(", "type", "(", "obj", ")", ",", "'__array_interface__'", ")", "and", "not", "isinstance", "(", "obj", ",", "Remote", ")", "and", "(", "isi...
b0fc49e157189932c70231077ed35e1aa5717da9
valid
_ufunc_dispatch
Route ufunc execution intelligently to local host or remote engine(s) depending on where the inputs are, to minimize the need to move data. Args: see numpy documentation for __numpy_ufunc__
distob/arrays.py
def _ufunc_dispatch(ufunc, method, i, inputs, **kwargs): """Route ufunc execution intelligently to local host or remote engine(s) depending on where the inputs are, to minimize the need to move data. Args: see numpy documentation for __numpy_ufunc__ """ #__print_ufunc(ufunc, method, i, inputs,...
def _ufunc_dispatch(ufunc, method, i, inputs, **kwargs): """Route ufunc execution intelligently to local host or remote engine(s) depending on where the inputs are, to minimize the need to move data. Args: see numpy documentation for __numpy_ufunc__ """ #__print_ufunc(ufunc, method, i, inputs,...
[ "Route", "ufunc", "execution", "intelligently", "to", "local", "host", "or", "remote", "engine", "(", "s", ")", "depending", "on", "where", "the", "inputs", "are", "to", "minimize", "the", "need", "to", "move", "data", ".", "Args", ":", "see", "numpy", "...
mattja/distob
python
https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1362-L1443
[ "def", "_ufunc_dispatch", "(", "ufunc", ",", "method", ",", "i", ",", "inputs", ",", "*", "*", "kwargs", ")", ":", "#__print_ufunc(ufunc, method, i, inputs, **kwargs)", "if", "'out'", "in", "kwargs", "and", "kwargs", "[", "'out'", "]", "is", "not", "None", "...
b0fc49e157189932c70231077ed35e1aa5717da9
valid
transpose
Returns a view of the array with axes transposed. For a 1-D array, this has no effect. For a 2-D array, this is the usual matrix transpose. For an n-D array, if axes are given, their order indicates how the axes are permuted Args: a (array_like): Input array. axes (list of int, optiona...
distob/arrays.py
def transpose(a, axes=None): """Returns a view of the array with axes transposed. For a 1-D array, this has no effect. For a 2-D array, this is the usual matrix transpose. For an n-D array, if axes are given, their order indicates how the axes are permuted Args: a (array_like): Input arr...
def transpose(a, axes=None): """Returns a view of the array with axes transposed. For a 1-D array, this has no effect. For a 2-D array, this is the usual matrix transpose. For an n-D array, if axes are given, their order indicates how the axes are permuted Args: a (array_like): Input arr...
[ "Returns", "a", "view", "of", "the", "array", "with", "axes", "transposed", "." ]
mattja/distob
python
https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1446-L1478
[ "def", "transpose", "(", "a", ",", "axes", "=", "None", ")", ":", "if", "isinstance", "(", "a", ",", "np", ".", "ndarray", ")", ":", "return", "np", ".", "transpose", "(", "a", ",", "axes", ")", "elif", "isinstance", "(", "a", ",", "RemoteArray", ...
b0fc49e157189932c70231077ed35e1aa5717da9
valid
rollaxis
Roll the specified axis backwards, until it lies in a given position. Args: a (array_like): Input array. axis (int): The axis to roll backwards. The positions of the other axes do not change relative to one another. start (int, optional): The axis is rolled until it lies before this ...
distob/arrays.py
def rollaxis(a, axis, start=0): """Roll the specified axis backwards, until it lies in a given position. Args: a (array_like): Input array. axis (int): The axis to roll backwards. The positions of the other axes do not change relative to one another. start (int, optional): The axis ...
def rollaxis(a, axis, start=0): """Roll the specified axis backwards, until it lies in a given position. Args: a (array_like): Input array. axis (int): The axis to roll backwards. The positions of the other axes do not change relative to one another. start (int, optional): The axis ...
[ "Roll", "the", "specified", "axis", "backwards", "until", "it", "lies", "in", "a", "given", "position", "." ]
mattja/distob
python
https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1481-L1505
[ "def", "rollaxis", "(", "a", ",", "axis", ",", "start", "=", "0", ")", ":", "if", "isinstance", "(", "a", ",", "np", ".", "ndarray", ")", ":", "return", "np", ".", "rollaxis", "(", "a", ",", "axis", ",", "start", ")", "if", "axis", "not", "in",...
b0fc49e157189932c70231077ed35e1aa5717da9