id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
53,900
synw/dataswim
dataswim/data/select.py
Select.daterange
def daterange(self, datecol, date_start, op, **args): """ Returns rows in a date range """ df = self._daterange(datecol, date_start, op, **args) if df is None: self.err("Can not select date range data") self.df = df
python
def daterange(self, datecol, date_start, op, **args): """ Returns rows in a date range """ df = self._daterange(datecol, date_start, op, **args) if df is None: self.err("Can not select date range data") self.df = df
[ "def", "daterange", "(", "self", ",", "datecol", ",", "date_start", ",", "op", ",", "*", "*", "args", ")", ":", "df", "=", "self", ".", "_daterange", "(", "datecol", ",", "date_start", ",", "op", ",", "*", "*", "args", ")", "if", "df", "is", "Non...
Returns rows in a date range
[ "Returns", "rows", "in", "a", "date", "range" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/select.py#L160-L167
53,901
synw/dataswim
dataswim/data/select.py
Select.daterange_
def daterange_(self, datecol, date_start, op, **args): """ Returns a DataSwim instance with rows in a date range """ df = self._daterange(datecol, date_start, op, **args) if df is None: self.err("Can not select date range data") return self._duplicate_(df)
python
def daterange_(self, datecol, date_start, op, **args): """ Returns a DataSwim instance with rows in a date range """ df = self._daterange(datecol, date_start, op, **args) if df is None: self.err("Can not select date range data") return self._duplicate_(df)
[ "def", "daterange_", "(", "self", ",", "datecol", ",", "date_start", ",", "op", ",", "*", "*", "args", ")", ":", "df", "=", "self", ".", "_daterange", "(", "datecol", ",", "date_start", ",", "op", ",", "*", "*", "args", ")", "if", "df", "is", "No...
Returns a DataSwim instance with rows in a date range
[ "Returns", "a", "DataSwim", "instance", "with", "rows", "in", "a", "date", "range" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/select.py#L169-L176
53,902
oasiswork/zimsoap
zimsoap/utils.py
build_preauth_str
def build_preauth_str(preauth_key, account_name, timestamp, expires, admin=False): """ Builds the preauth string and hmac it, following the zimbra spec. Spec and examples are here http://wiki.zimbra.com/wiki/Preauth """ if admin: s = '{0}|1|name|{1}|{2}'.format(account_nam...
python
def build_preauth_str(preauth_key, account_name, timestamp, expires, admin=False): """ Builds the preauth string and hmac it, following the zimbra spec. Spec and examples are here http://wiki.zimbra.com/wiki/Preauth """ if admin: s = '{0}|1|name|{1}|{2}'.format(account_nam...
[ "def", "build_preauth_str", "(", "preauth_key", ",", "account_name", ",", "timestamp", ",", "expires", ",", "admin", "=", "False", ")", ":", "if", "admin", ":", "s", "=", "'{0}|1|name|{1}|{2}'", ".", "format", "(", "account_name", ",", "expires", ",", "times...
Builds the preauth string and hmac it, following the zimbra spec. Spec and examples are here http://wiki.zimbra.com/wiki/Preauth
[ "Builds", "the", "preauth", "string", "and", "hmac", "it", "following", "the", "zimbra", "spec", "." ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/utils.py#L26-L38
53,903
oasiswork/zimsoap
zimsoap/utils.py
auto_type
def auto_type(s): """ Get a XML response and tries to convert it to Python base object """ if isinstance(s, bool): return s elif s is None: return '' elif s == 'TRUE': return True elif s == 'FALSE': return False else: try: try: ...
python
def auto_type(s): """ Get a XML response and tries to convert it to Python base object """ if isinstance(s, bool): return s elif s is None: return '' elif s == 'TRUE': return True elif s == 'FALSE': return False else: try: try: ...
[ "def", "auto_type", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "bool", ")", ":", "return", "s", "elif", "s", "is", "None", ":", "return", "''", "elif", "s", "==", "'TRUE'", ":", "return", "True", "elif", "s", "==", "'FALSE'", ":", "re...
Get a XML response and tries to convert it to Python base object
[ "Get", "a", "XML", "response", "and", "tries", "to", "convert", "it", "to", "Python", "base", "object" ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/utils.py#L64-L87
53,904
oasiswork/zimsoap
zimsoap/utils.py
xml_str_to_dict
def xml_str_to_dict(s): """ Transforms an XML string it to python-zimbra dict format For format, see: https://github.com/Zimbra-Community/python-zimbra/blob/master/README.md :param: a string, containing XML :returns: a dict, with python-zimbra format """ xml = minidom.parseString(s) ...
python
def xml_str_to_dict(s): """ Transforms an XML string it to python-zimbra dict format For format, see: https://github.com/Zimbra-Community/python-zimbra/blob/master/README.md :param: a string, containing XML :returns: a dict, with python-zimbra format """ xml = minidom.parseString(s) ...
[ "def", "xml_str_to_dict", "(", "s", ")", ":", "xml", "=", "minidom", ".", "parseString", "(", "s", ")", "return", "pythonzimbra", ".", "tools", ".", "xmlserializer", ".", "dom_to_dict", "(", "xml", ".", "firstChild", ")" ]
Transforms an XML string it to python-zimbra dict format For format, see: https://github.com/Zimbra-Community/python-zimbra/blob/master/README.md :param: a string, containing XML :returns: a dict, with python-zimbra format
[ "Transforms", "an", "XML", "string", "it", "to", "python", "-", "zimbra", "dict", "format" ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/utils.py#L102-L112
53,905
flaper87/python-gerrit
gerrit/reviews.py
Query._execute
def _execute(self): """Executes the query and yields items.""" query = [ 'gerrit', 'query', '--current-patch-set', str(self._filters), '--format=JSON'] results = self.client.exec_command(' '.join(query)) stdin, stdout, stderr = results ...
python
def _execute(self): """Executes the query and yields items.""" query = [ 'gerrit', 'query', '--current-patch-set', str(self._filters), '--format=JSON'] results = self.client.exec_command(' '.join(query)) stdin, stdout, stderr = results ...
[ "def", "_execute", "(", "self", ")", ":", "query", "=", "[", "'gerrit'", ",", "'query'", ",", "'--current-patch-set'", ",", "str", "(", "self", ".", "_filters", ")", ",", "'--format=JSON'", "]", "results", "=", "self", ".", "client", ".", "exec_command", ...
Executes the query and yields items.
[ "Executes", "the", "query", "and", "yields", "items", "." ]
34fcd6d98f31b35280f29c353ad8098905ba4b39
https://github.com/flaper87/python-gerrit/blob/34fcd6d98f31b35280f29c353ad8098905ba4b39/gerrit/reviews.py#L31-L52
53,906
nalourie/django-macros
build/lib/macros/templatetags/macros.py
do_macro
def do_macro(parser, token): """ the function taking the parsed tag and returning a DefineMacroNode object. """ try: bits = token.split_contents() tag_name, macro_name, arguments = bits[0], bits[1], bits[2:] except IndexError: raise template.TemplateSyntaxError( "...
python
def do_macro(parser, token): """ the function taking the parsed tag and returning a DefineMacroNode object. """ try: bits = token.split_contents() tag_name, macro_name, arguments = bits[0], bits[1], bits[2:] except IndexError: raise template.TemplateSyntaxError( "...
[ "def", "do_macro", "(", "parser", ",", "token", ")", ":", "try", ":", "bits", "=", "token", ".", "split_contents", "(", ")", "tag_name", ",", "macro_name", ",", "arguments", "=", "bits", "[", "0", "]", ",", "bits", "[", "1", "]", ",", "bits", "[", ...
the function taking the parsed tag and returning a DefineMacroNode object.
[ "the", "function", "taking", "the", "parsed", "tag", "and", "returning", "a", "DefineMacroNode", "object", "." ]
94b836f5d4073bc0752491c36dfb03e79098ab27
https://github.com/nalourie/django-macros/blob/94b836f5d4073bc0752491c36dfb03e79098ab27/build/lib/macros/templatetags/macros.py#L63-L123
53,907
nalourie/django-macros
build/lib/macros/templatetags/macros.py
do_loadmacros
def do_loadmacros(parser, token): """ The function taking a parsed tag and returning a LoadMacrosNode object, while also loading the macros into the page. """ try: tag_name, filename = token.split_contents() except ValueError: raise template.TemplateSyntaxError( "'{0}...
python
def do_loadmacros(parser, token): """ The function taking a parsed tag and returning a LoadMacrosNode object, while also loading the macros into the page. """ try: tag_name, filename = token.split_contents() except ValueError: raise template.TemplateSyntaxError( "'{0}...
[ "def", "do_loadmacros", "(", "parser", ",", "token", ")", ":", "try", ":", "tag_name", ",", "filename", "=", "token", ".", "split_contents", "(", ")", "except", "ValueError", ":", "raise", "template", ".", "TemplateSyntaxError", "(", "\"'{0}' tag requires exactl...
The function taking a parsed tag and returning a LoadMacrosNode object, while also loading the macros into the page.
[ "The", "function", "taking", "a", "parsed", "tag", "and", "returning", "a", "LoadMacrosNode", "object", "while", "also", "loading", "the", "macros", "into", "the", "page", "." ]
94b836f5d4073bc0752491c36dfb03e79098ab27
https://github.com/nalourie/django-macros/blob/94b836f5d4073bc0752491c36dfb03e79098ab27/build/lib/macros/templatetags/macros.py#L146-L179
53,908
nalourie/django-macros
build/lib/macros/templatetags/macros.py
parse_macro_params
def parse_macro_params(token): """ Common parsing logic for both use_macro and macro_block """ try: bits = token.split_contents() tag_name, macro_name, values = bits[0], bits[1], bits[2:] except IndexError: raise template.TemplateSyntaxError( "{0} tag requires at ...
python
def parse_macro_params(token): """ Common parsing logic for both use_macro and macro_block """ try: bits = token.split_contents() tag_name, macro_name, values = bits[0], bits[1], bits[2:] except IndexError: raise template.TemplateSyntaxError( "{0} tag requires at ...
[ "def", "parse_macro_params", "(", "token", ")", ":", "try", ":", "bits", "=", "token", ".", "split_contents", "(", ")", "tag_name", ",", "macro_name", ",", "values", "=", "bits", "[", "0", "]", ",", "bits", "[", "1", "]", ",", "bits", "[", "2", ":"...
Common parsing logic for both use_macro and macro_block
[ "Common", "parsing", "logic", "for", "both", "use_macro", "and", "macro_block" ]
94b836f5d4073bc0752491c36dfb03e79098ab27
https://github.com/nalourie/django-macros/blob/94b836f5d4073bc0752491c36dfb03e79098ab27/build/lib/macros/templatetags/macros.py#L221-L263
53,909
nalourie/django-macros
build/lib/macros/templatetags/macros.py
do_usemacro
def do_usemacro(parser, token): """ The function taking a parsed template tag and returning a UseMacroNode. """ tag_name, macro_name, args, kwargs = parse_macro_params(token) try: macro = parser._macros[macro_name] except (AttributeError, KeyError): raise template.TemplateSyntaxE...
python
def do_usemacro(parser, token): """ The function taking a parsed template tag and returning a UseMacroNode. """ tag_name, macro_name, args, kwargs = parse_macro_params(token) try: macro = parser._macros[macro_name] except (AttributeError, KeyError): raise template.TemplateSyntaxE...
[ "def", "do_usemacro", "(", "parser", ",", "token", ")", ":", "tag_name", ",", "macro_name", ",", "args", ",", "kwargs", "=", "parse_macro_params", "(", "token", ")", "try", ":", "macro", "=", "parser", ".", "_macros", "[", "macro_name", "]", "except", "(...
The function taking a parsed template tag and returning a UseMacroNode.
[ "The", "function", "taking", "a", "parsed", "template", "tag", "and", "returning", "a", "UseMacroNode", "." ]
94b836f5d4073bc0752491c36dfb03e79098ab27
https://github.com/nalourie/django-macros/blob/94b836f5d4073bc0752491c36dfb03e79098ab27/build/lib/macros/templatetags/macros.py#L267-L279
53,910
nalourie/django-macros
build/lib/macros/templatetags/macros.py
do_macro_block
def do_macro_block(parser, token): """ Function taking parsed template tag to a MacroBlockNode. """ tag_name, macro_name, args, kwargs = parse_macro_params(token) # could add extra validation on the macro_name tag # here, but probably don't need to since we're checking # if there's a macro b...
python
def do_macro_block(parser, token): """ Function taking parsed template tag to a MacroBlockNode. """ tag_name, macro_name, args, kwargs = parse_macro_params(token) # could add extra validation on the macro_name tag # here, but probably don't need to since we're checking # if there's a macro b...
[ "def", "do_macro_block", "(", "parser", ",", "token", ")", ":", "tag_name", ",", "macro_name", ",", "args", ",", "kwargs", "=", "parse_macro_params", "(", "token", ")", "# could add extra validation on the macro_name tag", "# here, but probably don't need to since we're che...
Function taking parsed template tag to a MacroBlockNode.
[ "Function", "taking", "parsed", "template", "tag", "to", "a", "MacroBlockNode", "." ]
94b836f5d4073bc0752491c36dfb03e79098ab27
https://github.com/nalourie/django-macros/blob/94b836f5d4073bc0752491c36dfb03e79098ab27/build/lib/macros/templatetags/macros.py#L293-L360
53,911
nalourie/django-macros
build/lib/macros/templatetags/macros.py
do_macro_arg
def do_macro_arg(parser, token): """ Function taking a parsed template tag to a MacroArgNode. """ # macro_arg takes no arguments, so we don't # need to split the token/do validation. nodelist = parser.parse(('endmacro_arg',)) parser.delete_first_token() # simply save the contents to a Ma...
python
def do_macro_arg(parser, token): """ Function taking a parsed template tag to a MacroArgNode. """ # macro_arg takes no arguments, so we don't # need to split the token/do validation. nodelist = parser.parse(('endmacro_arg',)) parser.delete_first_token() # simply save the contents to a Ma...
[ "def", "do_macro_arg", "(", "parser", ",", "token", ")", ":", "# macro_arg takes no arguments, so we don't", "# need to split the token/do validation.", "nodelist", "=", "parser", ".", "parse", "(", "(", "'endmacro_arg'", ",", ")", ")", "parser", ".", "delete_first_toke...
Function taking a parsed template tag to a MacroArgNode.
[ "Function", "taking", "a", "parsed", "template", "tag", "to", "a", "MacroArgNode", "." ]
94b836f5d4073bc0752491c36dfb03e79098ab27
https://github.com/nalourie/django-macros/blob/94b836f5d4073bc0752491c36dfb03e79098ab27/build/lib/macros/templatetags/macros.py#L383-L392
53,912
nalourie/django-macros
build/lib/macros/templatetags/macros.py
do_macro_kwarg
def do_macro_kwarg(parser, token): """ Function taking a parsed template tag to a MacroKwargNode. """ try: tag_name, keyword = token.split_contents() except ValueError: raise template.TemplateSyntaxError( "{0} tag requires exactly one argument, a keyword".format( ...
python
def do_macro_kwarg(parser, token): """ Function taking a parsed template tag to a MacroKwargNode. """ try: tag_name, keyword = token.split_contents() except ValueError: raise template.TemplateSyntaxError( "{0} tag requires exactly one argument, a keyword".format( ...
[ "def", "do_macro_kwarg", "(", "parser", ",", "token", ")", ":", "try", ":", "tag_name", ",", "keyword", "=", "token", ".", "split_contents", "(", ")", "except", "ValueError", ":", "raise", "template", ".", "TemplateSyntaxError", "(", "\"{0} tag requires exactly ...
Function taking a parsed template tag to a MacroKwargNode.
[ "Function", "taking", "a", "parsed", "template", "tag", "to", "a", "MacroKwargNode", "." ]
94b836f5d4073bc0752491c36dfb03e79098ab27
https://github.com/nalourie/django-macros/blob/94b836f5d4073bc0752491c36dfb03e79098ab27/build/lib/macros/templatetags/macros.py#L411-L425
53,913
danpoland/pyramid-restful-framework
pyramid_restful/decorators.py
detail_route
def detail_route(methods=None, **kwargs): """ Used to mark a method on a ViewSet that should be routed for detail requests. Usage:: class UserViewSet(ModelCRUDViewSet): model = User schema = UserSchema @detail_route(methods=['post'], url_path='lock-user') ...
python
def detail_route(methods=None, **kwargs): """ Used to mark a method on a ViewSet that should be routed for detail requests. Usage:: class UserViewSet(ModelCRUDViewSet): model = User schema = UserSchema @detail_route(methods=['post'], url_path='lock-user') ...
[ "def", "detail_route", "(", "methods", "=", "None", ",", "*", "*", "kwargs", ")", ":", "methods", "=", "[", "'get'", "]", "if", "(", "methods", "is", "None", ")", "else", "methods", "def", "decorator", "(", "func", ")", ":", "func", ".", "bind_to_met...
Used to mark a method on a ViewSet that should be routed for detail requests. Usage:: class UserViewSet(ModelCRUDViewSet): model = User schema = UserSchema @detail_route(methods=['post'], url_path='lock-user') def lock_user(request, id): ......
[ "Used", "to", "mark", "a", "method", "on", "a", "ViewSet", "that", "should", "be", "routed", "for", "detail", "requests", "." ]
4d8c9db44b1869c3d1fdd59ca304c3166473fcbb
https://github.com/danpoland/pyramid-restful-framework/blob/4d8c9db44b1869c3d1fdd59ca304c3166473fcbb/pyramid_restful/decorators.py#L1-L28
53,914
danpoland/pyramid-restful-framework
pyramid_restful/decorators.py
list_route
def list_route(methods=None, **kwargs): """ Used to mark a method on a ViewSet that should be routed for list requests. Usage:: class UserViewSet(ModelCRUDViewSet): model = User schema = UserSchema @list_route(methods=['get'], url_path='active-users') ...
python
def list_route(methods=None, **kwargs): """ Used to mark a method on a ViewSet that should be routed for list requests. Usage:: class UserViewSet(ModelCRUDViewSet): model = User schema = UserSchema @list_route(methods=['get'], url_path='active-users') ...
[ "def", "list_route", "(", "methods", "=", "None", ",", "*", "*", "kwargs", ")", ":", "methods", "=", "[", "'get'", "]", "if", "(", "methods", "is", "None", ")", "else", "methods", "def", "decorator", "(", "func", ")", ":", "func", ".", "bind_to_metho...
Used to mark a method on a ViewSet that should be routed for list requests. Usage:: class UserViewSet(ModelCRUDViewSet): model = User schema = UserSchema @list_route(methods=['get'], url_path='active-users') def active_users(request, *args, **kwargs): ...
[ "Used", "to", "mark", "a", "method", "on", "a", "ViewSet", "that", "should", "be", "routed", "for", "list", "requests", "." ]
4d8c9db44b1869c3d1fdd59ca304c3166473fcbb
https://github.com/danpoland/pyramid-restful-framework/blob/4d8c9db44b1869c3d1fdd59ca304c3166473fcbb/pyramid_restful/decorators.py#L31-L59
53,915
synw/dataswim
dataswim/data/count.py
Count.count_nulls
def count_nulls(self, field): """ Count the number of null values in a column """ try: n = self.df[field].isnull().sum() except KeyError: self.warning("Can not find column", field) return except Exception as e: self.err(e, "...
python
def count_nulls(self, field): """ Count the number of null values in a column """ try: n = self.df[field].isnull().sum() except KeyError: self.warning("Can not find column", field) return except Exception as e: self.err(e, "...
[ "def", "count_nulls", "(", "self", ",", "field", ")", ":", "try", ":", "n", "=", "self", ".", "df", "[", "field", "]", ".", "isnull", "(", ")", ".", "sum", "(", ")", "except", "KeyError", ":", "self", ".", "warning", "(", "\"Can not find column\"", ...
Count the number of null values in a column
[ "Count", "the", "number", "of", "null", "values", "in", "a", "column" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/count.py#L10-L22
53,916
synw/dataswim
dataswim/data/count.py
Count.count
def count(self): """ Counts the number of rows of the main dataframe """ try: num = len(self.df.index) except Exception as e: self.err(e, "Can not count data") return self.ok("Found", num, "rows in the dataframe")
python
def count(self): """ Counts the number of rows of the main dataframe """ try: num = len(self.df.index) except Exception as e: self.err(e, "Can not count data") return self.ok("Found", num, "rows in the dataframe")
[ "def", "count", "(", "self", ")", ":", "try", ":", "num", "=", "len", "(", "self", ".", "df", ".", "index", ")", "except", "Exception", "as", "e", ":", "self", ".", "err", "(", "e", ",", "\"Can not count data\"", ")", "return", "self", ".", "ok", ...
Counts the number of rows of the main dataframe
[ "Counts", "the", "number", "of", "rows", "of", "the", "main", "dataframe" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/count.py#L24-L33
53,917
synw/dataswim
dataswim/data/count.py
Count.count_
def count_(self): """ Returns the number of rows of the main dataframe """ try: num = len(self.df.index) except Exception as e: self.err(e, "Can not count data") return return num
python
def count_(self): """ Returns the number of rows of the main dataframe """ try: num = len(self.df.index) except Exception as e: self.err(e, "Can not count data") return return num
[ "def", "count_", "(", "self", ")", ":", "try", ":", "num", "=", "len", "(", "self", ".", "df", ".", "index", ")", "except", "Exception", "as", "e", ":", "self", ".", "err", "(", "e", ",", "\"Can not count data\"", ")", "return", "return", "num" ]
Returns the number of rows of the main dataframe
[ "Returns", "the", "number", "of", "rows", "of", "the", "main", "dataframe" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/count.py#L35-L44
53,918
synw/dataswim
dataswim/data/count.py
Count.count_empty
def count_empty(self, field): """ List of empty row indices """ try: df2 = self.df[[field]] vals = where(df2.applymap(lambda x: x == '')) num = len(vals[0]) except Exception as e: self.err(e, "Can not count empty values") ...
python
def count_empty(self, field): """ List of empty row indices """ try: df2 = self.df[[field]] vals = where(df2.applymap(lambda x: x == '')) num = len(vals[0]) except Exception as e: self.err(e, "Can not count empty values") ...
[ "def", "count_empty", "(", "self", ",", "field", ")", ":", "try", ":", "df2", "=", "self", ".", "df", "[", "[", "field", "]", "]", "vals", "=", "where", "(", "df2", ".", "applymap", "(", "lambda", "x", ":", "x", "==", "''", ")", ")", "num", "...
List of empty row indices
[ "List", "of", "empty", "row", "indices" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/count.py#L46-L57
53,919
synw/dataswim
dataswim/data/count.py
Count.count_unique_
def count_unique_(self, field): """ Return the number of unique values in a column """ try: num = self.df[field].nunique() except Exception as e: self.err(e, "Can not count unique values") return self.ok("Found", num, "unique values in ...
python
def count_unique_(self, field): """ Return the number of unique values in a column """ try: num = self.df[field].nunique() except Exception as e: self.err(e, "Can not count unique values") return self.ok("Found", num, "unique values in ...
[ "def", "count_unique_", "(", "self", ",", "field", ")", ":", "try", ":", "num", "=", "self", ".", "df", "[", "field", "]", ".", "nunique", "(", ")", "except", "Exception", "as", "e", ":", "self", ".", "err", "(", "e", ",", "\"Can not count unique val...
Return the number of unique values in a column
[ "Return", "the", "number", "of", "unique", "values", "in", "a", "column" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/count.py#L72-L81
53,920
AntagonistHQ/openprovider.py
openprovider/modules/customer.py
CustomerModule.create_customer
def create_customer(self, name, gender, address, phone, email, vat=None, fax=None, company_name=None, additional_data=None, extension_additional_data=None): """Create a customer""" response = self.request(E.createCustomerRequest( E.companyName(company_name), ...
python
def create_customer(self, name, gender, address, phone, email, vat=None, fax=None, company_name=None, additional_data=None, extension_additional_data=None): """Create a customer""" response = self.request(E.createCustomerRequest( E.companyName(company_name), ...
[ "def", "create_customer", "(", "self", ",", "name", ",", "gender", ",", "address", ",", "phone", ",", "email", ",", "vat", "=", "None", ",", "fax", "=", "None", ",", "company_name", "=", "None", ",", "additional_data", "=", "None", ",", "extension_additi...
Create a customer
[ "Create", "a", "customer" ]
5871c3d5b3661e23667f147f49f20389c817a0a4
https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/customer.py#L45-L75
53,921
AntagonistHQ/openprovider.py
openprovider/modules/customer.py
CustomerModule.modify_customer
def modify_customer(self, handle, address, phone, email=None, vat=None, fax=None, company_name=None, additional_data=None, extension_additional_data=None): """Modify a customer.""" self.request(E.modifyCustomerRequest( E.handle(handle), E.vat(vat or ''), ...
python
def modify_customer(self, handle, address, phone, email=None, vat=None, fax=None, company_name=None, additional_data=None, extension_additional_data=None): """Modify a customer.""" self.request(E.modifyCustomerRequest( E.handle(handle), E.vat(vat or ''), ...
[ "def", "modify_customer", "(", "self", ",", "handle", ",", "address", ",", "phone", ",", "email", "=", "None", ",", "vat", "=", "None", ",", "fax", "=", "None", ",", "company_name", "=", "None", ",", "additional_data", "=", "None", ",", "extension_additi...
Modify a customer.
[ "Modify", "a", "customer", "." ]
5871c3d5b3661e23667f147f49f20389c817a0a4
https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/customer.py#L84-L107
53,922
AntagonistHQ/openprovider.py
openprovider/modules/customer.py
CustomerModule.search_customer
def search_customer(self, limit=100, offset=0, email_pattern=None, last_name_pattern=None, company_name_pattern=None, with_additional_data=False): """Search the list of customers.""" response = self.request(E.searchCustomerRequest( E.limit(limit), E.offset(offset), ...
python
def search_customer(self, limit=100, offset=0, email_pattern=None, last_name_pattern=None, company_name_pattern=None, with_additional_data=False): """Search the list of customers.""" response = self.request(E.searchCustomerRequest( E.limit(limit), E.offset(offset), ...
[ "def", "search_customer", "(", "self", ",", "limit", "=", "100", ",", "offset", "=", "0", ",", "email_pattern", "=", "None", ",", "last_name_pattern", "=", "None", ",", "company_name_pattern", "=", "None", ",", "with_additional_data", "=", "False", ")", ":",...
Search the list of customers.
[ "Search", "the", "list", "of", "customers", "." ]
5871c3d5b3661e23667f147f49f20389c817a0a4
https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/customer.py#L109-L122
53,923
AntagonistHQ/openprovider.py
openprovider/modules/customer.py
CustomerModule.retrieve_customer
def retrieve_customer(self, handle, with_additional_data=False): """Retrieve information of an existing customer.""" response = self.request(E.retrieveCustomerRequest( E.handle(handle), E.withAdditionalData(int(with_additional_data)), )) return response.as_model...
python
def retrieve_customer(self, handle, with_additional_data=False): """Retrieve information of an existing customer.""" response = self.request(E.retrieveCustomerRequest( E.handle(handle), E.withAdditionalData(int(with_additional_data)), )) return response.as_model...
[ "def", "retrieve_customer", "(", "self", ",", "handle", ",", "with_additional_data", "=", "False", ")", ":", "response", "=", "self", ".", "request", "(", "E", ".", "retrieveCustomerRequest", "(", "E", ".", "handle", "(", "handle", ")", ",", "E", ".", "w...
Retrieve information of an existing customer.
[ "Retrieve", "information", "of", "an", "existing", "customer", "." ]
5871c3d5b3661e23667f147f49f20389c817a0a4
https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/customer.py#L124-L132
53,924
gmr/tinman
tinman/utils.py
import_namespaced_class
def import_namespaced_class(path): """Pass in a string in the format of foo.Bar, foo.bar.Baz, foo.bar.baz.Qux and it will return a handle to the class :param str path: The object path :rtype: class """ parts = path.split('.') return getattr(importlib.import_module('.'.join(parts[0:-1])), p...
python
def import_namespaced_class(path): """Pass in a string in the format of foo.Bar, foo.bar.Baz, foo.bar.baz.Qux and it will return a handle to the class :param str path: The object path :rtype: class """ parts = path.split('.') return getattr(importlib.import_module('.'.join(parts[0:-1])), p...
[ "def", "import_namespaced_class", "(", "path", ")", ":", "parts", "=", "path", ".", "split", "(", "'.'", ")", "return", "getattr", "(", "importlib", ".", "import_module", "(", "'.'", ".", "join", "(", "parts", "[", "0", ":", "-", "1", "]", ")", ")", ...
Pass in a string in the format of foo.Bar, foo.bar.Baz, foo.bar.baz.Qux and it will return a handle to the class :param str path: The object path :rtype: class
[ "Pass", "in", "a", "string", "in", "the", "format", "of", "foo", ".", "Bar", "foo", ".", "bar", ".", "Baz", "foo", ".", "bar", ".", "baz", ".", "Qux", "and", "it", "will", "return", "a", "handle", "to", "the", "class" ]
98f0acd15a228d752caa1864cdf02aaa3d492a9f
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/utils.py#L29-L38
53,925
wummel/dosage
dosagelib/loader.py
get_modules
def get_modules(folder): """Find all valid modules in the given folder which must be in in the same directory as this loader.py module. A valid module has a .py extension, and is importable. @return: all loaded valid modules @rtype: iterator of module """ if is_frozen(): # find modul...
python
def get_modules(folder): """Find all valid modules in the given folder which must be in in the same directory as this loader.py module. A valid module has a .py extension, and is importable. @return: all loaded valid modules @rtype: iterator of module """ if is_frozen(): # find modul...
[ "def", "get_modules", "(", "folder", ")", ":", "if", "is_frozen", "(", ")", ":", "# find modules in library.zip filename", "zipname", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "parentmodule", ...
Find all valid modules in the given folder which must be in in the same directory as this loader.py module. A valid module has a .py extension, and is importable. @return: all loaded valid modules @rtype: iterator of module
[ "Find", "all", "valid", "modules", "in", "the", "given", "folder", "which", "must", "be", "in", "in", "the", "same", "directory", "as", "this", "loader", ".", "py", "module", ".", "A", "valid", "module", "has", "a", ".", "py", "extension", "and", "is",...
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/loader.py#L23-L47
53,926
wummel/dosage
dosagelib/loader.py
get_plugins
def get_plugins(modules, classobj): """Find all class objects in all modules. @param modules: the modules to search @ptype modules: iterator of modules @return: found classes @rytpe: iterator of class objects """ for module in modules: for plugin in get_module_plugins(module, classob...
python
def get_plugins(modules, classobj): """Find all class objects in all modules. @param modules: the modules to search @ptype modules: iterator of modules @return: found classes @rytpe: iterator of class objects """ for module in modules: for plugin in get_module_plugins(module, classob...
[ "def", "get_plugins", "(", "modules", ",", "classobj", ")", ":", "for", "module", "in", "modules", ":", "for", "plugin", "in", "get_module_plugins", "(", "module", ",", "classobj", ")", ":", "yield", "plugin" ]
Find all class objects in all modules. @param modules: the modules to search @ptype modules: iterator of modules @return: found classes @rytpe: iterator of class objects
[ "Find", "all", "class", "objects", "in", "all", "modules", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/loader.py#L61-L70
53,927
synw/dataswim
dataswim/report.py
Report.stack
def stack(self, slug, chart_obj=None, title=None): """ Get the html for a chart and store it """ if chart_obj is None: if self.chart_obj is None: self.err( self.stack, "No chart object set: please provide one in paramete...
python
def stack(self, slug, chart_obj=None, title=None): """ Get the html for a chart and store it """ if chart_obj is None: if self.chart_obj is None: self.err( self.stack, "No chart object set: please provide one in paramete...
[ "def", "stack", "(", "self", ",", "slug", ",", "chart_obj", "=", "None", ",", "title", "=", "None", ")", ":", "if", "chart_obj", "is", "None", ":", "if", "self", ".", "chart_obj", "is", "None", ":", "self", ".", "err", "(", "self", ".", "stack", ...
Get the html for a chart and store it
[ "Get", "the", "html", "for", "a", "chart", "and", "store", "it" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/report.py#L21-L55
53,928
synw/dataswim
dataswim/report.py
Report.to_file
def to_file(self, slug, folderpath=None, header=None, footer=None): """ Writes the html report to a file from the report stack """ if folderpath is None: if self.report_path is None: self.err( "Please set the report_path parameter or pass a...
python
def to_file(self, slug, folderpath=None, header=None, footer=None): """ Writes the html report to a file from the report stack """ if folderpath is None: if self.report_path is None: self.err( "Please set the report_path parameter or pass a...
[ "def", "to_file", "(", "self", ",", "slug", ",", "folderpath", "=", "None", ",", "header", "=", "None", ",", "footer", "=", "None", ")", ":", "if", "folderpath", "is", "None", ":", "if", "self", ".", "report_path", "is", "None", ":", "self", ".", "...
Writes the html report to a file from the report stack
[ "Writes", "the", "html", "report", "to", "a", "file", "from", "the", "report", "stack" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/report.py#L57-L89
53,929
synw/dataswim
dataswim/report.py
Report.to_files
def to_files(self, folderpath=None): """ Writes the html report to one file per report """ if len(self.reports) == 0: self.warning( "No charts to save. Use stack to add charts for saving") return if folderpath is None: if self.r...
python
def to_files(self, folderpath=None): """ Writes the html report to one file per report """ if len(self.reports) == 0: self.warning( "No charts to save. Use stack to add charts for saving") return if folderpath is None: if self.r...
[ "def", "to_files", "(", "self", ",", "folderpath", "=", "None", ")", ":", "if", "len", "(", "self", ".", "reports", ")", "==", "0", ":", "self", ".", "warning", "(", "\"No charts to save. Use stack to add charts for saving\"", ")", "return", "if", "folderpath"...
Writes the html report to one file per report
[ "Writes", "the", "html", "report", "to", "one", "file", "per", "report" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/report.py#L91-L131
53,930
synw/dataswim
dataswim/report.py
Report.get_html
def get_html(self, chart_obj=None, slug=None): """ Get the html and script tag for a chart """ if chart_obj is None: if self.chart_obj is None: self.err( "No chart object registered, please provide " "one in parameters" ...
python
def get_html(self, chart_obj=None, slug=None): """ Get the html and script tag for a chart """ if chart_obj is None: if self.chart_obj is None: self.err( "No chart object registered, please provide " "one in parameters" ...
[ "def", "get_html", "(", "self", ",", "chart_obj", "=", "None", ",", "slug", "=", "None", ")", ":", "if", "chart_obj", "is", "None", ":", "if", "self", ".", "chart_obj", "is", "None", ":", "self", ".", "err", "(", "\"No chart object registered, please provi...
Get the html and script tag for a chart
[ "Get", "the", "html", "and", "script", "tag", "for", "a", "chart" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/report.py#L133-L160
53,931
synw/dataswim
dataswim/report.py
Report._get_header
def _get_header(self, header): """ Gets the html header """ if header is None: html = self.header() else: html = header return html
python
def _get_header(self, header): """ Gets the html header """ if header is None: html = self.header() else: html = header return html
[ "def", "_get_header", "(", "self", ",", "header", ")", ":", "if", "header", "is", "None", ":", "html", "=", "self", ".", "header", "(", ")", "else", ":", "html", "=", "header", "return", "html" ]
Gets the html header
[ "Gets", "the", "html", "header" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/report.py#L162-L170
53,932
synw/dataswim
dataswim/report.py
Report._get_footer
def _get_footer(self, footer): """ Gets the html footer """ if footer is None: html = self.footer() else: html = footer return html
python
def _get_footer(self, footer): """ Gets the html footer """ if footer is None: html = self.footer() else: html = footer return html
[ "def", "_get_footer", "(", "self", ",", "footer", ")", ":", "if", "footer", "is", "None", ":", "html", "=", "self", ".", "footer", "(", ")", "else", ":", "html", "=", "footer", "return", "html" ]
Gets the html footer
[ "Gets", "the", "html", "footer" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/report.py#L172-L180
53,933
synw/dataswim
dataswim/report.py
Report._write_file
def _write_file(self, slug, folderpath, html): """ Writes a chart's html to a file """ # check directories if not os.path.isdir(folderpath): try: os.makedirs(folderpath) self.info("Creating directory " + folderpath) except E...
python
def _write_file(self, slug, folderpath, html): """ Writes a chart's html to a file """ # check directories if not os.path.isdir(folderpath): try: os.makedirs(folderpath) self.info("Creating directory " + folderpath) except E...
[ "def", "_write_file", "(", "self", ",", "slug", ",", "folderpath", ",", "html", ")", ":", "# check directories", "if", "not", "os", ".", "path", ".", "isdir", "(", "folderpath", ")", ":", "try", ":", "os", ".", "makedirs", "(", "folderpath", ")", "self...
Writes a chart's html to a file
[ "Writes", "a", "chart", "s", "html", "to", "a", "file" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/report.py#L182-L208
53,934
synw/dataswim
dataswim/report.py
Report.title
def title(self, txt): """ Prints a title for pipelines """ num = len(txt) ticks = "=" * num print(ticks) print(txt) print(ticks)
python
def title(self, txt): """ Prints a title for pipelines """ num = len(txt) ticks = "=" * num print(ticks) print(txt) print(ticks)
[ "def", "title", "(", "self", ",", "txt", ")", ":", "num", "=", "len", "(", "txt", ")", "ticks", "=", "\"=\"", "*", "num", "print", "(", "ticks", ")", "print", "(", "txt", ")", "print", "(", "ticks", ")" ]
Prints a title for pipelines
[ "Prints", "a", "title", "for", "pipelines" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/report.py#L239-L247
53,935
synw/dataswim
dataswim/report.py
Report.subtitle
def subtitle(self, txt): """ Prints a subtitle for pipelines """ num = len(txt) ticks = "-" * num print(txt) print(ticks)
python
def subtitle(self, txt): """ Prints a subtitle for pipelines """ num = len(txt) ticks = "-" * num print(txt) print(ticks)
[ "def", "subtitle", "(", "self", ",", "txt", ")", ":", "num", "=", "len", "(", "txt", ")", "ticks", "=", "\"-\"", "*", "num", "print", "(", "txt", ")", "print", "(", "ticks", ")" ]
Prints a subtitle for pipelines
[ "Prints", "a", "subtitle", "for", "pipelines" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/report.py#L249-L256
53,936
gmr/tinman
tinman/process.py
Process.create_application
def create_application(self): """Create and return a new instance of tinman.application.Application""" return application.Application(self.settings, self.namespace.routes, self.port)
python
def create_application(self): """Create and return a new instance of tinman.application.Application""" return application.Application(self.settings, self.namespace.routes, self.port)
[ "def", "create_application", "(", "self", ")", ":", "return", "application", ".", "Application", "(", "self", ".", "settings", ",", "self", ".", "namespace", ".", "routes", ",", "self", ".", "port", ")" ]
Create and return a new instance of tinman.application.Application
[ "Create", "and", "return", "a", "new", "instance", "of", "tinman", ".", "application", ".", "Application" ]
98f0acd15a228d752caa1864cdf02aaa3d492a9f
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/process.py#L49-L53
53,937
gmr/tinman
tinman/process.py
Process.http_config
def http_config(self): """Return a dictionary of HTTPServer arguments using the default values as specified in the HTTPServer class docstrings if no values are specified. :param dict config: The HTTPServer specific section of the config :rtype: dict """ return {...
python
def http_config(self): """Return a dictionary of HTTPServer arguments using the default values as specified in the HTTPServer class docstrings if no values are specified. :param dict config: The HTTPServer specific section of the config :rtype: dict """ return {...
[ "def", "http_config", "(", "self", ")", ":", "return", "{", "config", ".", "NO_KEEP_ALIVE", ":", "self", ".", "namespace", ".", "server", ".", "get", "(", "config", ".", "NO_KEEP_ALIVE", ",", "False", ")", ",", "config", ".", "SSL_OPTIONS", ":", "self", ...
Return a dictionary of HTTPServer arguments using the default values as specified in the HTTPServer class docstrings if no values are specified. :param dict config: The HTTPServer specific section of the config :rtype: dict
[ "Return", "a", "dictionary", "of", "HTTPServer", "arguments", "using", "the", "default", "values", "as", "specified", "in", "the", "HTTPServer", "class", "docstrings", "if", "no", "values", "are", "specified", "." ]
98f0acd15a228d752caa1864cdf02aaa3d492a9f
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/process.py#L64-L77
53,938
gmr/tinman
tinman/process.py
Process.on_sigabrt
def on_sigabrt(self, signal_unused, frame_unused): """Stop the HTTP Server and IO Loop, shutting down the process :param int signal_unused: Unused signal number :param frame frame_unused: Unused frame the signal was caught in """ LOGGER.info('Stopping HTTP Server and IOLoop') ...
python
def on_sigabrt(self, signal_unused, frame_unused): """Stop the HTTP Server and IO Loop, shutting down the process :param int signal_unused: Unused signal number :param frame frame_unused: Unused frame the signal was caught in """ LOGGER.info('Stopping HTTP Server and IOLoop') ...
[ "def", "on_sigabrt", "(", "self", ",", "signal_unused", ",", "frame_unused", ")", ":", "LOGGER", ".", "info", "(", "'Stopping HTTP Server and IOLoop'", ")", "self", ".", "http_server", ".", "stop", "(", ")", "self", ".", "ioloop", ".", "stop", "(", ")" ]
Stop the HTTP Server and IO Loop, shutting down the process :param int signal_unused: Unused signal number :param frame frame_unused: Unused frame the signal was caught in
[ "Stop", "the", "HTTP", "Server", "and", "IO", "Loop", "shutting", "down", "the", "process" ]
98f0acd15a228d752caa1864cdf02aaa3d492a9f
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/process.py#L79-L88
53,939
gmr/tinman
tinman/process.py
Process.on_sighup
def on_sighup(self, signal_unused, frame_unused): """Reload the configuration :param int signal_unused: Unused signal number :param frame frame_unused: Unused frame the signal was caught in """ # Update HTTP configuration for setting in self.http_config: if ...
python
def on_sighup(self, signal_unused, frame_unused): """Reload the configuration :param int signal_unused: Unused signal number :param frame frame_unused: Unused frame the signal was caught in """ # Update HTTP configuration for setting in self.http_config: if ...
[ "def", "on_sighup", "(", "self", ",", "signal_unused", ",", "frame_unused", ")", ":", "# Update HTTP configuration", "for", "setting", "in", "self", ".", "http_config", ":", "if", "getattr", "(", "self", ".", "http_server", ",", "setting", ")", "!=", "self", ...
Reload the configuration :param int signal_unused: Unused signal number :param frame frame_unused: Unused frame the signal was caught in
[ "Reload", "the", "configuration" ]
98f0acd15a228d752caa1864cdf02aaa3d492a9f
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/process.py#L90-L115
53,940
gmr/tinman
tinman/process.py
Process.run
def run(self): """Called when the process has started :param int port: The HTTP Server port """ LOGGER.debug('Initializing process') # Setup logging self.logging_config = self.setup_logging() # Register the signal handlers self.setup_signal_handlers() ...
python
def run(self): """Called when the process has started :param int port: The HTTP Server port """ LOGGER.debug('Initializing process') # Setup logging self.logging_config = self.setup_logging() # Register the signal handlers self.setup_signal_handlers() ...
[ "def", "run", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "'Initializing process'", ")", "# Setup logging", "self", ".", "logging_config", "=", "self", ".", "setup_logging", "(", ")", "# Register the signal handlers", "self", ".", "setup_signal_handlers", ...
Called when the process has started :param int port: The HTTP Server port
[ "Called", "when", "the", "process", "has", "started" ]
98f0acd15a228d752caa1864cdf02aaa3d492a9f
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/process.py#L117-L147
53,941
gmr/tinman
tinman/process.py
Process.setup_signal_handlers
def setup_signal_handlers(self): """Called when a child process is spawned to register the signal handlers """ LOGGER.debug('Registering signal handlers') signal.signal(signal.SIGABRT, self.on_sigabrt)
python
def setup_signal_handlers(self): """Called when a child process is spawned to register the signal handlers """ LOGGER.debug('Registering signal handlers') signal.signal(signal.SIGABRT, self.on_sigabrt)
[ "def", "setup_signal_handlers", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "'Registering signal handlers'", ")", "signal", ".", "signal", "(", "signal", ".", "SIGABRT", ",", "self", ".", "on_sigabrt", ")" ]
Called when a child process is spawned to register the signal handlers
[ "Called", "when", "a", "child", "process", "is", "spawned", "to", "register", "the", "signal", "handlers" ]
98f0acd15a228d752caa1864cdf02aaa3d492a9f
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/process.py#L170-L176
53,942
gmr/tinman
tinman/process.py
Process.ssl_options
def ssl_options(self): """Check the config to see if SSL configuration options have been passed and replace none, option, and required with the correct values in the certreqs attribute if it is specified. :rtype: dict """ opts = self.namespace.server.get(config.SSL_OPTI...
python
def ssl_options(self): """Check the config to see if SSL configuration options have been passed and replace none, option, and required with the correct values in the certreqs attribute if it is specified. :rtype: dict """ opts = self.namespace.server.get(config.SSL_OPTI...
[ "def", "ssl_options", "(", "self", ")", ":", "opts", "=", "self", ".", "namespace", ".", "server", ".", "get", "(", "config", ".", "SSL_OPTIONS", ")", "or", "dict", "(", ")", "if", "config", ".", "CERT_REQS", "in", "opts", ":", "opts", "[", "config",...
Check the config to see if SSL configuration options have been passed and replace none, option, and required with the correct values in the certreqs attribute if it is specified. :rtype: dict
[ "Check", "the", "config", "to", "see", "if", "SSL", "configuration", "options", "have", "been", "passed", "and", "replace", "none", "option", "and", "required", "with", "the", "correct", "values", "in", "the", "certreqs", "attribute", "if", "it", "is", "spec...
98f0acd15a228d752caa1864cdf02aaa3d492a9f
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/process.py#L179-L191
53,943
gmr/tinman
tinman/process.py
Process.start_http_server
def start_http_server(self, port, args): """Start the HTTPServer :param int port: The port to run the HTTPServer on :param dict args: Dictionary of arguments for HTTPServer :rtype: tornado.httpserver.HTTPServer """ # Start the HTTP Server LOGGER.info("Starting T...
python
def start_http_server(self, port, args): """Start the HTTPServer :param int port: The port to run the HTTPServer on :param dict args: Dictionary of arguments for HTTPServer :rtype: tornado.httpserver.HTTPServer """ # Start the HTTP Server LOGGER.info("Starting T...
[ "def", "start_http_server", "(", "self", ",", "port", ",", "args", ")", ":", "# Start the HTTP Server", "LOGGER", ".", "info", "(", "\"Starting Tornado v%s HTTPServer on port %i Args: %r\"", ",", "tornado_version", ",", "port", ",", "args", ")", "http_server", "=", ...
Start the HTTPServer :param int port: The port to run the HTTPServer on :param dict args: Dictionary of arguments for HTTPServer :rtype: tornado.httpserver.HTTPServer
[ "Start", "the", "HTTPServer" ]
98f0acd15a228d752caa1864cdf02aaa3d492a9f
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/process.py#L193-L207
53,944
misli/django-cms-articles
cms_articles/utils/__init__.py
is_valid_article_slug
def is_valid_article_slug(article, language, slug): """Validates given slug depending on settings. """ from ..models import Title qs = Title.objects.filter(slug=slug, language=language) if article.pk: qs = qs.exclude(Q(language=language) & Q(article=article)) qs = qs.exclude(articl...
python
def is_valid_article_slug(article, language, slug): """Validates given slug depending on settings. """ from ..models import Title qs = Title.objects.filter(slug=slug, language=language) if article.pk: qs = qs.exclude(Q(language=language) & Q(article=article)) qs = qs.exclude(articl...
[ "def", "is_valid_article_slug", "(", "article", ",", "language", ",", "slug", ")", ":", "from", ".", ".", "models", "import", "Title", "qs", "=", "Title", ".", "objects", ".", "filter", "(", "slug", "=", "slug", ",", "language", "=", "language", ")", "...
Validates given slug depending on settings.
[ "Validates", "given", "slug", "depending", "on", "settings", "." ]
d96ac77e049022deb4c70d268e4eab74d175145c
https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/utils/__init__.py#L4-L18
53,945
ska-sa/hypercube
hypercube/util/__init__.py
array_bytes
def array_bytes(array): """ Estimates the memory of the supplied array in bytes """ return np.product(array.shape)*np.dtype(array.dtype).itemsize
python
def array_bytes(array): """ Estimates the memory of the supplied array in bytes """ return np.product(array.shape)*np.dtype(array.dtype).itemsize
[ "def", "array_bytes", "(", "array", ")", ":", "return", "np", ".", "product", "(", "array", ".", "shape", ")", "*", "np", ".", "dtype", "(", "array", ".", "dtype", ")", ".", "itemsize" ]
Estimates the memory of the supplied array in bytes
[ "Estimates", "the", "memory", "of", "the", "supplied", "array", "in", "bytes" ]
6564a9e65ccd9ed7e7a71bd643f183e1ec645b29
https://github.com/ska-sa/hypercube/blob/6564a9e65ccd9ed7e7a71bd643f183e1ec645b29/hypercube/util/__init__.py#L26-L28
53,946
ska-sa/hypercube
hypercube/util/__init__.py
reify_arrays
def reify_arrays(arrays, dims, copy=True): """ Reify arrays, given the supplied dimensions. If copy is True, returns a copy of arrays else performs this inplace. """ arrays = ({ k : AttrDict(**a) for k, a in arrays.iteritems() } if copy else arrays) for n, a in arrays.iteritems(): ...
python
def reify_arrays(arrays, dims, copy=True): """ Reify arrays, given the supplied dimensions. If copy is True, returns a copy of arrays else performs this inplace. """ arrays = ({ k : AttrDict(**a) for k, a in arrays.iteritems() } if copy else arrays) for n, a in arrays.iteritems(): ...
[ "def", "reify_arrays", "(", "arrays", ",", "dims", ",", "copy", "=", "True", ")", ":", "arrays", "=", "(", "{", "k", ":", "AttrDict", "(", "*", "*", "a", ")", "for", "k", ",", "a", "in", "arrays", ".", "iteritems", "(", ")", "}", "if", "copy", ...
Reify arrays, given the supplied dimensions. If copy is True, returns a copy of arrays else performs this inplace.
[ "Reify", "arrays", "given", "the", "supplied", "dimensions", ".", "If", "copy", "is", "True", "returns", "a", "copy", "of", "arrays", "else", "performs", "this", "inplace", "." ]
6564a9e65ccd9ed7e7a71bd643f183e1ec645b29
https://github.com/ska-sa/hypercube/blob/6564a9e65ccd9ed7e7a71bd643f183e1ec645b29/hypercube/util/__init__.py#L51-L63
53,947
danpoland/pyramid-restful-framework
pyramid_restful/views.py
APIView.check_object_permissions
def check_object_permissions(self, request, obj): """ Check if the request should be permitted for a given object. Raises an appropriate exception if the request is not permitted. :param request: Pyramid Request object. :param obj: The SQLAlchemy model instance that permissions ...
python
def check_object_permissions(self, request, obj): """ Check if the request should be permitted for a given object. Raises an appropriate exception if the request is not permitted. :param request: Pyramid Request object. :param obj: The SQLAlchemy model instance that permissions ...
[ "def", "check_object_permissions", "(", "self", ",", "request", ",", "obj", ")", ":", "for", "permission", "in", "self", ".", "get_permissions", "(", ")", ":", "if", "not", "permission", ".", "has_object_permission", "(", "request", ",", "self", ",", "obj", ...
Check if the request should be permitted for a given object. Raises an appropriate exception if the request is not permitted. :param request: Pyramid Request object. :param obj: The SQLAlchemy model instance that permissions will be evaluated against.
[ "Check", "if", "the", "request", "should", "be", "permitted", "for", "a", "given", "object", ".", "Raises", "an", "appropriate", "exception", "if", "the", "request", "is", "not", "permitted", "." ]
4d8c9db44b1869c3d1fdd59ca304c3166473fcbb
https://github.com/danpoland/pyramid-restful-framework/blob/4d8c9db44b1869c3d1fdd59ca304c3166473fcbb/pyramid_restful/views.py#L96-L107
53,948
danpoland/pyramid-restful-framework
pyramid_restful/views.py
APIView.options
def options(self, request, *args, **kwargs): """ Handles responding to requests for the OPTIONS HTTP verb. """ response = Response() response.headers['Allow'] = ', '.join(self.allowed_methods) response.headers['Content-Length'] = '0' return response
python
def options(self, request, *args, **kwargs): """ Handles responding to requests for the OPTIONS HTTP verb. """ response = Response() response.headers['Allow'] = ', '.join(self.allowed_methods) response.headers['Content-Length'] = '0' return response
[ "def", "options", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "Response", "(", ")", "response", ".", "headers", "[", "'Allow'", "]", "=", "', '", ".", "join", "(", "self", ".", "allowed_methods",...
Handles responding to requests for the OPTIONS HTTP verb.
[ "Handles", "responding", "to", "requests", "for", "the", "OPTIONS", "HTTP", "verb", "." ]
4d8c9db44b1869c3d1fdd59ca304c3166473fcbb
https://github.com/danpoland/pyramid-restful-framework/blob/4d8c9db44b1869c3d1fdd59ca304c3166473fcbb/pyramid_restful/views.py#L113-L123
53,949
wummel/dosage
dosagelib/plugins/a.py
AstronomyPOTD.shouldSkipUrl
def shouldSkipUrl(self, url, data): """Skip pages without images.""" return url in ( self.stripUrl % '130217', # video self.stripUrl % '130218', # video self.stripUrl % '130226', # video self.stripUrl % '130424', # video )
python
def shouldSkipUrl(self, url, data): """Skip pages without images.""" return url in ( self.stripUrl % '130217', # video self.stripUrl % '130218', # video self.stripUrl % '130226', # video self.stripUrl % '130424', # video )
[ "def", "shouldSkipUrl", "(", "self", ",", "url", ",", "data", ")", ":", "return", "url", "in", "(", "self", ".", "stripUrl", "%", "'130217'", ",", "# video", "self", ".", "stripUrl", "%", "'130218'", ",", "# video", "self", ".", "stripUrl", "%", "'1302...
Skip pages without images.
[ "Skip", "pages", "without", "images", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/a.py#L299-L306
53,950
misli/django-cms-articles
cms_articles/admin/article.py
ArticleAdmin.get_urls
def get_urls(self): """Get the admin urls """ info = '%s_%s' % (self.model._meta.app_label, self.model._meta.model_name) def pat(regex, fn): return url(regex, self.admin_site.admin_view(fn), name='%s_%s' % (info, fn.__name__)) url_patterns = [ pat(r'^([0...
python
def get_urls(self): """Get the admin urls """ info = '%s_%s' % (self.model._meta.app_label, self.model._meta.model_name) def pat(regex, fn): return url(regex, self.admin_site.admin_view(fn), name='%s_%s' % (info, fn.__name__)) url_patterns = [ pat(r'^([0...
[ "def", "get_urls", "(", "self", ")", ":", "info", "=", "'%s_%s'", "%", "(", "self", ".", "model", ".", "_meta", ".", "app_label", ",", "self", ".", "model", ".", "_meta", ".", "model_name", ")", "def", "pat", "(", "regex", ",", "fn", ")", ":", "r...
Get the admin urls
[ "Get", "the", "admin", "urls" ]
d96ac77e049022deb4c70d268e4eab74d175145c
https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/admin/article.py#L102-L118
53,951
misli/django-cms-articles
cms_articles/admin/article.py
ArticleAdmin.get_form
def get_form(self, request, obj=None, **kwargs): """ Get ArticleForm for the Article model and modify its fields depending on the request. """ language = get_language_from_request(request) form = super(ArticleAdmin, self).get_form( request, obj, fo...
python
def get_form(self, request, obj=None, **kwargs): """ Get ArticleForm for the Article model and modify its fields depending on the request. """ language = get_language_from_request(request) form = super(ArticleAdmin, self).get_form( request, obj, fo...
[ "def", "get_form", "(", "self", ",", "request", ",", "obj", "=", "None", ",", "*", "*", "kwargs", ")", ":", "language", "=", "get_language_from_request", "(", "request", ")", "form", "=", "super", "(", "ArticleAdmin", ",", "self", ")", ".", "get_form", ...
Get ArticleForm for the Article model and modify its fields depending on the request.
[ "Get", "ArticleForm", "for", "the", "Article", "model", "and", "modify", "its", "fields", "depending", "on", "the", "request", "." ]
d96ac77e049022deb4c70d268e4eab74d175145c
https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/admin/article.py#L140-L175
53,952
misli/django-cms-articles
cms_articles/admin/article.py
ArticleAdmin.unpublish
def unpublish(self, request, article_id, language): """ Publish or unpublish a language of a article """ article = get_object_or_404(self.model, pk=article_id) if not article.has_publish_permission(request): return HttpResponseForbidden(force_text(_('You do not have p...
python
def unpublish(self, request, article_id, language): """ Publish or unpublish a language of a article """ article = get_object_or_404(self.model, pk=article_id) if not article.has_publish_permission(request): return HttpResponseForbidden(force_text(_('You do not have p...
[ "def", "unpublish", "(", "self", ",", "request", ",", "article_id", ",", "language", ")", ":", "article", "=", "get_object_or_404", "(", "self", ".", "model", ",", "pk", "=", "article_id", ")", "if", "not", "article", ".", "has_publish_permission", "(", "r...
Publish or unpublish a language of a article
[ "Publish", "or", "unpublish", "a", "language", "of", "a", "article" ]
d96ac77e049022deb4c70d268e4eab74d175145c
https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/admin/article.py#L306-L341
53,953
misli/django-cms-articles
cms_articles/admin/article.py
ArticleAdmin.preview_article
def preview_article(self, request, object_id, language): """Redirecting preview function based on draft_id """ article = get_object_or_404(self.model, id=object_id) attrs = '?%s' % get_cms_setting('CMS_TOOLBAR_URL__EDIT_ON') attrs += '&language=' + language with force_lan...
python
def preview_article(self, request, object_id, language): """Redirecting preview function based on draft_id """ article = get_object_or_404(self.model, id=object_id) attrs = '?%s' % get_cms_setting('CMS_TOOLBAR_URL__EDIT_ON') attrs += '&language=' + language with force_lan...
[ "def", "preview_article", "(", "self", ",", "request", ",", "object_id", ",", "language", ")", ":", "article", "=", "get_object_or_404", "(", "self", ".", "model", ",", "id", "=", "object_id", ")", "attrs", "=", "'?%s'", "%", "get_cms_setting", "(", "'CMS_...
Redirecting preview function based on draft_id
[ "Redirecting", "preview", "function", "based", "on", "draft_id" ]
d96ac77e049022deb4c70d268e4eab74d175145c
https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/admin/article.py#L439-L447
53,954
synw/dataswim
dataswim/db/influxdb/__init__.py
InfluxDb.influx_init
def influx_init(self, url, port, user, pwd, db): """ Initialize an Influxdb database client """ try: cli = DataFrameClient(url, port, user, pwd, db) self.influx_cli = cli except Exception as e: self.err(e, self.influx_init, ...
python
def influx_init(self, url, port, user, pwd, db): """ Initialize an Influxdb database client """ try: cli = DataFrameClient(url, port, user, pwd, db) self.influx_cli = cli except Exception as e: self.err(e, self.influx_init, ...
[ "def", "influx_init", "(", "self", ",", "url", ",", "port", ",", "user", ",", "pwd", ",", "db", ")", ":", "try", ":", "cli", "=", "DataFrameClient", "(", "url", ",", "port", ",", "user", ",", "pwd", ",", "db", ")", "self", ".", "influx_cli", "=",...
Initialize an Influxdb database client
[ "Initialize", "an", "Influxdb", "database", "client" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/db/influxdb/__init__.py#L15-L24
53,955
synw/dataswim
dataswim/db/influxdb/__init__.py
InfluxDb.influx_query_
def influx_query_(self, q): """ Runs an Influx db query """ if self.influx_cli is None: self.err( self.influx_query_, "No database connected. Please initialize a connection") return try: return self.influx_cli.qu...
python
def influx_query_(self, q): """ Runs an Influx db query """ if self.influx_cli is None: self.err( self.influx_query_, "No database connected. Please initialize a connection") return try: return self.influx_cli.qu...
[ "def", "influx_query_", "(", "self", ",", "q", ")", ":", "if", "self", ".", "influx_cli", "is", "None", ":", "self", ".", "err", "(", "self", ".", "influx_query_", ",", "\"No database connected. Please initialize a connection\"", ")", "return", "try", ":", "re...
Runs an Influx db query
[ "Runs", "an", "Influx", "db", "query" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/db/influxdb/__init__.py#L26-L39
53,956
synw/dataswim
dataswim/db/influxdb/__init__.py
InfluxDb.influx_count_
def influx_count_(self, measurement): """ Count the number of rows for a measurement """ try: q = "select count(*) from " + measurement self.start("Querying: count ...") datalen = self.influx_cli.query(q) self.end("Finished querying") ...
python
def influx_count_(self, measurement): """ Count the number of rows for a measurement """ try: q = "select count(*) from " + measurement self.start("Querying: count ...") datalen = self.influx_cli.query(q) self.end("Finished querying") ...
[ "def", "influx_count_", "(", "self", ",", "measurement", ")", ":", "try", ":", "q", "=", "\"select count(*) from \"", "+", "measurement", "self", ".", "start", "(", "\"Querying: count ...\"", ")", "datalen", "=", "self", ".", "influx_cli", ".", "query", "(", ...
Count the number of rows for a measurement
[ "Count", "the", "number", "of", "rows", "for", "a", "measurement" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/db/influxdb/__init__.py#L41-L54
53,957
synw/dataswim
dataswim/db/influxdb/__init__.py
InfluxDb.influx_to_csv
def influx_to_csv(self, measurement, batch_size=5000): """ Batch export data from an Influxdb measurement to csv """ if self.autoprint is True: print("Processing data from InfluxDb to csv") try: q = "select count(*) from " + measurement numrows...
python
def influx_to_csv(self, measurement, batch_size=5000): """ Batch export data from an Influxdb measurement to csv """ if self.autoprint is True: print("Processing data from InfluxDb to csv") try: q = "select count(*) from " + measurement numrows...
[ "def", "influx_to_csv", "(", "self", ",", "measurement", ",", "batch_size", "=", "5000", ")", ":", "if", "self", ".", "autoprint", "is", "True", ":", "print", "(", "\"Processing data from InfluxDb to csv\"", ")", "try", ":", "q", "=", "\"select count(*) from \""...
Batch export data from an Influxdb measurement to csv
[ "Batch", "export", "data", "from", "an", "Influxdb", "measurement", "to", "csv" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/db/influxdb/__init__.py#L56-L104
53,958
wummel/dosage
dosagelib/scraper.py
find_scraperclasses
def find_scraperclasses(comic, multiple_allowed=False): """Get a list comic scraper classes. Can return more than one entries if multiple_allowed is True, else it raises a ValueError if multiple modules match. The match is a case insensitive substring search.""" if not comic: raise ValueError("e...
python
def find_scraperclasses(comic, multiple_allowed=False): """Get a list comic scraper classes. Can return more than one entries if multiple_allowed is True, else it raises a ValueError if multiple modules match. The match is a case insensitive substring search.""" if not comic: raise ValueError("e...
[ "def", "find_scraperclasses", "(", "comic", ",", "multiple_allowed", "=", "False", ")", ":", "if", "not", "comic", ":", "raise", "ValueError", "(", "\"empty comic name\"", ")", "candidates", "=", "[", "]", "cname", "=", "comic", ".", "lower", "(", ")", "fo...
Get a list comic scraper classes. Can return more than one entries if multiple_allowed is True, else it raises a ValueError if multiple modules match. The match is a case insensitive substring search.
[ "Get", "a", "list", "comic", "scraper", "classes", ".", "Can", "return", "more", "than", "one", "entries", "if", "multiple_allowed", "is", "True", "else", "it", "raises", "a", "ValueError", "if", "multiple", "modules", "match", ".", "The", "match", "is", "...
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L484-L507
53,959
wummel/dosage
dosagelib/scraper.py
get_scraperclasses
def get_scraperclasses(): """Find all comic scraper classes in the plugins directory. The result is cached. @return: list of Scraper classes @rtype: list of Scraper """ global _scraperclasses if _scraperclasses is None: out.debug(u"Loading comic modules...") modules = loader....
python
def get_scraperclasses(): """Find all comic scraper classes in the plugins directory. The result is cached. @return: list of Scraper classes @rtype: list of Scraper """ global _scraperclasses if _scraperclasses is None: out.debug(u"Loading comic modules...") modules = loader....
[ "def", "get_scraperclasses", "(", ")", ":", "global", "_scraperclasses", "if", "_scraperclasses", "is", "None", ":", "out", ".", "debug", "(", "u\"Loading comic modules...\"", ")", "modules", "=", "loader", ".", "get_modules", "(", "'plugins'", ")", "plugins", "...
Find all comic scraper classes in the plugins directory. The result is cached. @return: list of Scraper classes @rtype: list of Scraper
[ "Find", "all", "comic", "scraper", "classes", "in", "the", "plugins", "directory", ".", "The", "result", "is", "cached", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L511-L525
53,960
wummel/dosage
dosagelib/scraper.py
check_scrapers
def check_scrapers(): """Check for duplicate scraper class names.""" d = {} for scraperclass in _scraperclasses: name = scraperclass.getName().lower() if name in d: name1 = scraperclass.getName() name2 = d[name].getName() raise ValueError('duplicate scrape...
python
def check_scrapers(): """Check for duplicate scraper class names.""" d = {} for scraperclass in _scraperclasses: name = scraperclass.getName().lower() if name in d: name1 = scraperclass.getName() name2 = d[name].getName() raise ValueError('duplicate scrape...
[ "def", "check_scrapers", "(", ")", ":", "d", "=", "{", "}", "for", "scraperclass", "in", "_scraperclasses", ":", "name", "=", "scraperclass", ".", "getName", "(", ")", ".", "lower", "(", ")", "if", "name", "in", "d", ":", "name1", "=", "scraperclass", ...
Check for duplicate scraper class names.
[ "Check", "for", "duplicate", "scraper", "class", "names", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L528-L537
53,961
wummel/dosage
dosagelib/scraper.py
Scraper.getComicStrip
def getComicStrip(self, url, data): """Get comic strip downloader for given URL and data.""" imageUrls = self.fetchUrls(url, data, self.imageSearch) # map modifier function on image URLs imageUrls = [self.imageUrlModifier(x, data) for x in imageUrls] # remove duplicate URLs ...
python
def getComicStrip(self, url, data): """Get comic strip downloader for given URL and data.""" imageUrls = self.fetchUrls(url, data, self.imageSearch) # map modifier function on image URLs imageUrls = [self.imageUrlModifier(x, data) for x in imageUrls] # remove duplicate URLs ...
[ "def", "getComicStrip", "(", "self", ",", "url", ",", "data", ")", ":", "imageUrls", "=", "self", ".", "fetchUrls", "(", "url", ",", "data", ",", "self", ".", "imageSearch", ")", "# map modifier function on image URLs", "imageUrls", "=", "[", "self", ".", ...
Get comic strip downloader for given URL and data.
[ "Get", "comic", "strip", "downloader", "for", "given", "URL", "and", "data", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L117-L135
53,962
wummel/dosage
dosagelib/scraper.py
Scraper.getStrips
def getStrips(self, maxstrips=None): """Get comic strips.""" if maxstrips: word = u"strip" if maxstrips == 1 else "strips" msg = u'Retrieving %d %s' % (maxstrips, word) else: msg = u'Retrieving all strips' if self.indexes: if len(self.index...
python
def getStrips(self, maxstrips=None): """Get comic strips.""" if maxstrips: word = u"strip" if maxstrips == 1 else "strips" msg = u'Retrieving %d %s' % (maxstrips, word) else: msg = u'Retrieving all strips' if self.indexes: if len(self.index...
[ "def", "getStrips", "(", "self", ",", "maxstrips", "=", "None", ")", ":", "if", "maxstrips", ":", "word", "=", "u\"strip\"", "if", "maxstrips", "==", "1", "else", "\"strips\"", "msg", "=", "u'Retrieving %d %s'", "%", "(", "maxstrips", ",", "word", ")", "...
Get comic strips.
[ "Get", "comic", "strips", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L137-L160
53,963
wummel/dosage
dosagelib/scraper.py
Scraper.getStripsFor
def getStripsFor(self, url, maxstrips): """Get comic strips for an URL. If maxstrips is a positive number, stop after retrieving the given number of strips.""" self.hitFirstStripUrl = False seen_urls = set() while url: out.info(u'Get strip URL %s' % url, level=1) ...
python
def getStripsFor(self, url, maxstrips): """Get comic strips for an URL. If maxstrips is a positive number, stop after retrieving the given number of strips.""" self.hitFirstStripUrl = False seen_urls = set() while url: out.info(u'Get strip URL %s' % url, level=1) ...
[ "def", "getStripsFor", "(", "self", ",", "url", ",", "maxstrips", ")", ":", "self", ".", "hitFirstStripUrl", "=", "False", "seen_urls", "=", "set", "(", ")", "while", "url", ":", "out", ".", "info", "(", "u'Get strip URL %s'", "%", "url", ",", "level", ...
Get comic strips for an URL. If maxstrips is a positive number, stop after retrieving the given number of strips.
[ "Get", "comic", "strips", "for", "an", "URL", ".", "If", "maxstrips", "is", "a", "positive", "number", "stop", "after", "retrieving", "the", "given", "number", "of", "strips", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L162-L196
53,964
wummel/dosage
dosagelib/scraper.py
Scraper.vote
def vote(cls): """Cast a public vote for this comic.""" url = configuration.VoteUrl + 'count/' uid = get_system_uid() data = {"name": cls.getName().replace('/', '_'), "uid": uid} page = urlopen(url, cls.session, data=data) return page.text
python
def vote(cls): """Cast a public vote for this comic.""" url = configuration.VoteUrl + 'count/' uid = get_system_uid() data = {"name": cls.getName().replace('/', '_'), "uid": uid} page = urlopen(url, cls.session, data=data) return page.text
[ "def", "vote", "(", "cls", ")", ":", "url", "=", "configuration", ".", "VoteUrl", "+", "'count/'", "uid", "=", "get_system_uid", "(", ")", "data", "=", "{", "\"name\"", ":", "cls", ".", "getName", "(", ")", ".", "replace", "(", "'/'", ",", "'_'", "...
Cast a public vote for this comic.
[ "Cast", "a", "public", "vote", "for", "this", "comic", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L255-L261
53,965
wummel/dosage
dosagelib/scraper.py
Scraper.getCompleteFile
def getCompleteFile(self, basepath): """Get filename indicating all comics are downloaded.""" dirname = getDirname(self.getName()) return os.path.join(basepath, dirname, "complete.txt")
python
def getCompleteFile(self, basepath): """Get filename indicating all comics are downloaded.""" dirname = getDirname(self.getName()) return os.path.join(basepath, dirname, "complete.txt")
[ "def", "getCompleteFile", "(", "self", ",", "basepath", ")", ":", "dirname", "=", "getDirname", "(", "self", ".", "getName", "(", ")", ")", "return", "os", ".", "path", ".", "join", "(", "basepath", ",", "dirname", ",", "\"complete.txt\"", ")" ]
Get filename indicating all comics are downloaded.
[ "Get", "filename", "indicating", "all", "comics", "are", "downloaded", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L263-L266
53,966
wummel/dosage
dosagelib/scraper.py
Scraper.setComplete
def setComplete(self, basepath): """Set complete flag for this comic, ie. all comics are downloaded.""" if self.endOfLife: filename = self.getCompleteFile(basepath) if not os.path.exists(filename): with open(filename, 'w') as f: f.write('All co...
python
def setComplete(self, basepath): """Set complete flag for this comic, ie. all comics are downloaded.""" if self.endOfLife: filename = self.getCompleteFile(basepath) if not os.path.exists(filename): with open(filename, 'w') as f: f.write('All co...
[ "def", "setComplete", "(", "self", ",", "basepath", ")", ":", "if", "self", ".", "endOfLife", ":", "filename", "=", "self", ".", "getCompleteFile", "(", "basepath", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "with", ...
Set complete flag for this comic, ie. all comics are downloaded.
[ "Set", "complete", "flag", "for", "this", "comic", "ie", ".", "all", "comics", "are", "downloaded", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L272-L278
53,967
wummel/dosage
dosagelib/scraper.py
Scraper.language
def language(cls): """ Return language of the comic as a human-readable language name instead of a 2-character ISO639-1 code. """ lang = 'Unknown (%s)' % cls.lang if pycountry is None: if cls.lang in languages.Languages: lang = languages.Langua...
python
def language(cls): """ Return language of the comic as a human-readable language name instead of a 2-character ISO639-1 code. """ lang = 'Unknown (%s)' % cls.lang if pycountry is None: if cls.lang in languages.Languages: lang = languages.Langua...
[ "def", "language", "(", "cls", ")", ":", "lang", "=", "'Unknown (%s)'", "%", "cls", ".", "lang", "if", "pycountry", "is", "None", ":", "if", "cls", ".", "lang", "in", "languages", ".", "Languages", ":", "lang", "=", "languages", ".", "Languages", "[", ...
Return language of the comic as a human-readable language name instead of a 2-character ISO639-1 code.
[ "Return", "language", "of", "the", "comic", "as", "a", "human", "-", "readable", "language", "name", "instead", "of", "a", "2", "-", "character", "ISO639", "-", "1", "code", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L318-L335
53,968
wummel/dosage
dosagelib/scraper.py
_BasicScraper.fetchText
def fetchText(cls, url, data, textSearch, optional): """Search text entry for given text pattern in a HTML page.""" if textSearch: match = textSearch.search(data[0]) if match: text = match.group(1) out.debug(u'matched text %r with pattern %s' % (te...
python
def fetchText(cls, url, data, textSearch, optional): """Search text entry for given text pattern in a HTML page.""" if textSearch: match = textSearch.search(data[0]) if match: text = match.group(1) out.debug(u'matched text %r with pattern %s' % (te...
[ "def", "fetchText", "(", "cls", ",", "url", ",", "data", ",", "textSearch", ",", "optional", ")", ":", "if", "textSearch", ":", "match", "=", "textSearch", ".", "search", "(", "data", "[", "0", "]", ")", "if", "match", ":", "text", "=", "match", "....
Search text entry for given text pattern in a HTML page.
[ "Search", "text", "entry", "for", "given", "text", "pattern", "in", "a", "HTML", "page", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L384-L397
53,969
wummel/dosage
dosagelib/scraper.py
_ParserScraper.fetchUrls
def fetchUrls(cls, url, data, urlSearch): """Search all entries for given XPath in a HTML page.""" searchUrls = [] if cls.css: searchFun = data.cssselect else: searchFun = data.xpath searches = makeSequence(urlSearch) for search in searches: ...
python
def fetchUrls(cls, url, data, urlSearch): """Search all entries for given XPath in a HTML page.""" searchUrls = [] if cls.css: searchFun = data.cssselect else: searchFun = data.xpath searches = makeSequence(urlSearch) for search in searches: ...
[ "def", "fetchUrls", "(", "cls", ",", "url", ",", "data", ",", "urlSearch", ")", ":", "searchUrls", "=", "[", "]", "if", "cls", ".", "css", ":", "searchFun", "=", "data", ".", "cssselect", "else", ":", "searchFun", "=", "data", ".", "xpath", "searches...
Search all entries for given XPath in a HTML page.
[ "Search", "all", "entries", "for", "given", "XPath", "in", "a", "HTML", "page", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L428-L449
53,970
wummel/dosage
dosagelib/scraper.py
_ParserScraper.fetchText
def fetchText(cls, url, data, textSearch, optional): """Search text entry for given text XPath in a HTML page.""" if cls.css: searchFun = data.cssselect else: searchFun = data.xpath if textSearch: text = '' for match in searchFun(textSearch...
python
def fetchText(cls, url, data, textSearch, optional): """Search text entry for given text XPath in a HTML page.""" if cls.css: searchFun = data.cssselect else: searchFun = data.xpath if textSearch: text = '' for match in searchFun(textSearch...
[ "def", "fetchText", "(", "cls", ",", "url", ",", "data", ",", "textSearch", ",", "optional", ")", ":", "if", "cls", ".", "css", ":", "searchFun", "=", "data", ".", "cssselect", "else", ":", "searchFun", "=", "data", ".", "xpath", "if", "textSearch", ...
Search text entry for given text XPath in a HTML page.
[ "Search", "text", "entry", "for", "given", "text", "XPath", "in", "a", "HTML", "page", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/scraper.py#L452-L473
53,971
synw/dataswim
dataswim/data/transform/resample.py
Resample.rsum
def rsum(self, time_period: str, num_col: str="Number", dateindex: str=None): """ Resample and add a sum the main dataframe to a time period :param time_period: unit + period: periods are Y, M, D, H, Min, S :param time_period: str :param num_col: number of the new column, defaults to "Number" :param num_co...
python
def rsum(self, time_period: str, num_col: str="Number", dateindex: str=None): """ Resample and add a sum the main dataframe to a time period :param time_period: unit + period: periods are Y, M, D, H, Min, S :param time_period: str :param num_col: number of the new column, defaults to "Number" :param num_co...
[ "def", "rsum", "(", "self", ",", "time_period", ":", "str", ",", "num_col", ":", "str", "=", "\"Number\"", ",", "dateindex", ":", "str", "=", "None", ")", ":", "try", ":", "df", "=", "self", ".", "_resample_", "(", "\"sum\"", ",", "time_period", ",",...
Resample and add a sum the main dataframe to a time period :param time_period: unit + period: periods are Y, M, D, H, Min, S :param time_period: str :param num_col: number of the new column, defaults to "Number" :param num_col: str, optional :param dateindex: column name to use as date index, defaults to Non...
[ "Resample", "and", "add", "a", "sum", "the", "main", "dataframe", "to", "a", "time", "period" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/transform/resample.py#L6-L26
53,972
wummel/dosage
dosagelib/events.py
addHandlerClass
def addHandlerClass(clazz): """Register handler class.""" if not issubclass(clazz, EventHandler): raise ValueError("%s must be subclassed from %s" % (clazz, EventHandler)) _handler_classes[clazz.name] = clazz
python
def addHandlerClass(clazz): """Register handler class.""" if not issubclass(clazz, EventHandler): raise ValueError("%s must be subclassed from %s" % (clazz, EventHandler)) _handler_classes[clazz.name] = clazz
[ "def", "addHandlerClass", "(", "clazz", ")", ":", "if", "not", "issubclass", "(", "clazz", ",", "EventHandler", ")", ":", "raise", "ValueError", "(", "\"%s must be subclassed from %s\"", "%", "(", "clazz", ",", "EventHandler", ")", ")", "_handler_classes", "[", ...
Register handler class.
[ "Register", "handler", "class", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L292-L296
53,973
wummel/dosage
dosagelib/events.py
addHandler
def addHandler(name, basepath=None, baseurl=None, allowDownscale=False): """Add an event handler with given name.""" if basepath is None: basepath = '.' _handlers.append(_handler_classes[name](basepath, baseurl, allowDownscale))
python
def addHandler(name, basepath=None, baseurl=None, allowDownscale=False): """Add an event handler with given name.""" if basepath is None: basepath = '.' _handlers.append(_handler_classes[name](basepath, baseurl, allowDownscale))
[ "def", "addHandler", "(", "name", ",", "basepath", "=", "None", ",", "baseurl", "=", "None", ",", "allowDownscale", "=", "False", ")", ":", "if", "basepath", "is", "None", ":", "basepath", "=", "'.'", "_handlers", ".", "append", "(", "_handler_classes", ...
Add an event handler with given name.
[ "Add", "an", "event", "handler", "with", "given", "name", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L310-L314
53,974
wummel/dosage
dosagelib/events.py
EventHandler.getUrlFromFilename
def getUrlFromFilename(self, filename): """Construct URL from filename.""" components = util.splitpath(util.getRelativePath(self.basepath, filename)) url = '/'.join([url_quote(component, '') for component in components]) return self.baseurl + url
python
def getUrlFromFilename(self, filename): """Construct URL from filename.""" components = util.splitpath(util.getRelativePath(self.basepath, filename)) url = '/'.join([url_quote(component, '') for component in components]) return self.baseurl + url
[ "def", "getUrlFromFilename", "(", "self", ",", "filename", ")", ":", "components", "=", "util", ".", "splitpath", "(", "util", ".", "getRelativePath", "(", "self", ".", "basepath", ",", "filename", ")", ")", "url", "=", "'/'", ".", "join", "(", "[", "u...
Construct URL from filename.
[ "Construct", "URL", "from", "filename", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L38-L42
53,975
wummel/dosage
dosagelib/events.py
RSSEventHandler.getFilename
def getFilename(self): """Return RSS filename.""" return os.path.abspath(os.path.join(self.basepath, 'dailydose.rss'))
python
def getFilename(self): """Return RSS filename.""" return os.path.abspath(os.path.join(self.basepath, 'dailydose.rss'))
[ "def", "getFilename", "(", "self", ")", ":", "return", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "self", ".", "basepath", ",", "'dailydose.rss'", ")", ")" ]
Return RSS filename.
[ "Return", "RSS", "filename", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L66-L68
53,976
wummel/dosage
dosagelib/events.py
RSSEventHandler.start
def start(self): """Log start event.""" today = time.time() yesterday = today - 86400 today = time.localtime(today) yesterday = time.localtime(yesterday) link = configuration.Url self.rssfn = self.getFilename() if os.path.exists(self.rssfn): ...
python
def start(self): """Log start event.""" today = time.time() yesterday = today - 86400 today = time.localtime(today) yesterday = time.localtime(yesterday) link = configuration.Url self.rssfn = self.getFilename() if os.path.exists(self.rssfn): ...
[ "def", "start", "(", "self", ")", ":", "today", "=", "time", ".", "time", "(", ")", "yesterday", "=", "today", "-", "86400", "today", "=", "time", ".", "localtime", "(", "today", ")", "yesterday", "=", "time", ".", "localtime", "(", "yesterday", ")",...
Log start event.
[ "Log", "start", "event", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L70-L86
53,977
wummel/dosage
dosagelib/events.py
RSSEventHandler.comicDownloaded
def comicDownloaded(self, comic, filename, text=None): """Write RSS entry for downloaded comic.""" imageUrl = self.getUrlFromFilename(filename) size = None if self.allowdownscale: size = getDimensionForImage(filename, MaxImageSize) title = '%s - %s' % (comic.name, os....
python
def comicDownloaded(self, comic, filename, text=None): """Write RSS entry for downloaded comic.""" imageUrl = self.getUrlFromFilename(filename) size = None if self.allowdownscale: size = getDimensionForImage(filename, MaxImageSize) title = '%s - %s' % (comic.name, os....
[ "def", "comicDownloaded", "(", "self", ",", "comic", ",", "filename", ",", "text", "=", "None", ")", ":", "imageUrl", "=", "self", ".", "getUrlFromFilename", "(", "filename", ")", "size", "=", "None", "if", "self", ".", "allowdownscale", ":", "size", "="...
Write RSS entry for downloaded comic.
[ "Write", "RSS", "entry", "for", "downloaded", "comic", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L88-L114
53,978
wummel/dosage
dosagelib/events.py
HtmlEventHandler.fnFromDate
def fnFromDate(self, date): """Get filename from date.""" fn = time.strftime('comics-%Y%m%d', date) fn = os.path.join(self.basepath, 'html', fn + ".html") fn = os.path.abspath(fn) return fn
python
def fnFromDate(self, date): """Get filename from date.""" fn = time.strftime('comics-%Y%m%d', date) fn = os.path.join(self.basepath, 'html', fn + ".html") fn = os.path.abspath(fn) return fn
[ "def", "fnFromDate", "(", "self", ",", "date", ")", ":", "fn", "=", "time", ".", "strftime", "(", "'comics-%Y%m%d'", ",", "date", ")", "fn", "=", "os", ".", "path", ".", "join", "(", "self", ".", "basepath", ",", "'html'", ",", "fn", "+", "\".html\...
Get filename from date.
[ "Get", "filename", "from", "date", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L143-L148
53,979
wummel/dosage
dosagelib/events.py
HtmlEventHandler.start
def start(self): """Start HTML output.""" today = time.time() yesterday = today - 86400 tomorrow = today + 86400 today = time.localtime(today) yesterday = time.localtime(yesterday) tomorrow = time.localtime(tomorrow) fn = self.fnFromDate(today) if...
python
def start(self): """Start HTML output.""" today = time.time() yesterday = today - 86400 tomorrow = today + 86400 today = time.localtime(today) yesterday = time.localtime(yesterday) tomorrow = time.localtime(tomorrow) fn = self.fnFromDate(today) if...
[ "def", "start", "(", "self", ")", ":", "today", "=", "time", ".", "time", "(", ")", "yesterday", "=", "today", "-", "86400", "tomorrow", "=", "today", "+", "86400", "today", "=", "time", ".", "localtime", "(", "today", ")", "yesterday", "=", "time", ...
Start HTML output.
[ "Start", "HTML", "output", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L155-L198
53,980
wummel/dosage
dosagelib/events.py
HtmlEventHandler.comicDownloaded
def comicDownloaded(self, comic, filename, text=None): """Write HTML entry for downloaded comic.""" if self.lastComic != comic.name: self.newComic(comic) size = None if self.allowdownscale: size = getDimensionForImage(filename, MaxImageSize) imageUrl = sel...
python
def comicDownloaded(self, comic, filename, text=None): """Write HTML entry for downloaded comic.""" if self.lastComic != comic.name: self.newComic(comic) size = None if self.allowdownscale: size = getDimensionForImage(filename, MaxImageSize) imageUrl = sel...
[ "def", "comicDownloaded", "(", "self", ",", "comic", ",", "filename", ",", "text", "=", "None", ")", ":", "if", "self", ".", "lastComic", "!=", "comic", ".", "name", ":", "self", ".", "newComic", "(", "comic", ")", "size", "=", "None", "if", "self", ...
Write HTML entry for downloaded comic.
[ "Write", "HTML", "entry", "for", "downloaded", "comic", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L200-L218
53,981
wummel/dosage
dosagelib/events.py
HtmlEventHandler.newComic
def newComic(self, comic): """Start new comic list in HTML.""" if self.lastUrl is not None: self.html.write(u'</li>\n') if self.lastComic is not None: self.html.write(u'</ul>\n') self.html.write(u'<li>%s</li>\n' % comic.name) self.html.write(u'<ul>\n')
python
def newComic(self, comic): """Start new comic list in HTML.""" if self.lastUrl is not None: self.html.write(u'</li>\n') if self.lastComic is not None: self.html.write(u'</ul>\n') self.html.write(u'<li>%s</li>\n' % comic.name) self.html.write(u'<ul>\n')
[ "def", "newComic", "(", "self", ",", "comic", ")", ":", "if", "self", ".", "lastUrl", "is", "not", "None", ":", "self", ".", "html", ".", "write", "(", "u'</li>\\n'", ")", "if", "self", ".", "lastComic", "is", "not", "None", ":", "self", ".", "html...
Start new comic list in HTML.
[ "Start", "new", "comic", "list", "in", "HTML", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L220-L227
53,982
wummel/dosage
dosagelib/events.py
HtmlEventHandler.end
def end(self): """End HTML output.""" if self.lastUrl is not None: self.html.write(u'</li>\n') if self.lastComic is not None: self.html.write(u'</ul>\n') self.html.write(u'</ul>\n') self.addNavLinks() self.html.close()
python
def end(self): """End HTML output.""" if self.lastUrl is not None: self.html.write(u'</li>\n') if self.lastComic is not None: self.html.write(u'</ul>\n') self.html.write(u'</ul>\n') self.addNavLinks() self.html.close()
[ "def", "end", "(", "self", ")", ":", "if", "self", ".", "lastUrl", "is", "not", "None", ":", "self", ".", "html", ".", "write", "(", "u'</li>\\n'", ")", "if", "self", ".", "lastComic", "is", "not", "None", ":", "self", ".", "html", ".", "write", ...
End HTML output.
[ "End", "HTML", "output", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L229-L237
53,983
wummel/dosage
dosagelib/events.py
JSONEventHandler.jsonFn
def jsonFn(self, comic): """Get filename for the JSON file for a comic.""" fn = os.path.join(self.basepath, comic, 'dosage.json') fn = os.path.abspath(fn) return fn
python
def jsonFn(self, comic): """Get filename for the JSON file for a comic.""" fn = os.path.join(self.basepath, comic, 'dosage.json') fn = os.path.abspath(fn) return fn
[ "def", "jsonFn", "(", "self", ",", "comic", ")", ":", "fn", "=", "os", ".", "path", ".", "join", "(", "self", ".", "basepath", ",", "comic", ",", "'dosage.json'", ")", "fn", "=", "os", ".", "path", ".", "abspath", "(", "fn", ")", "return", "fn" ]
Get filename for the JSON file for a comic.
[ "Get", "filename", "for", "the", "JSON", "file", "for", "a", "comic", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L250-L254
53,984
wummel/dosage
dosagelib/events.py
JSONEventHandler.getComicData
def getComicData(self, comic): """Return dictionary with comic info.""" if comic not in self.data: if os.path.exists(self.jsonFn(comic)): with codecs.open(self.jsonFn(comic), 'r', self.encoding) as f: self.data[comic] = json.load(f) else: ...
python
def getComicData(self, comic): """Return dictionary with comic info.""" if comic not in self.data: if os.path.exists(self.jsonFn(comic)): with codecs.open(self.jsonFn(comic), 'r', self.encoding) as f: self.data[comic] = json.load(f) else: ...
[ "def", "getComicData", "(", "self", ",", "comic", ")", ":", "if", "comic", "not", "in", "self", ".", "data", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "jsonFn", "(", "comic", ")", ")", ":", "with", "codecs", ".", "open", "(",...
Return dictionary with comic info.
[ "Return", "dictionary", "with", "comic", "info", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L256-L264
53,985
wummel/dosage
dosagelib/events.py
JSONEventHandler.getPageInfo
def getPageInfo(self, comic, url): """Return dictionary with comic page info.""" comicData = self.getComicData(comic) if url not in comicData['pages']: comicData['pages'][url] = {'images':{}} return comicData['pages'][url]
python
def getPageInfo(self, comic, url): """Return dictionary with comic page info.""" comicData = self.getComicData(comic) if url not in comicData['pages']: comicData['pages'][url] = {'images':{}} return comicData['pages'][url]
[ "def", "getPageInfo", "(", "self", ",", "comic", ",", "url", ")", ":", "comicData", "=", "self", ".", "getComicData", "(", "comic", ")", "if", "url", "not", "in", "comicData", "[", "'pages'", "]", ":", "comicData", "[", "'pages'", "]", "[", "url", "]...
Return dictionary with comic page info.
[ "Return", "dictionary", "with", "comic", "page", "info", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L266-L271
53,986
wummel/dosage
dosagelib/events.py
JSONEventHandler.comicDownloaded
def comicDownloaded(self, comic, filename, text=None): """Add URL-to-filename mapping into JSON.""" pageInfo = self.getPageInfo(comic.name, comic.referrer) pageInfo['images'][comic.url] = os.path.basename(filename)
python
def comicDownloaded(self, comic, filename, text=None): """Add URL-to-filename mapping into JSON.""" pageInfo = self.getPageInfo(comic.name, comic.referrer) pageInfo['images'][comic.url] = os.path.basename(filename)
[ "def", "comicDownloaded", "(", "self", ",", "comic", ",", "filename", ",", "text", "=", "None", ")", ":", "pageInfo", "=", "self", ".", "getPageInfo", "(", "comic", ".", "name", ",", "comic", ".", "referrer", ")", "pageInfo", "[", "'images'", "]", "[",...
Add URL-to-filename mapping into JSON.
[ "Add", "URL", "-", "to", "-", "filename", "mapping", "into", "JSON", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L273-L276
53,987
wummel/dosage
dosagelib/events.py
JSONEventHandler.comicPageLink
def comicPageLink(self, comic, url, prevUrl): """Write previous link into JSON.""" pageInfo = self.getPageInfo(comic, url) pageInfo['prev'] = prevUrl
python
def comicPageLink(self, comic, url, prevUrl): """Write previous link into JSON.""" pageInfo = self.getPageInfo(comic, url) pageInfo['prev'] = prevUrl
[ "def", "comicPageLink", "(", "self", ",", "comic", ",", "url", ",", "prevUrl", ")", ":", "pageInfo", "=", "self", ".", "getPageInfo", "(", "comic", ",", "url", ")", "pageInfo", "[", "'prev'", "]", "=", "prevUrl" ]
Write previous link into JSON.
[ "Write", "previous", "link", "into", "JSON", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L278-L281
53,988
wummel/dosage
dosagelib/events.py
JSONEventHandler.end
def end(self): """Write all JSON data to files.""" for comic in self.data: with codecs.open(self.jsonFn(comic), 'w', self.encoding) as f: json.dump(self.data[comic], f, indent=2, separators=(',', ': '), sort_keys=True)
python
def end(self): """Write all JSON data to files.""" for comic in self.data: with codecs.open(self.jsonFn(comic), 'w', self.encoding) as f: json.dump(self.data[comic], f, indent=2, separators=(',', ': '), sort_keys=True)
[ "def", "end", "(", "self", ")", ":", "for", "comic", "in", "self", ".", "data", ":", "with", "codecs", ".", "open", "(", "self", ".", "jsonFn", "(", "comic", ")", ",", "'w'", ",", "self", ".", "encoding", ")", "as", "f", ":", "json", ".", "dump...
Write all JSON data to files.
[ "Write", "all", "JSON", "data", "to", "files", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L283-L287
53,989
wummel/dosage
dosagelib/events.py
MultiHandler.comicDownloaded
def comicDownloaded(self, comic, filename, text=None): """Emit comic downloaded events for handlers.""" for handler in _handlers: handler.comicDownloaded(comic, filename, text=text)
python
def comicDownloaded(self, comic, filename, text=None): """Emit comic downloaded events for handlers.""" for handler in _handlers: handler.comicDownloaded(comic, filename, text=text)
[ "def", "comicDownloaded", "(", "self", ",", "comic", ",", "filename", ",", "text", "=", "None", ")", ":", "for", "handler", "in", "_handlers", ":", "handler", ".", "comicDownloaded", "(", "comic", ",", "filename", ",", "text", "=", "text", ")" ]
Emit comic downloaded events for handlers.
[ "Emit", "comic", "downloaded", "events", "for", "handlers", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L325-L328
53,990
wummel/dosage
dosagelib/events.py
MultiHandler.comicPageLink
def comicPageLink(self, comic, url, prevUrl): """Emit an event to inform the handler about links between comic pages. Should be overridden in subclass.""" for handler in _handlers: handler.comicPageLink(comic, url, prevUrl)
python
def comicPageLink(self, comic, url, prevUrl): """Emit an event to inform the handler about links between comic pages. Should be overridden in subclass.""" for handler in _handlers: handler.comicPageLink(comic, url, prevUrl)
[ "def", "comicPageLink", "(", "self", ",", "comic", ",", "url", ",", "prevUrl", ")", ":", "for", "handler", "in", "_handlers", ":", "handler", ".", "comicPageLink", "(", "comic", ",", "url", ",", "prevUrl", ")" ]
Emit an event to inform the handler about links between comic pages. Should be overridden in subclass.
[ "Emit", "an", "event", "to", "inform", "the", "handler", "about", "links", "between", "comic", "pages", ".", "Should", "be", "overridden", "in", "subclass", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/events.py#L330-L333
53,991
oasiswork/zimsoap
zimsoap/client.py
ZimbraAbstractClient.request
def request(self, name, content={}, namespace=None): """ Do a SOAP request and returns the result. Simple wrapper arround pythonzimbra functions :param name: ex: 'Auth' for performing an 'AuthRequest' :param content: a dict formatted pythonzimbra-style for request :param namespa...
python
def request(self, name, content={}, namespace=None): """ Do a SOAP request and returns the result. Simple wrapper arround pythonzimbra functions :param name: ex: 'Auth' for performing an 'AuthRequest' :param content: a dict formatted pythonzimbra-style for request :param namespa...
[ "def", "request", "(", "self", ",", "name", ",", "content", "=", "{", "}", ",", "namespace", "=", "None", ")", ":", "if", "not", "namespace", ":", "namespace", "=", "self", ".", "NAMESPACE", "req_name", "=", "name", "+", "'Request'", "resp_name", "=", ...
Do a SOAP request and returns the result. Simple wrapper arround pythonzimbra functions :param name: ex: 'Auth' for performing an 'AuthRequest' :param content: a dict formatted pythonzimbra-style for request :param namespace: (optional), the namespace, if different from the ...
[ "Do", "a", "SOAP", "request", "and", "returns", "the", "result", "." ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L182-L223
53,992
oasiswork/zimsoap
zimsoap/client.py
ZimbraAbstractClient.request_single
def request_single(self, name, content={}): """ Simple wrapper arround request to extract a single response :returns: the first tag in the response body """ resp = self.request(name, content) # We stop on the first non-attribute (attributes are unicode/str) # If it's a ...
python
def request_single(self, name, content={}): """ Simple wrapper arround request to extract a single response :returns: the first tag in the response body """ resp = self.request(name, content) # We stop on the first non-attribute (attributes are unicode/str) # If it's a ...
[ "def", "request_single", "(", "self", ",", "name", ",", "content", "=", "{", "}", ")", ":", "resp", "=", "self", ".", "request", "(", "name", ",", "content", ")", "# We stop on the first non-attribute (attributes are unicode/str)", "# If it's a list, we only return th...
Simple wrapper arround request to extract a single response :returns: the first tag in the response body
[ "Simple", "wrapper", "arround", "request", "to", "extract", "a", "single", "response" ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L225-L241
53,993
oasiswork/zimsoap
zimsoap/client.py
ZimbraAbstractClient.get_logged_in_by
def get_logged_in_by(self, login, parent_zc, duration=0): """Use another client to get logged in via preauth mechanism by an already logged in admin. It required the domain of the admin user to have preAuthKey The preauth key cannot be created by API, do it with zmprov : zmp...
python
def get_logged_in_by(self, login, parent_zc, duration=0): """Use another client to get logged in via preauth mechanism by an already logged in admin. It required the domain of the admin user to have preAuthKey The preauth key cannot be created by API, do it with zmprov : zmp...
[ "def", "get_logged_in_by", "(", "self", ",", "login", ",", "parent_zc", ",", "duration", "=", "0", ")", ":", "domain_name", "=", "zobjects", ".", "Account", "(", "name", "=", "login", ")", ".", "get_domain", "(", ")", "preauth_key", "=", "parent_zc", "."...
Use another client to get logged in via preauth mechanism by an already logged in admin. It required the domain of the admin user to have preAuthKey The preauth key cannot be created by API, do it with zmprov : zmprov gdpak <domain>
[ "Use", "another", "client", "to", "get", "logged", "in", "via", "preauth", "mechanism", "by", "an", "already", "logged", "in", "admin", "." ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L269-L285
53,994
oasiswork/zimsoap
zimsoap/client.py
ZimbraAbstractClient.delegated_login
def delegated_login(self, login, admin_zc, duration=0): """Use another client to get logged in via delegated_auth mechanism by an already logged in admin. :param admin_zc: An already logged-in admin client :type admin_zc: ZimbraAdminClient :param login: the user login (or email)...
python
def delegated_login(self, login, admin_zc, duration=0): """Use another client to get logged in via delegated_auth mechanism by an already logged in admin. :param admin_zc: An already logged-in admin client :type admin_zc: ZimbraAdminClient :param login: the user login (or email)...
[ "def", "delegated_login", "(", "self", ",", "login", ",", "admin_zc", ",", "duration", "=", "0", ")", ":", "# a duration of zero is interpretted literaly by the API...", "selector", "=", "zobjects", ".", "Account", "(", "name", "=", "login", ")", ".", "to_selector...
Use another client to get logged in via delegated_auth mechanism by an already logged in admin. :param admin_zc: An already logged-in admin client :type admin_zc: ZimbraAdminClient :param login: the user login (or email) you want to log as
[ "Use", "another", "client", "to", "get", "logged", "in", "via", "delegated_auth", "mechanism", "by", "an", "already", "logged", "in", "admin", "." ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L287-L306
53,995
oasiswork/zimsoap
zimsoap/client.py
ZimbraAccountClient.get_signatures
def get_signatures(self): """ Get all signatures for the current user :returns: a list of zobjects.Signature """ signatures = self.request_list('GetSignatures') return [zobjects.Signature.from_dict(i) for i in signatures]
python
def get_signatures(self): """ Get all signatures for the current user :returns: a list of zobjects.Signature """ signatures = self.request_list('GetSignatures') return [zobjects.Signature.from_dict(i) for i in signatures]
[ "def", "get_signatures", "(", "self", ")", ":", "signatures", "=", "self", ".", "request_list", "(", "'GetSignatures'", ")", "return", "[", "zobjects", ".", "Signature", ".", "from_dict", "(", "i", ")", "for", "i", "in", "signatures", "]" ]
Get all signatures for the current user :returns: a list of zobjects.Signature
[ "Get", "all", "signatures", "for", "the", "current", "user" ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L384-L391
53,996
oasiswork/zimsoap
zimsoap/client.py
ZimbraAccountClient.get_signature
def get_signature(self, signature): """Retrieve one signature, discriminated by name or id. Note that signature name is not case sensitive. :param: a zobjects.Signature describing the signature like "Signature(name='my-sig')" :returns: a zobjects.Signature object, fille...
python
def get_signature(self, signature): """Retrieve one signature, discriminated by name or id. Note that signature name is not case sensitive. :param: a zobjects.Signature describing the signature like "Signature(name='my-sig')" :returns: a zobjects.Signature object, fille...
[ "def", "get_signature", "(", "self", ",", "signature", ")", ":", "resp", "=", "self", ".", "request_list", "(", "'GetSignatures'", ")", "# GetSignature does not allow to filter the results, so we do it by", "# hand...", "if", "resp", "and", "(", "len", "(", "resp", ...
Retrieve one signature, discriminated by name or id. Note that signature name is not case sensitive. :param: a zobjects.Signature describing the signature like "Signature(name='my-sig')" :returns: a zobjects.Signature object, filled with the signature if no sig...
[ "Retrieve", "one", "signature", "discriminated", "by", "name", "or", "id", "." ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L393-L420
53,997
oasiswork/zimsoap
zimsoap/client.py
ZimbraAccountClient.modify_signature
def modify_signature(self, signature): """ Modify an existing signature Can modify the content, contenttype and name. An unset attribute will not delete the attribute but leave it untouched. :param: signature a zobject.Signature object, with modified content/con...
python
def modify_signature(self, signature): """ Modify an existing signature Can modify the content, contenttype and name. An unset attribute will not delete the attribute but leave it untouched. :param: signature a zobject.Signature object, with modified content/con...
[ "def", "modify_signature", "(", "self", ",", "signature", ")", ":", "# if no content is specified, just use a selector (id/name)", "dic", "=", "signature", ".", "to_creator", "(", "for_modify", "=", "True", ")", "self", ".", "request", "(", "'ModifySignature'", ",", ...
Modify an existing signature Can modify the content, contenttype and name. An unset attribute will not delete the attribute but leave it untouched. :param: signature a zobject.Signature object, with modified content/contentype/name, the id should be present and ...
[ "Modify", "an", "existing", "signature" ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L429-L442
53,998
oasiswork/zimsoap
zimsoap/client.py
ZimbraAccountClient.get_preferences
def get_preferences(self): """ Gets all the preferences of the current user :returns: a dict presenting the preferences by name, values are typed to str/bool/int/float regarding their content. """ pref_list = self.request('GetPrefs')['pref'] out = {} fo...
python
def get_preferences(self): """ Gets all the preferences of the current user :returns: a dict presenting the preferences by name, values are typed to str/bool/int/float regarding their content. """ pref_list = self.request('GetPrefs')['pref'] out = {} fo...
[ "def", "get_preferences", "(", "self", ")", ":", "pref_list", "=", "self", ".", "request", "(", "'GetPrefs'", ")", "[", "'pref'", "]", "out", "=", "{", "}", "for", "pref", "in", "pref_list", ":", "out", "[", "pref", "[", "'name'", "]", "]", "=", "u...
Gets all the preferences of the current user :returns: a dict presenting the preferences by name, values are typed to str/bool/int/float regarding their content.
[ "Gets", "all", "the", "preferences", "of", "the", "current", "user" ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L444-L456
53,999
oasiswork/zimsoap
zimsoap/client.py
ZimbraAccountClient.get_preference
def get_preference(self, pref_name): """ Gets a single named preference :returns: the value, typed to str/bool/int/float regarding its content. """ resp = self.request_single('GetPrefs', {'pref': {'name': pref_name}}) return utils.auto_type(resp['_content'])
python
def get_preference(self, pref_name): """ Gets a single named preference :returns: the value, typed to str/bool/int/float regarding its content. """ resp = self.request_single('GetPrefs', {'pref': {'name': pref_name}}) return utils.auto_type(resp['_content'])
[ "def", "get_preference", "(", "self", ",", "pref_name", ")", ":", "resp", "=", "self", ".", "request_single", "(", "'GetPrefs'", ",", "{", "'pref'", ":", "{", "'name'", ":", "pref_name", "}", "}", ")", "return", "utils", ".", "auto_type", "(", "resp", ...
Gets a single named preference :returns: the value, typed to str/bool/int/float regarding its content.
[ "Gets", "a", "single", "named", "preference" ]
d1ea2eb4d50f263c9a16e5549af03f1eff3e295e
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L458-L464