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
train
recordtype
Returns a new class with named fields. @keyword field_defaults: A mapping from (a subset of) field names to default values. @keyword default: If provided, the default value for all fields without an explicit default in `field_defaults`. >>> Point = recordtype('Point', 'x y', default=0) ...
smop/recipes.py
def recordtype(typename, field_names, verbose=False, **default_kwds): '''Returns a new class with named fields. @keyword field_defaults: A mapping from (a subset of) field names to default values. @keyword default: If provided, the default value for all fields without an explicit default i...
def recordtype(typename, field_names, verbose=False, **default_kwds): '''Returns a new class with named fields. @keyword field_defaults: A mapping from (a subset of) field names to default values. @keyword default: If provided, the default value for all fields without an explicit default i...
[ "Returns", "a", "new", "class", "with", "named", "fields", "." ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/recipes.py#L8-L146
[ "def", "recordtype", "(", "typename", ",", "field_names", ",", "verbose", "=", "False", ",", "*", "*", "default_kwds", ")", ":", "# Parse and validate the field names. Validation serves two purposes,", "# generating informative error messages and preventing template injection atta...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
isvector_or_scalar
one-dimensional arrays having shape [N], row and column matrices having shape [1 N] and [N 1] correspondingly, and their generalizations having shape [1 1 ... N ... 1 1 1]. Scalars have shape [1 1 ... 1]. Empty arrays dont count
smop/libsmop.py
def isvector_or_scalar(a): """ one-dimensional arrays having shape [N], row and column matrices having shape [1 N] and [N 1] correspondingly, and their generalizations having shape [1 1 ... N ... 1 1 1]. Scalars have shape [1 1 ... 1]. Empty arrays dont count """ try: return ...
def isvector_or_scalar(a): """ one-dimensional arrays having shape [N], row and column matrices having shape [1 N] and [N 1] correspondingly, and their generalizations having shape [1 1 ... N ... 1 1 1]. Scalars have shape [1 1 ... 1]. Empty arrays dont count """ try: return ...
[ "one", "-", "dimensional", "arrays", "having", "shape", "[", "N", "]", "row", "and", "column", "matrices", "having", "shape", "[", "1", "N", "]", "and", "[", "N", "1", "]", "correspondingly", "and", "their", "generalizations", "having", "shape", "[", "1"...
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/libsmop.py#L29-L41
[ "def", "isvector_or_scalar", "(", "a", ")", ":", "try", ":", "return", "a", ".", "size", "and", "a", ".", "ndim", "-", "a", ".", "shape", ".", "count", "(", "1", ")", "<=", "1", "except", ":", "return", "False" ]
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
arange
>>> a=arange(1,10) # 1:10 >>> size(a) matlabarray([[ 1, 10]])
smop/libsmop.py
def arange(start,stop,step=1,**kwargs): """ >>> a=arange(1,10) # 1:10 >>> size(a) matlabarray([[ 1, 10]]) """ expand_value = 1 if step > 0 else -1 return matlabarray(np.arange(start, stop+expand_value, step, ...
def arange(start,stop,step=1,**kwargs): """ >>> a=arange(1,10) # 1:10 >>> size(a) matlabarray([[ 1, 10]]) """ expand_value = 1 if step > 0 else -1 return matlabarray(np.arange(start, stop+expand_value, step, ...
[ ">>>", "a", "=", "arange", "(", "1", "10", ")", "#", "1", ":", "10", ">>>", "size", "(", "a", ")", "matlabarray", "(", "[[", "1", "10", "]]", ")" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/libsmop.py#L359-L369
[ "def", "arange", "(", "start", ",", "stop", ",", "step", "=", "1", ",", "*", "*", "kwargs", ")", ":", "expand_value", "=", "1", "if", "step", ">", "0", "else", "-", "1", "return", "matlabarray", "(", "np", ".", "arange", "(", "start", ",", "stop"...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
concat
>>> concat([1,2,3,4,5] , [1,2,3,4,5]]) [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
smop/libsmop.py
def concat(args): """ >>> concat([1,2,3,4,5] , [1,2,3,4,5]]) [1, 2, 3, 4, 5, 1, 2, 3, 4, 5] """ import pdb pdb.set_trace() t = [matlabarray(a) for a in args] return np.concatenate(t)
def concat(args): """ >>> concat([1,2,3,4,5] , [1,2,3,4,5]]) [1, 2, 3, 4, 5, 1, 2, 3, 4, 5] """ import pdb pdb.set_trace() t = [matlabarray(a) for a in args] return np.concatenate(t)
[ ">>>", "concat", "(", "[", "1", "2", "3", "4", "5", "]", "[", "1", "2", "3", "4", "5", "]]", ")", "[", "1", "2", "3", "4", "5", "1", "2", "3", "4", "5", "]" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/libsmop.py#L370-L378
[ "def", "concat", "(", "args", ")", ":", "import", "pdb", "pdb", ".", "set_trace", "(", ")", "t", "=", "[", "matlabarray", "(", "a", ")", "for", "a", "in", "args", "]", "return", "np", ".", "concatenate", "(", "t", ")" ]
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
size
>>> size(zeros(3,3)) + 1 matlabarray([[4, 4]])
smop/libsmop.py
def size(a, b=0, nargout=1): """ >>> size(zeros(3,3)) + 1 matlabarray([[4, 4]]) """ s = np.asarray(a).shape if s is (): return 1 if b else (1,)*nargout # a is not a scalar try: if b: return s[b-1] else: return matlabarray(s) if nargout <= 1...
def size(a, b=0, nargout=1): """ >>> size(zeros(3,3)) + 1 matlabarray([[4, 4]]) """ s = np.asarray(a).shape if s is (): return 1 if b else (1,)*nargout # a is not a scalar try: if b: return s[b-1] else: return matlabarray(s) if nargout <= 1...
[ ">>>", "size", "(", "zeros", "(", "3", "3", "))", "+", "1", "matlabarray", "(", "[[", "4", "4", "]]", ")" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/libsmop.py#L642-L657
[ "def", "size", "(", "a", ",", "b", "=", "0", ",", "nargout", "=", "1", ")", ":", "s", "=", "np", ".", "asarray", "(", "a", ")", ".", "shape", "if", "s", "is", "(", ")", ":", "return", "1", "if", "b", "else", "(", "1", ",", ")", "*", "na...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_top
top : | top stmt
smop/parse.py
def p_top(p): """ top : | top stmt """ if len(p) == 1: p[0] = node.stmt_list() else: p[0] = p[1] p[0].append(p[2])
def p_top(p): """ top : | top stmt """ if len(p) == 1: p[0] = node.stmt_list() else: p[0] = p[1] p[0].append(p[2])
[ "top", ":", "|", "top", "stmt" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L43-L52
[ "def", "p_top", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "1", ":", "p", "[", "0", "]", "=", "node", ".", "stmt_list", "(", ")", "else", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "p", "[", "0", "]", ".", "append", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_end_function
top : top END_FUNCTION
smop/parse.py
def p_end_function(p): """ top : top END_FUNCTION """ p[0] = p[1] p[0].append(node.return_stmt(ret=ret_expr)) p[0].append(node.comment_stmt("\nif __name__ == '__main__':\n pass"))
def p_end_function(p): """ top : top END_FUNCTION """ p[0] = p[1] p[0].append(node.return_stmt(ret=ret_expr)) p[0].append(node.comment_stmt("\nif __name__ == '__main__':\n pass"))
[ "top", ":", "top", "END_FUNCTION" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L62-L68
[ "def", "p_end_function", "(", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "p", "[", "0", "]", ".", "append", "(", "node", ".", "return_stmt", "(", "ret", "=", "ret_expr", ")", ")", "p", "[", "0", "]", ".", "append", "(", "no...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_arg1
arg1 : STRING | NUMBER | IDENT | GLOBAL
smop/parse.py
def p_arg1(p): """ arg1 : STRING | NUMBER | IDENT | GLOBAL """ # a hack to support "clear global" p[0] = node.string(value=str(p[1]), lineno=p.lineno(1), lexpos=p.lexpos(1))
def p_arg1(p): """ arg1 : STRING | NUMBER | IDENT | GLOBAL """ # a hack to support "clear global" p[0] = node.string(value=str(p[1]), lineno=p.lineno(1), lexpos=p.lexpos(1))
[ "arg1", ":", "STRING", "|", "NUMBER", "|", "IDENT", "|", "GLOBAL" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L72-L80
[ "def", "p_arg1", "(", "p", ")", ":", "# a hack to support \"clear global\"", "p", "[", "0", "]", "=", "node", ".", "string", "(", "value", "=", "str", "(", "p", "[", "1", "]", ")", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ")", ",", "lexp...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_arg_list
arg_list : ident_init_opt | arg_list COMMA ident_init_opt
smop/parse.py
def p_arg_list(p): """ arg_list : ident_init_opt | arg_list COMMA ident_init_opt """ if len(p) == 2: p[0] = node.expr_list([p[1]]) elif len(p) == 4: p[0] = p[1] p[0].append(p[3]) else: assert 0 assert isinstance(p[0], node.expr_list)
def p_arg_list(p): """ arg_list : ident_init_opt | arg_list COMMA ident_init_opt """ if len(p) == 2: p[0] = node.expr_list([p[1]]) elif len(p) == 4: p[0] = p[1] p[0].append(p[3]) else: assert 0 assert isinstance(p[0], node.expr_list)
[ "arg_list", ":", "ident_init_opt", "|", "arg_list", "COMMA", "ident_init_opt" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L84-L96
[ "def", "p_arg_list", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "node", ".", "expr_list", "(", "[", "p", "[", "1", "]", "]", ")", "elif", "len", "(", "p", ")", "==", "4", ":", "p", "[", "0",...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_args
args : arg1 | args arg1
smop/parse.py
def p_args(p): """ args : arg1 | args arg1 """ if len(p) == 2: p[0] = node.expr_list([p[1]]) else: p[0] = p[1] p[0].append(p[2])
def p_args(p): """ args : arg1 | args arg1 """ if len(p) == 2: p[0] = node.expr_list([p[1]]) else: p[0] = p[1] p[0].append(p[2])
[ "args", ":", "arg1", "|", "args", "arg1" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L100-L109
[ "def", "p_args", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "node", ".", "expr_list", "(", "[", "p", "[", "1", "]", "]", ")", "else", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "p",...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_case_list
case_list : | CASE expr sep stmt_list_opt case_list | CASE expr error stmt_list_opt case_list | OTHERWISE stmt_list
smop/parse.py
def p_case_list(p): """ case_list : | CASE expr sep stmt_list_opt case_list | CASE expr error stmt_list_opt case_list | OTHERWISE stmt_list """ if len(p) == 1: p[0] = node.stmt_list() elif len(p) == 3: assert isinstance(p[2], node.stmt_list) ...
def p_case_list(p): """ case_list : | CASE expr sep stmt_list_opt case_list | CASE expr error stmt_list_opt case_list | OTHERWISE stmt_list """ if len(p) == 1: p[0] = node.stmt_list() elif len(p) == 3: assert isinstance(p[2], node.stmt_list) ...
[ "case_list", ":", "|", "CASE", "expr", "sep", "stmt_list_opt", "case_list", "|", "CASE", "expr", "error", "stmt_list_opt", "case_list", "|", "OTHERWISE", "stmt_list" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L119-L140
[ "def", "p_case_list", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "1", ":", "p", "[", "0", "]", "=", "node", ".", "stmt_list", "(", ")", "elif", "len", "(", "p", ")", "==", "3", ":", "assert", "isinstance", "(", "p", "[", "2", "]"...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_cellarray
cellarray : LBRACE RBRACE | LBRACE expr_list RBRACE | LBRACE concat_list RBRACE | LBRACE concat_list SEMI RBRACE
smop/parse.py
def p_cellarray(p): """ cellarray : LBRACE RBRACE | LBRACE expr_list RBRACE | LBRACE concat_list RBRACE | LBRACE concat_list SEMI RBRACE """ if len(p) == 3: p[0] = node.cellarray(op="{}", args=node.expr_list()) else: p[0] = node.cellarray(op=...
def p_cellarray(p): """ cellarray : LBRACE RBRACE | LBRACE expr_list RBRACE | LBRACE concat_list RBRACE | LBRACE concat_list SEMI RBRACE """ if len(p) == 3: p[0] = node.cellarray(op="{}", args=node.expr_list()) else: p[0] = node.cellarray(op=...
[ "cellarray", ":", "LBRACE", "RBRACE", "|", "LBRACE", "expr_list", "RBRACE", "|", "LBRACE", "concat_list", "RBRACE", "|", "LBRACE", "concat_list", "SEMI", "RBRACE" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L144-L154
[ "def", "p_cellarray", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "3", ":", "p", "[", "0", "]", "=", "node", ".", "cellarray", "(", "op", "=", "\"{}\"", ",", "args", "=", "node", ".", "expr_list", "(", ")", ")", "else", ":", "p", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_cellarrayref
expr : expr LBRACE expr_list RBRACE | expr LBRACE RBRACE
smop/parse.py
def p_cellarrayref(p): """expr : expr LBRACE expr_list RBRACE | expr LBRACE RBRACE """ args = node.expr_list() if len(p) == 4 else p[3] assert isinstance(args, node.expr_list) p[0] = node.cellarrayref(func_expr=p[1], args=args)
def p_cellarrayref(p): """expr : expr LBRACE expr_list RBRACE | expr LBRACE RBRACE """ args = node.expr_list() if len(p) == 4 else p[3] assert isinstance(args, node.expr_list) p[0] = node.cellarrayref(func_expr=p[1], args=args)
[ "expr", ":", "expr", "LBRACE", "expr_list", "RBRACE", "|", "expr", "LBRACE", "RBRACE" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L158-L164
[ "def", "p_cellarrayref", "(", "p", ")", ":", "args", "=", "node", ".", "expr_list", "(", ")", "if", "len", "(", "p", ")", "==", "4", "else", "p", "[", "3", "]", "assert", "isinstance", "(", "args", ",", "node", ".", "expr_list", ")", "p", "[", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_concat_list
concat_list : expr_list SEMI expr_list | concat_list SEMI expr_list
smop/parse.py
def p_concat_list(p): """ concat_list : expr_list SEMI expr_list | concat_list SEMI expr_list """ if p[1].__class__ == node.expr_list: p[0] = node.concat_list([p[1], p[3]]) else: p[0] = p[1] p[0].append(p[3])
def p_concat_list(p): """ concat_list : expr_list SEMI expr_list | concat_list SEMI expr_list """ if p[1].__class__ == node.expr_list: p[0] = node.concat_list([p[1], p[3]]) else: p[0] = p[1] p[0].append(p[3])
[ "concat_list", ":", "expr_list", "SEMI", "expr_list", "|", "concat_list", "SEMI", "expr_list" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L195-L204
[ "def", "p_concat_list", "(", "p", ")", ":", "if", "p", "[", "1", "]", ".", "__class__", "==", "node", ".", "expr_list", ":", "p", "[", "0", "]", "=", "node", ".", "concat_list", "(", "[", "p", "[", "1", "]", ",", "p", "[", "3", "]", "]", ")...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_elseif_stmt
elseif_stmt : | ELSE stmt_list_opt | ELSEIF expr sep stmt_list_opt elseif_stmt | ELSEIF LPAREN expr RPAREN stmt_list_opt elseif_stmt
smop/parse.py
def p_elseif_stmt(p): """ elseif_stmt : | ELSE stmt_list_opt | ELSEIF expr sep stmt_list_opt elseif_stmt | ELSEIF LPAREN expr RPAREN stmt_list_opt elseif_stmt """ if len(p) == 1: p[0] = node.stmt_list() elif len(p) == 3: p[0] = p[2] ...
def p_elseif_stmt(p): """ elseif_stmt : | ELSE stmt_list_opt | ELSEIF expr sep stmt_list_opt elseif_stmt | ELSEIF LPAREN expr RPAREN stmt_list_opt elseif_stmt """ if len(p) == 1: p[0] = node.stmt_list() elif len(p) == 3: p[0] = p[2] ...
[ "elseif_stmt", ":", "|", "ELSE", "stmt_list_opt", "|", "ELSEIF", "expr", "sep", "stmt_list_opt", "elseif_stmt", "|", "ELSEIF", "LPAREN", "expr", "RPAREN", "stmt_list_opt", "elseif_stmt" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L214-L230
[ "def", "p_elseif_stmt", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "1", ":", "p", "[", "0", "]", "=", "node", ".", "stmt_list", "(", ")", "elif", "len", "(", "p", ")", "==", "3", ":", "p", "[", "0", "]", "=", "p", "[", "2", "...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_expr1
expr1 : MINUS expr %prec UMINUS | PLUS expr %prec UMINUS | NEG expr | HANDLE ident | PLUSPLUS ident | MINUSMINUS ident
smop/parse.py
def p_expr1(p): """expr1 : MINUS expr %prec UMINUS | PLUS expr %prec UMINUS | NEG expr | HANDLE ident | PLUSPLUS ident | MINUSMINUS ident """ p[0] = node.expr(op=p[1], args=node.expr_list([p[2]]))
def p_expr1(p): """expr1 : MINUS expr %prec UMINUS | PLUS expr %prec UMINUS | NEG expr | HANDLE ident | PLUSPLUS ident | MINUSMINUS ident """ p[0] = node.expr(op=p[1], args=node.expr_list([p[2]]))
[ "expr1", ":", "MINUS", "expr", "%prec", "UMINUS", "|", "PLUS", "expr", "%prec", "UMINUS", "|", "NEG", "expr", "|", "HANDLE", "ident", "|", "PLUSPLUS", "ident", "|", "MINUSMINUS", "ident" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L266-L274
[ "def", "p_expr1", "(", "p", ")", ":", "p", "[", "0", "]", "=", "node", ".", "expr", "(", "op", "=", "p", "[", "1", "]", ",", "args", "=", "node", ".", "expr_list", "(", "[", "p", "[", "2", "]", "]", ")", ")" ]
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_expr2
expr2 : expr AND expr | expr ANDAND expr | expr BACKSLASH expr | expr COLON expr | expr DIV expr | expr DOT expr | expr DOTDIV expr | expr DOTDIVEQ expr | expr DOTEXP expr | expr DOTMUL expr ...
smop/parse.py
def p_expr2(p): """expr2 : expr AND expr | expr ANDAND expr | expr BACKSLASH expr | expr COLON expr | expr DIV expr | expr DOT expr | expr DOTDIV expr | expr DOTDIVEQ expr | expr DOTEXP expr | expr D...
def p_expr2(p): """expr2 : expr AND expr | expr ANDAND expr | expr BACKSLASH expr | expr COLON expr | expr DIV expr | expr DOT expr | expr DOTDIV expr | expr DOTDIVEQ expr | expr DOTEXP expr | expr D...
[ "expr2", ":", "expr", "AND", "expr", "|", "expr", "ANDAND", "expr", "|", "expr", "BACKSLASH", "expr", "|", "expr", "COLON", "expr", "|", "expr", "DIV", "expr", "|", "expr", "DOT", "expr", "|", "expr", "DOTDIV", "expr", "|", "expr", "DOTDIVEQ", "expr", ...
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L278-L386
[ "def", "p_expr2", "(", "p", ")", ":", "if", "p", "[", "2", "]", "==", "\"=\"", ":", "if", "p", "[", "1", "]", ".", "__class__", "is", "node", ".", "let", ":", "raise_exception", "(", "SyntaxError", ",", "\"Not implemented assignment as expression\"", ","...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_expr_end
end : END_EXPR
smop/parse.py
def p_expr_end(p): "end : END_EXPR" p[0] = node.expr( op="end", args=node.expr_list([node.number(0), node.number(0)]))
def p_expr_end(p): "end : END_EXPR" p[0] = node.expr( op="end", args=node.expr_list([node.number(0), node.number(0)]))
[ "end", ":", "END_EXPR" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L396-L399
[ "def", "p_expr_end", "(", "p", ")", ":", "p", "[", "0", "]", "=", "node", ".", "expr", "(", "op", "=", "\"end\"", ",", "args", "=", "node", ".", "expr_list", "(", "[", "node", ".", "number", "(", "0", ")", ",", "node", ".", "number", "(", "0"...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_expr_ident
ident : IDENT
smop/parse.py
def p_expr_ident(p): "ident : IDENT" global use_nargin, use_varargin if p[1] == "varargin": use_varargin = 1 if p[1] == "nargin": use_nargin = 1 # import pdb; pdb.set_trace() p[0] = node.ident( name=p[1], lineno=p.lineno(1), column=p.lexpos(1) - p.lexer.le...
def p_expr_ident(p): "ident : IDENT" global use_nargin, use_varargin if p[1] == "varargin": use_varargin = 1 if p[1] == "nargin": use_nargin = 1 # import pdb; pdb.set_trace() p[0] = node.ident( name=p[1], lineno=p.lineno(1), column=p.lexpos(1) - p.lexer.le...
[ "ident", ":", "IDENT" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L403-L418
[ "def", "p_expr_ident", "(", "p", ")", ":", "global", "use_nargin", ",", "use_varargin", "if", "p", "[", "1", "]", "==", "\"varargin\"", ":", "use_varargin", "=", "1", "if", "p", "[", "1", "]", "==", "\"nargin\"", ":", "use_nargin", "=", "1", "# import ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_ident_init_opt
ident_init_opt : NEG | ident | ident EQ expr
smop/parse.py
def p_ident_init_opt(p): """ ident_init_opt : NEG | ident | ident EQ expr """ if p[1] == '~': p[0] = node.ident("__") else: p[0] = p[1] if len(p) == 2: p[0].init = node.ident(name="None") else: p[0].init = p[3]
def p_ident_init_opt(p): """ ident_init_opt : NEG | ident | ident EQ expr """ if p[1] == '~': p[0] = node.ident("__") else: p[0] = p[1] if len(p) == 2: p[0].init = node.ident(name="None") else: p[0].init = p[3]
[ "ident_init_opt", ":", "NEG", "|", "ident", "|", "ident", "EQ", "expr" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L423-L436
[ "def", "p_ident_init_opt", "(", "p", ")", ":", "if", "p", "[", "1", "]", "==", "'~'", ":", "p", "[", "0", "]", "=", "node", ".", "ident", "(", "\"__\"", ")", "else", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "if", "len", "(", "p",...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_expr_number
number : NUMBER
smop/parse.py
def p_expr_number(p): "number : NUMBER" p[0] = node.number(p[1], lineno=p.lineno(1), lexpos=p.lexpos(1))
def p_expr_number(p): "number : NUMBER" p[0] = node.number(p[1], lineno=p.lineno(1), lexpos=p.lexpos(1))
[ "number", ":", "NUMBER" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L449-L451
[ "def", "p_expr_number", "(", "p", ")", ":", "p", "[", "0", "]", "=", "node", ".", "number", "(", "p", "[", "1", "]", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ")", ",", "lexpos", "=", "p", ".", "lexpos", "(", "1", ")", ")" ]
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_expr_stmt
expr_stmt : expr_list SEMI
smop/parse.py
def p_expr_stmt(p): """ expr_stmt : expr_list SEMI """ assert isinstance(p[1], node.expr_list) p[0] = node.expr_stmt(expr=p[1])
def p_expr_stmt(p): """ expr_stmt : expr_list SEMI """ assert isinstance(p[1], node.expr_list) p[0] = node.expr_stmt(expr=p[1])
[ "expr_stmt", ":", "expr_list", "SEMI" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L455-L460
[ "def", "p_expr_stmt", "(", "p", ")", ":", "assert", "isinstance", "(", "p", "[", "1", "]", ",", "node", ".", "expr_list", ")", "p", "[", "0", "]", "=", "node", ".", "expr_stmt", "(", "expr", "=", "p", "[", "1", "]", ")" ]
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_expr_string
string : STRING
smop/parse.py
def p_expr_string(p): "string : STRING" p[0] = node.string(p[1], lineno=p.lineno(1), lexpos=p.lexpos(1))
def p_expr_string(p): "string : STRING" p[0] = node.string(p[1], lineno=p.lineno(1), lexpos=p.lexpos(1))
[ "string", ":", "STRING" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L464-L466
[ "def", "p_expr_string", "(", "p", ")", ":", "p", "[", "0", "]", "=", "node", ".", "string", "(", "p", "[", "1", "]", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ")", ",", "lexpos", "=", "p", ".", "lexpos", "(", "1", ")", ")" ]
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_exprs
exprs : expr | exprs COMMA expr
smop/parse.py
def p_exprs(p): """ exprs : expr | exprs COMMA expr """ if len(p) == 2: p[0] = node.expr_list([p[1]]) elif len(p) == 4: p[0] = p[1] p[0].append(p[3]) else: assert (0) assert isinstance(p[0], node.expr_list)
def p_exprs(p): """ exprs : expr | exprs COMMA expr """ if len(p) == 2: p[0] = node.expr_list([p[1]]) elif len(p) == 4: p[0] = p[1] p[0].append(p[3]) else: assert (0) assert isinstance(p[0], node.expr_list)
[ "exprs", ":", "expr", "|", "exprs", "COMMA", "expr" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L470-L482
[ "def", "p_exprs", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "node", ".", "expr_list", "(", "[", "p", "[", "1", "]", "]", ")", "elif", "len", "(", "p", ")", "==", "4", ":", "p", "[", "0", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_field_expr
expr : expr FIELD
smop/parse.py
def p_field_expr(p): """ expr : expr FIELD """ p[0] = node.expr( op=".", args=node.expr_list([ p[1], node.ident( name=p[2], lineno=p.lineno(2), lexpos=p.lexpos(2)) ]))
def p_field_expr(p): """ expr : expr FIELD """ p[0] = node.expr( op=".", args=node.expr_list([ p[1], node.ident( name=p[2], lineno=p.lineno(2), lexpos=p.lexpos(2)) ]))
[ "expr", ":", "expr", "FIELD" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L486-L495
[ "def", "p_field_expr", "(", "p", ")", ":", "p", "[", "0", "]", "=", "node", ".", "expr", "(", "op", "=", "\".\"", ",", "args", "=", "node", ".", "expr_list", "(", "[", "p", "[", "1", "]", ",", "node", ".", "ident", "(", "name", "=", "p", "[...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_foo_stmt
foo_stmt : expr OROR expr SEMI
smop/parse.py
def p_foo_stmt(p): "foo_stmt : expr OROR expr SEMI" expr1 = p[1][1][0] expr2 = p[3][1][0] ident = expr1.ret args1 = expr1.args args2 = expr2.args p[0] = node.let(ret=ident, args=node.expr("or", node.expr_list([args1, args2])))
def p_foo_stmt(p): "foo_stmt : expr OROR expr SEMI" expr1 = p[1][1][0] expr2 = p[3][1][0] ident = expr1.ret args1 = expr1.args args2 = expr2.args p[0] = node.let(ret=ident, args=node.expr("or", node.expr_list([args1, args2])))
[ "foo_stmt", ":", "expr", "OROR", "expr", "SEMI" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L499-L507
[ "def", "p_foo_stmt", "(", "p", ")", ":", "expr1", "=", "p", "[", "1", "]", "[", "1", "]", "[", "0", "]", "expr2", "=", "p", "[", "3", "]", "[", "1", "]", "[", "0", "]", "ident", "=", "expr1", ".", "ret", "args1", "=", "expr1", ".", "args"...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_for_stmt
for_stmt : FOR ident EQ expr SEMI stmt_list END_STMT | FOR LPAREN ident EQ expr RPAREN SEMI stmt_list END_STMT | FOR matrix EQ expr SEMI stmt_list END_STMT
smop/parse.py
def p_for_stmt(p): """ for_stmt : FOR ident EQ expr SEMI stmt_list END_STMT | FOR LPAREN ident EQ expr RPAREN SEMI stmt_list END_STMT | FOR matrix EQ expr SEMI stmt_list END_STMT """ if len(p) == 8: if not isinstance(p[2], node.ident): raise_exception(Syntax...
def p_for_stmt(p): """ for_stmt : FOR ident EQ expr SEMI stmt_list END_STMT | FOR LPAREN ident EQ expr RPAREN SEMI stmt_list END_STMT | FOR matrix EQ expr SEMI stmt_list END_STMT """ if len(p) == 8: if not isinstance(p[2], node.ident): raise_exception(Syntax...
[ "for_stmt", ":", "FOR", "ident", "EQ", "expr", "SEMI", "stmt_list", "END_STMT", "|", "FOR", "LPAREN", "ident", "EQ", "expr", "RPAREN", "SEMI", "stmt_list", "END_STMT", "|", "FOR", "matrix", "EQ", "expr", "SEMI", "stmt_list", "END_STMT" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L511-L521
[ "def", "p_for_stmt", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "8", ":", "if", "not", "isinstance", "(", "p", "[", "2", "]", ",", "node", ".", "ident", ")", ":", "raise_exception", "(", "SyntaxError", ",", "\"Not implemented: for loop\"", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_func_stmt
func_stmt : FUNCTION ident lambda_args SEMI | FUNCTION ret EQ ident lambda_args SEMI
smop/parse.py
def p_func_stmt(p): """func_stmt : FUNCTION ident lambda_args SEMI | FUNCTION ret EQ ident lambda_args SEMI """ # stmt_list of func_stmt is set below # marked with XYZZY global ret_expr, use_nargin, use_varargin ret_expr = node.expr_list() use_varargin = use_nargin = 0 ...
def p_func_stmt(p): """func_stmt : FUNCTION ident lambda_args SEMI | FUNCTION ret EQ ident lambda_args SEMI """ # stmt_list of func_stmt is set below # marked with XYZZY global ret_expr, use_nargin, use_varargin ret_expr = node.expr_list() use_varargin = use_nargin = 0 ...
[ "func_stmt", ":", "FUNCTION", "ident", "lambda_args", "SEMI", "|", "FUNCTION", "ret", "EQ", "ident", "lambda_args", "SEMI" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L524-L549
[ "def", "p_func_stmt", "(", "p", ")", ":", "# stmt_list of func_stmt is set below", "# marked with XYZZY", "global", "ret_expr", ",", "use_nargin", ",", "use_varargin", "ret_expr", "=", "node", ".", "expr_list", "(", ")", "use_varargin", "=", "use_nargin", "=", "0", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_funcall_expr
expr : expr LPAREN expr_list RPAREN | expr LPAREN RPAREN
smop/parse.py
def p_funcall_expr(p): """expr : expr LPAREN expr_list RPAREN | expr LPAREN RPAREN """ if (len(p) == 5 and len(p[3]) == 1 and p[3][0].__class__ is node.expr and p[3][0].op == ":" and not p[3][0].args): # foo(:) => ravel(foo) p[0] = node.funcall( func_expr=...
def p_funcall_expr(p): """expr : expr LPAREN expr_list RPAREN | expr LPAREN RPAREN """ if (len(p) == 5 and len(p[3]) == 1 and p[3][0].__class__ is node.expr and p[3][0].op == ":" and not p[3][0].args): # foo(:) => ravel(foo) p[0] = node.funcall( func_expr=...
[ "expr", ":", "expr", "LPAREN", "expr_list", "RPAREN", "|", "expr", "LPAREN", "RPAREN" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L553-L565
[ "def", "p_funcall_expr", "(", "p", ")", ":", "if", "(", "len", "(", "p", ")", "==", "5", "and", "len", "(", "p", "[", "3", "]", ")", "==", "1", "and", "p", "[", "3", "]", "[", "0", "]", ".", "__class__", "is", "node", ".", "expr", "and", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_global_list
global_list : ident | global_list ident
smop/parse.py
def p_global_list(p): """global_list : ident | global_list ident """ if len(p) == 2: p[0] = node.global_list([p[1]]) elif len(p) == 3: p[0] = p[1] p[0].append(p[2])
def p_global_list(p): """global_list : ident | global_list ident """ if len(p) == 2: p[0] = node.global_list([p[1]]) elif len(p) == 3: p[0] = p[1] p[0].append(p[2])
[ "global_list", ":", "ident", "|", "global_list", "ident" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L569-L577
[ "def", "p_global_list", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "node", ".", "global_list", "(", "[", "p", "[", "1", "]", "]", ")", "elif", "len", "(", "p", ")", "==", "3", ":", "p", "[", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_global_stmt
global_stmt : GLOBAL global_list SEMI | GLOBAL ident EQ expr SEMI
smop/parse.py
def p_global_stmt(p): """ global_stmt : GLOBAL global_list SEMI | GLOBAL ident EQ expr SEMI """ p[0] = node.global_stmt(p[2]) for ident in p[0]: ident.props = "G"
def p_global_stmt(p): """ global_stmt : GLOBAL global_list SEMI | GLOBAL ident EQ expr SEMI """ p[0] = node.global_stmt(p[2]) for ident in p[0]: ident.props = "G"
[ "global_stmt", ":", "GLOBAL", "global_list", "SEMI", "|", "GLOBAL", "ident", "EQ", "expr", "SEMI" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L581-L588
[ "def", "p_global_stmt", "(", "p", ")", ":", "p", "[", "0", "]", "=", "node", ".", "global_stmt", "(", "p", "[", "2", "]", ")", "for", "ident", "in", "p", "[", "0", "]", ":", "ident", ".", "props", "=", "\"G\"" ]
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_if_stmt
if_stmt : IF expr sep stmt_list_opt elseif_stmt END_STMT | IF LPAREN expr RPAREN stmt_list_opt elseif_stmt END_STMT
smop/parse.py
def p_if_stmt(p): """ if_stmt : IF expr sep stmt_list_opt elseif_stmt END_STMT | IF LPAREN expr RPAREN stmt_list_opt elseif_stmt END_STMT """ if len(p) == 7: p[0] = node.if_stmt(cond_expr=p[2], then_stmt=p[4], else_stmt=p[5]) elif len(p) == 8: p[0] = node.if_stmt(cond_exp...
def p_if_stmt(p): """ if_stmt : IF expr sep stmt_list_opt elseif_stmt END_STMT | IF LPAREN expr RPAREN stmt_list_opt elseif_stmt END_STMT """ if len(p) == 7: p[0] = node.if_stmt(cond_expr=p[2], then_stmt=p[4], else_stmt=p[5]) elif len(p) == 8: p[0] = node.if_stmt(cond_exp...
[ "if_stmt", ":", "IF", "expr", "sep", "stmt_list_opt", "elseif_stmt", "END_STMT", "|", "IF", "LPAREN", "expr", "RPAREN", "stmt_list_opt", "elseif_stmt", "END_STMT" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L592-L602
[ "def", "p_if_stmt", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "7", ":", "p", "[", "0", "]", "=", "node", ".", "if_stmt", "(", "cond_expr", "=", "p", "[", "2", "]", ",", "then_stmt", "=", "p", "[", "4", "]", ",", "else_stmt", "="...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_matrix
matrix : LBRACKET RBRACKET | LBRACKET concat_list RBRACKET | LBRACKET concat_list SEMI RBRACKET | LBRACKET expr_list RBRACKET | LBRACKET expr_list SEMI RBRACKET
smop/parse.py
def p_matrix(p): """matrix : LBRACKET RBRACKET | LBRACKET concat_list RBRACKET | LBRACKET concat_list SEMI RBRACKET | LBRACKET expr_list RBRACKET | LBRACKET expr_list SEMI RBRACKET """ if len(p) == 3: p[0] = node.matrix() else: p[0]...
def p_matrix(p): """matrix : LBRACKET RBRACKET | LBRACKET concat_list RBRACKET | LBRACKET concat_list SEMI RBRACKET | LBRACKET expr_list RBRACKET | LBRACKET expr_list SEMI RBRACKET """ if len(p) == 3: p[0] = node.matrix() else: p[0]...
[ "matrix", ":", "LBRACKET", "RBRACKET", "|", "LBRACKET", "concat_list", "RBRACKET", "|", "LBRACKET", "concat_list", "SEMI", "RBRACKET", "|", "LBRACKET", "expr_list", "RBRACKET", "|", "LBRACKET", "expr_list", "SEMI", "RBRACKET" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L621-L631
[ "def", "p_matrix", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "3", ":", "p", "[", "0", "]", "=", "node", ".", "matrix", "(", ")", "else", ":", "p", "[", "0", "]", "=", "node", ".", "matrix", "(", "p", "[", "2", "]", ")" ]
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_parens_expr
expr : LPAREN expr RPAREN
smop/parse.py
def p_parens_expr(p): """ expr : LPAREN expr RPAREN """ p[0] = node.expr(op="parens", args=node.expr_list([p[2]]))
def p_parens_expr(p): """ expr : LPAREN expr RPAREN """ p[0] = node.expr(op="parens", args=node.expr_list([p[2]]))
[ "expr", ":", "LPAREN", "expr", "RPAREN" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L644-L648
[ "def", "p_parens_expr", "(", "p", ")", ":", "p", "[", "0", "]", "=", "node", ".", "expr", "(", "op", "=", "\"parens\"", ",", "args", "=", "node", ".", "expr_list", "(", "[", "p", "[", "2", "]", "]", ")", ")" ]
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_ret
ret : ident | LBRACKET RBRACKET | LBRACKET expr_list RBRACKET
smop/parse.py
def p_ret(p): """ ret : ident | LBRACKET RBRACKET | LBRACKET expr_list RBRACKET """ if len(p) == 2: p[0] = node.expr_list([p[1]]) elif len(p) == 3: p[0] = node.expr_list([]) elif len(p) == 4: assert isinstance(p[2], node.expr_list) p[0] = p[2] ...
def p_ret(p): """ ret : ident | LBRACKET RBRACKET | LBRACKET expr_list RBRACKET """ if len(p) == 2: p[0] = node.expr_list([p[1]]) elif len(p) == 3: p[0] = node.expr_list([]) elif len(p) == 4: assert isinstance(p[2], node.expr_list) p[0] = p[2] ...
[ "ret", ":", "ident", "|", "LBRACKET", "RBRACKET", "|", "LBRACKET", "expr_list", "RBRACKET" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L671-L687
[ "def", "p_ret", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "node", ".", "expr_list", "(", "[", "p", "[", "1", "]", "]", ")", "elif", "len", "(", "p", ")", "==", "3", ":", "p", "[", "0", "]...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_stmt_list
stmt_list : stmt | stmt_list stmt
smop/parse.py
def p_stmt_list(p): """ stmt_list : stmt | stmt_list stmt """ if len(p) == 2: p[0] = node.stmt_list([p[1]] if p[1] else []) elif len(p) == 3: p[0] = p[1] if p[2]: p[0].append(p[2]) else: assert 0
def p_stmt_list(p): """ stmt_list : stmt | stmt_list stmt """ if len(p) == 2: p[0] = node.stmt_list([p[1]] if p[1] else []) elif len(p) == 3: p[0] = p[1] if p[2]: p[0].append(p[2]) else: assert 0
[ "stmt_list", ":", "stmt", "|", "stmt_list", "stmt" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L746-L758
[ "def", "p_stmt_list", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "node", ".", "stmt_list", "(", "[", "p", "[", "1", "]", "]", "if", "p", "[", "1", "]", "else", "[", "]", ")", "elif", "len", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_switch_stmt
switch_stmt : SWITCH expr semi_opt case_list END_STMT
smop/parse.py
def p_switch_stmt(p): """ switch_stmt : SWITCH expr semi_opt case_list END_STMT """ def backpatch(expr, stmt): if isinstance(stmt, node.if_stmt): stmt.cond_expr.args[1] = expr backpatch(expr, stmt.else_stmt) backpatch(p[2], p[4]) p[0] = p[4]
def p_switch_stmt(p): """ switch_stmt : SWITCH expr semi_opt case_list END_STMT """ def backpatch(expr, stmt): if isinstance(stmt, node.if_stmt): stmt.cond_expr.args[1] = expr backpatch(expr, stmt.else_stmt) backpatch(p[2], p[4]) p[0] = p[4]
[ "switch_stmt", ":", "SWITCH", "expr", "semi_opt", "case_list", "END_STMT" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L774-L785
[ "def", "p_switch_stmt", "(", "p", ")", ":", "def", "backpatch", "(", "expr", ",", "stmt", ")", ":", "if", "isinstance", "(", "stmt", ",", "node", ".", "if_stmt", ")", ":", "stmt", ".", "cond_expr", ".", "args", "[", "1", "]", "=", "expr", "backpatc...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_try_catch
try_catch : TRY stmt_list CATCH stmt_list END_STMT
smop/parse.py
def p_try_catch(p): """ try_catch : TRY stmt_list CATCH stmt_list END_STMT """ ## | TRY stmt_list END_STMT assert isinstance(p[2], node.stmt_list) # assert isinstance(p[4],node.stmt_list) p[0] = node.try_catch( try_stmt=p[2], catch_stmt=p[4], finally_stmt=node.stmt_li...
def p_try_catch(p): """ try_catch : TRY stmt_list CATCH stmt_list END_STMT """ ## | TRY stmt_list END_STMT assert isinstance(p[2], node.stmt_list) # assert isinstance(p[4],node.stmt_list) p[0] = node.try_catch( try_stmt=p[2], catch_stmt=p[4], finally_stmt=node.stmt_li...
[ "try_catch", ":", "TRY", "stmt_list", "CATCH", "stmt_list", "END_STMT" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L797-L807
[ "def", "p_try_catch", "(", "p", ")", ":", "## | TRY stmt_list END_STMT", "assert", "isinstance", "(", "p", "[", "2", "]", ",", "node", ".", "stmt_list", ")", "# assert isinstance(p[4],node.stmt_list)", "p", "[", "0", "]", "=", "node", ".", "try_catch", "(", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_unwind
unwind : UNWIND_PROTECT stmt_list UNWIND_PROTECT_CLEANUP stmt_list END_UNWIND_PROTECT
smop/parse.py
def p_unwind(p): """ unwind : UNWIND_PROTECT stmt_list UNWIND_PROTECT_CLEANUP stmt_list END_UNWIND_PROTECT """ p[0] = node.try_catch( try_stmt=p[2], catch_stmt=node.expr_list(), finally_stmt=p[4])
def p_unwind(p): """ unwind : UNWIND_PROTECT stmt_list UNWIND_PROTECT_CLEANUP stmt_list END_UNWIND_PROTECT """ p[0] = node.try_catch( try_stmt=p[2], catch_stmt=node.expr_list(), finally_stmt=p[4])
[ "unwind", ":", "UNWIND_PROTECT", "stmt_list", "UNWIND_PROTECT_CLEANUP", "stmt_list", "END_UNWIND_PROTECT" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L811-L816
[ "def", "p_unwind", "(", "p", ")", ":", "p", "[", "0", "]", "=", "node", ".", "try_catch", "(", "try_stmt", "=", "p", "[", "2", "]", ",", "catch_stmt", "=", "node", ".", "expr_list", "(", ")", ",", "finally_stmt", "=", "p", "[", "4", "]", ")" ]
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
p_while_stmt
while_stmt : WHILE expr SEMI stmt_list END_STMT
smop/parse.py
def p_while_stmt(p): """ while_stmt : WHILE expr SEMI stmt_list END_STMT """ assert isinstance(p[4], node.stmt_list) p[0] = node.while_stmt(cond_expr=p[2], stmt_list=p[4])
def p_while_stmt(p): """ while_stmt : WHILE expr SEMI stmt_list END_STMT """ assert isinstance(p[4], node.stmt_list) p[0] = node.while_stmt(cond_expr=p[2], stmt_list=p[4])
[ "while_stmt", ":", "WHILE", "expr", "SEMI", "stmt_list", "END_STMT" ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/parse.py#L820-L825
[ "def", "p_while_stmt", "(", "p", ")", ":", "assert", "isinstance", "(", "p", "[", "4", "]", ",", "node", ".", "stmt_list", ")", "p", "[", "0", "]", "=", "node", ".", "while_stmt", "(", "cond_expr", "=", "p", "[", "2", "]", ",", "stmt_list", "=", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
to_arrayref
To the parser, funcall is indistinguishable from rhs array reference. But LHS references can be converted to arrayref nodes.
smop/rewrite.py
def to_arrayref(u): """ To the parser, funcall is indistinguishable from rhs array reference. But LHS references can be converted to arrayref nodes. """ if u.__class__ is node.funcall: try: if u.func_expr.props in "UR": # upd,ref u.__class__ = node.arrayref ...
def to_arrayref(u): """ To the parser, funcall is indistinguishable from rhs array reference. But LHS references can be converted to arrayref nodes. """ if u.__class__ is node.funcall: try: if u.func_expr.props in "UR": # upd,ref u.__class__ = node.arrayref ...
[ "To", "the", "parser", "funcall", "is", "indistinguishable", "from", "rhs", "array", "reference", ".", "But", "LHS", "references", "can", "be", "converted", "to", "arrayref", "nodes", "." ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/rewrite.py#L34-L45
[ "def", "to_arrayref", "(", "u", ")", ":", "if", "u", ".", "__class__", "is", "node", ".", "funcall", ":", "try", ":", "if", "u", ".", "func_expr", ".", "props", "in", "\"UR\"", ":", "# upd,ref", "u", ".", "__class__", "=", "node", ".", "arrayref", ...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
colon_subscripts
Array colon subscripts foo(1:10) and colon expressions 1:10 look too similar to each other. Now is the time to find out who is who.
smop/rewrite.py
def colon_subscripts(u): """ Array colon subscripts foo(1:10) and colon expressions 1:10 look too similar to each other. Now is the time to find out who is who. """ if u.__class__ in (node.arrayref,node.cellarrayref): for w in u.args: if w.__class__ is node.expr and w.op == ":":...
def colon_subscripts(u): """ Array colon subscripts foo(1:10) and colon expressions 1:10 look too similar to each other. Now is the time to find out who is who. """ if u.__class__ in (node.arrayref,node.cellarrayref): for w in u.args: if w.__class__ is node.expr and w.op == ":":...
[ "Array", "colon", "subscripts", "foo", "(", "1", ":", "10", ")", "and", "colon", "expressions", "1", ":", "10", "look", "too", "similar", "to", "each", "other", ".", "Now", "is", "the", "time", "to", "find", "out", "who", "is", "who", "." ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/rewrite.py#L47-L55
[ "def", "colon_subscripts", "(", "u", ")", ":", "if", "u", ".", "__class__", "in", "(", "node", ".", "arrayref", ",", "node", ".", "cellarrayref", ")", ":", "for", "w", "in", "u", ".", "args", ":", "if", "w", ".", "__class__", "is", "node", ".", "...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
let_statement
If LHS is a plain variable, and RHS is a matrix enclosed in square brackets, replace the matrix expr with a funcall.
smop/rewrite.py
def let_statement(u): """ If LHS is a plain variable, and RHS is a matrix enclosed in square brackets, replace the matrix expr with a funcall. """ if u.__class__ is node.let: if (u.ret.__class__ is node.ident and u.args.__class__ is node.matrix): u.args = node.fun...
def let_statement(u): """ If LHS is a plain variable, and RHS is a matrix enclosed in square brackets, replace the matrix expr with a funcall. """ if u.__class__ is node.let: if (u.ret.__class__ is node.ident and u.args.__class__ is node.matrix): u.args = node.fun...
[ "If", "LHS", "is", "a", "plain", "variable", "and", "RHS", "is", "a", "matrix", "enclosed", "in", "square", "brackets", "replace", "the", "matrix", "expr", "with", "a", "funcall", "." ]
victorlei/smop
python
https://github.com/victorlei/smop/blob/bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd/smop/rewrite.py#L63-L73
[ "def", "let_statement", "(", "u", ")", ":", "if", "u", ".", "__class__", "is", "node", ".", "let", ":", "if", "(", "u", ".", "ret", ".", "__class__", "is", "node", ".", "ident", "and", "u", ".", "args", ".", "__class__", "is", "node", ".", "matri...
bdad96b715d1dd75ce8ab4724f76b9b1bb1f61cd
train
process_win_streak
Convert "+++"/"---" formatted win/loss streak column into a +/- integer column
pybaseball/team_results.py
def process_win_streak(data): """ Convert "+++"/"---" formatted win/loss streak column into a +/- integer column """ #only do this if there are non-NANs in the column if data['Streak'].count()>0: data['Streak2'] = data['Streak'].str.len() data.loc[data['Streak'].str[0]=='-','Streak2'...
def process_win_streak(data): """ Convert "+++"/"---" formatted win/loss streak column into a +/- integer column """ #only do this if there are non-NANs in the column if data['Streak'].count()>0: data['Streak2'] = data['Streak'].str.len() data.loc[data['Streak'].str[0]=='-','Streak2'...
[ "Convert", "+++", "/", "---", "formatted", "win", "/", "loss", "streak", "column", "into", "a", "+", "/", "-", "integer", "column" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/team_results.py#L71-L81
[ "def", "process_win_streak", "(", "data", ")", ":", "#only do this if there are non-NANs in the column", "if", "data", "[", "'Streak'", "]", ".", "count", "(", ")", ">", "0", ":", "data", "[", "'Streak2'", "]", "=", "data", "[", "'Streak'", "]", ".", "str", ...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
split_request
Splits Statcast queries to avoid request timeouts
pybaseball/utils.py
def split_request(start_dt, end_dt, player_id, url): """ Splits Statcast queries to avoid request timeouts """ current_dt = datetime.datetime.strptime(start_dt, '%Y-%m-%d') end_dt = datetime.datetime.strptime(end_dt, '%Y-%m-%d') results = [] # list to hold data as it is returned player_id =...
def split_request(start_dt, end_dt, player_id, url): """ Splits Statcast queries to avoid request timeouts """ current_dt = datetime.datetime.strptime(start_dt, '%Y-%m-%d') end_dt = datetime.datetime.strptime(end_dt, '%Y-%m-%d') results = [] # list to hold data as it is returned player_id =...
[ "Splits", "Statcast", "queries", "to", "avoid", "request", "timeouts" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/utils.py#L69-L92
[ "def", "split_request", "(", "start_dt", ",", "end_dt", ",", "player_id", ",", "url", ")", ":", "current_dt", "=", "datetime", ".", "datetime", ".", "strptime", "(", "start_dt", ",", "'%Y-%m-%d'", ")", "end_dt", "=", "datetime", ".", "datetime", ".", "strp...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
get_zip_file
Get zip file from provided URL
pybaseball/utils.py
def get_zip_file(url): """ Get zip file from provided URL """ with requests.get(url, stream=True) as f: z = zipfile.ZipFile(io.BytesIO(f.content)) return z
def get_zip_file(url): """ Get zip file from provided URL """ with requests.get(url, stream=True) as f: z = zipfile.ZipFile(io.BytesIO(f.content)) return z
[ "Get", "zip", "file", "from", "provided", "URL" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/utils.py#L95-L101
[ "def", "get_zip_file", "(", "url", ")", ":", "with", "requests", ".", "get", "(", "url", ",", "stream", "=", "True", ")", "as", "f", ":", "z", "=", "zipfile", ".", "ZipFile", "(", "io", ".", "BytesIO", "(", "f", ".", "content", ")", ")", "return"...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
statcast_pitcher
Pulls statcast pitch-level data from Baseball Savant for a given pitcher. ARGUMENTS start_dt : YYYY-MM-DD : the first date for which you want a player's statcast data end_dt : YYYY-MM-DD : the final date for which you want data player_id : INT : the player's MLBAM ID. Find this by calling pybaseball.pl...
pybaseball/statcast_pitcher.py
def statcast_pitcher(start_dt=None, end_dt=None, player_id=None): """ Pulls statcast pitch-level data from Baseball Savant for a given pitcher. ARGUMENTS start_dt : YYYY-MM-DD : the first date for which you want a player's statcast data end_dt : YYYY-MM-DD : the final date for which you want data ...
def statcast_pitcher(start_dt=None, end_dt=None, player_id=None): """ Pulls statcast pitch-level data from Baseball Savant for a given pitcher. ARGUMENTS start_dt : YYYY-MM-DD : the first date for which you want a player's statcast data end_dt : YYYY-MM-DD : the final date for which you want data ...
[ "Pulls", "statcast", "pitch", "-", "level", "data", "from", "Baseball", "Savant", "for", "a", "given", "pitcher", "." ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/statcast_pitcher.py#L4-L19
[ "def", "statcast_pitcher", "(", "start_dt", "=", "None", ",", "end_dt", "=", "None", ",", "player_id", "=", "None", ")", ":", "start_dt", ",", "end_dt", ",", "player_id", "=", "sanitize_input", "(", "start_dt", ",", "end_dt", ",", "player_id", ")", "# inpu...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
batting_stats_range
Get all batting stats for a set time range. This can be the past week, the month of August, anything. Just supply the start and end date in YYYY-MM-DD format.
pybaseball/league_batting_stats.py
def batting_stats_range(start_dt=None, end_dt=None): """ Get all batting stats for a set time range. This can be the past week, the month of August, anything. Just supply the start and end date in YYYY-MM-DD format. """ # make sure date inputs are valid start_dt, end_dt = sanitize_input(star...
def batting_stats_range(start_dt=None, end_dt=None): """ Get all batting stats for a set time range. This can be the past week, the month of August, anything. Just supply the start and end date in YYYY-MM-DD format. """ # make sure date inputs are valid start_dt, end_dt = sanitize_input(star...
[ "Get", "all", "batting", "stats", "for", "a", "set", "time", "range", ".", "This", "can", "be", "the", "past", "week", "the", "month", "of", "August", "anything", ".", "Just", "supply", "the", "start", "and", "end", "date", "in", "YYYY", "-", "MM", "...
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/league_batting_stats.py#L67-L92
[ "def", "batting_stats_range", "(", "start_dt", "=", "None", ",", "end_dt", "=", "None", ")", ":", "# make sure date inputs are valid", "start_dt", ",", "end_dt", "=", "sanitize_input", "(", "start_dt", ",", "end_dt", ")", "if", "datetime", ".", "datetime", ".", ...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
batting_stats_bref
Get all batting stats for a set season. If no argument is supplied, gives stats for current season to date.
pybaseball/league_batting_stats.py
def batting_stats_bref(season=None): """ Get all batting stats for a set season. If no argument is supplied, gives stats for current season to date. """ if season is None: season = datetime.datetime.today().strftime("%Y") season = str(season) start_dt = season + '-03-01' #opening day...
def batting_stats_bref(season=None): """ Get all batting stats for a set season. If no argument is supplied, gives stats for current season to date. """ if season is None: season = datetime.datetime.today().strftime("%Y") season = str(season) start_dt = season + '-03-01' #opening day...
[ "Get", "all", "batting", "stats", "for", "a", "set", "season", ".", "If", "no", "argument", "is", "supplied", "gives", "stats", "for", "current", "season", "to", "date", "." ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/league_batting_stats.py#L95-L105
[ "def", "batting_stats_bref", "(", "season", "=", "None", ")", ":", "if", "season", "is", "None", ":", "season", "=", "datetime", ".", "datetime", ".", "today", "(", ")", ".", "strftime", "(", "\"%Y\"", ")", "season", "=", "str", "(", "season", ")", "...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
season_game_logs
Pull Retrosheet game logs for a given season
pybaseball/retrosheet.py
def season_game_logs(season): """ Pull Retrosheet game logs for a given season """ # validate input max_year = int(datetime.now().year) - 1 if season > max_year or season < 1871: raise ValueError('Season must be between 1871 and {}'.format(max_year)) file_name = 'GL{}.TXT'.format(sea...
def season_game_logs(season): """ Pull Retrosheet game logs for a given season """ # validate input max_year = int(datetime.now().year) - 1 if season > max_year or season < 1871: raise ValueError('Season must be between 1871 and {}'.format(max_year)) file_name = 'GL{}.TXT'.format(sea...
[ "Pull", "Retrosheet", "game", "logs", "for", "a", "given", "season" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/retrosheet.py#L88-L100
[ "def", "season_game_logs", "(", "season", ")", ":", "# validate input", "max_year", "=", "int", "(", "datetime", ".", "now", "(", ")", ".", "year", ")", "-", "1", "if", "season", ">", "max_year", "or", "season", "<", "1871", ":", "raise", "ValueError", ...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
world_series_logs
Pull Retrosheet World Series Game Logs
pybaseball/retrosheet.py
def world_series_logs(): """ Pull Retrosheet World Series Game Logs """ file_name = 'GLWS.TXT' z = get_zip_file(world_series_url) data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"') data.columns = gamelog_columns return data
def world_series_logs(): """ Pull Retrosheet World Series Game Logs """ file_name = 'GLWS.TXT' z = get_zip_file(world_series_url) data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"') data.columns = gamelog_columns return data
[ "Pull", "Retrosheet", "World", "Series", "Game", "Logs" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/retrosheet.py#L103-L111
[ "def", "world_series_logs", "(", ")", ":", "file_name", "=", "'GLWS.TXT'", "z", "=", "get_zip_file", "(", "world_series_url", ")", "data", "=", "pd", ".", "read_csv", "(", "z", ".", "open", "(", "file_name", ")", ",", "header", "=", "None", ",", "sep", ...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
all_star_game_logs
Pull Retrosheet All Star Game Logs
pybaseball/retrosheet.py
def all_star_game_logs(): """ Pull Retrosheet All Star Game Logs """ file_name = 'GLAS.TXT' z = get_zip_file(all_star_url) data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"') data.columns = gamelog_columns return data
def all_star_game_logs(): """ Pull Retrosheet All Star Game Logs """ file_name = 'GLAS.TXT' z = get_zip_file(all_star_url) data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"') data.columns = gamelog_columns return data
[ "Pull", "Retrosheet", "All", "Star", "Game", "Logs" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/retrosheet.py#L114-L122
[ "def", "all_star_game_logs", "(", ")", ":", "file_name", "=", "'GLAS.TXT'", "z", "=", "get_zip_file", "(", "all_star_url", ")", "data", "=", "pd", ".", "read_csv", "(", "z", ".", "open", "(", "file_name", ")", ",", "header", "=", "None", ",", "sep", "=...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
wild_card_logs
Pull Retrosheet Wild Card Game Logs
pybaseball/retrosheet.py
def wild_card_logs(): """ Pull Retrosheet Wild Card Game Logs """ file_name = 'GLWC.TXT' z = get_zip_file(wild_card_url) data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"') data.columns = gamelog_columns return data
def wild_card_logs(): """ Pull Retrosheet Wild Card Game Logs """ file_name = 'GLWC.TXT' z = get_zip_file(wild_card_url) data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"') data.columns = gamelog_columns return data
[ "Pull", "Retrosheet", "Wild", "Card", "Game", "Logs" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/retrosheet.py#L125-L133
[ "def", "wild_card_logs", "(", ")", ":", "file_name", "=", "'GLWC.TXT'", "z", "=", "get_zip_file", "(", "wild_card_url", ")", "data", "=", "pd", ".", "read_csv", "(", "z", ".", "open", "(", "file_name", ")", ",", "header", "=", "None", ",", "sep", "=", ...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
division_series_logs
Pull Retrosheet Division Series Game Logs
pybaseball/retrosheet.py
def division_series_logs(): """ Pull Retrosheet Division Series Game Logs """ file_name = 'GLDV.TXT' z = get_zip_file(division_series_url) data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"') data.columns = gamelog_columns return data
def division_series_logs(): """ Pull Retrosheet Division Series Game Logs """ file_name = 'GLDV.TXT' z = get_zip_file(division_series_url) data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"') data.columns = gamelog_columns return data
[ "Pull", "Retrosheet", "Division", "Series", "Game", "Logs" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/retrosheet.py#L136-L144
[ "def", "division_series_logs", "(", ")", ":", "file_name", "=", "'GLDV.TXT'", "z", "=", "get_zip_file", "(", "division_series_url", ")", "data", "=", "pd", ".", "read_csv", "(", "z", ".", "open", "(", "file_name", ")", ",", "header", "=", "None", ",", "s...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
lcs_logs
Pull Retrosheet LCS Game Logs
pybaseball/retrosheet.py
def lcs_logs(): """ Pull Retrosheet LCS Game Logs """ file_name = 'GLLC.TXT' z = get_zip_file(lcs_url) data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"') data.columns = gamelog_columns return data
def lcs_logs(): """ Pull Retrosheet LCS Game Logs """ file_name = 'GLLC.TXT' z = get_zip_file(lcs_url) data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"') data.columns = gamelog_columns return data
[ "Pull", "Retrosheet", "LCS", "Game", "Logs" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/retrosheet.py#L147-L155
[ "def", "lcs_logs", "(", ")", ":", "file_name", "=", "'GLLC.TXT'", "z", "=", "get_zip_file", "(", "lcs_url", ")", "data", "=", "pd", ".", "read_csv", "(", "z", ".", "open", "(", "file_name", ")", ",", "header", "=", "None", ",", "sep", "=", "','", "...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
team_pitching
Get season-level pitching data aggregated by team. ARGUMENTS: start_season : int : first season you want data for (or the only season if you do not specify an end_season) end_season : int : final season you want data for league : "all", "nl", or "al" ind : int : =1 if you want individual season l...
pybaseball/team_pitching.py
def team_pitching(start_season, end_season=None, league='all', ind=1): """ Get season-level pitching data aggregated by team. ARGUMENTS: start_season : int : first season you want data for (or the only season if you do not specify an end_season) end_season : int : final season you want data for ...
def team_pitching(start_season, end_season=None, league='all', ind=1): """ Get season-level pitching data aggregated by team. ARGUMENTS: start_season : int : first season you want data for (or the only season if you do not specify an end_season) end_season : int : final season you want data for ...
[ "Get", "season", "-", "level", "pitching", "data", "aggregated", "by", "team", "." ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/team_pitching.py#L60-L77
[ "def", "team_pitching", "(", "start_season", ",", "end_season", "=", "None", ",", "league", "=", "'all'", ",", "ind", "=", "1", ")", ":", "if", "start_season", "is", "None", ":", "raise", "ValueError", "(", "\"You need to provide at least one season to collect dat...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
team_pitching_bref
Get season-level Pitching Statistics for Specific Team (from Baseball-Reference) ARGUMENTS: team : str : The Team Abbreviation (i.e. 'NYY' for Yankees) of the Team you want data for start_season : int : first season you want data for (or the only season if you do not specify an end_season) end_season :...
pybaseball/team_pitching.py
def team_pitching_bref(team, start_season, end_season=None): """ Get season-level Pitching Statistics for Specific Team (from Baseball-Reference) ARGUMENTS: team : str : The Team Abbreviation (i.e. 'NYY' for Yankees) of the Team you want data for start_season : int : first season you want data for ...
def team_pitching_bref(team, start_season, end_season=None): """ Get season-level Pitching Statistics for Specific Team (from Baseball-Reference) ARGUMENTS: team : str : The Team Abbreviation (i.e. 'NYY' for Yankees) of the Team you want data for start_season : int : first season you want data for ...
[ "Get", "season", "-", "level", "Pitching", "Statistics", "for", "Specific", "Team", "(", "from", "Baseball", "-", "Reference", ")" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/team_pitching.py#L79-L121
[ "def", "team_pitching_bref", "(", "team", ",", "start_season", ",", "end_season", "=", "None", ")", ":", "if", "start_season", "is", "None", ":", "raise", "ValueError", "(", "\"You need to provide at least one season to collect data for. Try team_pitching_bref(season) or team...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
statcast_batter
Pulls statcast pitch-level data from Baseball Savant for a given batter. ARGUMENTS start_dt : YYYY-MM-DD : the first date for which you want a player's statcast data end_dt : YYYY-MM-DD : the final date for which you want data player_id : INT : the player's MLBAM ID. Find this by calling pybaseball.pla...
pybaseball/statcast_batter.py
def statcast_batter(start_dt=None, end_dt=None, player_id=None): """ Pulls statcast pitch-level data from Baseball Savant for a given batter. ARGUMENTS start_dt : YYYY-MM-DD : the first date for which you want a player's statcast data end_dt : YYYY-MM-DD : the final date for which you want data ...
def statcast_batter(start_dt=None, end_dt=None, player_id=None): """ Pulls statcast pitch-level data from Baseball Savant for a given batter. ARGUMENTS start_dt : YYYY-MM-DD : the first date for which you want a player's statcast data end_dt : YYYY-MM-DD : the final date for which you want data ...
[ "Pulls", "statcast", "pitch", "-", "level", "data", "from", "Baseball", "Savant", "for", "a", "given", "batter", "." ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/statcast_batter.py#L4-L18
[ "def", "statcast_batter", "(", "start_dt", "=", "None", ",", "end_dt", "=", "None", ",", "player_id", "=", "None", ")", ":", "start_dt", ",", "end_dt", ",", "player_id", "=", "sanitize_input", "(", "start_dt", ",", "end_dt", ",", "player_id", ")", "# input...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
playerid_reverse_lookup
Retrieve a table of player information given a list of player ids :param player_ids: list of player ids :type player_ids: list :param key_type: name of the key type being looked up (one of "mlbam", "retro", "bbref", or "fangraphs") :type key_type: str :rtype: :class:`pandas.core.frame.DataFrame`
pybaseball/playerid_lookup.py
def playerid_reverse_lookup(player_ids, key_type=None): """Retrieve a table of player information given a list of player ids :param player_ids: list of player ids :type player_ids: list :param key_type: name of the key type being looked up (one of "mlbam", "retro", "bbref", or "fangraphs") :type ke...
def playerid_reverse_lookup(player_ids, key_type=None): """Retrieve a table of player information given a list of player ids :param player_ids: list of player ids :type player_ids: list :param key_type: name of the key type being looked up (one of "mlbam", "retro", "bbref", or "fangraphs") :type ke...
[ "Retrieve", "a", "table", "of", "player", "information", "given", "a", "list", "of", "player", "ids" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/playerid_lookup.py#L46-L70
[ "def", "playerid_reverse_lookup", "(", "player_ids", ",", "key_type", "=", "None", ")", ":", "key_types", "=", "(", "'mlbam'", ",", "'retro'", ",", "'bbref'", ",", "'fangraphs'", ",", ")", "if", "not", "key_type", ":", "key_type", "=", "key_types", "[", "0...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
pitching_stats
Get season-level pitching data from FanGraphs. ARGUMENTS: start_season : int : first season you want data for (or the only season if you do not specify an end_season) end_season : int : final season you want data for league : "all", "nl", or "al" qual: minimum number of pitches thrown to be inclu...
pybaseball/pitching_leaders.py
def pitching_stats(start_season, end_season=None, league='all', qual=1, ind=1): """ Get season-level pitching data from FanGraphs. ARGUMENTS: start_season : int : first season you want data for (or the only season if you do not specify an end_season) end_season : int : final season you want data f...
def pitching_stats(start_season, end_season=None, league='all', qual=1, ind=1): """ Get season-level pitching data from FanGraphs. ARGUMENTS: start_season : int : first season you want data for (or the only season if you do not specify an end_season) end_season : int : final season you want data f...
[ "Get", "season", "-", "level", "pitching", "data", "from", "FanGraphs", "." ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/pitching_leaders.py#L63-L80
[ "def", "pitching_stats", "(", "start_season", ",", "end_season", "=", "None", ",", "league", "=", "'all'", ",", "qual", "=", "1", ",", "ind", "=", "1", ")", ":", "if", "start_season", "is", "None", ":", "raise", "ValueError", "(", "\"You need to provide at...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
large_request
break start and end date into smaller increments, collecting all data in small chunks and appending all results to a common dataframe end_dt is the date strings for the final day of the query d1 and d2 are datetime objects for first and last day of query, for doing date math a third datetime object (d) will...
pybaseball/statcast.py
def large_request(start_dt,end_dt,d1,d2,step,verbose): """ break start and end date into smaller increments, collecting all data in small chunks and appending all results to a common dataframe end_dt is the date strings for the final day of the query d1 and d2 are datetime objects for first and last day...
def large_request(start_dt,end_dt,d1,d2,step,verbose): """ break start and end date into smaller increments, collecting all data in small chunks and appending all results to a common dataframe end_dt is the date strings for the final day of the query d1 and d2 are datetime objects for first and last day...
[ "break", "start", "and", "end", "date", "into", "smaller", "increments", "collecting", "all", "data", "in", "small", "chunks", "and", "appending", "all", "results", "to", "a", "common", "dataframe", "end_dt", "is", "the", "date", "strings", "for", "the", "fi...
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/statcast.py#L46-L134
[ "def", "large_request", "(", "start_dt", ",", "end_dt", ",", "d1", ",", "d2", ",", "step", ",", "verbose", ")", ":", "error_counter", "=", "0", "# count failed requests. If > X, break", "no_success_msg_flag", "=", "False", "# a flag for passing over the success message ...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
statcast
Pulls statcast play-level data from Baseball Savant for a given date range. INPUTS: start_dt: YYYY-MM-DD : the first date for which you want statcast data end_dt: YYYY-MM-DD : the last date for which you want statcast data team: optional (defaults to None) : city abbreviation of the team you want data ...
pybaseball/statcast.py
def statcast(start_dt=None, end_dt=None, team=None, verbose=True): """ Pulls statcast play-level data from Baseball Savant for a given date range. INPUTS: start_dt: YYYY-MM-DD : the first date for which you want statcast data end_dt: YYYY-MM-DD : the last date for which you want statcast data t...
def statcast(start_dt=None, end_dt=None, team=None, verbose=True): """ Pulls statcast play-level data from Baseball Savant for a given date range. INPUTS: start_dt: YYYY-MM-DD : the first date for which you want statcast data end_dt: YYYY-MM-DD : the last date for which you want statcast data t...
[ "Pulls", "statcast", "play", "-", "level", "data", "from", "Baseball", "Savant", "for", "a", "given", "date", "range", "." ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/statcast.py#L173-L204
[ "def", "statcast", "(", "start_dt", "=", "None", ",", "end_dt", "=", "None", ",", "team", "=", "None", ",", "verbose", "=", "True", ")", ":", "start_dt", ",", "end_dt", "=", "sanitize_input", "(", "start_dt", ",", "end_dt", ")", "# 3 days or less -> a quic...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
statcast_single_game
Pulls statcast play-level data from Baseball Savant for a single game, identified by its MLB game ID (game_pk in statcast data) INPUTS: game_pk : 6-digit integer MLB game ID to retrieve
pybaseball/statcast.py
def statcast_single_game(game_pk, team=None): """ Pulls statcast play-level data from Baseball Savant for a single game, identified by its MLB game ID (game_pk in statcast data) INPUTS: game_pk : 6-digit integer MLB game ID to retrieve """ data = single_game_request(game_pk) data = post...
def statcast_single_game(game_pk, team=None): """ Pulls statcast play-level data from Baseball Savant for a single game, identified by its MLB game ID (game_pk in statcast data) INPUTS: game_pk : 6-digit integer MLB game ID to retrieve """ data = single_game_request(game_pk) data = post...
[ "Pulls", "statcast", "play", "-", "level", "data", "from", "Baseball", "Savant", "for", "a", "single", "game", "identified", "by", "its", "MLB", "game", "ID", "(", "game_pk", "in", "statcast", "data", ")" ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/statcast.py#L206-L216
[ "def", "statcast_single_game", "(", "game_pk", ",", "team", "=", "None", ")", ":", "data", "=", "single_game_request", "(", "game_pk", ")", "data", "=", "postprocessing", "(", "data", ",", "team", ")", "return", "data" ]
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
pitching_stats_range
Get all pitching stats for a set time range. This can be the past week, the month of August, anything. Just supply the start and end date in YYYY-MM-DD format.
pybaseball/league_pitching_stats.py
def pitching_stats_range(start_dt=None, end_dt=None): """ Get all pitching stats for a set time range. This can be the past week, the month of August, anything. Just supply the start and end date in YYYY-MM-DD format. """ # ensure valid date strings, perform necessary processing for query ...
def pitching_stats_range(start_dt=None, end_dt=None): """ Get all pitching stats for a set time range. This can be the past week, the month of August, anything. Just supply the start and end date in YYYY-MM-DD format. """ # ensure valid date strings, perform necessary processing for query ...
[ "Get", "all", "pitching", "stats", "for", "a", "set", "time", "range", ".", "This", "can", "be", "the", "past", "week", "the", "month", "of", "August", "anything", ".", "Just", "supply", "the", "start", "and", "end", "date", "in", "YYYY", "-", "MM", ...
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/league_pitching_stats.py#L67-L96
[ "def", "pitching_stats_range", "(", "start_dt", "=", "None", ",", "end_dt", "=", "None", ")", ":", "# ensure valid date strings, perform necessary processing for query", "start_dt", ",", "end_dt", "=", "sanitize_input", "(", "start_dt", ",", "end_dt", ")", "if", "date...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
pitching_stats_bref
Get all pitching stats for a set season. If no argument is supplied, gives stats for current season to date.
pybaseball/league_pitching_stats.py
def pitching_stats_bref(season=None): """ Get all pitching stats for a set season. If no argument is supplied, gives stats for current season to date. """ if season is None: season = datetime.datetime.today().strftime("%Y") season = str(season) start_dt = season + '-03-01' #opening...
def pitching_stats_bref(season=None): """ Get all pitching stats for a set season. If no argument is supplied, gives stats for current season to date. """ if season is None: season = datetime.datetime.today().strftime("%Y") season = str(season) start_dt = season + '-03-01' #opening...
[ "Get", "all", "pitching", "stats", "for", "a", "set", "season", ".", "If", "no", "argument", "is", "supplied", "gives", "stats", "for", "current", "season", "to", "date", "." ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/league_pitching_stats.py#L98-L108
[ "def", "pitching_stats_bref", "(", "season", "=", "None", ")", ":", "if", "season", "is", "None", ":", "season", "=", "datetime", ".", "datetime", ".", "today", "(", ")", ".", "strftime", "(", "\"%Y\"", ")", "season", "=", "str", "(", "season", ")", ...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
bwar_pitch
Get data from war_daily_pitch table. Returns WAR, its components, and a few other useful stats. To get all fields from this table, supply argument return_all=True.
pybaseball/league_pitching_stats.py
def bwar_pitch(return_all=False): """ Get data from war_daily_pitch table. Returns WAR, its components, and a few other useful stats. To get all fields from this table, supply argument return_all=True. """ url = "http://www.baseball-reference.com/data/war_daily_pitch.txt" s = requests.get(url...
def bwar_pitch(return_all=False): """ Get data from war_daily_pitch table. Returns WAR, its components, and a few other useful stats. To get all fields from this table, supply argument return_all=True. """ url = "http://www.baseball-reference.com/data/war_daily_pitch.txt" s = requests.get(url...
[ "Get", "data", "from", "war_daily_pitch", "table", ".", "Returns", "WAR", "its", "components", "and", "a", "few", "other", "useful", "stats", ".", "To", "get", "all", "fields", "from", "this", "table", "supply", "argument", "return_all", "=", "True", "." ]
jldbc/pybaseball
python
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/league_pitching_stats.py#L111-L125
[ "def", "bwar_pitch", "(", "return_all", "=", "False", ")", ":", "url", "=", "\"http://www.baseball-reference.com/data/war_daily_pitch.txt\"", "s", "=", "requests", ".", "get", "(", "url", ")", ".", "content", "c", "=", "pd", ".", "read_csv", "(", "io", ".", ...
085ea26bfd1b5f5926d79d4fac985c88278115f2
train
deprecated
Decorator to mark a specified function as deprecated :param version: version in which it is deprecated :param replacement: replacement functions to use
O365/utils/decorators.py
def deprecated(version, *replacement): """ Decorator to mark a specified function as deprecated :param version: version in which it is deprecated :param replacement: replacement functions to use """ def deprecated_wrapper(func): replacement_message = 'Use {} instead'.format(', '.join( ...
def deprecated(version, *replacement): """ Decorator to mark a specified function as deprecated :param version: version in which it is deprecated :param replacement: replacement functions to use """ def deprecated_wrapper(func): replacement_message = 'Use {} instead'.format(', '.join( ...
[ "Decorator", "to", "mark", "a", "specified", "function", "as", "deprecated" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/decorators.py#L7-L47
[ "def", "deprecated", "(", "version", ",", "*", "replacement", ")", ":", "def", "deprecated_wrapper", "(", "func", ")", ":", "replacement_message", "=", "'Use {} instead'", ".", "format", "(", "', '", ".", "join", "(", "[", "\"'{}'\"", ".", "format", "(", "...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Contact.to_api_data
Returns a dictionary in cloud format :param restrict_keys: a set of keys to restrict the returned data to.
O365/address_book.py
def to_api_data(self, restrict_keys=None): """ Returns a dictionary in cloud format :param restrict_keys: a set of keys to restrict the returned data to. """ cc = self._cc # alias data = { cc('displayName'): self.__display_name, cc('givenName'): self.__...
def to_api_data(self, restrict_keys=None): """ Returns a dictionary in cloud format :param restrict_keys: a set of keys to restrict the returned data to. """ cc = self._cc # alias data = { cc('displayName'): self.__display_name, cc('givenName'): self.__...
[ "Returns", "a", "dictionary", "in", "cloud", "format" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L435-L469
[ "def", "to_api_data", "(", "self", ",", "restrict_keys", "=", "None", ")", ":", "cc", "=", "self", ".", "_cc", "# alias", "data", "=", "{", "cc", "(", "'displayName'", ")", ":", "self", ".", "__display_name", ",", "cc", "(", "'givenName'", ")", ":", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Contact.delete
Deletes this contact :return: Success or Failure :rtype: bool :raises RuntimeError: if contact is not yet saved to cloud
O365/address_book.py
def delete(self): """ Deletes this contact :return: Success or Failure :rtype: bool :raises RuntimeError: if contact is not yet saved to cloud """ if not self.object_id: raise RuntimeError('Attempting to delete an unsaved Contact') url = self.build_u...
def delete(self): """ Deletes this contact :return: Success or Failure :rtype: bool :raises RuntimeError: if contact is not yet saved to cloud """ if not self.object_id: raise RuntimeError('Attempting to delete an unsaved Contact') url = self.build_u...
[ "Deletes", "this", "contact" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L471-L486
[ "def", "delete", "(", "self", ")", ":", "if", "not", "self", ".", "object_id", ":", "raise", "RuntimeError", "(", "'Attempting to delete an unsaved Contact'", ")", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoints", ".", "get", "(", "'root_...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Contact.save
Saves this contact to the cloud (create or update existing one based on what values have changed) :return: Saved or Not :rtype: bool
O365/address_book.py
def save(self): """ Saves this contact to the cloud (create or update existing one based on what values have changed) :return: Saved or Not :rtype: bool """ if self.object_id: # Update Contact if not self._track_changes: return Tru...
def save(self): """ Saves this contact to the cloud (create or update existing one based on what values have changed) :return: Saved or Not :rtype: bool """ if self.object_id: # Update Contact if not self._track_changes: return Tru...
[ "Saves", "this", "contact", "to", "the", "cloud", "(", "create", "or", "update", "existing", "one", "based", "on", "what", "values", "have", "changed", ")" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L488-L536
[ "def", "save", "(", "self", ")", ":", "if", "self", ".", "object_id", ":", "# Update Contact", "if", "not", "self", ".", "_track_changes", ":", "return", "True", "# there's nothing to update", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoin...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Contact.new_message
This method returns a new draft Message instance with contacts first email as a recipient :param Recipient recipient: a Recipient instance where to send this message. If None first email of this contact will be used :param RecipientType recipient_type: section to add recipient into ...
O365/address_book.py
def new_message(self, recipient=None, *, recipient_type=RecipientType.TO): """ This method returns a new draft Message instance with contacts first email as a recipient :param Recipient recipient: a Recipient instance where to send this message. If None first email of this contact will...
def new_message(self, recipient=None, *, recipient_type=RecipientType.TO): """ This method returns a new draft Message instance with contacts first email as a recipient :param Recipient recipient: a Recipient instance where to send this message. If None first email of this contact will...
[ "This", "method", "returns", "a", "new", "draft", "Message", "instance", "with", "contacts", "first", "email", "as", "a", "recipient" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L538-L565
[ "def", "new_message", "(", "self", ",", "recipient", "=", "None", ",", "*", ",", "recipient_type", "=", "RecipientType", ".", "TO", ")", ":", "if", "self", ".", "main_resource", "==", "GAL_MAIN_RESOURCE", ":", "# preventing the contact lookup to explode for big orga...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
BaseContactFolder.get_contacts
Gets a list of contacts from this address book When querying the Global Address List the Users endpoint will be used. Only a limited set of information will be available unless you have access to scope 'User.Read.All' which requires App Administration Consent. Also using endpoi...
O365/address_book.py
def get_contacts(self, limit=100, *, query=None, order_by=None, batch=None): """ Gets a list of contacts from this address book When querying the Global Address List the Users endpoint will be used. Only a limited set of information will be available unless you have access to scope 'Use...
def get_contacts(self, limit=100, *, query=None, order_by=None, batch=None): """ Gets a list of contacts from this address book When querying the Global Address List the Users endpoint will be used. Only a limited set of information will be available unless you have access to scope 'Use...
[ "Gets", "a", "list", "of", "contacts", "from", "this", "address", "book" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L626-L696
[ "def", "get_contacts", "(", "self", ",", "limit", "=", "100", ",", "*", ",", "query", "=", "None", ",", "order_by", "=", "None", ",", "batch", "=", "None", ")", ":", "if", "self", ".", "main_resource", "==", "GAL_MAIN_RESOURCE", ":", "# using Users endpo...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
BaseContactFolder.get_contact_by_email
Returns a Contact by it's email :param email: email to get contact for :return: Contact for specified email :rtype: Contact
O365/address_book.py
def get_contact_by_email(self, email): """ Returns a Contact by it's email :param email: email to get contact for :return: Contact for specified email :rtype: Contact """ if not email: return None email = email.strip() query = self.q().any(co...
def get_contact_by_email(self, email): """ Returns a Contact by it's email :param email: email to get contact for :return: Contact for specified email :rtype: Contact """ if not email: return None email = email.strip() query = self.q().any(co...
[ "Returns", "a", "Contact", "by", "it", "s", "email" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L698-L712
[ "def", "get_contact_by_email", "(", "self", ",", "email", ")", ":", "if", "not", "email", ":", "return", "None", "email", "=", "email", ".", "strip", "(", ")", "query", "=", "self", ".", "q", "(", ")", ".", "any", "(", "collection", "=", "'email_addr...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
ContactFolder.get_folders
Returns a list of child folders :param int limit: max no. of folders to get. Over 999 uses batch. :param query: applies a OData filter to the request :type query: Query or str :param order_by: orders the result set based on this condition :type order_by: Query or str :re...
O365/address_book.py
def get_folders(self, limit=None, *, query=None, order_by=None): """ Returns a list of child folders :param int limit: max no. of folders to get. Over 999 uses batch. :param query: applies a OData filter to the request :type query: Query or str :param order_by: orders the result...
def get_folders(self, limit=None, *, query=None, order_by=None): """ Returns a list of child folders :param int limit: max no. of folders to get. Over 999 uses batch. :param query: applies a OData filter to the request :type query: Query or str :param order_by: orders the result...
[ "Returns", "a", "list", "of", "child", "folders" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L770-L808
[ "def", "get_folders", "(", "self", ",", "limit", "=", "None", ",", "*", ",", "query", "=", "None", ",", "order_by", "=", "None", ")", ":", "if", "self", ".", "root", ":", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoints", ".", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
ContactFolder.create_child_folder
Creates a new child folder :param str folder_name: name of the new folder to create :return: newly created folder :rtype: ContactFolder or None
O365/address_book.py
def create_child_folder(self, folder_name): """ Creates a new child folder :param str folder_name: name of the new folder to create :return: newly created folder :rtype: ContactFolder or None """ if not folder_name: return None if self.root: ...
def create_child_folder(self, folder_name): """ Creates a new child folder :param str folder_name: name of the new folder to create :return: newly created folder :rtype: ContactFolder or None """ if not folder_name: return None if self.root: ...
[ "Creates", "a", "new", "child", "folder" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L810-L835
[ "def", "create_child_folder", "(", "self", ",", "folder_name", ")", ":", "if", "not", "folder_name", ":", "return", "None", "if", "self", ".", "root", ":", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoints", ".", "get", "(", "'root_fold...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
ContactFolder.update_folder_name
Change this folder name :param str name: new name to change to :return: Updated or Not :rtype: bool
O365/address_book.py
def update_folder_name(self, name): """ Change this folder name :param str name: new name to change to :return: Updated or Not :rtype: bool """ if self.root: return False if not name: return False url = self.build_url( ...
def update_folder_name(self, name): """ Change this folder name :param str name: new name to change to :return: Updated or Not :rtype: bool """ if self.root: return False if not name: return False url = self.build_url( ...
[ "Change", "this", "folder", "name" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L837-L861
[ "def", "update_folder_name", "(", "self", ",", "name", ")", ":", "if", "self", ".", "root", ":", "return", "False", "if", "not", "name", ":", "return", "False", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoints", ".", "get", "(", "'...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
ContactFolder.move_folder
Change this folder name :param to_folder: folder_id/ContactFolder to move into :type to_folder: str or ContactFolder :return: Moved or Not :rtype: bool
O365/address_book.py
def move_folder(self, to_folder): """ Change this folder name :param to_folder: folder_id/ContactFolder to move into :type to_folder: str or ContactFolder :return: Moved or Not :rtype: bool """ if self.root: return False if not to_folder: ...
def move_folder(self, to_folder): """ Change this folder name :param to_folder: folder_id/ContactFolder to move into :type to_folder: str or ContactFolder :return: Moved or Not :rtype: bool """ if self.root: return False if not to_folder: ...
[ "Change", "this", "folder", "name" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L863-L896
[ "def", "move_folder", "(", "self", ",", "to_folder", ")", ":", "if", "self", ".", "root", ":", "return", "False", "if", "not", "to_folder", ":", "return", "False", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoints", ".", "get", "(", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
ContactFolder.new_contact
Creates a new contact to be saved into it's parent folder :return: newly created contact :rtype: Contact
O365/address_book.py
def new_contact(self): """ Creates a new contact to be saved into it's parent folder :return: newly created contact :rtype: Contact """ contact = self.contact_constructor(parent=self) if not self.root: contact.__folder_id = self.folder_id return conta...
def new_contact(self): """ Creates a new contact to be saved into it's parent folder :return: newly created contact :rtype: Contact """ contact = self.contact_constructor(parent=self) if not self.root: contact.__folder_id = self.folder_id return conta...
[ "Creates", "a", "new", "contact", "to", "be", "saved", "into", "it", "s", "parent", "folder" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L919-L928
[ "def", "new_contact", "(", "self", ")", ":", "contact", "=", "self", ".", "contact_constructor", "(", "parent", "=", "self", ")", "if", "not", "self", ".", "root", ":", "contact", ".", "__folder_id", "=", "self", ".", "folder_id", "return", "contact" ]
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
ContactFolder.new_message
This method returns a new draft Message instance with all the contacts first email as a recipient :param RecipientType recipient_type: section to add recipient into :param query: applies a OData filter to the request :type query: Query or str :return: newly created message ...
O365/address_book.py
def new_message(self, recipient_type=RecipientType.TO, *, query=None): """ This method returns a new draft Message instance with all the contacts first email as a recipient :param RecipientType recipient_type: section to add recipient into :param query: applies a OData filter to the req...
def new_message(self, recipient_type=RecipientType.TO, *, query=None): """ This method returns a new draft Message instance with all the contacts first email as a recipient :param RecipientType recipient_type: section to add recipient into :param query: applies a OData filter to the req...
[ "This", "method", "returns", "a", "new", "draft", "Message", "instance", "with", "all", "the", "contacts", "first", "email", "as", "a", "recipient" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L930-L955
[ "def", "new_message", "(", "self", ",", "recipient_type", "=", "RecipientType", ".", "TO", ",", "*", ",", "query", "=", "None", ")", ":", "if", "isinstance", "(", "recipient_type", ",", "str", ")", ":", "recipient_type", "=", "RecipientType", "(", "recipie...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
GlobalAddressList.get_contact_by_email
Returns a Contact by it's email :param email: email to get contact for :return: Contact for specified email :rtype: Contact
O365/address_book.py
def get_contact_by_email(self, email): """ Returns a Contact by it's email :param email: email to get contact for :return: Contact for specified email :rtype: Contact """ if not email: return None email = email.strip() url = self.build_url('...
def get_contact_by_email(self, email): """ Returns a Contact by it's email :param email: email to get contact for :return: Contact for specified email :rtype: Contact """ if not email: return None email = email.strip() url = self.build_url('...
[ "Returns", "a", "Contact", "by", "it", "s", "email" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/address_book.py#L981-L1003
[ "def", "get_contact_by_email", "(", "self", ",", "email", ")", ":", "if", "not", "email", ":", "return", "None", "email", "=", "email", ".", "strip", "(", ")", "url", "=", "self", ".", "build_url", "(", "'{}/{}'", ".", "format", "(", "self", ".", "_e...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
MessageFlag.set_flagged
Sets this message as flagged :param start_date: the start datetime of the followUp :param due_date: the due datetime of the followUp
O365/message.py
def set_flagged(self, *, start_date=None, due_date=None): """ Sets this message as flagged :param start_date: the start datetime of the followUp :param due_date: the due datetime of the followUp """ self.__status = Flag.Flagged start_date = start_date or dt.datetime.now()...
def set_flagged(self, *, start_date=None, due_date=None): """ Sets this message as flagged :param start_date: the start datetime of the followUp :param due_date: the due datetime of the followUp """ self.__status = Flag.Flagged start_date = start_date or dt.datetime.now()...
[ "Sets", "this", "message", "as", "flagged", ":", "param", "start_date", ":", "the", "start", "datetime", "of", "the", "followUp", ":", "param", "due_date", ":", "the", "due", "datetime", "of", "the", "followUp" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L91-L105
[ "def", "set_flagged", "(", "self", ",", "*", ",", "start_date", "=", "None", ",", "due_date", "=", "None", ")", ":", "self", ".", "__status", "=", "Flag", ".", "Flagged", "start_date", "=", "start_date", "or", "dt", ".", "datetime", ".", "now", "(", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
MessageFlag.set_completed
Sets this message flag as completed :param completition_date: the datetime this followUp was completed
O365/message.py
def set_completed(self, *, completition_date=None): """ Sets this message flag as completed :param completition_date: the datetime this followUp was completed """ self.__status = Flag.Complete completition_date = completition_date or dt.datetime.now() if completition_date...
def set_completed(self, *, completition_date=None): """ Sets this message flag as completed :param completition_date: the datetime this followUp was completed """ self.__status = Flag.Complete completition_date = completition_date or dt.datetime.now() if completition_date...
[ "Sets", "this", "message", "flag", "as", "completed", ":", "param", "completition_date", ":", "the", "datetime", "this", "followUp", "was", "completed" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L107-L116
[ "def", "set_completed", "(", "self", ",", "*", ",", "completition_date", "=", "None", ")", ":", "self", ".", "__status", "=", "Flag", ".", "Complete", "completition_date", "=", "completition_date", "or", "dt", ".", "datetime", ".", "now", "(", ")", "if", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
MessageFlag.delete_flag
Sets this message as un flagged
O365/message.py
def delete_flag(self): """ Sets this message as un flagged """ self.__status = Flag.NotFlagged self.__start = None self.__due_date = None self.__completed = None self._track_changes()
def delete_flag(self): """ Sets this message as un flagged """ self.__status = Flag.NotFlagged self.__start = None self.__due_date = None self.__completed = None self._track_changes()
[ "Sets", "this", "message", "as", "un", "flagged" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L118-L124
[ "def", "delete_flag", "(", "self", ")", ":", "self", ".", "__status", "=", "Flag", ".", "NotFlagged", "self", ".", "__start", "=", "None", "self", ".", "__due_date", "=", "None", "self", ".", "__completed", "=", "None", "self", ".", "_track_changes", "("...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
MessageFlag.to_api_data
Returns this data as a dict to be sent to the server
O365/message.py
def to_api_data(self): """ Returns this data as a dict to be sent to the server """ data = { self._cc('flagStatus'): self._cc(self.__status.value) } if self.__status is Flag.Flagged: data[self._cc('startDateTime')] = self._build_date_time_time_zone(self.__start) ...
def to_api_data(self): """ Returns this data as a dict to be sent to the server """ data = { self._cc('flagStatus'): self._cc(self.__status.value) } if self.__status is Flag.Flagged: data[self._cc('startDateTime')] = self._build_date_time_time_zone(self.__start) ...
[ "Returns", "this", "data", "as", "a", "dict", "to", "be", "sent", "to", "the", "server" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L146-L158
[ "def", "to_api_data", "(", "self", ")", ":", "data", "=", "{", "self", ".", "_cc", "(", "'flagStatus'", ")", ":", "self", ".", "_cc", "(", "self", ".", "__status", ".", "value", ")", "}", "if", "self", ".", "__status", "is", "Flag", ".", "Flagged",...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Message.sender
sender is a property to force to be always a Recipient class
O365/message.py
def sender(self, value): """ sender is a property to force to be always a Recipient class """ if isinstance(value, Recipient): if value._parent is None: value._parent = self value._field = 'from' self.__sender = value elif isinstance(value,...
def sender(self, value): """ sender is a property to force to be always a Recipient class """ if isinstance(value, Recipient): if value._parent is None: value._parent = self value._field = 'from' self.__sender = value elif isinstance(value,...
[ "sender", "is", "a", "property", "to", "force", "to", "be", "always", "a", "Recipient", "class" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L381-L394
[ "def", "sender", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "Recipient", ")", ":", "if", "value", ".", "_parent", "is", "None", ":", "value", ".", "_parent", "=", "self", "value", ".", "_field", "=", "'from'", "self",...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Message.to_api_data
Returns a dict representation of this message prepared to be send to the cloud :param restrict_keys: a set of keys to restrict the returned data to :type restrict_keys: dict or set :return: converted to cloud based keys :rtype: dict
O365/message.py
def to_api_data(self, restrict_keys=None): """ Returns a dict representation of this message prepared to be send to the cloud :param restrict_keys: a set of keys to restrict the returned data to :type restrict_keys: dict or set :return: converted to cloud based keys ...
def to_api_data(self, restrict_keys=None): """ Returns a dict representation of this message prepared to be send to the cloud :param restrict_keys: a set of keys to restrict the returned data to :type restrict_keys: dict or set :return: converted to cloud based keys ...
[ "Returns", "a", "dict", "representation", "of", "this", "message", "prepared", "to", "be", "send", "to", "the", "cloud" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L504-L573
[ "def", "to_api_data", "(", "self", ",", "restrict_keys", "=", "None", ")", ":", "cc", "=", "self", ".", "_cc", "# alias to shorten the code", "message", "=", "{", "cc", "(", "'subject'", ")", ":", "self", ".", "subject", ",", "cc", "(", "'body'", ")", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Message.send
Sends this message :param bool save_to_sent_folder: whether or not to save it to sent folder :return: Success / Failure :rtype: bool
O365/message.py
def send(self, save_to_sent_folder=True): """ Sends this message :param bool save_to_sent_folder: whether or not to save it to sent folder :return: Success / Failure :rtype: bool """ if self.object_id and not self.__is_draft: return RuntimeError('No...
def send(self, save_to_sent_folder=True): """ Sends this message :param bool save_to_sent_folder: whether or not to save it to sent folder :return: Success / Failure :rtype: bool """ if self.object_id and not self.__is_draft: return RuntimeError('No...
[ "Sends", "this", "message" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L575-L611
[ "def", "send", "(", "self", ",", "save_to_sent_folder", "=", "True", ")", ":", "if", "self", ".", "object_id", "and", "not", "self", ".", "__is_draft", ":", "return", "RuntimeError", "(", "'Not possible to send a message that is not '", "'new or a draft. Use Reply or ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Message.reply
Creates a new message that is a reply to this message :param bool to_all: whether or not to replies to all the recipients instead to just the sender :return: new message :rtype: Message
O365/message.py
def reply(self, to_all=True): """ Creates a new message that is a reply to this message :param bool to_all: whether or not to replies to all the recipients instead to just the sender :return: new message :rtype: Message """ if not self.object_id or self.__is_dr...
def reply(self, to_all=True): """ Creates a new message that is a reply to this message :param bool to_all: whether or not to replies to all the recipients instead to just the sender :return: new message :rtype: Message """ if not self.object_id or self.__is_dr...
[ "Creates", "a", "new", "message", "that", "is", "a", "reply", "to", "this", "message" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L613-L638
[ "def", "reply", "(", "self", ",", "to_all", "=", "True", ")", ":", "if", "not", "self", ".", "object_id", "or", "self", ".", "__is_draft", ":", "raise", "RuntimeError", "(", "\"Can't reply to this message\"", ")", "if", "to_all", ":", "url", "=", "self", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Message.forward
Creates a new message that is a forward this message :return: new message :rtype: Message
O365/message.py
def forward(self): """ Creates a new message that is a forward this message :return: new message :rtype: Message """ if not self.object_id or self.__is_draft: raise RuntimeError("Can't forward this message") url = self.build_url( self._endpoints...
def forward(self): """ Creates a new message that is a forward this message :return: new message :rtype: Message """ if not self.object_id or self.__is_draft: raise RuntimeError("Can't forward this message") url = self.build_url( self._endpoints...
[ "Creates", "a", "new", "message", "that", "is", "a", "forward", "this", "message" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L640-L659
[ "def", "forward", "(", "self", ")", ":", "if", "not", "self", ".", "object_id", "or", "self", ".", "__is_draft", ":", "raise", "RuntimeError", "(", "\"Can't forward this message\"", ")", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoints", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Message.mark_as_read
Marks this message as read in the cloud :return: Success / Failure :rtype: bool
O365/message.py
def mark_as_read(self): """ Marks this message as read in the cloud :return: Success / Failure :rtype: bool """ if self.object_id is None or self.__is_draft: raise RuntimeError('Attempting to mark as read an unsaved Message') data = {self._cc('isRead'): True...
def mark_as_read(self): """ Marks this message as read in the cloud :return: Success / Failure :rtype: bool """ if self.object_id is None or self.__is_draft: raise RuntimeError('Attempting to mark as read an unsaved Message') data = {self._cc('isRead'): True...
[ "Marks", "this", "message", "as", "read", "in", "the", "cloud" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L677-L697
[ "def", "mark_as_read", "(", "self", ")", ":", "if", "self", ".", "object_id", "is", "None", "or", "self", ".", "__is_draft", ":", "raise", "RuntimeError", "(", "'Attempting to mark as read an unsaved Message'", ")", "data", "=", "{", "self", ".", "_cc", "(", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Message.move
Move the message to a given folder :param folder: Folder object or Folder id or Well-known name to move this message to :type folder: str or mailbox.Folder :return: Success / Failure :rtype: bool
O365/message.py
def move(self, folder): """ Move the message to a given folder :param folder: Folder object or Folder id or Well-known name to move this message to :type folder: str or mailbox.Folder :return: Success / Failure :rtype: bool """ if self.object_id is None:...
def move(self, folder): """ Move the message to a given folder :param folder: Folder object or Folder id or Well-known name to move this message to :type folder: str or mailbox.Folder :return: Success / Failure :rtype: bool """ if self.object_id is None:...
[ "Move", "the", "message", "to", "a", "given", "folder" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L699-L730
[ "def", "move", "(", "self", ",", "folder", ")", ":", "if", "self", ".", "object_id", "is", "None", ":", "raise", "RuntimeError", "(", "'Attempting to move an unsaved Message'", ")", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoints", ".", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Message.copy
Copy the message to a given folder :param folder: Folder object or Folder id or Well-known name to copy this message to :type folder: str or mailbox.Folder :returns: the copied message :rtype: Message
O365/message.py
def copy(self, folder): """ Copy the message to a given folder :param folder: Folder object or Folder id or Well-known name to copy this message to :type folder: str or mailbox.Folder :returns: the copied message :rtype: Message """ if self.object_id is ...
def copy(self, folder): """ Copy the message to a given folder :param folder: Folder object or Folder id or Well-known name to copy this message to :type folder: str or mailbox.Folder :returns: the copied message :rtype: Message """ if self.object_id is ...
[ "Copy", "the", "message", "to", "a", "given", "folder" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L732-L764
[ "def", "copy", "(", "self", ",", "folder", ")", ":", "if", "self", ".", "object_id", "is", "None", ":", "raise", "RuntimeError", "(", "'Attempting to move an unsaved Message'", ")", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoints", ".", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Message.save_message
Saves changes to a message. If the message is a new or saved draft it will call 'save_draft' otherwise this will save only properties of a message that are draft-independent such as: - is_read - category - flag :return: Success / Failure :rtype: bool
O365/message.py
def save_message(self): """ Saves changes to a message. If the message is a new or saved draft it will call 'save_draft' otherwise this will save only properties of a message that are draft-independent such as: - is_read - category - flag :return: Succ...
def save_message(self): """ Saves changes to a message. If the message is a new or saved draft it will call 'save_draft' otherwise this will save only properties of a message that are draft-independent such as: - is_read - category - flag :return: Succ...
[ "Saves", "changes", "to", "a", "message", ".", "If", "the", "message", "is", "a", "new", "or", "saved", "draft", "it", "will", "call", "save_draft", "otherwise", "this", "will", "save", "only", "properties", "of", "a", "message", "that", "are", "draft", ...
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L766-L799
[ "def", "save_message", "(", "self", ")", ":", "if", "self", ".", "object_id", "and", "not", "self", ".", "__is_draft", ":", "# we are only allowed to save some properties:", "allowed_changes", "=", "{", "self", ".", "_cc", "(", "'isRead'", ")", ",", "self", "....
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Message.save_draft
Save this message as a draft on the cloud :param target_folder: name of the drafts folder :return: Success / Failure :rtype: bool
O365/message.py
def save_draft(self, target_folder=OutlookWellKnowFolderNames.DRAFTS): """ Save this message as a draft on the cloud :param target_folder: name of the drafts folder :return: Success / Failure :rtype: bool """ if self.object_id: # update message. Attachments ...
def save_draft(self, target_folder=OutlookWellKnowFolderNames.DRAFTS): """ Save this message as a draft on the cloud :param target_folder: name of the drafts folder :return: Success / Failure :rtype: bool """ if self.object_id: # update message. Attachments ...
[ "Save", "this", "message", "as", "a", "draft", "on", "the", "cloud" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L801-L878
[ "def", "save_draft", "(", "self", ",", "target_folder", "=", "OutlookWellKnowFolderNames", ".", "DRAFTS", ")", ":", "if", "self", ".", "object_id", ":", "# update message. Attachments are NOT included nor saved.", "if", "not", "self", ".", "__is_draft", ":", "raise", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
Message.get_event
If this is a EventMessage it should return the related Event
O365/message.py
def get_event(self): """ If this is a EventMessage it should return the related Event""" if not self.is_event_message: return None # select a dummy field (eg. subject) to avoid pull unneccesary data query = self.q().select('subject').expand('event') url = self.buil...
def get_event(self): """ If this is a EventMessage it should return the related Event""" if not self.is_event_message: return None # select a dummy field (eg. subject) to avoid pull unneccesary data query = self.q().select('subject').expand('event') url = self.buil...
[ "If", "this", "is", "a", "EventMessage", "it", "should", "return", "the", "related", "Event" ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/message.py#L907-L926
[ "def", "get_event", "(", "self", ")", ":", "if", "not", "self", ".", "is_event_message", ":", "return", "None", "# select a dummy field (eg. subject) to avoid pull unneccesary data", "query", "=", "self", ".", "q", "(", ")", ".", "select", "(", "'subject'", ")", ...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
build
Builds the distribution files: wheels and source.
release.py
def build(force): """ Builds the distribution files: wheels and source. """ dist_path = Path(DIST_PATH) if dist_path.exists() and list(dist_path.glob('*')): if force or click.confirm('{} is not empty - delete contents?'.format(dist_path)): dist_path.rename(DIST_PATH_DELETE) s...
def build(force): """ Builds the distribution files: wheels and source. """ dist_path = Path(DIST_PATH) if dist_path.exists() and list(dist_path.glob('*')): if force or click.confirm('{} is not empty - delete contents?'.format(dist_path)): dist_path.rename(DIST_PATH_DELETE) s...
[ "Builds", "the", "distribution", "files", ":", "wheels", "and", "source", "." ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/release.py#L29-L43
[ "def", "build", "(", "force", ")", ":", "dist_path", "=", "Path", "(", "DIST_PATH", ")", "if", "dist_path", ".", "exists", "(", ")", "and", "list", "(", "dist_path", ".", "glob", "(", "'*'", ")", ")", ":", "if", "force", "or", "click", ".", "confir...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
upload
Uploads distribuition files to pypi or pypitest.
release.py
def upload(ctx, release, rebuild): """ Uploads distribuition files to pypi or pypitest. """ dist_path = Path(DIST_PATH) if rebuild is False: if not dist_path.exists() or not list(dist_path.glob('*')): print("No distribution files found. Please run 'build' command first") retu...
def upload(ctx, release, rebuild): """ Uploads distribuition files to pypi or pypitest. """ dist_path = Path(DIST_PATH) if rebuild is False: if not dist_path.exists() or not list(dist_path.glob('*')): print("No distribution files found. Please run 'build' command first") retu...
[ "Uploads", "distribuition", "files", "to", "pypi", "or", "pypitest", "." ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/release.py#L50-L69
[ "def", "upload", "(", "ctx", ",", "release", ",", "rebuild", ")", ":", "dist_path", "=", "Path", "(", "DIST_PATH", ")", "if", "rebuild", "is", "False", ":", "if", "not", "dist_path", ".", "exists", "(", ")", "or", "not", "list", "(", "dist_path", "."...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
check
Checks the long description.
release.py
def check(): """ Checks the long description. """ dist_path = Path(DIST_PATH) if not dist_path.exists() or not list(dist_path.glob('*')): print("No distribution files found. Please run 'build' command first") return subprocess.check_call(['twine', 'check', 'dist/*'])
def check(): """ Checks the long description. """ dist_path = Path(DIST_PATH) if not dist_path.exists() or not list(dist_path.glob('*')): print("No distribution files found. Please run 'build' command first") return subprocess.check_call(['twine', 'check', 'dist/*'])
[ "Checks", "the", "long", "description", "." ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/release.py#L73-L80
[ "def", "check", "(", ")", ":", "dist_path", "=", "Path", "(", "DIST_PATH", ")", "if", "not", "dist_path", ".", "exists", "(", ")", "or", "not", "list", "(", "dist_path", ".", "glob", "(", "'*'", ")", ")", ":", "print", "(", "\"No distribution files fou...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
list_releases
Lists all releases published on pypi.
release.py
def list_releases(): """ Lists all releases published on pypi. """ response = requests.get(PYPI_URL.format(package=PYPI_PACKAGE_NAME)) if response: data = response.json() releases_dict = data.get('releases', {}) if releases_dict: for version, release in releases_dict.it...
def list_releases(): """ Lists all releases published on pypi. """ response = requests.get(PYPI_URL.format(package=PYPI_PACKAGE_NAME)) if response: data = response.json() releases_dict = data.get('releases', {}) if releases_dict: for version, release in releases_dict.it...
[ "Lists", "all", "releases", "published", "on", "pypi", "." ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/release.py#L109-L130
[ "def", "list_releases", "(", ")", ":", "response", "=", "requests", ".", "get", "(", "PYPI_URL", ".", "format", "(", "package", "=", "PYPI_PACKAGE_NAME", ")", ")", "if", "response", ":", "data", "=", "response", ".", "json", "(", ")", "releases_dict", "=...
02a71cf3775cc6a3c042e003365d6a07c8c75a73
train
contribution_breakdown
Displays a table of the contributors and to what extent we have them to thank.
release.py
def contribution_breakdown(): """ Displays a table of the contributors and to what extent we have them to thank.""" args = ['git', 'blame'] counts = {} line_format = '{0:30}\t{1:>10}\t{2:>10}%' files = subprocess.check_output(['git', 'ls-files']).decode("utf-8").split('\n') for f in files[:-1]:...
def contribution_breakdown(): """ Displays a table of the contributors and to what extent we have them to thank.""" args = ['git', 'blame'] counts = {} line_format = '{0:30}\t{1:>10}\t{2:>10}%' files = subprocess.check_output(['git', 'ls-files']).decode("utf-8").split('\n') for f in files[:-1]:...
[ "Displays", "a", "table", "of", "the", "contributors", "and", "to", "what", "extent", "we", "have", "them", "to", "thank", "." ]
O365/python-o365
python
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/release.py#L135-L161
[ "def", "contribution_breakdown", "(", ")", ":", "args", "=", "[", "'git'", ",", "'blame'", "]", "counts", "=", "{", "}", "line_format", "=", "'{0:30}\\t{1:>10}\\t{2:>10}%'", "files", "=", "subprocess", ".", "check_output", "(", "[", "'git'", ",", "'ls-files'",...
02a71cf3775cc6a3c042e003365d6a07c8c75a73