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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
38,800 | stephrdev/django-tapeforms | tapeforms/templatetags/tapeforms.py | formfield | def formfield(context, bound_field, **kwargs):
"""
The `formfield` template tag will render a form field of a tape-form enabled form
using the template provided by `get_field_template` method of the form together with
the context generated by `get_field_context` method of the form.
Usage::
... | python | def formfield(context, bound_field, **kwargs):
"""
The `formfield` template tag will render a form field of a tape-form enabled form
using the template provided by `get_field_template` method of the form together with
the context generated by `get_field_context` method of the form.
Usage::
... | [
"def",
"formfield",
"(",
"context",
",",
"bound_field",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"bound_field",
",",
"forms",
".",
"BoundField",
")",
":",
"raise",
"template",
".",
"TemplateSyntaxError",
"(",
"'Provided field should b... | The `formfield` template tag will render a form field of a tape-form enabled form
using the template provided by `get_field_template` method of the form together with
the context generated by `get_field_context` method of the form.
Usage::
{% load tapeforms %}
{% formfield my_form.my_field... | [
"The",
"formfield",
"template",
"tag",
"will",
"render",
"a",
"form",
"field",
"of",
"a",
"tape",
"-",
"form",
"enabled",
"form",
"using",
"the",
"template",
"provided",
"by",
"get_field_template",
"method",
"of",
"the",
"form",
"together",
"with",
"the",
"c... | 255602de43777141f18afaf30669d7bdd4f7c323 | https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/templatetags/tapeforms.py#L43-L71 |
38,801 | BrianHicks/emit | emit/router/core.py | Router.wrap_as_node | def wrap_as_node(self, func):
'wrap a function as a node'
name = self.get_name(func)
@wraps(func)
def wrapped(*args, **kwargs):
'wrapped version of func'
message = self.get_message_from_call(*args, **kwargs)
self.logger.info('calling "%s" with %r', na... | python | def wrap_as_node(self, func):
'wrap a function as a node'
name = self.get_name(func)
@wraps(func)
def wrapped(*args, **kwargs):
'wrapped version of func'
message = self.get_message_from_call(*args, **kwargs)
self.logger.info('calling "%s" with %r', na... | [
"def",
"wrap_as_node",
"(",
"self",
",",
"func",
")",
":",
"name",
"=",
"self",
".",
"get_name",
"(",
"func",
")",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"'wrapped version of func'",
"me... | wrap a function as a node | [
"wrap",
"a",
"function",
"as",
"a",
"node"
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L61-L105 |
38,802 | BrianHicks/emit | emit/router/core.py | Router.node | def node(self, fields, subscribe_to=None, entry_point=False, ignore=None,
**wrapper_options):
'''\
Decorate a function to make it a node.
.. note::
decorating as a node changes the function signature. Nodes should
accept a single argument, which will be a
... | python | def node(self, fields, subscribe_to=None, entry_point=False, ignore=None,
**wrapper_options):
'''\
Decorate a function to make it a node.
.. note::
decorating as a node changes the function signature. Nodes should
accept a single argument, which will be a
... | [
"def",
"node",
"(",
"self",
",",
"fields",
",",
"subscribe_to",
"=",
"None",
",",
"entry_point",
"=",
"False",
",",
"ignore",
"=",
"None",
",",
"*",
"*",
"wrapper_options",
")",
":",
"def",
"outer",
"(",
"func",
")",
":",
"'outer level function'",
"# cre... | \
Decorate a function to make it a node.
.. note::
decorating as a node changes the function signature. Nodes should
accept a single argument, which will be a
:py:class:`emit.message.Message`. Nodes can be called directly by
providing a dictionary argument or... | [
"\\",
"Decorate",
"a",
"function",
"to",
"make",
"it",
"a",
"node",
"."
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L107-L159 |
38,803 | BrianHicks/emit | emit/router/core.py | Router.resolve_node_modules | def resolve_node_modules(self):
'import the modules specified in init'
if not self.resolved_node_modules:
try:
self.resolved_node_modules = [
importlib.import_module(mod, self.node_package)
for mod in self.node_modules
]... | python | def resolve_node_modules(self):
'import the modules specified in init'
if not self.resolved_node_modules:
try:
self.resolved_node_modules = [
importlib.import_module(mod, self.node_package)
for mod in self.node_modules
]... | [
"def",
"resolve_node_modules",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"resolved_node_modules",
":",
"try",
":",
"self",
".",
"resolved_node_modules",
"=",
"[",
"importlib",
".",
"import_module",
"(",
"mod",
",",
"self",
".",
"node_package",
")",
"f... | import the modules specified in init | [
"import",
"the",
"modules",
"specified",
"in",
"init"
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L161-L173 |
38,804 | BrianHicks/emit | emit/router/core.py | Router.get_message_from_call | def get_message_from_call(self, *args, **kwargs):
'''\
Get message object from a call.
:raises: :py:exc:`TypeError` (if the format is not what we expect)
This is where arguments to nodes are turned into Messages. Arguments
are parsed in the following order:
- A single... | python | def get_message_from_call(self, *args, **kwargs):
'''\
Get message object from a call.
:raises: :py:exc:`TypeError` (if the format is not what we expect)
This is where arguments to nodes are turned into Messages. Arguments
are parsed in the following order:
- A single... | [
"def",
"get_message_from_call",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"and",
"isinstance",
"(",
"args",
"[",
"0",
"]",
",",
"dict",
")",
":",
"# then it's a message",
"self",
".",
... | \
Get message object from a call.
:raises: :py:exc:`TypeError` (if the format is not what we expect)
This is where arguments to nodes are turned into Messages. Arguments
are parsed in the following order:
- A single positional argument (a :py:class:`dict`)
- No posit... | [
"\\",
"Get",
"message",
"object",
"from",
"a",
"call",
"."
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L175-L203 |
38,805 | BrianHicks/emit | emit/router/core.py | Router.register | def register(self, name, func, fields, subscribe_to, entry_point, ignore):
'''
Register a named function in the graph
:param name: name to register
:type name: :py:class:`str`
:param func: function to remember and call
:type func: callable
``fields``, ``subscrib... | python | def register(self, name, func, fields, subscribe_to, entry_point, ignore):
'''
Register a named function in the graph
:param name: name to register
:type name: :py:class:`str`
:param func: function to remember and call
:type func: callable
``fields``, ``subscrib... | [
"def",
"register",
"(",
"self",
",",
"name",
",",
"func",
",",
"fields",
",",
"subscribe_to",
",",
"entry_point",
",",
"ignore",
")",
":",
"self",
".",
"fields",
"[",
"name",
"]",
"=",
"fields",
"self",
".",
"functions",
"[",
"name",
"]",
"=",
"func"... | Register a named function in the graph
:param name: name to register
:type name: :py:class:`str`
:param func: function to remember and call
:type func: callable
``fields``, ``subscribe_to`` and ``entry_point`` are the same as in
:py:meth:`Router.node`. | [
"Register",
"a",
"named",
"function",
"in",
"the",
"graph"
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L205-L228 |
38,806 | BrianHicks/emit | emit/router/core.py | Router.add_entry_point | def add_entry_point(self, destination):
'''\
Add an entry point
:param destination: node to route to initially
:type destination: str
'''
self.routes.setdefault('__entry_point', set()).add(destination)
return self.routes['__entry_point'] | python | def add_entry_point(self, destination):
'''\
Add an entry point
:param destination: node to route to initially
:type destination: str
'''
self.routes.setdefault('__entry_point', set()).add(destination)
return self.routes['__entry_point'] | [
"def",
"add_entry_point",
"(",
"self",
",",
"destination",
")",
":",
"self",
".",
"routes",
".",
"setdefault",
"(",
"'__entry_point'",
",",
"set",
"(",
")",
")",
".",
"add",
"(",
"destination",
")",
"return",
"self",
".",
"routes",
"[",
"'__entry_point'",
... | \
Add an entry point
:param destination: node to route to initially
:type destination: str | [
"\\",
"Add",
"an",
"entry",
"point"
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L230-L238 |
38,807 | BrianHicks/emit | emit/router/core.py | Router.register_route | def register_route(self, origins, destination):
'''
Add routes to the routing dictionary
:param origins: a number of origins to register
:type origins: :py:class:`str` or iterable of :py:class:`str` or None
:param destination: where the origins should point to
:type dest... | python | def register_route(self, origins, destination):
'''
Add routes to the routing dictionary
:param origins: a number of origins to register
:type origins: :py:class:`str` or iterable of :py:class:`str` or None
:param destination: where the origins should point to
:type dest... | [
"def",
"register_route",
"(",
"self",
",",
"origins",
",",
"destination",
")",
":",
"self",
".",
"names",
".",
"add",
"(",
"destination",
")",
"self",
".",
"logger",
".",
"debug",
"(",
"'added \"%s\" to names'",
",",
"destination",
")",
"origins",
"=",
"or... | Add routes to the routing dictionary
:param origins: a number of origins to register
:type origins: :py:class:`str` or iterable of :py:class:`str` or None
:param destination: where the origins should point to
:type destination: :py:class:`str`
Routing dictionary takes the follo... | [
"Add",
"routes",
"to",
"the",
"routing",
"dictionary"
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L240-L265 |
38,808 | BrianHicks/emit | emit/router/core.py | Router.register_ignore | def register_ignore(self, origins, destination):
'''
Add routes to the ignore dictionary
:param origins: a number of origins to register
:type origins: :py:class:`str` or iterable of :py:class:`str`
:param destination: where the origins should point to
:type destination:... | python | def register_ignore(self, origins, destination):
'''
Add routes to the ignore dictionary
:param origins: a number of origins to register
:type origins: :py:class:`str` or iterable of :py:class:`str`
:param destination: where the origins should point to
:type destination:... | [
"def",
"register_ignore",
"(",
"self",
",",
"origins",
",",
"destination",
")",
":",
"if",
"not",
"isinstance",
"(",
"origins",
",",
"list",
")",
":",
"origins",
"=",
"[",
"origins",
"]",
"self",
".",
"ignore_regexes",
".",
"setdefault",
"(",
"destination"... | Add routes to the ignore dictionary
:param origins: a number of origins to register
:type origins: :py:class:`str` or iterable of :py:class:`str`
:param destination: where the origins should point to
:type destination: :py:class:`str`
Ignore dictionary takes the following form:... | [
"Add",
"routes",
"to",
"the",
"ignore",
"dictionary"
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L267-L288 |
38,809 | BrianHicks/emit | emit/router/core.py | Router.regenerate_routes | def regenerate_routes(self):
'regenerate the routes after a new route is added'
for destination, origins in self.regexes.items():
# we want only the names that match the destination regexes.
resolved = [
name for name in self.names
if name is not d... | python | def regenerate_routes(self):
'regenerate the routes after a new route is added'
for destination, origins in self.regexes.items():
# we want only the names that match the destination regexes.
resolved = [
name for name in self.names
if name is not d... | [
"def",
"regenerate_routes",
"(",
"self",
")",
":",
"for",
"destination",
",",
"origins",
"in",
"self",
".",
"regexes",
".",
"items",
"(",
")",
":",
"# we want only the names that match the destination regexes.",
"resolved",
"=",
"[",
"name",
"for",
"name",
"in",
... | regenerate the routes after a new route is added | [
"regenerate",
"the",
"routes",
"after",
"a",
"new",
"route",
"is",
"added"
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L290-L317 |
38,810 | BrianHicks/emit | emit/router/core.py | Router.route | def route(self, origin, message):
'''\
Using the routing dictionary, dispatch a message to all subscribers
:param origin: name of the origin node
:type origin: :py:class:`str`
:param message: message to dispatch
:type message: :py:class:`emit.message.Message` or subclass... | python | def route(self, origin, message):
'''\
Using the routing dictionary, dispatch a message to all subscribers
:param origin: name of the origin node
:type origin: :py:class:`str`
:param message: message to dispatch
:type message: :py:class:`emit.message.Message` or subclass... | [
"def",
"route",
"(",
"self",
",",
"origin",
",",
"message",
")",
":",
"# side-effect: we have to know all the routes before we can route. But",
"# we can't resolve them while the object is initializing, so we have to",
"# do it just in time to route.",
"self",
".",
"resolve_node_module... | \
Using the routing dictionary, dispatch a message to all subscribers
:param origin: name of the origin node
:type origin: :py:class:`str`
:param message: message to dispatch
:type message: :py:class:`emit.message.Message` or subclass | [
"\\",
"Using",
"the",
"routing",
"dictionary",
"dispatch",
"a",
"message",
"to",
"all",
"subscribers"
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L327-L348 |
38,811 | BrianHicks/emit | emit/router/core.py | Router.dispatch | def dispatch(self, origin, destination, message):
'''\
dispatch a message to a named function
:param destination: destination to dispatch to
:type destination: :py:class:`str`
:param message: message to dispatch
:type message: :py:class:`emit.message.Message` or subclass... | python | def dispatch(self, origin, destination, message):
'''\
dispatch a message to a named function
:param destination: destination to dispatch to
:type destination: :py:class:`str`
:param message: message to dispatch
:type message: :py:class:`emit.message.Message` or subclass... | [
"def",
"dispatch",
"(",
"self",
",",
"origin",
",",
"destination",
",",
"message",
")",
":",
"func",
"=",
"self",
".",
"functions",
"[",
"destination",
"]",
"self",
".",
"logger",
".",
"debug",
"(",
"'calling %r directly'",
",",
"func",
")",
"return",
"f... | \
dispatch a message to a named function
:param destination: destination to dispatch to
:type destination: :py:class:`str`
:param message: message to dispatch
:type message: :py:class:`emit.message.Message` or subclass | [
"\\",
"dispatch",
"a",
"message",
"to",
"a",
"named",
"function"
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L350-L361 |
38,812 | BrianHicks/emit | emit/router/core.py | Router.wrap_result | def wrap_result(self, name, result):
'''
Wrap a result from a function with it's stated fields
:param name: fields to look up
:type name: :py:class:`str`
:param result: return value from function. Will be converted to tuple.
:type result: anything
:raises: :py:e... | python | def wrap_result(self, name, result):
'''
Wrap a result from a function with it's stated fields
:param name: fields to look up
:type name: :py:class:`str`
:param result: return value from function. Will be converted to tuple.
:type result: anything
:raises: :py:e... | [
"def",
"wrap_result",
"(",
"self",
",",
"name",
",",
"result",
")",
":",
"if",
"not",
"isinstance",
"(",
"result",
",",
"tuple",
")",
":",
"result",
"=",
"tuple",
"(",
"[",
"result",
"]",
")",
"try",
":",
"return",
"dict",
"(",
"zip",
"(",
"self",
... | Wrap a result from a function with it's stated fields
:param name: fields to look up
:type name: :py:class:`str`
:param result: return value from function. Will be converted to tuple.
:type result: anything
:raises: :py:exc:`ValueError` if name has no associated fields
... | [
"Wrap",
"a",
"result",
"from",
"a",
"function",
"with",
"it",
"s",
"stated",
"fields"
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L363-L384 |
38,813 | BrianHicks/emit | emit/router/core.py | Router.get_name | def get_name(self, func):
'''
Get the name to reference a function by
:param func: function to get the name of
:type func: callable
'''
if hasattr(func, 'name'):
return func.name
return '%s.%s' % (
func.__module__,
func.__name... | python | def get_name(self, func):
'''
Get the name to reference a function by
:param func: function to get the name of
:type func: callable
'''
if hasattr(func, 'name'):
return func.name
return '%s.%s' % (
func.__module__,
func.__name... | [
"def",
"get_name",
"(",
"self",
",",
"func",
")",
":",
"if",
"hasattr",
"(",
"func",
",",
"'name'",
")",
":",
"return",
"func",
".",
"name",
"return",
"'%s.%s'",
"%",
"(",
"func",
".",
"__module__",
",",
"func",
".",
"__name__",
")"
] | Get the name to reference a function by
:param func: function to get the name of
:type func: callable | [
"Get",
"the",
"name",
"to",
"reference",
"a",
"function",
"by"
] | 19a86c2392b136c9e857000798ccaa525aa0ed84 | https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L386-L399 |
38,814 | GeorgeArgyros/symautomata | symautomata/pdadiff.py | main | def main():
"""
Testing function for PDA - DFA Diff Operation
"""
if len(argv) < 2:
print 'Usage: '
print ' Get A String %s CFG_fileA FST_fileB' % argv[0]
return
alphabet = createalphabet()
cfgtopda = CfgPDA(alphabet)
print '* Parsing Grammar:',... | python | def main():
"""
Testing function for PDA - DFA Diff Operation
"""
if len(argv) < 2:
print 'Usage: '
print ' Get A String %s CFG_fileA FST_fileB' % argv[0]
return
alphabet = createalphabet()
cfgtopda = CfgPDA(alphabet)
print '* Parsing Grammar:',... | [
"def",
"main",
"(",
")",
":",
"if",
"len",
"(",
"argv",
")",
"<",
"2",
":",
"print",
"'Usage: '",
"print",
"' Get A String %s CFG_fileA FST_fileB'",
"%",
"argv",
"[",
"0",
"]",
"return",
"alphabet",
"=",
"createalphabet",
"(",
")",
"cfgtop... | Testing function for PDA - DFA Diff Operation | [
"Testing",
"function",
"for",
"PDA",
"-",
"DFA",
"Diff",
"Operation"
] | f5d66533573b27e155bec3f36b8c00b8e3937cb3 | https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/pdadiff.py#L259-L289 |
38,815 | GeorgeArgyros/symautomata | symautomata/pdadiff.py | PdaDiff._intesect | def _intesect(self):
"""The intesection of a PDA and a DFA"""
p1automaton = self.mma
p2automaton = self.mmb
p3automaton = PDA(self.alphabet)
self._break_terms()
p1counter = 0
p3counter = 0
p2states = list(p2automaton.states)
print 'PDA States: ' + ... | python | def _intesect(self):
"""The intesection of a PDA and a DFA"""
p1automaton = self.mma
p2automaton = self.mmb
p3automaton = PDA(self.alphabet)
self._break_terms()
p1counter = 0
p3counter = 0
p2states = list(p2automaton.states)
print 'PDA States: ' + ... | [
"def",
"_intesect",
"(",
"self",
")",
":",
"p1automaton",
"=",
"self",
".",
"mma",
"p2automaton",
"=",
"self",
".",
"mmb",
"p3automaton",
"=",
"PDA",
"(",
"self",
".",
"alphabet",
")",
"self",
".",
"_break_terms",
"(",
")",
"p1counter",
"=",
"0",
"p3co... | The intesection of a PDA and a DFA | [
"The",
"intesection",
"of",
"a",
"PDA",
"and",
"a",
"DFA"
] | f5d66533573b27e155bec3f36b8c00b8e3937cb3 | https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/pdadiff.py#L86-L164 |
38,816 | GeorgeArgyros/symautomata | symautomata/pdadiff.py | PdaDiff.diff | def diff(self):
"""The Difference between a PDA and a DFA"""
self.mmb.complement(self.alphabet)
self.mmb.minimize()
print 'start intersection'
self.mmc = self._intesect()
print 'end intersection'
return self.mmc | python | def diff(self):
"""The Difference between a PDA and a DFA"""
self.mmb.complement(self.alphabet)
self.mmb.minimize()
print 'start intersection'
self.mmc = self._intesect()
print 'end intersection'
return self.mmc | [
"def",
"diff",
"(",
"self",
")",
":",
"self",
".",
"mmb",
".",
"complement",
"(",
"self",
".",
"alphabet",
")",
"self",
".",
"mmb",
".",
"minimize",
"(",
")",
"print",
"'start intersection'",
"self",
".",
"mmc",
"=",
"self",
".",
"_intesect",
"(",
")... | The Difference between a PDA and a DFA | [
"The",
"Difference",
"between",
"a",
"PDA",
"and",
"a",
"DFA"
] | f5d66533573b27e155bec3f36b8c00b8e3937cb3 | https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/pdadiff.py#L166-L173 |
38,817 | FreekingDean/insteon-hub | insteon/insteon.py | Insteon.refresh_devices | def refresh_devices(self):
'''Queries hub for list of devices, and creates new device objects'''
try:
response = self.api.get("/api/v2/devices", {'properties':'all'})
for device_data in response['DeviceList']:
self.devices.append(Device(device_data, self))
... | python | def refresh_devices(self):
'''Queries hub for list of devices, and creates new device objects'''
try:
response = self.api.get("/api/v2/devices", {'properties':'all'})
for device_data in response['DeviceList']:
self.devices.append(Device(device_data, self))
... | [
"def",
"refresh_devices",
"(",
"self",
")",
":",
"try",
":",
"response",
"=",
"self",
".",
"api",
".",
"get",
"(",
"\"/api/v2/devices\"",
",",
"{",
"'properties'",
":",
"'all'",
"}",
")",
"for",
"device_data",
"in",
"response",
"[",
"'DeviceList'",
"]",
... | Queries hub for list of devices, and creates new device objects | [
"Queries",
"hub",
"for",
"list",
"of",
"devices",
"and",
"creates",
"new",
"device",
"objects"
] | afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e | https://github.com/FreekingDean/insteon-hub/blob/afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e/insteon/insteon.py#L34-L43 |
38,818 | FreekingDean/insteon-hub | insteon/insteon.py | DeviceP.refresh_details | def refresh_details(self):
'''Query hub and refresh all details of a device,
but NOT status, includes grouplist not present in
refresh_all_devices'''
try:
return self.api_iface._api_get("/api/v2/devices/" + str(self.device_id))
except APIError as e:
print(... | python | def refresh_details(self):
'''Query hub and refresh all details of a device,
but NOT status, includes grouplist not present in
refresh_all_devices'''
try:
return self.api_iface._api_get("/api/v2/devices/" + str(self.device_id))
except APIError as e:
print(... | [
"def",
"refresh_details",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"api_iface",
".",
"_api_get",
"(",
"\"/api/v2/devices/\"",
"+",
"str",
"(",
"self",
".",
"device_id",
")",
")",
"except",
"APIError",
"as",
"e",
":",
"print",
"(",
"\"API... | Query hub and refresh all details of a device,
but NOT status, includes grouplist not present in
refresh_all_devices | [
"Query",
"hub",
"and",
"refresh",
"all",
"details",
"of",
"a",
"device",
"but",
"NOT",
"status",
"includes",
"grouplist",
"not",
"present",
"in",
"refresh_all_devices"
] | afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e | https://github.com/FreekingDean/insteon-hub/blob/afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e/insteon/insteon.py#L50-L59 |
38,819 | FreekingDean/insteon-hub | insteon/insteon.py | DeviceP.send_command | def send_command(self, command):
'''Send a command to a device'''
data = {"command": command, "device_id": self.device_id}
try:
response = self.api_iface._api_post("/api/v2/commands", data)
return Command(response, self)
except APIError as e:
print("AP... | python | def send_command(self, command):
'''Send a command to a device'''
data = {"command": command, "device_id": self.device_id}
try:
response = self.api_iface._api_post("/api/v2/commands", data)
return Command(response, self)
except APIError as e:
print("AP... | [
"def",
"send_command",
"(",
"self",
",",
"command",
")",
":",
"data",
"=",
"{",
"\"command\"",
":",
"command",
",",
"\"device_id\"",
":",
"self",
".",
"device_id",
"}",
"try",
":",
"response",
"=",
"self",
".",
"api_iface",
".",
"_api_post",
"(",
"\"/api... | Send a command to a device | [
"Send",
"a",
"command",
"to",
"a",
"device"
] | afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e | https://github.com/FreekingDean/insteon-hub/blob/afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e/insteon/insteon.py#L61-L70 |
38,820 | FreekingDean/insteon-hub | insteon/insteon.py | DeviceP._update_details | def _update_details(self,data):
'''Intakes dict of details, and sets necessary properties
in device'''
# DeviceName, IconID, HouseID, DeviceID always present
self.device_id = data['DeviceID']
self.device_name = data['DeviceName']
self.properties = data | python | def _update_details(self,data):
'''Intakes dict of details, and sets necessary properties
in device'''
# DeviceName, IconID, HouseID, DeviceID always present
self.device_id = data['DeviceID']
self.device_name = data['DeviceName']
self.properties = data | [
"def",
"_update_details",
"(",
"self",
",",
"data",
")",
":",
"# DeviceName, IconID, HouseID, DeviceID always present",
"self",
".",
"device_id",
"=",
"data",
"[",
"'DeviceID'",
"]",
"self",
".",
"device_name",
"=",
"data",
"[",
"'DeviceName'",
"]",
"self",
".",
... | Intakes dict of details, and sets necessary properties
in device | [
"Intakes",
"dict",
"of",
"details",
"and",
"sets",
"necessary",
"properties",
"in",
"device"
] | afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e | https://github.com/FreekingDean/insteon-hub/blob/afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e/insteon/insteon.py#L72-L78 |
38,821 | FreekingDean/insteon-hub | insteon/insteon.py | Command._update_details | def _update_details(self,data):
'''Intakes dict of details, and sets necessary properties
in command'''
for api_name in self._properties:
if api_name in data:
setattr(self, "_" + api_name, data[api_name])
else:
# Only set to blank if not in... | python | def _update_details(self,data):
'''Intakes dict of details, and sets necessary properties
in command'''
for api_name in self._properties:
if api_name in data:
setattr(self, "_" + api_name, data[api_name])
else:
# Only set to blank if not in... | [
"def",
"_update_details",
"(",
"self",
",",
"data",
")",
":",
"for",
"api_name",
"in",
"self",
".",
"_properties",
":",
"if",
"api_name",
"in",
"data",
":",
"setattr",
"(",
"self",
",",
"\"_\"",
"+",
"api_name",
",",
"data",
"[",
"api_name",
"]",
")",
... | Intakes dict of details, and sets necessary properties
in command | [
"Intakes",
"dict",
"of",
"details",
"and",
"sets",
"necessary",
"properties",
"in",
"command"
] | afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e | https://github.com/FreekingDean/insteon-hub/blob/afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e/insteon/insteon.py#L89-L100 |
38,822 | FreekingDean/insteon-hub | insteon/insteon.py | Command.query_status | def query_status(self):
'''Query the hub for the status of this command'''
try:
data = self.api_iface._api_get(self.link)
self._update_details(data)
except APIError as e:
print("API error: ")
for key,value in e.data.iteritems:
print... | python | def query_status(self):
'''Query the hub for the status of this command'''
try:
data = self.api_iface._api_get(self.link)
self._update_details(data)
except APIError as e:
print("API error: ")
for key,value in e.data.iteritems:
print... | [
"def",
"query_status",
"(",
"self",
")",
":",
"try",
":",
"data",
"=",
"self",
".",
"api_iface",
".",
"_api_get",
"(",
"self",
".",
"link",
")",
"self",
".",
"_update_details",
"(",
"data",
")",
"except",
"APIError",
"as",
"e",
":",
"print",
"(",
"\"... | Query the hub for the status of this command | [
"Query",
"the",
"hub",
"for",
"the",
"status",
"of",
"this",
"command"
] | afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e | https://github.com/FreekingDean/insteon-hub/blob/afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e/insteon/insteon.py#L102-L110 |
38,823 | jingming/spotify | spotify/v1/album/__init__.py | AlbumContext.tracks | def tracks(self):
"""
Tracks list context
:return: Tracks list context
"""
if self._tracks is None:
self._tracks = TrackList(self.version, self.id)
return self._tracks | python | def tracks(self):
"""
Tracks list context
:return: Tracks list context
"""
if self._tracks is None:
self._tracks = TrackList(self.version, self.id)
return self._tracks | [
"def",
"tracks",
"(",
"self",
")",
":",
"if",
"self",
".",
"_tracks",
"is",
"None",
":",
"self",
".",
"_tracks",
"=",
"TrackList",
"(",
"self",
".",
"version",
",",
"self",
".",
"id",
")",
"return",
"self",
".",
"_tracks"
] | Tracks list context
:return: Tracks list context | [
"Tracks",
"list",
"context"
] | d92c71073b2515f3c850604114133a7d2022d1a4 | https://github.com/jingming/spotify/blob/d92c71073b2515f3c850604114133a7d2022d1a4/spotify/v1/album/__init__.py#L24-L33 |
38,824 | what-studio/smartformat | smartformat/smart.py | extension | def extension(names):
"""Makes a function to be an extension."""
for name in names:
if not NAME_PATTERN.match(name):
raise ValueError('invalid extension name: %s' % name)
def decorator(f, names=names):
return Extension(f, names=names)
return decorator | python | def extension(names):
"""Makes a function to be an extension."""
for name in names:
if not NAME_PATTERN.match(name):
raise ValueError('invalid extension name: %s' % name)
def decorator(f, names=names):
return Extension(f, names=names)
return decorator | [
"def",
"extension",
"(",
"names",
")",
":",
"for",
"name",
"in",
"names",
":",
"if",
"not",
"NAME_PATTERN",
".",
"match",
"(",
"name",
")",
":",
"raise",
"ValueError",
"(",
"'invalid extension name: %s'",
"%",
"name",
")",
"def",
"decorator",
"(",
"f",
"... | Makes a function to be an extension. | [
"Makes",
"a",
"function",
"to",
"be",
"an",
"extension",
"."
] | 5731203cbf29617ab8d42542f9dac03d5e34b217 | https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/smart.py#L190-L197 |
38,825 | what-studio/smartformat | smartformat/smart.py | SmartFormatter.register | def register(self, extensions):
"""Registers extensions."""
for ext in reversed(extensions):
for name in ext.names:
try:
self._extensions[name].appendleft(ext)
except KeyError:
self._extensions[name] = deque([ext]) | python | def register(self, extensions):
"""Registers extensions."""
for ext in reversed(extensions):
for name in ext.names:
try:
self._extensions[name].appendleft(ext)
except KeyError:
self._extensions[name] = deque([ext]) | [
"def",
"register",
"(",
"self",
",",
"extensions",
")",
":",
"for",
"ext",
"in",
"reversed",
"(",
"extensions",
")",
":",
"for",
"name",
"in",
"ext",
".",
"names",
":",
"try",
":",
"self",
".",
"_extensions",
"[",
"name",
"]",
".",
"appendleft",
"(",... | Registers extensions. | [
"Registers",
"extensions",
"."
] | 5731203cbf29617ab8d42542f9dac03d5e34b217 | https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/smart.py#L75-L82 |
38,826 | what-studio/smartformat | smartformat/smart.py | SmartFormatter.eval_extensions | def eval_extensions(self, value, name, option, format):
"""Evaluates extensions in the registry. If some extension handles the
format string, it returns a string. Otherwise, returns ``None``.
"""
try:
exts = self._extensions[name]
except KeyError:
raise ... | python | def eval_extensions(self, value, name, option, format):
"""Evaluates extensions in the registry. If some extension handles the
format string, it returns a string. Otherwise, returns ``None``.
"""
try:
exts = self._extensions[name]
except KeyError:
raise ... | [
"def",
"eval_extensions",
"(",
"self",
",",
"value",
",",
"name",
",",
"option",
",",
"format",
")",
":",
"try",
":",
"exts",
"=",
"self",
".",
"_extensions",
"[",
"name",
"]",
"except",
"KeyError",
":",
"raise",
"ValueError",
"(",
"'no suitable extension:... | Evaluates extensions in the registry. If some extension handles the
format string, it returns a string. Otherwise, returns ``None``. | [
"Evaluates",
"extensions",
"in",
"the",
"registry",
".",
"If",
"some",
"extension",
"handles",
"the",
"format",
"string",
"it",
"returns",
"a",
"string",
".",
"Otherwise",
"returns",
"None",
"."
] | 5731203cbf29617ab8d42542f9dac03d5e34b217 | https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/smart.py#L95-L106 |
38,827 | davgeo/clear | clear/tvfile.py | TVFile.GetShowDetails | def GetShowDetails(self):
"""
Extract show name, season number and episode number from file name.
Supports formats S<NUM>E<NUM> or <NUM>x<NUM> for season and episode numbers
where letters are case insensitive and number can be one or more digits. It
expects season number to be unique however it can... | python | def GetShowDetails(self):
"""
Extract show name, season number and episode number from file name.
Supports formats S<NUM>E<NUM> or <NUM>x<NUM> for season and episode numbers
where letters are case insensitive and number can be one or more digits. It
expects season number to be unique however it can... | [
"def",
"GetShowDetails",
"(",
"self",
")",
":",
"fileName",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"self",
".",
"fileInfo",
".",
"origPath",
")",
")",
"[",
"0",
"]",
"# Episode Number",
"episodeNumSubstring... | Extract show name, season number and episode number from file name.
Supports formats S<NUM>E<NUM> or <NUM>x<NUM> for season and episode numbers
where letters are case insensitive and number can be one or more digits. It
expects season number to be unique however it can handle either single or
multipart... | [
"Extract",
"show",
"name",
"season",
"number",
"and",
"episode",
"number",
"from",
"file",
"name",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/tvfile.py#L170-L255 |
38,828 | davgeo/clear | clear/tvfile.py | TVFile.GenerateNewFilePath | def GenerateNewFilePath(self, fileDir = None):
"""
Create new file path. If a fileDir is provided it will be used otherwise
the original file path is used. Updates file info object with new path.
Parameters
----------
fileDir : string [optional : default = None]
Optional file director... | python | def GenerateNewFilePath(self, fileDir = None):
"""
Create new file path. If a fileDir is provided it will be used otherwise
the original file path is used. Updates file info object with new path.
Parameters
----------
fileDir : string [optional : default = None]
Optional file director... | [
"def",
"GenerateNewFilePath",
"(",
"self",
",",
"fileDir",
"=",
"None",
")",
":",
"newFileName",
"=",
"self",
".",
"GenerateNewFileName",
"(",
")",
"if",
"newFileName",
"is",
"not",
"None",
":",
"if",
"fileDir",
"is",
"None",
":",
"fileDir",
"=",
"os",
"... | Create new file path. If a fileDir is provided it will be used otherwise
the original file path is used. Updates file info object with new path.
Parameters
----------
fileDir : string [optional : default = None]
Optional file directory | [
"Create",
"new",
"file",
"path",
".",
"If",
"a",
"fileDir",
"is",
"provided",
"it",
"will",
"be",
"used",
"otherwise",
"the",
"original",
"file",
"path",
"is",
"used",
".",
"Updates",
"file",
"info",
"object",
"with",
"new",
"path",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/tvfile.py#L286-L300 |
38,829 | davgeo/clear | clear/tvfile.py | TVFile.Print | def Print(self):
""" Print contents of showInfo and FileInfo object """
goodlogging.Log.Info("TVFILE", "TV File details are:")
goodlogging.Log.IncreaseIndent()
goodlogging.Log.Info("TVFILE", "Original File Path = {0}".format(self.fileInfo.origPath))
if self.showInfo.showName is not None:
... | python | def Print(self):
""" Print contents of showInfo and FileInfo object """
goodlogging.Log.Info("TVFILE", "TV File details are:")
goodlogging.Log.IncreaseIndent()
goodlogging.Log.Info("TVFILE", "Original File Path = {0}".format(self.fileInfo.origPath))
if self.showInfo.showName is not None:
... | [
"def",
"Print",
"(",
"self",
")",
":",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"TVFILE\"",
",",
"\"TV File details are:\"",
")",
"goodlogging",
".",
"Log",
".",
"IncreaseIndent",
"(",
")",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"TVFILE\"",
"... | Print contents of showInfo and FileInfo object | [
"Print",
"contents",
"of",
"showInfo",
"and",
"FileInfo",
"object"
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/tvfile.py#L305-L320 |
38,830 | sporsh/carnifex | carnifex/ssh/process.py | connectProcess | def connectProcess(connection, processProtocol, commandLine='', env={},
usePTY=None, childFDs=None, *args, **kwargs):
"""Opens a SSHSession channel and connects a ProcessProtocol to it
@param connection: the SSH Connection to open the session channel on
@param processProtocol: the Proces... | python | def connectProcess(connection, processProtocol, commandLine='', env={},
usePTY=None, childFDs=None, *args, **kwargs):
"""Opens a SSHSession channel and connects a ProcessProtocol to it
@param connection: the SSH Connection to open the session channel on
@param processProtocol: the Proces... | [
"def",
"connectProcess",
"(",
"connection",
",",
"processProtocol",
",",
"commandLine",
"=",
"''",
",",
"env",
"=",
"{",
"}",
",",
"usePTY",
"=",
"None",
",",
"childFDs",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"processOpenDef... | Opens a SSHSession channel and connects a ProcessProtocol to it
@param connection: the SSH Connection to open the session channel on
@param processProtocol: the ProcessProtocol instance to connect to the process
@param commandLine: the command line to execute the process
@param env: optional environmen... | [
"Opens",
"a",
"SSHSession",
"channel",
"and",
"connects",
"a",
"ProcessProtocol",
"to",
"it"
] | 82dd3bd2bc134dfb69a78f43171e227f2127060b | https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/process.py#L16-L34 |
38,831 | pauleveritt/kaybee | kaybee/plugins/events.py | EventAction.call_builder_init | def call_builder_init(cls, kb_app, sphinx_app: Sphinx):
""" On builder init event, commit registry and do callbacks """
# Find and commit docs project plugins
conf_dir = sphinx_app.confdir
plugins_dir = sphinx_app.config.kaybee_settings.plugins_dir
full_plugins_dir = os.path.joi... | python | def call_builder_init(cls, kb_app, sphinx_app: Sphinx):
""" On builder init event, commit registry and do callbacks """
# Find and commit docs project plugins
conf_dir = sphinx_app.confdir
plugins_dir = sphinx_app.config.kaybee_settings.plugins_dir
full_plugins_dir = os.path.joi... | [
"def",
"call_builder_init",
"(",
"cls",
",",
"kb_app",
",",
"sphinx_app",
":",
"Sphinx",
")",
":",
"# Find and commit docs project plugins",
"conf_dir",
"=",
"sphinx_app",
".",
"confdir",
"plugins_dir",
"=",
"sphinx_app",
".",
"config",
".",
"kaybee_settings",
".",
... | On builder init event, commit registry and do callbacks | [
"On",
"builder",
"init",
"event",
"commit",
"registry",
"and",
"do",
"callbacks"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/events.py#L86-L103 |
38,832 | pauleveritt/kaybee | kaybee/plugins/events.py | EventAction.call_purge_doc | def call_purge_doc(cls, kb_app, sphinx_app: Sphinx,
sphinx_env: BuildEnvironment,
docname: str):
""" On env-purge-doc, do callbacks """
for callback in EventAction.get_callbacks(kb_app, SphinxEvent.EPD):
callback(kb_app, sphinx_app, sphinx_env, ... | python | def call_purge_doc(cls, kb_app, sphinx_app: Sphinx,
sphinx_env: BuildEnvironment,
docname: str):
""" On env-purge-doc, do callbacks """
for callback in EventAction.get_callbacks(kb_app, SphinxEvent.EPD):
callback(kb_app, sphinx_app, sphinx_env, ... | [
"def",
"call_purge_doc",
"(",
"cls",
",",
"kb_app",
",",
"sphinx_app",
":",
"Sphinx",
",",
"sphinx_env",
":",
"BuildEnvironment",
",",
"docname",
":",
"str",
")",
":",
"for",
"callback",
"in",
"EventAction",
".",
"get_callbacks",
"(",
"kb_app",
",",
"SphinxE... | On env-purge-doc, do callbacks | [
"On",
"env",
"-",
"purge",
"-",
"doc",
"do",
"callbacks"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/events.py#L106-L112 |
38,833 | pauleveritt/kaybee | kaybee/plugins/events.py | EventAction.call_env_before_read_docs | def call_env_before_read_docs(cls, kb_app, sphinx_app: Sphinx,
sphinx_env: BuildEnvironment,
docnames: List[str]):
""" On env-read-docs, do callbacks"""
for callback in EventAction.get_callbacks(kb_app,
... | python | def call_env_before_read_docs(cls, kb_app, sphinx_app: Sphinx,
sphinx_env: BuildEnvironment,
docnames: List[str]):
""" On env-read-docs, do callbacks"""
for callback in EventAction.get_callbacks(kb_app,
... | [
"def",
"call_env_before_read_docs",
"(",
"cls",
",",
"kb_app",
",",
"sphinx_app",
":",
"Sphinx",
",",
"sphinx_env",
":",
"BuildEnvironment",
",",
"docnames",
":",
"List",
"[",
"str",
"]",
")",
":",
"for",
"callback",
"in",
"EventAction",
".",
"get_callbacks",
... | On env-read-docs, do callbacks | [
"On",
"env",
"-",
"read",
"-",
"docs",
"do",
"callbacks"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/events.py#L115-L122 |
38,834 | pauleveritt/kaybee | kaybee/plugins/events.py | EventAction.call_env_doctree_read | def call_env_doctree_read(cls, kb_app, sphinx_app: Sphinx,
doctree: doctree):
""" On doctree-read, do callbacks"""
for callback in EventAction.get_callbacks(kb_app,
SphinxEvent.DREAD):
callback(kb_app, sphinx_ap... | python | def call_env_doctree_read(cls, kb_app, sphinx_app: Sphinx,
doctree: doctree):
""" On doctree-read, do callbacks"""
for callback in EventAction.get_callbacks(kb_app,
SphinxEvent.DREAD):
callback(kb_app, sphinx_ap... | [
"def",
"call_env_doctree_read",
"(",
"cls",
",",
"kb_app",
",",
"sphinx_app",
":",
"Sphinx",
",",
"doctree",
":",
"doctree",
")",
":",
"for",
"callback",
"in",
"EventAction",
".",
"get_callbacks",
"(",
"kb_app",
",",
"SphinxEvent",
".",
"DREAD",
")",
":",
... | On doctree-read, do callbacks | [
"On",
"doctree",
"-",
"read",
"do",
"callbacks"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/events.py#L125-L131 |
38,835 | pauleveritt/kaybee | kaybee/plugins/events.py | EventAction.call_env_updated | def call_env_updated(cls, kb_app,
sphinx_app: Sphinx,
sphinx_env: BuildEnvironment):
""" On the env-updated event, do callbacks """
for callback in EventAction.get_callbacks(kb_app, SphinxEvent.EU):
callback(kb_app, sphinx_app, sphinx_env) | python | def call_env_updated(cls, kb_app,
sphinx_app: Sphinx,
sphinx_env: BuildEnvironment):
""" On the env-updated event, do callbacks """
for callback in EventAction.get_callbacks(kb_app, SphinxEvent.EU):
callback(kb_app, sphinx_app, sphinx_env) | [
"def",
"call_env_updated",
"(",
"cls",
",",
"kb_app",
",",
"sphinx_app",
":",
"Sphinx",
",",
"sphinx_env",
":",
"BuildEnvironment",
")",
":",
"for",
"callback",
"in",
"EventAction",
".",
"get_callbacks",
"(",
"kb_app",
",",
"SphinxEvent",
".",
"EU",
")",
":"... | On the env-updated event, do callbacks | [
"On",
"the",
"env",
"-",
"updated",
"event",
"do",
"callbacks"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/events.py#L144-L150 |
38,836 | pauleveritt/kaybee | kaybee/plugins/events.py | EventAction.call_html_collect_pages | def call_html_collect_pages(cls, kb_app, sphinx_app: Sphinx):
""" On html-collect-pages, do callbacks"""
EventAction.get_callbacks(kb_app,
SphinxEvent.HCP)
for callback in EventAction.get_callbacks(kb_app,
Sphin... | python | def call_html_collect_pages(cls, kb_app, sphinx_app: Sphinx):
""" On html-collect-pages, do callbacks"""
EventAction.get_callbacks(kb_app,
SphinxEvent.HCP)
for callback in EventAction.get_callbacks(kb_app,
Sphin... | [
"def",
"call_html_collect_pages",
"(",
"cls",
",",
"kb_app",
",",
"sphinx_app",
":",
"Sphinx",
")",
":",
"EventAction",
".",
"get_callbacks",
"(",
"kb_app",
",",
"SphinxEvent",
".",
"HCP",
")",
"for",
"callback",
"in",
"EventAction",
".",
"get_callbacks",
"(",... | On html-collect-pages, do callbacks | [
"On",
"html",
"-",
"collect",
"-",
"pages",
"do",
"callbacks"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/events.py#L153-L160 |
38,837 | pauleveritt/kaybee | kaybee/plugins/events.py | EventAction.call_env_check_consistency | def call_env_check_consistency(cls, kb_app, builder: StandaloneHTMLBuilder,
sphinx_env: BuildEnvironment):
""" On env-check-consistency, do callbacks"""
for callback in EventAction.get_callbacks(kb_app,
SphinxEvent.ECC... | python | def call_env_check_consistency(cls, kb_app, builder: StandaloneHTMLBuilder,
sphinx_env: BuildEnvironment):
""" On env-check-consistency, do callbacks"""
for callback in EventAction.get_callbacks(kb_app,
SphinxEvent.ECC... | [
"def",
"call_env_check_consistency",
"(",
"cls",
",",
"kb_app",
",",
"builder",
":",
"StandaloneHTMLBuilder",
",",
"sphinx_env",
":",
"BuildEnvironment",
")",
":",
"for",
"callback",
"in",
"EventAction",
".",
"get_callbacks",
"(",
"kb_app",
",",
"SphinxEvent",
"."... | On env-check-consistency, do callbacks | [
"On",
"env",
"-",
"check",
"-",
"consistency",
"do",
"callbacks"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/events.py#L163-L169 |
38,838 | stephrdev/django-tapeforms | tapeforms/mixins.py | TapeformLayoutMixin.get_layout_template | def get_layout_template(self, template_name=None):
"""
Returns the layout template to use when rendering the form to HTML.
Preference of template selection:
1. Provided method argument `template_name`
2. Form class property `layout_template`
3. Globally defined default ... | python | def get_layout_template(self, template_name=None):
"""
Returns the layout template to use when rendering the form to HTML.
Preference of template selection:
1. Provided method argument `template_name`
2. Form class property `layout_template`
3. Globally defined default ... | [
"def",
"get_layout_template",
"(",
"self",
",",
"template_name",
"=",
"None",
")",
":",
"if",
"template_name",
":",
"return",
"template_name",
"if",
"self",
".",
"layout_template",
":",
"return",
"self",
".",
"layout_template",
"return",
"defaults",
".",
"LAYOUT... | Returns the layout template to use when rendering the form to HTML.
Preference of template selection:
1. Provided method argument `template_name`
2. Form class property `layout_template`
3. Globally defined default template from `defaults.LAYOUT_DEFAULT_TEMPLATE`
:param templa... | [
"Returns",
"the",
"layout",
"template",
"to",
"use",
"when",
"rendering",
"the",
"form",
"to",
"HTML",
"."
] | 255602de43777141f18afaf30669d7bdd4f7c323 | https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/mixins.py#L18-L37 |
38,839 | stephrdev/django-tapeforms | tapeforms/mixins.py | TapeformLayoutMixin.get_layout_context | def get_layout_context(self):
"""
Returns the context which is used when rendering the form to HTML.
The generated template context will contain the following variables:
* form: `Form` instance
* errors: `ErrorList` instance with non field errors and hidden field errors
... | python | def get_layout_context(self):
"""
Returns the context which is used when rendering the form to HTML.
The generated template context will contain the following variables:
* form: `Form` instance
* errors: `ErrorList` instance with non field errors and hidden field errors
... | [
"def",
"get_layout_context",
"(",
"self",
")",
":",
"errors",
"=",
"self",
".",
"non_field_errors",
"(",
")",
"for",
"field",
"in",
"self",
".",
"hidden_fields",
"(",
")",
":",
"errors",
".",
"extend",
"(",
"field",
".",
"errors",
")",
"return",
"{",
"... | Returns the context which is used when rendering the form to HTML.
The generated template context will contain the following variables:
* form: `Form` instance
* errors: `ErrorList` instance with non field errors and hidden field errors
* hidden_fields: All hidden fields to render.
... | [
"Returns",
"the",
"context",
"which",
"is",
"used",
"when",
"rendering",
"the",
"form",
"to",
"HTML",
"."
] | 255602de43777141f18afaf30669d7bdd4f7c323 | https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/mixins.py#L39-L61 |
38,840 | stephrdev/django-tapeforms | tapeforms/mixins.py | TapeformMixin.get_field_template | def get_field_template(self, bound_field, template_name=None):
"""
Returns the field template to use when rendering a form field to HTML.
Preference of template selection:
1. Provided method argument `template_name`
2. Template from `field_template_overrides` selected by field ... | python | def get_field_template(self, bound_field, template_name=None):
"""
Returns the field template to use when rendering a form field to HTML.
Preference of template selection:
1. Provided method argument `template_name`
2. Template from `field_template_overrides` selected by field ... | [
"def",
"get_field_template",
"(",
"self",
",",
"bound_field",
",",
"template_name",
"=",
"None",
")",
":",
"if",
"template_name",
":",
"return",
"template_name",
"templates",
"=",
"self",
".",
"field_template_overrides",
"or",
"{",
"}",
"template_name",
"=",
"te... | Returns the field template to use when rendering a form field to HTML.
Preference of template selection:
1. Provided method argument `template_name`
2. Template from `field_template_overrides` selected by field name
3. Template from `field_template_overrides` selected by field class
... | [
"Returns",
"the",
"field",
"template",
"to",
"use",
"when",
"rendering",
"a",
"form",
"field",
"to",
"HTML",
"."
] | 255602de43777141f18afaf30669d7bdd4f7c323 | https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/mixins.py#L129-L161 |
38,841 | stephrdev/django-tapeforms | tapeforms/mixins.py | TapeformMixin.get_field_label_css_class | def get_field_label_css_class(self, bound_field):
"""
Returns the optional label CSS class to use when rendering a field template.
By default, returns the Form class property `field_label_css_class`. If the
field has errors and the Form class property `field_label_invalid_css_class`
... | python | def get_field_label_css_class(self, bound_field):
"""
Returns the optional label CSS class to use when rendering a field template.
By default, returns the Form class property `field_label_css_class`. If the
field has errors and the Form class property `field_label_invalid_css_class`
... | [
"def",
"get_field_label_css_class",
"(",
"self",
",",
"bound_field",
")",
":",
"class_name",
"=",
"self",
".",
"field_label_css_class",
"if",
"bound_field",
".",
"errors",
"and",
"self",
".",
"field_label_invalid_css_class",
":",
"class_name",
"=",
"join_css_class",
... | Returns the optional label CSS class to use when rendering a field template.
By default, returns the Form class property `field_label_css_class`. If the
field has errors and the Form class property `field_label_invalid_css_class`
is defined, its value is appended to the CSS class.
:par... | [
"Returns",
"the",
"optional",
"label",
"CSS",
"class",
"to",
"use",
"when",
"rendering",
"a",
"field",
"template",
"."
] | 255602de43777141f18afaf30669d7bdd4f7c323 | https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/mixins.py#L174-L191 |
38,842 | stephrdev/django-tapeforms | tapeforms/mixins.py | TapeformMixin.get_field_context | def get_field_context(self, bound_field):
"""
Returns the context which is used when rendering a form field to HTML.
The generated template context will contain the following variables:
* form: `Form` instance
* field: `BoundField` instance of the field
* field_id: Fiel... | python | def get_field_context(self, bound_field):
"""
Returns the context which is used when rendering a form field to HTML.
The generated template context will contain the following variables:
* form: `Form` instance
* field: `BoundField` instance of the field
* field_id: Fiel... | [
"def",
"get_field_context",
"(",
"self",
",",
"bound_field",
")",
":",
"widget",
"=",
"bound_field",
".",
"field",
".",
"widget",
"widget_class_name",
"=",
"widget",
".",
"__class__",
".",
"__name__",
".",
"lower",
"(",
")",
"# Check if we have an overwritten id i... | Returns the context which is used when rendering a form field to HTML.
The generated template context will contain the following variables:
* form: `Form` instance
* field: `BoundField` instance of the field
* field_id: Field ID to use in `<label for="..">`
* field_name: Name o... | [
"Returns",
"the",
"context",
"which",
"is",
"used",
"when",
"rendering",
"a",
"form",
"field",
"to",
"HTML",
"."
] | 255602de43777141f18afaf30669d7bdd4f7c323 | https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/mixins.py#L193-L237 |
38,843 | stephrdev/django-tapeforms | tapeforms/mixins.py | TapeformMixin.apply_widget_template | def apply_widget_template(self, field_name):
"""
Applies widget template overrides if available.
The method uses the `get_widget_template` method to determine if the widget
template should be exchanged. If a template is available, the template_name
property of the widget instanc... | python | def apply_widget_template(self, field_name):
"""
Applies widget template overrides if available.
The method uses the `get_widget_template` method to determine if the widget
template should be exchanged. If a template is available, the template_name
property of the widget instanc... | [
"def",
"apply_widget_template",
"(",
"self",
",",
"field_name",
")",
":",
"field",
"=",
"self",
".",
"fields",
"[",
"field_name",
"]",
"template_name",
"=",
"self",
".",
"get_widget_template",
"(",
"field_name",
",",
"field",
")",
"if",
"template_name",
":",
... | Applies widget template overrides if available.
The method uses the `get_widget_template` method to determine if the widget
template should be exchanged. If a template is available, the template_name
property of the widget instance is updated.
:param field_name: A field name of the for... | [
"Applies",
"widget",
"template",
"overrides",
"if",
"available",
"."
] | 255602de43777141f18afaf30669d7bdd4f7c323 | https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/mixins.py#L257-L271 |
38,844 | stephrdev/django-tapeforms | tapeforms/mixins.py | TapeformMixin.get_widget_template | def get_widget_template(self, field_name, field):
"""
Returns the optional widget template to use when rendering the widget
for a form field.
Preference of template selection:
1. Template from `widget_template_overrides` selected by field name
2. Template from `w... | python | def get_widget_template(self, field_name, field):
"""
Returns the optional widget template to use when rendering the widget
for a form field.
Preference of template selection:
1. Template from `widget_template_overrides` selected by field name
2. Template from `w... | [
"def",
"get_widget_template",
"(",
"self",
",",
"field_name",
",",
"field",
")",
":",
"templates",
"=",
"self",
".",
"widget_template_overrides",
"or",
"{",
"}",
"template_name",
"=",
"templates",
".",
"get",
"(",
"field_name",
",",
"None",
")",
"if",
"templ... | Returns the optional widget template to use when rendering the widget
for a form field.
Preference of template selection:
1. Template from `widget_template_overrides` selected by field name
2. Template from `widget_template_overrides` selected by widget class
By default... | [
"Returns",
"the",
"optional",
"widget",
"template",
"to",
"use",
"when",
"rendering",
"the",
"widget",
"for",
"a",
"form",
"field",
"."
] | 255602de43777141f18afaf30669d7bdd4f7c323 | https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/mixins.py#L273-L298 |
38,845 | stephrdev/django-tapeforms | tapeforms/mixins.py | TapeformMixin.apply_widget_css_class | def apply_widget_css_class(self, field_name):
"""
Applies CSS classes to widgets if available.
The method uses the `get_widget_css_class` method to determine if the widget
CSS class should be changed. If a CSS class is returned, it is appended to
the current value of the class p... | python | def apply_widget_css_class(self, field_name):
"""
Applies CSS classes to widgets if available.
The method uses the `get_widget_css_class` method to determine if the widget
CSS class should be changed. If a CSS class is returned, it is appended to
the current value of the class p... | [
"def",
"apply_widget_css_class",
"(",
"self",
",",
"field_name",
")",
":",
"field",
"=",
"self",
".",
"fields",
"[",
"field_name",
"]",
"class_name",
"=",
"self",
".",
"get_widget_css_class",
"(",
"field_name",
",",
"field",
")",
"if",
"class_name",
":",
"fi... | Applies CSS classes to widgets if available.
The method uses the `get_widget_css_class` method to determine if the widget
CSS class should be changed. If a CSS class is returned, it is appended to
the current value of the class property of the widget instance.
:param field_name: A fiel... | [
"Applies",
"CSS",
"classes",
"to",
"widgets",
"if",
"available",
"."
] | 255602de43777141f18afaf30669d7bdd4f7c323 | https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/mixins.py#L300-L315 |
38,846 | stephrdev/django-tapeforms | tapeforms/mixins.py | TapeformMixin.apply_widget_invalid_options | def apply_widget_invalid_options(self, field_name):
"""
Applies additional widget options for an invalid field.
This method is called when there is some error on a field to apply
additional options on its widget. It does the following:
* Sets the aria-invalid property of the wi... | python | def apply_widget_invalid_options(self, field_name):
"""
Applies additional widget options for an invalid field.
This method is called when there is some error on a field to apply
additional options on its widget. It does the following:
* Sets the aria-invalid property of the wi... | [
"def",
"apply_widget_invalid_options",
"(",
"self",
",",
"field_name",
")",
":",
"field",
"=",
"self",
".",
"fields",
"[",
"field_name",
"]",
"class_name",
"=",
"self",
".",
"get_widget_invalid_css_class",
"(",
"field_name",
",",
"field",
")",
"if",
"class_name"... | Applies additional widget options for an invalid field.
This method is called when there is some error on a field to apply
additional options on its widget. It does the following:
* Sets the aria-invalid property of the widget for accessibility.
* Adds an invalid CSS class, which is de... | [
"Applies",
"additional",
"widget",
"options",
"for",
"an",
"invalid",
"field",
"."
] | 255602de43777141f18afaf30669d7bdd4f7c323 | https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/mixins.py#L330-L351 |
38,847 | Equitable/trump | trump/converting/objects.py | FXConverter.use_quandl_data | def use_quandl_data(self, authtoken):
"""
Use quandl data to build conversion table
"""
dfs = {}
st = self.start.strftime("%Y-%m-%d")
at = authtoken
for pair in self.pairs:
symbol = "".join(pair)
qsym = "CURRFX/{}".format(symbol)
... | python | def use_quandl_data(self, authtoken):
"""
Use quandl data to build conversion table
"""
dfs = {}
st = self.start.strftime("%Y-%m-%d")
at = authtoken
for pair in self.pairs:
symbol = "".join(pair)
qsym = "CURRFX/{}".format(symbol)
... | [
"def",
"use_quandl_data",
"(",
"self",
",",
"authtoken",
")",
":",
"dfs",
"=",
"{",
"}",
"st",
"=",
"self",
".",
"start",
".",
"strftime",
"(",
"\"%Y-%m-%d\"",
")",
"at",
"=",
"authtoken",
"for",
"pair",
"in",
"self",
".",
"pairs",
":",
"symbol",
"="... | Use quandl data to build conversion table | [
"Use",
"quandl",
"data",
"to",
"build",
"conversion",
"table"
] | a2802692bc642fa32096374159eea7ceca2947b4 | https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/converting/objects.py#L51-L63 |
38,848 | Equitable/trump | trump/converting/objects.py | FXConverter.build_conversion_table | def build_conversion_table(self, dataframes):
"""
Build conversion table from a dictionary of dataframes
"""
self.data = pd.DataFrame(dataframes)
tmp_pairs = [s.split("/") for s in self.data.columns]
self.data.columns = pd.MultiIndex.from_tuples(tmp_pairs) | python | def build_conversion_table(self, dataframes):
"""
Build conversion table from a dictionary of dataframes
"""
self.data = pd.DataFrame(dataframes)
tmp_pairs = [s.split("/") for s in self.data.columns]
self.data.columns = pd.MultiIndex.from_tuples(tmp_pairs) | [
"def",
"build_conversion_table",
"(",
"self",
",",
"dataframes",
")",
":",
"self",
".",
"data",
"=",
"pd",
".",
"DataFrame",
"(",
"dataframes",
")",
"tmp_pairs",
"=",
"[",
"s",
".",
"split",
"(",
"\"/\"",
")",
"for",
"s",
"in",
"self",
".",
"data",
"... | Build conversion table from a dictionary of dataframes | [
"Build",
"conversion",
"table",
"from",
"a",
"dictionary",
"of",
"dataframes"
] | a2802692bc642fa32096374159eea7ceca2947b4 | https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/converting/objects.py#L78-L84 |
38,849 | invinst/ResponseBot | responsebot/models.py | TweetFilter.match_tweet | def match_tweet(self, tweet, user_stream):
"""
Check if a tweet matches the defined criteria
:param tweet: The tweet in question
:type tweet: :class:`~responsebot.models.Tweet`
:return: True if matched, False otherwise
"""
if user_stream:
if len(self.... | python | def match_tweet(self, tweet, user_stream):
"""
Check if a tweet matches the defined criteria
:param tweet: The tweet in question
:type tweet: :class:`~responsebot.models.Tweet`
:return: True if matched, False otherwise
"""
if user_stream:
if len(self.... | [
"def",
"match_tweet",
"(",
"self",
",",
"tweet",
",",
"user_stream",
")",
":",
"if",
"user_stream",
":",
"if",
"len",
"(",
"self",
".",
"track",
")",
">",
"0",
":",
"return",
"self",
".",
"is_tweet_match_track",
"(",
"tweet",
")",
"return",
"True",
"re... | Check if a tweet matches the defined criteria
:param tweet: The tweet in question
:type tweet: :class:`~responsebot.models.Tweet`
:return: True if matched, False otherwise | [
"Check",
"if",
"a",
"tweet",
"matches",
"the",
"defined",
"criteria"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/models.py#L81-L95 |
38,850 | bitesofcode/projex | projex/notify.py | connectMSExchange | def connectMSExchange(server):
"""
Creates a connection for the inputted server to a Microsoft Exchange server.
:param server | <smtplib.SMTP>
:usage |>>> import smtplib
|>>> import projex.notify
|>>> smtp = smtplib.SMTP('mail.server.com')
... | python | def connectMSExchange(server):
"""
Creates a connection for the inputted server to a Microsoft Exchange server.
:param server | <smtplib.SMTP>
:usage |>>> import smtplib
|>>> import projex.notify
|>>> smtp = smtplib.SMTP('mail.server.com')
... | [
"def",
"connectMSExchange",
"(",
"server",
")",
":",
"if",
"not",
"sspi",
":",
"return",
"False",
",",
"'No sspi module found.'",
"# send the SMTP EHLO command",
"code",
",",
"response",
"=",
"server",
".",
"ehlo",
"(",
")",
"if",
"code",
"!=",
"SMTP_EHLO_OKAY",... | Creates a connection for the inputted server to a Microsoft Exchange server.
:param server | <smtplib.SMTP>
:usage |>>> import smtplib
|>>> import projex.notify
|>>> smtp = smtplib.SMTP('mail.server.com')
|>>> projex.notify.connectMSExchange(smtp)
... | [
"Creates",
"a",
"connection",
"for",
"the",
"inputted",
"server",
"to",
"a",
"Microsoft",
"Exchange",
"server",
"."
] | d31743ec456a41428709968ab11a2cf6c6c76247 | https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/notify.py#L51-L100 |
38,851 | pauleveritt/kaybee | kaybee/plugins/articles/base_toctree.py | BaseToctree.set_entries | def set_entries(self, entries: List[Tuple[str, str]], titles, resources):
""" Provide the template the data for the toc entries """
self.entries = []
for flag, pagename in entries:
title = titles[pagename].children[0]
resource = resources.get(pagename, None)
... | python | def set_entries(self, entries: List[Tuple[str, str]], titles, resources):
""" Provide the template the data for the toc entries """
self.entries = []
for flag, pagename in entries:
title = titles[pagename].children[0]
resource = resources.get(pagename, None)
... | [
"def",
"set_entries",
"(",
"self",
",",
"entries",
":",
"List",
"[",
"Tuple",
"[",
"str",
",",
"str",
"]",
"]",
",",
"titles",
",",
"resources",
")",
":",
"self",
".",
"entries",
"=",
"[",
"]",
"for",
"flag",
",",
"pagename",
"in",
"entries",
":",
... | Provide the template the data for the toc entries | [
"Provide",
"the",
"template",
"the",
"data",
"for",
"the",
"toc",
"entries"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/articles/base_toctree.py#L29-L46 |
38,852 | pauleveritt/kaybee | kaybee/plugins/articles/base_toctree.py | BaseToctree.render | def render(self, builder, context, sphinx_app: Sphinx):
""" Given a Sphinx builder and context with site in it,
generate HTML """
context['sphinx_app'] = sphinx_app
context['toctree'] = self
html = builder.templates.render(self.template + '.html', context)
return html | python | def render(self, builder, context, sphinx_app: Sphinx):
""" Given a Sphinx builder and context with site in it,
generate HTML """
context['sphinx_app'] = sphinx_app
context['toctree'] = self
html = builder.templates.render(self.template + '.html', context)
return html | [
"def",
"render",
"(",
"self",
",",
"builder",
",",
"context",
",",
"sphinx_app",
":",
"Sphinx",
")",
":",
"context",
"[",
"'sphinx_app'",
"]",
"=",
"sphinx_app",
"context",
"[",
"'toctree'",
"]",
"=",
"self",
"html",
"=",
"builder",
".",
"templates",
"."... | Given a Sphinx builder and context with site in it,
generate HTML | [
"Given",
"a",
"Sphinx",
"builder",
"and",
"context",
"with",
"site",
"in",
"it",
"generate",
"HTML"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/articles/base_toctree.py#L63-L71 |
38,853 | jingming/spotify | spotify/auth/util.py | parse_code | def parse_code(url):
"""
Parse the code parameter from the a URL
:param str url: URL to parse
:return: code query parameter
:rtype: str
"""
result = urlparse(url)
query = parse_qs(result.query)
return query['code'] | python | def parse_code(url):
"""
Parse the code parameter from the a URL
:param str url: URL to parse
:return: code query parameter
:rtype: str
"""
result = urlparse(url)
query = parse_qs(result.query)
return query['code'] | [
"def",
"parse_code",
"(",
"url",
")",
":",
"result",
"=",
"urlparse",
"(",
"url",
")",
"query",
"=",
"parse_qs",
"(",
"result",
".",
"query",
")",
"return",
"query",
"[",
"'code'",
"]"
] | Parse the code parameter from the a URL
:param str url: URL to parse
:return: code query parameter
:rtype: str | [
"Parse",
"the",
"code",
"parameter",
"from",
"the",
"a",
"URL"
] | d92c71073b2515f3c850604114133a7d2022d1a4 | https://github.com/jingming/spotify/blob/d92c71073b2515f3c850604114133a7d2022d1a4/spotify/auth/util.py#L6-L16 |
38,854 | jingming/spotify | spotify/auth/util.py | user_token | def user_token(scopes, client_id=None, client_secret=None, redirect_uri=None):
"""
Generate a user access token
:param List[str] scopes: Scopes to get
:param str client_id: Spotify Client ID
:param str client_secret: Spotify Client secret
:param str redirect_uri: Spotify redirect URI
:retur... | python | def user_token(scopes, client_id=None, client_secret=None, redirect_uri=None):
"""
Generate a user access token
:param List[str] scopes: Scopes to get
:param str client_id: Spotify Client ID
:param str client_secret: Spotify Client secret
:param str redirect_uri: Spotify redirect URI
:retur... | [
"def",
"user_token",
"(",
"scopes",
",",
"client_id",
"=",
"None",
",",
"client_secret",
"=",
"None",
",",
"redirect_uri",
"=",
"None",
")",
":",
"webbrowser",
".",
"open_new",
"(",
"authorize_url",
"(",
"client_id",
"=",
"client_id",
",",
"redirect_uri",
"=... | Generate a user access token
:param List[str] scopes: Scopes to get
:param str client_id: Spotify Client ID
:param str client_secret: Spotify Client secret
:param str redirect_uri: Spotify redirect URI
:return: Generated access token
:rtype: User | [
"Generate",
"a",
"user",
"access",
"token"
] | d92c71073b2515f3c850604114133a7d2022d1a4 | https://github.com/jingming/spotify/blob/d92c71073b2515f3c850604114133a7d2022d1a4/spotify/auth/util.py#L19-L32 |
38,855 | standage/tag | tag/index.py | Index.consume_file | def consume_file(self, infile):
"""Load the specified GFF3 file into memory."""
reader = tag.reader.GFF3Reader(infilename=infile)
self.consume(reader) | python | def consume_file(self, infile):
"""Load the specified GFF3 file into memory."""
reader = tag.reader.GFF3Reader(infilename=infile)
self.consume(reader) | [
"def",
"consume_file",
"(",
"self",
",",
"infile",
")",
":",
"reader",
"=",
"tag",
".",
"reader",
".",
"GFF3Reader",
"(",
"infilename",
"=",
"infile",
")",
"self",
".",
"consume",
"(",
"reader",
")"
] | Load the specified GFF3 file into memory. | [
"Load",
"the",
"specified",
"GFF3",
"file",
"into",
"memory",
"."
] | 94686adf57115cea1c5235e99299e691f80ba10b | https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/index.py#L55-L58 |
38,856 | standage/tag | tag/index.py | Index.consume | def consume(self, entrystream):
"""
Load a stream of entries into memory.
Only Feature objects and sequence-region directives are loaded, all
other entries are discarded.
"""
for entry in entrystream:
if isinstance(entry, tag.directive.Directive) and \
... | python | def consume(self, entrystream):
"""
Load a stream of entries into memory.
Only Feature objects and sequence-region directives are loaded, all
other entries are discarded.
"""
for entry in entrystream:
if isinstance(entry, tag.directive.Directive) and \
... | [
"def",
"consume",
"(",
"self",
",",
"entrystream",
")",
":",
"for",
"entry",
"in",
"entrystream",
":",
"if",
"isinstance",
"(",
"entry",
",",
"tag",
".",
"directive",
".",
"Directive",
")",
"and",
"entry",
".",
"type",
"==",
"'sequence-region'",
":",
"se... | Load a stream of entries into memory.
Only Feature objects and sequence-region directives are loaded, all
other entries are discarded. | [
"Load",
"a",
"stream",
"of",
"entries",
"into",
"memory",
"."
] | 94686adf57115cea1c5235e99299e691f80ba10b | https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/index.py#L81-L93 |
38,857 | standage/tag | tag/index.py | Index.query | def query(self, seqid, start, end, strict=True):
"""
Query the index for features in the specified range.
:param seqid: ID of the sequence to query
:param start: start of the query interval
:param end: end of the query interval
:param strict: indicates whether query is s... | python | def query(self, seqid, start, end, strict=True):
"""
Query the index for features in the specified range.
:param seqid: ID of the sequence to query
:param start: start of the query interval
:param end: end of the query interval
:param strict: indicates whether query is s... | [
"def",
"query",
"(",
"self",
",",
"seqid",
",",
"start",
",",
"end",
",",
"strict",
"=",
"True",
")",
":",
"return",
"sorted",
"(",
"[",
"intvl",
".",
"data",
"for",
"intvl",
"in",
"self",
"[",
"seqid",
"]",
".",
"search",
"(",
"start",
",",
"end... | Query the index for features in the specified range.
:param seqid: ID of the sequence to query
:param start: start of the query interval
:param end: end of the query interval
:param strict: indicates whether query is strict containment or overlap
(:code:`True` and... | [
"Query",
"the",
"index",
"for",
"features",
"in",
"the",
"specified",
"range",
"."
] | 94686adf57115cea1c5235e99299e691f80ba10b | https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/index.py#L110-L122 |
38,858 | e7dal/bubble3 | bubble3/commands/cmd_functions.py | cli | def cli(ctx, stage):
"""Show the functions that are available, bubble system and custom."""
if not ctx.bubble:
ctx.say_yellow(
'There is no bubble present, will not show any transformer functions')
raise click.Abort()
rule_functions = get_registered_rule_functions()
ctx.gbc.s... | python | def cli(ctx, stage):
"""Show the functions that are available, bubble system and custom."""
if not ctx.bubble:
ctx.say_yellow(
'There is no bubble present, will not show any transformer functions')
raise click.Abort()
rule_functions = get_registered_rule_functions()
ctx.gbc.s... | [
"def",
"cli",
"(",
"ctx",
",",
"stage",
")",
":",
"if",
"not",
"ctx",
".",
"bubble",
":",
"ctx",
".",
"say_yellow",
"(",
"'There is no bubble present, will not show any transformer functions'",
")",
"raise",
"click",
".",
"Abort",
"(",
")",
"rule_functions",
"="... | Show the functions that are available, bubble system and custom. | [
"Show",
"the",
"functions",
"that",
"are",
"available",
"bubble",
"system",
"and",
"custom",
"."
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/commands/cmd_functions.py#L17-L33 |
38,859 | MacHu-GWU/rolex-project | rolex/util.py | to_utc | def to_utc(a_datetime, keep_utc_tzinfo=False):
"""
Convert a time awared datetime to utc datetime.
:param a_datetime: a timezone awared datetime. (If not, then just returns)
:param keep_utc_tzinfo: whether to retain the utc time zone information.
**中文文档**
将一个带时区的时间转化成UTC时间。而对于UTC时间而言, 有没有时区信息... | python | def to_utc(a_datetime, keep_utc_tzinfo=False):
"""
Convert a time awared datetime to utc datetime.
:param a_datetime: a timezone awared datetime. (If not, then just returns)
:param keep_utc_tzinfo: whether to retain the utc time zone information.
**中文文档**
将一个带时区的时间转化成UTC时间。而对于UTC时间而言, 有没有时区信息... | [
"def",
"to_utc",
"(",
"a_datetime",
",",
"keep_utc_tzinfo",
"=",
"False",
")",
":",
"if",
"a_datetime",
".",
"tzinfo",
":",
"utc_datetime",
"=",
"a_datetime",
".",
"astimezone",
"(",
"utc",
")",
"# convert to utc time",
"if",
"keep_utc_tzinfo",
"is",
"False",
... | Convert a time awared datetime to utc datetime.
:param a_datetime: a timezone awared datetime. (If not, then just returns)
:param keep_utc_tzinfo: whether to retain the utc time zone information.
**中文文档**
将一个带时区的时间转化成UTC时间。而对于UTC时间而言, 有没有时区信息都无所谓了。 | [
"Convert",
"a",
"time",
"awared",
"datetime",
"to",
"utc",
"datetime",
"."
] | a1111b410ed04b4b6eddd81df110fa2dacfa6537 | https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/util.py#L74-L91 |
38,860 | MacHu-GWU/rolex-project | rolex/util.py | utc_to_tz | def utc_to_tz(utc_datetime, tzinfo, keep_tzinfo=False):
"""
Convert a UTC datetime to a time awared local time
:param utc_datetime:
:param tzinfo:
:param keep_tzinfo:
"""
tz_awared_datetime = utc_datetime.replace(tzinfo=utc).astimezone(tzinfo)
if keep_tzinfo is False:
tz_awared_... | python | def utc_to_tz(utc_datetime, tzinfo, keep_tzinfo=False):
"""
Convert a UTC datetime to a time awared local time
:param utc_datetime:
:param tzinfo:
:param keep_tzinfo:
"""
tz_awared_datetime = utc_datetime.replace(tzinfo=utc).astimezone(tzinfo)
if keep_tzinfo is False:
tz_awared_... | [
"def",
"utc_to_tz",
"(",
"utc_datetime",
",",
"tzinfo",
",",
"keep_tzinfo",
"=",
"False",
")",
":",
"tz_awared_datetime",
"=",
"utc_datetime",
".",
"replace",
"(",
"tzinfo",
"=",
"utc",
")",
".",
"astimezone",
"(",
"tzinfo",
")",
"if",
"keep_tzinfo",
"is",
... | Convert a UTC datetime to a time awared local time
:param utc_datetime:
:param tzinfo:
:param keep_tzinfo: | [
"Convert",
"a",
"UTC",
"datetime",
"to",
"a",
"time",
"awared",
"local",
"time"
] | a1111b410ed04b4b6eddd81df110fa2dacfa6537 | https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/util.py#L94-L105 |
38,861 | MacHu-GWU/crawlib-project | crawlib/helper.py | repr_data_size | def repr_data_size(size_in_bytes, precision=2): # pragma: no cover
"""Return human readable string represent of a file size. Doesn"t support
size greater than 1EB.
For example:
- 100 bytes => 100 B
- 100,000 bytes => 97.66 KB
- 100,000,000 bytes => 95.37 MB
- 100,000,000,000 bytes => 93.1... | python | def repr_data_size(size_in_bytes, precision=2): # pragma: no cover
"""Return human readable string represent of a file size. Doesn"t support
size greater than 1EB.
For example:
- 100 bytes => 100 B
- 100,000 bytes => 97.66 KB
- 100,000,000 bytes => 95.37 MB
- 100,000,000,000 bytes => 93.1... | [
"def",
"repr_data_size",
"(",
"size_in_bytes",
",",
"precision",
"=",
"2",
")",
":",
"# pragma: no cover",
"if",
"size_in_bytes",
"<",
"1024",
":",
"return",
"\"%s B\"",
"%",
"size_in_bytes",
"magnitude_of_data",
"=",
"[",
"\"B\"",
",",
"\"KB\"",
",",
"\"MB\"",
... | Return human readable string represent of a file size. Doesn"t support
size greater than 1EB.
For example:
- 100 bytes => 100 B
- 100,000 bytes => 97.66 KB
- 100,000,000 bytes => 95.37 MB
- 100,000,000,000 bytes => 93.13 GB
- 100,000,000,000,000 bytes => 90.95 TB
- 100,000,000,000,000,... | [
"Return",
"human",
"readable",
"string",
"represent",
"of",
"a",
"file",
"size",
".",
"Doesn",
"t",
"support",
"size",
"greater",
"than",
"1EB",
"."
] | 241516f2a7a0a32c692f7af35a1f44064e8ce1ab | https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/helper.py#L5-L42 |
38,862 | pauleveritt/kaybee | kaybee/plugins/articles/handlers.py | render_toctrees | def render_toctrees(kb_app: kb, sphinx_app: Sphinx, doctree: doctree,
fromdocname: str):
""" Look in doctrees for toctree and replace with custom render """
# Only do any of this if toctree support is turned on in KaybeeSettings.
# By default, this is off.
settings: KaybeeSettings =... | python | def render_toctrees(kb_app: kb, sphinx_app: Sphinx, doctree: doctree,
fromdocname: str):
""" Look in doctrees for toctree and replace with custom render """
# Only do any of this if toctree support is turned on in KaybeeSettings.
# By default, this is off.
settings: KaybeeSettings =... | [
"def",
"render_toctrees",
"(",
"kb_app",
":",
"kb",
",",
"sphinx_app",
":",
"Sphinx",
",",
"doctree",
":",
"doctree",
",",
"fromdocname",
":",
"str",
")",
":",
"# Only do any of this if toctree support is turned on in KaybeeSettings.",
"# By default, this is off.",
"setti... | Look in doctrees for toctree and replace with custom render | [
"Look",
"in",
"doctrees",
"for",
"toctree",
"and",
"replace",
"with",
"custom",
"render"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/articles/handlers.py#L48-L85 |
38,863 | pauleveritt/kaybee | kaybee/plugins/articles/handlers.py | stamp_excerpt | def stamp_excerpt(kb_app: kb,
sphinx_app: Sphinx,
doctree: doctree):
""" Walk the tree and extract excert into resource.excerpt """
# First, find out which resource this is. Won't be easy.
resources = sphinx_app.env.resources
confdir = sphinx_app.confdir
source =... | python | def stamp_excerpt(kb_app: kb,
sphinx_app: Sphinx,
doctree: doctree):
""" Walk the tree and extract excert into resource.excerpt """
# First, find out which resource this is. Won't be easy.
resources = sphinx_app.env.resources
confdir = sphinx_app.confdir
source =... | [
"def",
"stamp_excerpt",
"(",
"kb_app",
":",
"kb",
",",
"sphinx_app",
":",
"Sphinx",
",",
"doctree",
":",
"doctree",
")",
":",
"# First, find out which resource this is. Won't be easy.",
"resources",
"=",
"sphinx_app",
".",
"env",
".",
"resources",
"confdir",
"=",
... | Walk the tree and extract excert into resource.excerpt | [
"Walk",
"the",
"tree",
"and",
"extract",
"excert",
"into",
"resource",
".",
"excerpt"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/articles/handlers.py#L114-L140 |
38,864 | diamondman/proteusisc | proteusisc/jtagUtils.py | bitfieldify | def bitfieldify(buff, count):
"""Extract a bitarray out of a bytes array.
Some hardware devices read from the LSB to the MSB, but the bit types available prefer to put pad bits on the LSB side, completely changing the data.
This function takes in bytes and the number of bits to extract
starting from t... | python | def bitfieldify(buff, count):
"""Extract a bitarray out of a bytes array.
Some hardware devices read from the LSB to the MSB, but the bit types available prefer to put pad bits on the LSB side, completely changing the data.
This function takes in bytes and the number of bits to extract
starting from t... | [
"def",
"bitfieldify",
"(",
"buff",
",",
"count",
")",
":",
"databits",
"=",
"bitarray",
"(",
")",
"databits",
".",
"frombytes",
"(",
"buff",
")",
"return",
"databits",
"[",
"len",
"(",
"databits",
")",
"-",
"count",
":",
"]"
] | Extract a bitarray out of a bytes array.
Some hardware devices read from the LSB to the MSB, but the bit types available prefer to put pad bits on the LSB side, completely changing the data.
This function takes in bytes and the number of bits to extract
starting from the LSB, and produces a bitarray of th... | [
"Extract",
"a",
"bitarray",
"out",
"of",
"a",
"bytes",
"array",
"."
] | 7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c | https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/jtagUtils.py#L57-L68 |
38,865 | diamondman/proteusisc | proteusisc/jtagUtils.py | build_byte_align_buff | def build_byte_align_buff(bits):
"""Pad the left side of a bitarray with 0s to align its length with byte boundaries.
Args:
bits: A bitarray to be padded and aligned.
Returns:
A newly aligned bitarray.
"""
bitmod = len(bits)%8
if bitmod == 0:
rdiff = bitarray()
else... | python | def build_byte_align_buff(bits):
"""Pad the left side of a bitarray with 0s to align its length with byte boundaries.
Args:
bits: A bitarray to be padded and aligned.
Returns:
A newly aligned bitarray.
"""
bitmod = len(bits)%8
if bitmod == 0:
rdiff = bitarray()
else... | [
"def",
"build_byte_align_buff",
"(",
"bits",
")",
":",
"bitmod",
"=",
"len",
"(",
"bits",
")",
"%",
"8",
"if",
"bitmod",
"==",
"0",
":",
"rdiff",
"=",
"bitarray",
"(",
")",
"else",
":",
"#KEEP bitarray",
"rdiff",
"=",
"bitarray",
"(",
"8",
"-",
"bitm... | Pad the left side of a bitarray with 0s to align its length with byte boundaries.
Args:
bits: A bitarray to be padded and aligned.
Returns:
A newly aligned bitarray. | [
"Pad",
"the",
"left",
"side",
"of",
"a",
"bitarray",
"with",
"0s",
"to",
"align",
"its",
"length",
"with",
"byte",
"boundaries",
"."
] | 7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c | https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/jtagUtils.py#L96-L112 |
38,866 | HPCC-Cloud-Computing/CAL | calplus/v1/network/client.py | Client.create | def create(self, name, cidr, **kwargs):
"""This function will create a user network.
Within OpenStack, it will create a network and a subnet
Within AWS, it will create a VPC and a subnet
:param name: string
:param cidr: string E.x: "10.0.0.0/24"
:param kwargs: dict
... | python | def create(self, name, cidr, **kwargs):
"""This function will create a user network.
Within OpenStack, it will create a network and a subnet
Within AWS, it will create a VPC and a subnet
:param name: string
:param cidr: string E.x: "10.0.0.0/24"
:param kwargs: dict
... | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"cidr",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"driver",
".",
"create",
"(",
"name",
",",
"cidr",
",",
"*",
"*",
"kwargs",
")"
] | This function will create a user network.
Within OpenStack, it will create a network and a subnet
Within AWS, it will create a VPC and a subnet
:param name: string
:param cidr: string E.x: "10.0.0.0/24"
:param kwargs: dict
:return: dict | [
"This",
"function",
"will",
"create",
"a",
"user",
"network",
".",
"Within",
"OpenStack",
"it",
"will",
"create",
"a",
"network",
"and",
"a",
"subnet",
"Within",
"AWS",
"it",
"will",
"create",
"a",
"VPC",
"and",
"a",
"subnet"
] | 7134b3dfe9ee3a383506a592765c7a12fa4ca1e9 | https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/network/client.py#L16-L26 |
38,867 | sparknetworks/pgpm | pgpm/lib/utils/misc.py | find_whole_word | def find_whole_word(w):
"""
Scan through string looking for a location where this word produces a match,
and return a corresponding MatchObject instance.
Return None if no position in the string matches the pattern;
note that this is different from finding a zero-length match at some point in the st... | python | def find_whole_word(w):
"""
Scan through string looking for a location where this word produces a match,
and return a corresponding MatchObject instance.
Return None if no position in the string matches the pattern;
note that this is different from finding a zero-length match at some point in the st... | [
"def",
"find_whole_word",
"(",
"w",
")",
":",
"return",
"re",
".",
"compile",
"(",
"r'\\b({0})\\b'",
".",
"format",
"(",
"w",
")",
",",
"flags",
"=",
"re",
".",
"IGNORECASE",
")",
".",
"search"
] | Scan through string looking for a location where this word produces a match,
and return a corresponding MatchObject instance.
Return None if no position in the string matches the pattern;
note that this is different from finding a zero-length match at some point in the string. | [
"Scan",
"through",
"string",
"looking",
"for",
"a",
"location",
"where",
"this",
"word",
"produces",
"a",
"match",
"and",
"return",
"a",
"corresponding",
"MatchObject",
"instance",
".",
"Return",
"None",
"if",
"no",
"position",
"in",
"the",
"string",
"matches"... | 1a060df46a886095181f692ea870a73a32510a2e | https://github.com/sparknetworks/pgpm/blob/1a060df46a886095181f692ea870a73a32510a2e/pgpm/lib/utils/misc.py#L11-L18 |
38,868 | davgeo/clear | clear/extract.py | GetCompressedFilesInDir | def GetCompressedFilesInDir(fileDir, fileList, ignoreDirList, supportedFormatList = ['.rar',]):
"""
Get all supported files from given directory folder. Appends to given file list.
Parameters
----------
fileDir : string
File directory to search.
fileList : list
List which any file matches ... | python | def GetCompressedFilesInDir(fileDir, fileList, ignoreDirList, supportedFormatList = ['.rar',]):
"""
Get all supported files from given directory folder. Appends to given file list.
Parameters
----------
fileDir : string
File directory to search.
fileList : list
List which any file matches ... | [
"def",
"GetCompressedFilesInDir",
"(",
"fileDir",
",",
"fileList",
",",
"ignoreDirList",
",",
"supportedFormatList",
"=",
"[",
"'.rar'",
",",
"]",
")",
":",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"EXTRACT\"",
",",
"\"Parsing file directory: {0}\"",
".",
... | Get all supported files from given directory folder. Appends to given file list.
Parameters
----------
fileDir : string
File directory to search.
fileList : list
List which any file matches will be added to.
ignoreDirList : list
List of directories to ignore in recursive lookup (cur... | [
"Get",
"all",
"supported",
"files",
"from",
"given",
"directory",
"folder",
".",
"Appends",
"to",
"given",
"file",
"list",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/extract.py#L23-L45 |
38,869 | davgeo/clear | clear/extract.py | MultipartArchiving | def MultipartArchiving(firstPartExtractList, otherPartSkippedList, archiveDir, otherPartFilePath = None):
"""
Archive all parts of multi-part compressed file.
If file has been extracted (via part1) then move all subsequent parts directly to archive directory.
If file has not been extracted then if part >1 add ... | python | def MultipartArchiving(firstPartExtractList, otherPartSkippedList, archiveDir, otherPartFilePath = None):
"""
Archive all parts of multi-part compressed file.
If file has been extracted (via part1) then move all subsequent parts directly to archive directory.
If file has not been extracted then if part >1 add ... | [
"def",
"MultipartArchiving",
"(",
"firstPartExtractList",
",",
"otherPartSkippedList",
",",
"archiveDir",
",",
"otherPartFilePath",
"=",
"None",
")",
":",
"if",
"otherPartFilePath",
"is",
"None",
":",
"for",
"filePath",
"in",
"list",
"(",
"otherPartSkippedList",
")"... | Archive all parts of multi-part compressed file.
If file has been extracted (via part1) then move all subsequent parts directly to archive directory.
If file has not been extracted then if part >1 add to other part skipped list and only archive
when the first part is sent for archiving.
Parameters
---------... | [
"Archive",
"all",
"parts",
"of",
"multi",
"-",
"part",
"compressed",
"file",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/extract.py#L50-L83 |
38,870 | davgeo/clear | clear/extract.py | DoRarExtraction | def DoRarExtraction(rarArchive, targetFile, dstDir):
"""
RAR extraction with exception catching
Parameters
----------
rarArchive : RarFile object
RarFile object to extract.
targetFile : string
Target file name.
dstDir : string
Target directory.
Returns
----------
boolea... | python | def DoRarExtraction(rarArchive, targetFile, dstDir):
"""
RAR extraction with exception catching
Parameters
----------
rarArchive : RarFile object
RarFile object to extract.
targetFile : string
Target file name.
dstDir : string
Target directory.
Returns
----------
boolea... | [
"def",
"DoRarExtraction",
"(",
"rarArchive",
",",
"targetFile",
",",
"dstDir",
")",
":",
"try",
":",
"rarArchive",
".",
"extract",
"(",
"targetFile",
",",
"dstDir",
")",
"except",
"BaseException",
"as",
"ex",
":",
"goodlogging",
".",
"Log",
".",
"Info",
"(... | RAR extraction with exception catching
Parameters
----------
rarArchive : RarFile object
RarFile object to extract.
targetFile : string
Target file name.
dstDir : string
Target directory.
Returns
----------
boolean
False if rar extraction failed, otherwise True. | [
"RAR",
"extraction",
"with",
"exception",
"catching"
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/extract.py#L88-L114 |
38,871 | davgeo/clear | clear/extract.py | GetRarPassword | def GetRarPassword(skipUserInput):
"""
Get password for rar archive from user input.
Parameters
----------
skipUserInput : boolean
Set to skip user input.
Returns
----------
string or boolean
If no password is given then returns False otherwise returns user
response string.
"""... | python | def GetRarPassword(skipUserInput):
"""
Get password for rar archive from user input.
Parameters
----------
skipUserInput : boolean
Set to skip user input.
Returns
----------
string or boolean
If no password is given then returns False otherwise returns user
response string.
"""... | [
"def",
"GetRarPassword",
"(",
"skipUserInput",
")",
":",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"EXTRACT\"",
",",
"\"RAR file needs password to extract\"",
")",
"if",
"skipUserInput",
"is",
"False",
":",
"prompt",
"=",
"\"Enter password, 'x' to skip this file or... | Get password for rar archive from user input.
Parameters
----------
skipUserInput : boolean
Set to skip user input.
Returns
----------
string or boolean
If no password is given then returns False otherwise returns user
response string. | [
"Get",
"password",
"for",
"rar",
"archive",
"from",
"user",
"input",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/extract.py#L119-L148 |
38,872 | davgeo/clear | clear/extract.py | CheckPasswordReuse | def CheckPasswordReuse(skipUserInput):
"""
Check with user for password reuse.
Parameters
----------
skipUserInput : boolean
Set to skip user input.
Returns
----------
int
Integer from -1 to 2 depending on user response.
"""
goodlogging.Log.Info("EXTRACT", "RAR files needs password... | python | def CheckPasswordReuse(skipUserInput):
"""
Check with user for password reuse.
Parameters
----------
skipUserInput : boolean
Set to skip user input.
Returns
----------
int
Integer from -1 to 2 depending on user response.
"""
goodlogging.Log.Info("EXTRACT", "RAR files needs password... | [
"def",
"CheckPasswordReuse",
"(",
"skipUserInput",
")",
":",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"EXTRACT\"",
",",
"\"RAR files needs password to extract\"",
")",
"if",
"skipUserInput",
"is",
"False",
":",
"prompt",
"=",
"\"Enter 't' to reuse the last passwor... | Check with user for password reuse.
Parameters
----------
skipUserInput : boolean
Set to skip user input.
Returns
----------
int
Integer from -1 to 2 depending on user response. | [
"Check",
"with",
"user",
"for",
"password",
"reuse",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/extract.py#L153-L185 |
38,873 | steinitzu/giveme | giveme/core.py | Manager.register | def register(self, func, singleton=False, threadlocal=False, name=None):
"""
Register a dependency function
"""
func._giveme_singleton = singleton
func._giveme_threadlocal = threadlocal
if name is None:
name = func.__name__
self._registered[name] = fu... | python | def register(self, func, singleton=False, threadlocal=False, name=None):
"""
Register a dependency function
"""
func._giveme_singleton = singleton
func._giveme_threadlocal = threadlocal
if name is None:
name = func.__name__
self._registered[name] = fu... | [
"def",
"register",
"(",
"self",
",",
"func",
",",
"singleton",
"=",
"False",
",",
"threadlocal",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"func",
".",
"_giveme_singleton",
"=",
"singleton",
"func",
".",
"_giveme_threadlocal",
"=",
"threadlocal",
"... | Register a dependency function | [
"Register",
"a",
"dependency",
"function"
] | b250995c59eb7e141d2cd8260e292c417785bbd1 | https://github.com/steinitzu/giveme/blob/b250995c59eb7e141d2cd8260e292c417785bbd1/giveme/core.py#L21-L31 |
38,874 | steinitzu/giveme | giveme/core.py | Manager.get_value | def get_value(self, name):
"""
Get return value of a dependency factory or
a live singleton instance.
"""
factory = self._registered.get(name)
if not factory:
raise KeyError('Name not registered')
if factory._giveme_singleton:
if name in se... | python | def get_value(self, name):
"""
Get return value of a dependency factory or
a live singleton instance.
"""
factory = self._registered.get(name)
if not factory:
raise KeyError('Name not registered')
if factory._giveme_singleton:
if name in se... | [
"def",
"get_value",
"(",
"self",
",",
"name",
")",
":",
"factory",
"=",
"self",
".",
"_registered",
".",
"get",
"(",
"name",
")",
"if",
"not",
"factory",
":",
"raise",
"KeyError",
"(",
"'Name not registered'",
")",
"if",
"factory",
".",
"_giveme_singleton"... | Get return value of a dependency factory or
a live singleton instance. | [
"Get",
"return",
"value",
"of",
"a",
"dependency",
"factory",
"or",
"a",
"live",
"singleton",
"instance",
"."
] | b250995c59eb7e141d2cd8260e292c417785bbd1 | https://github.com/steinitzu/giveme/blob/b250995c59eb7e141d2cd8260e292c417785bbd1/giveme/core.py#L45-L63 |
38,875 | e7dal/bubble3 | bubble3/functions.py | trace | def trace(fun, *a, **k):
""" define a tracer for a rule function
for log and statistic purposes """
@wraps(fun)
def tracer(*a, **k):
ret = fun(*a, **k)
print('trace:fun: %s\n ret=%s\n a=%s\nk%s\n' %
(str(fun), str(ret), str(a), str(k)))
return ret
return tracer | python | def trace(fun, *a, **k):
""" define a tracer for a rule function
for log and statistic purposes """
@wraps(fun)
def tracer(*a, **k):
ret = fun(*a, **k)
print('trace:fun: %s\n ret=%s\n a=%s\nk%s\n' %
(str(fun), str(ret), str(a), str(k)))
return ret
return tracer | [
"def",
"trace",
"(",
"fun",
",",
"*",
"a",
",",
"*",
"*",
"k",
")",
":",
"@",
"wraps",
"(",
"fun",
")",
"def",
"tracer",
"(",
"*",
"a",
",",
"*",
"*",
"k",
")",
":",
"ret",
"=",
"fun",
"(",
"*",
"a",
",",
"*",
"*",
"k",
")",
"print",
... | define a tracer for a rule function
for log and statistic purposes | [
"define",
"a",
"tracer",
"for",
"a",
"rule",
"function",
"for",
"log",
"and",
"statistic",
"purposes"
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L186-L195 |
38,876 | e7dal/bubble3 | bubble3/functions.py | timer | def timer(fun, *a, **k):
""" define a timer for a rule function
for log and statistic purposes """
@wraps(fun)
def timer(*a, **k):
start = arrow.now()
ret = fun(*a, **k)
end = arrow.now()
print('timer:fun: %s\n start:%s,end:%s, took [%s]' % (
str(fun), str(sta... | python | def timer(fun, *a, **k):
""" define a timer for a rule function
for log and statistic purposes """
@wraps(fun)
def timer(*a, **k):
start = arrow.now()
ret = fun(*a, **k)
end = arrow.now()
print('timer:fun: %s\n start:%s,end:%s, took [%s]' % (
str(fun), str(sta... | [
"def",
"timer",
"(",
"fun",
",",
"*",
"a",
",",
"*",
"*",
"k",
")",
":",
"@",
"wraps",
"(",
"fun",
")",
"def",
"timer",
"(",
"*",
"a",
",",
"*",
"*",
"k",
")",
":",
"start",
"=",
"arrow",
".",
"now",
"(",
")",
"ret",
"=",
"fun",
"(",
"*... | define a timer for a rule function
for log and statistic purposes | [
"define",
"a",
"timer",
"for",
"a",
"rule",
"function",
"for",
"log",
"and",
"statistic",
"purposes"
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L198-L209 |
38,877 | e7dal/bubble3 | bubble3/functions.py | RuleFunctions.get_function | def get_function(self, fun=None):
"""get function as RuleFunction or return a NoRuleFunction function"""
sfun = str(fun)
self.say('get_function:' + sfun, verbosity=100)
if not fun:
return NoRuleFunction() # dummy to execute via no_fun
if sfun in self._rule_function... | python | def get_function(self, fun=None):
"""get function as RuleFunction or return a NoRuleFunction function"""
sfun = str(fun)
self.say('get_function:' + sfun, verbosity=100)
if not fun:
return NoRuleFunction() # dummy to execute via no_fun
if sfun in self._rule_function... | [
"def",
"get_function",
"(",
"self",
",",
"fun",
"=",
"None",
")",
":",
"sfun",
"=",
"str",
"(",
"fun",
")",
"self",
".",
"say",
"(",
"'get_function:'",
"+",
"sfun",
",",
"verbosity",
"=",
"100",
")",
"if",
"not",
"fun",
":",
"return",
"NoRuleFunction... | get function as RuleFunction or return a NoRuleFunction function | [
"get",
"function",
"as",
"RuleFunction",
"or",
"return",
"a",
"NoRuleFunction",
"function"
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L85-L103 |
38,878 | e7dal/bubble3 | bubble3/functions.py | RuleFunctions.add_function | def add_function(self,
fun=None,
name=None,
fun_type=FUN_TYPE):
"""actually replace function"""
if not name:
if six.PY2:
name = fun.func_name
else:
name = fun.__name__
self.say... | python | def add_function(self,
fun=None,
name=None,
fun_type=FUN_TYPE):
"""actually replace function"""
if not name:
if six.PY2:
name = fun.func_name
else:
name = fun.__name__
self.say... | [
"def",
"add_function",
"(",
"self",
",",
"fun",
"=",
"None",
",",
"name",
"=",
"None",
",",
"fun_type",
"=",
"FUN_TYPE",
")",
":",
"if",
"not",
"name",
":",
"if",
"six",
".",
"PY2",
":",
"name",
"=",
"fun",
".",
"func_name",
"else",
":",
"name",
... | actually replace function | [
"actually",
"replace",
"function"
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L113-L132 |
38,879 | e7dal/bubble3 | bubble3/functions.py | RuleFunctions.function_exists | def function_exists(self, fun):
""" get function's existense """
res = fun in self._rule_functions
self.say('function exists:' + str(fun) + ':' + str(res),
verbosity=10)
return res | python | def function_exists(self, fun):
""" get function's existense """
res = fun in self._rule_functions
self.say('function exists:' + str(fun) + ':' + str(res),
verbosity=10)
return res | [
"def",
"function_exists",
"(",
"self",
",",
"fun",
")",
":",
"res",
"=",
"fun",
"in",
"self",
".",
"_rule_functions",
"self",
".",
"say",
"(",
"'function exists:'",
"+",
"str",
"(",
"fun",
")",
"+",
"':'",
"+",
"str",
"(",
"res",
")",
",",
"verbosity... | get function's existense | [
"get",
"function",
"s",
"existense"
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L134-L139 |
38,880 | e7dal/bubble3 | bubble3/functions.py | RuleFunctions.rule_function_not_found | def rule_function_not_found(self, fun=None):
""" any function that does not exist will be added as a
dummy function that will gather inputs for easing into
the possible future implementation
"""
sfun = str(fun)
self.cry('rule_function_not_found:' + sfun)
def not_... | python | def rule_function_not_found(self, fun=None):
""" any function that does not exist will be added as a
dummy function that will gather inputs for easing into
the possible future implementation
"""
sfun = str(fun)
self.cry('rule_function_not_found:' + sfun)
def not_... | [
"def",
"rule_function_not_found",
"(",
"self",
",",
"fun",
"=",
"None",
")",
":",
"sfun",
"=",
"str",
"(",
"fun",
")",
"self",
".",
"cry",
"(",
"'rule_function_not_found:'",
"+",
"sfun",
")",
"def",
"not_found",
"(",
"*",
"a",
",",
"*",
"*",
"k",
")"... | any function that does not exist will be added as a
dummy function that will gather inputs for easing into
the possible future implementation | [
"any",
"function",
"that",
"does",
"not",
"exist",
"will",
"be",
"added",
"as",
"a",
"dummy",
"function",
"that",
"will",
"gather",
"inputs",
"for",
"easing",
"into",
"the",
"possible",
"future",
"implementation"
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L145-L155 |
38,881 | jplusplus/statscraper | statscraper/scrapers/VantetiderScraper.py | parse_value | def parse_value(val):
""" Parse values from html
"""
val = val.replace("%", " ")\
.replace(" ","")\
.replace(",", ".")\
.replace("st","").strip()
missing = ["Ejdeltagit", "N/A"]
if val in missing:
return val
elif val == "":
return None
return float(v... | python | def parse_value(val):
""" Parse values from html
"""
val = val.replace("%", " ")\
.replace(" ","")\
.replace(",", ".")\
.replace("st","").strip()
missing = ["Ejdeltagit", "N/A"]
if val in missing:
return val
elif val == "":
return None
return float(v... | [
"def",
"parse_value",
"(",
"val",
")",
":",
"val",
"=",
"val",
".",
"replace",
"(",
"\"%\"",
",",
"\" \"",
")",
".",
"replace",
"(",
"\" \"",
",",
"\"\"",
")",
".",
"replace",
"(",
"\",\"",
",",
"\".\"",
")",
".",
"replace",
"(",
"\"st\"",
",",
"... | Parse values from html | [
"Parse",
"values",
"from",
"html"
] | 932ec048b23d15b3dbdaf829facc55fd78ec0109 | https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L636-L650 |
38,882 | jplusplus/statscraper | statscraper/scrapers/VantetiderScraper.py | VantetiderScraper._get_html | def _get_html(self, url):
""" Get html from url
"""
self.log.info(u"/GET {}".format(url))
r = requests.get(url)
if hasattr(r, 'from_cache'):
if r.from_cache:
self.log.info("(from cache)")
if r.status_code != 200:
throw_request_err(... | python | def _get_html(self, url):
""" Get html from url
"""
self.log.info(u"/GET {}".format(url))
r = requests.get(url)
if hasattr(r, 'from_cache'):
if r.from_cache:
self.log.info("(from cache)")
if r.status_code != 200:
throw_request_err(... | [
"def",
"_get_html",
"(",
"self",
",",
"url",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"u\"/GET {}\"",
".",
"format",
"(",
"url",
")",
")",
"r",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"if",
"hasattr",
"(",
"r",
",",
"'from_cache'",
"... | Get html from url | [
"Get",
"html",
"from",
"url"
] | 932ec048b23d15b3dbdaf829facc55fd78ec0109 | https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L141-L153 |
38,883 | jplusplus/statscraper | statscraper/scrapers/VantetiderScraper.py | VantetiderScraper._get_json | def _get_json(self, url):
""" Get json from url
"""
self.log.info(u"/GET " + url)
r = requests.get(url)
if hasattr(r, 'from_cache'):
if r.from_cache:
self.log.info("(from cache)")
if r.status_code != 200:
throw_request_err(r)
... | python | def _get_json(self, url):
""" Get json from url
"""
self.log.info(u"/GET " + url)
r = requests.get(url)
if hasattr(r, 'from_cache'):
if r.from_cache:
self.log.info("(from cache)")
if r.status_code != 200:
throw_request_err(r)
... | [
"def",
"_get_json",
"(",
"self",
",",
"url",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"u\"/GET \"",
"+",
"url",
")",
"r",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"if",
"hasattr",
"(",
"r",
",",
"'from_cache'",
")",
":",
"if",
"r",
... | Get json from url | [
"Get",
"json",
"from",
"url"
] | 932ec048b23d15b3dbdaf829facc55fd78ec0109 | https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L163-L174 |
38,884 | jplusplus/statscraper | statscraper/scrapers/VantetiderScraper.py | VantetiderDataset.regions | def regions(self):
""" Get a list of all regions
"""
regions = []
elem = self.dimensions["region"].elem
for option_elem in elem.find_all("option"):
region = option_elem.text.strip()
regions.append(region)
return regions | python | def regions(self):
""" Get a list of all regions
"""
regions = []
elem = self.dimensions["region"].elem
for option_elem in elem.find_all("option"):
region = option_elem.text.strip()
regions.append(region)
return regions | [
"def",
"regions",
"(",
"self",
")",
":",
"regions",
"=",
"[",
"]",
"elem",
"=",
"self",
".",
"dimensions",
"[",
"\"region\"",
"]",
".",
"elem",
"for",
"option_elem",
"in",
"elem",
".",
"find_all",
"(",
"\"option\"",
")",
":",
"region",
"=",
"option_ele... | Get a list of all regions | [
"Get",
"a",
"list",
"of",
"all",
"regions"
] | 932ec048b23d15b3dbdaf829facc55fd78ec0109 | https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L203-L212 |
38,885 | jplusplus/statscraper | statscraper/scrapers/VantetiderScraper.py | VantetiderDataset._get_region_slug | def _get_region_slug(self, id_or_label):
""" Get the regional slug to be used in url
"Norrbotten" => "Norrbottens"
:param id_or_label: Id or label of region
"""
#region = self.dimensions["region"].get(id_or_label)
region = id_or_label
slug = region\
... | python | def _get_region_slug(self, id_or_label):
""" Get the regional slug to be used in url
"Norrbotten" => "Norrbottens"
:param id_or_label: Id or label of region
"""
#region = self.dimensions["region"].get(id_or_label)
region = id_or_label
slug = region\
... | [
"def",
"_get_region_slug",
"(",
"self",
",",
"id_or_label",
")",
":",
"#region = self.dimensions[\"region\"].get(id_or_label)",
"region",
"=",
"id_or_label",
"slug",
"=",
"region",
".",
"replace",
"(",
"u\" \"",
",",
"\"-\"",
")",
".",
"replace",
"(",
"u\"ö\",",
"... | Get the regional slug to be used in url
"Norrbotten" => "Norrbottens"
:param id_or_label: Id or label of region | [
"Get",
"the",
"regional",
"slug",
"to",
"be",
"used",
"in",
"url",
"Norrbotten",
"=",
">",
"Norrbottens"
] | 932ec048b23d15b3dbdaf829facc55fd78ec0109 | https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L215-L237 |
38,886 | jplusplus/statscraper | statscraper/scrapers/VantetiderScraper.py | VantetiderDimension.default_value | def default_value(self):
""" The default category when making a query
"""
if not hasattr(self, "_default_value"):
if self.elem_type == "select":
try:
# Get option marked "selected"
def_value = get_option_value(self.elem.select_o... | python | def default_value(self):
""" The default category when making a query
"""
if not hasattr(self, "_default_value"):
if self.elem_type == "select":
try:
# Get option marked "selected"
def_value = get_option_value(self.elem.select_o... | [
"def",
"default_value",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"_default_value\"",
")",
":",
"if",
"self",
".",
"elem_type",
"==",
"\"select\"",
":",
"try",
":",
"# Get option marked \"selected\"",
"def_value",
"=",
"get_option_value"... | The default category when making a query | [
"The",
"default",
"category",
"when",
"making",
"a",
"query"
] | 932ec048b23d15b3dbdaf829facc55fd78ec0109 | https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L337-L359 |
38,887 | jplusplus/statscraper | statscraper/scrapers/VantetiderScraper.py | Datatable._parse_horizontal_scroll_table | def _parse_horizontal_scroll_table(self, table_html):
""" Get list of dicts from horizontally scrollable table
"""
row_labels = [parse_text(x.text) for x in table_html.select(".DTFC_LeftBodyWrapper tbody tr")]
row_label_ids = [None] * len(row_labels)
cols = [parse_text(x.text) f... | python | def _parse_horizontal_scroll_table(self, table_html):
""" Get list of dicts from horizontally scrollable table
"""
row_labels = [parse_text(x.text) for x in table_html.select(".DTFC_LeftBodyWrapper tbody tr")]
row_label_ids = [None] * len(row_labels)
cols = [parse_text(x.text) f... | [
"def",
"_parse_horizontal_scroll_table",
"(",
"self",
",",
"table_html",
")",
":",
"row_labels",
"=",
"[",
"parse_text",
"(",
"x",
".",
"text",
")",
"for",
"x",
"in",
"table_html",
".",
"select",
"(",
"\".DTFC_LeftBodyWrapper tbody tr\"",
")",
"]",
"row_label_id... | Get list of dicts from horizontally scrollable table | [
"Get",
"list",
"of",
"dicts",
"from",
"horizontally",
"scrollable",
"table"
] | 932ec048b23d15b3dbdaf829facc55fd78ec0109 | https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L474-L489 |
38,888 | Miachol/pycnf | pycnf/configtype.py | is_json_file | def is_json_file(filename, show_warnings = False):
"""Check configuration file type is JSON
Return a boolean indicating wheather the file is JSON format or not
"""
try:
config_dict = load_config(filename, file_type = "json")
is_json = True
except:
is_json = False
return(i... | python | def is_json_file(filename, show_warnings = False):
"""Check configuration file type is JSON
Return a boolean indicating wheather the file is JSON format or not
"""
try:
config_dict = load_config(filename, file_type = "json")
is_json = True
except:
is_json = False
return(i... | [
"def",
"is_json_file",
"(",
"filename",
",",
"show_warnings",
"=",
"False",
")",
":",
"try",
":",
"config_dict",
"=",
"load_config",
"(",
"filename",
",",
"file_type",
"=",
"\"json\"",
")",
"is_json",
"=",
"True",
"except",
":",
"is_json",
"=",
"False",
"r... | Check configuration file type is JSON
Return a boolean indicating wheather the file is JSON format or not | [
"Check",
"configuration",
"file",
"type",
"is",
"JSON",
"Return",
"a",
"boolean",
"indicating",
"wheather",
"the",
"file",
"is",
"JSON",
"format",
"or",
"not"
] | 8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b | https://github.com/Miachol/pycnf/blob/8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b/pycnf/configtype.py#L2-L11 |
38,889 | Miachol/pycnf | pycnf/configtype.py | is_yaml_file | def is_yaml_file(filename, show_warnings = False):
"""Check configuration file type is yaml
Return a boolean indicating wheather the file is yaml format or not
"""
if is_json_file(filename):
return(False)
try:
config_dict = load_config(filename, file_type = "yaml")
if(type(co... | python | def is_yaml_file(filename, show_warnings = False):
"""Check configuration file type is yaml
Return a boolean indicating wheather the file is yaml format or not
"""
if is_json_file(filename):
return(False)
try:
config_dict = load_config(filename, file_type = "yaml")
if(type(co... | [
"def",
"is_yaml_file",
"(",
"filename",
",",
"show_warnings",
"=",
"False",
")",
":",
"if",
"is_json_file",
"(",
"filename",
")",
":",
"return",
"(",
"False",
")",
"try",
":",
"config_dict",
"=",
"load_config",
"(",
"filename",
",",
"file_type",
"=",
"\"ya... | Check configuration file type is yaml
Return a boolean indicating wheather the file is yaml format or not | [
"Check",
"configuration",
"file",
"type",
"is",
"yaml",
"Return",
"a",
"boolean",
"indicating",
"wheather",
"the",
"file",
"is",
"yaml",
"format",
"or",
"not"
] | 8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b | https://github.com/Miachol/pycnf/blob/8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b/pycnf/configtype.py#L13-L27 |
38,890 | Miachol/pycnf | pycnf/configtype.py | is_ini_file | def is_ini_file(filename, show_warnings = False):
"""Check configuration file type is INI
Return a boolean indicating wheather the file is INI format or not
"""
try:
config_dict = load_config(filename, file_type = "ini")
if config_dict == {}:
is_ini = False
else:
... | python | def is_ini_file(filename, show_warnings = False):
"""Check configuration file type is INI
Return a boolean indicating wheather the file is INI format or not
"""
try:
config_dict = load_config(filename, file_type = "ini")
if config_dict == {}:
is_ini = False
else:
... | [
"def",
"is_ini_file",
"(",
"filename",
",",
"show_warnings",
"=",
"False",
")",
":",
"try",
":",
"config_dict",
"=",
"load_config",
"(",
"filename",
",",
"file_type",
"=",
"\"ini\"",
")",
"if",
"config_dict",
"==",
"{",
"}",
":",
"is_ini",
"=",
"False",
... | Check configuration file type is INI
Return a boolean indicating wheather the file is INI format or not | [
"Check",
"configuration",
"file",
"type",
"is",
"INI",
"Return",
"a",
"boolean",
"indicating",
"wheather",
"the",
"file",
"is",
"INI",
"format",
"or",
"not"
] | 8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b | https://github.com/Miachol/pycnf/blob/8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b/pycnf/configtype.py#L29-L41 |
38,891 | Miachol/pycnf | pycnf/configtype.py | is_toml_file | def is_toml_file(filename, show_warnings = False):
"""Check configuration file type is TOML
Return a boolean indicating wheather the file is TOML format or not
"""
if is_yaml_file(filename):
return(False)
try:
config_dict = load_config(filename, file_type = "toml")
is_toml = ... | python | def is_toml_file(filename, show_warnings = False):
"""Check configuration file type is TOML
Return a boolean indicating wheather the file is TOML format or not
"""
if is_yaml_file(filename):
return(False)
try:
config_dict = load_config(filename, file_type = "toml")
is_toml = ... | [
"def",
"is_toml_file",
"(",
"filename",
",",
"show_warnings",
"=",
"False",
")",
":",
"if",
"is_yaml_file",
"(",
"filename",
")",
":",
"return",
"(",
"False",
")",
"try",
":",
"config_dict",
"=",
"load_config",
"(",
"filename",
",",
"file_type",
"=",
"\"to... | Check configuration file type is TOML
Return a boolean indicating wheather the file is TOML format or not | [
"Check",
"configuration",
"file",
"type",
"is",
"TOML",
"Return",
"a",
"boolean",
"indicating",
"wheather",
"the",
"file",
"is",
"TOML",
"format",
"or",
"not"
] | 8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b | https://github.com/Miachol/pycnf/blob/8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b/pycnf/configtype.py#L43-L54 |
38,892 | jrief/django-nodebow | nodebow/management/commands/_base.py | BaseCommand._collect_settings | def _collect_settings(self, apps):
"""
Iterate over given apps or INSTALLED_APPS and collect the content of each's
settings file, which is expected to be in JSON format.
"""
contents = {}
if apps:
for app in apps:
if app not in settings.INSTALL... | python | def _collect_settings(self, apps):
"""
Iterate over given apps or INSTALLED_APPS and collect the content of each's
settings file, which is expected to be in JSON format.
"""
contents = {}
if apps:
for app in apps:
if app not in settings.INSTALL... | [
"def",
"_collect_settings",
"(",
"self",
",",
"apps",
")",
":",
"contents",
"=",
"{",
"}",
"if",
"apps",
":",
"for",
"app",
"in",
"apps",
":",
"if",
"app",
"not",
"in",
"settings",
".",
"INSTALLED_APPS",
":",
"raise",
"CommandError",
"(",
"\"Application ... | Iterate over given apps or INSTALLED_APPS and collect the content of each's
settings file, which is expected to be in JSON format. | [
"Iterate",
"over",
"given",
"apps",
"or",
"INSTALLED_APPS",
"and",
"collect",
"the",
"content",
"of",
"each",
"s",
"settings",
"file",
"which",
"is",
"expected",
"to",
"be",
"in",
"JSON",
"format",
"."
] | 36053f3e9d156a95376d29533d2ec40f56c70f05 | https://github.com/jrief/django-nodebow/blob/36053f3e9d156a95376d29533d2ec40f56c70f05/nodebow/management/commands/_base.py#L31-L50 |
38,893 | LeastAuthority/txkube | src/txkube/_model.py | required_unique | def required_unique(objects, key):
"""
A pyrsistent invariant which requires all objects in the given iterable to
have a unique key.
:param objects: The objects to check.
:param key: A one-argument callable to compute the key of an object.
:return: An invariant failure if any two or more objec... | python | def required_unique(objects, key):
"""
A pyrsistent invariant which requires all objects in the given iterable to
have a unique key.
:param objects: The objects to check.
:param key: A one-argument callable to compute the key of an object.
:return: An invariant failure if any two or more objec... | [
"def",
"required_unique",
"(",
"objects",
",",
"key",
")",
":",
"keys",
"=",
"{",
"}",
"duplicate",
"=",
"set",
"(",
")",
"for",
"k",
"in",
"map",
"(",
"key",
",",
"objects",
")",
":",
"keys",
"[",
"k",
"]",
"=",
"keys",
".",
"get",
"(",
"k",
... | A pyrsistent invariant which requires all objects in the given iterable to
have a unique key.
:param objects: The objects to check.
:param key: A one-argument callable to compute the key of an object.
:return: An invariant failure if any two or more objects have the same key
computed. An inva... | [
"A",
"pyrsistent",
"invariant",
"which",
"requires",
"all",
"objects",
"in",
"the",
"given",
"iterable",
"to",
"have",
"a",
"unique",
"key",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_model.py#L236-L255 |
38,894 | LeastAuthority/txkube | src/txkube/_model.py | _List.item_by_name | def item_by_name(self, name):
"""
Find an item in this collection by its name metadata.
:param unicode name: The name of the object for which to search.
:raise KeyError: If no object matching the given name is found.
:return IObject: The object with the matching name.
"... | python | def item_by_name(self, name):
"""
Find an item in this collection by its name metadata.
:param unicode name: The name of the object for which to search.
:raise KeyError: If no object matching the given name is found.
:return IObject: The object with the matching name.
"... | [
"def",
"item_by_name",
"(",
"self",
",",
"name",
")",
":",
"for",
"obj",
"in",
"self",
".",
"items",
":",
"if",
"obj",
".",
"metadata",
".",
"name",
"==",
"name",
":",
"return",
"obj",
"raise",
"KeyError",
"(",
"name",
")"
] | Find an item in this collection by its name metadata.
:param unicode name: The name of the object for which to search.
:raise KeyError: If no object matching the given name is found.
:return IObject: The object with the matching name. | [
"Find",
"an",
"item",
"in",
"this",
"collection",
"by",
"its",
"name",
"metadata",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_model.py#L292-L304 |
38,895 | chrizzFTD/naming | naming/base.py | _BaseName._init_name_core | def _init_name_core(self, name: str):
"""Runs whenever a new instance is initialized or `sep` is set."""
self.__regex = re.compile(rf'^{self._pattern}$')
self.name = name | python | def _init_name_core(self, name: str):
"""Runs whenever a new instance is initialized or `sep` is set."""
self.__regex = re.compile(rf'^{self._pattern}$')
self.name = name | [
"def",
"_init_name_core",
"(",
"self",
",",
"name",
":",
"str",
")",
":",
"self",
".",
"__regex",
"=",
"re",
".",
"compile",
"(",
"rf'^{self._pattern}$'",
")",
"self",
".",
"name",
"=",
"name"
] | Runs whenever a new instance is initialized or `sep` is set. | [
"Runs",
"whenever",
"a",
"new",
"instance",
"is",
"initialized",
"or",
"sep",
"is",
"set",
"."
] | ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c | https://github.com/chrizzFTD/naming/blob/ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c/naming/base.py#L132-L135 |
38,896 | chrizzFTD/naming | naming/base.py | _BaseName.get_name | def get_name(self, **values) -> str:
"""Get a new name string from this object's name values.
:param values: Variable keyword arguments where the **key** should refer to a field on this object that will
use the provided **value** to build the new name.
"""
if not ... | python | def get_name(self, **values) -> str:
"""Get a new name string from this object's name values.
:param values: Variable keyword arguments where the **key** should refer to a field on this object that will
use the provided **value** to build the new name.
"""
if not ... | [
"def",
"get_name",
"(",
"self",
",",
"*",
"*",
"values",
")",
"->",
"str",
":",
"if",
"not",
"values",
"and",
"self",
".",
"name",
":",
"return",
"self",
".",
"name",
"if",
"values",
":",
"# if values are provided, solve compounds that may be affected",
"for",... | Get a new name string from this object's name values.
:param values: Variable keyword arguments where the **key** should refer to a field on this object that will
use the provided **value** to build the new name. | [
"Get",
"a",
"new",
"name",
"string",
"from",
"this",
"object",
"s",
"name",
"values",
"."
] | ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c | https://github.com/chrizzFTD/naming/blob/ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c/naming/base.py#L205-L221 |
38,897 | chrizzFTD/naming | naming/base.py | _BaseName.cast_config | def cast_config(cls, config: typing.Mapping[str, str]) -> typing.Dict[str, str]:
"""Cast `config` to grouped regular expressions."""
return {k: cls.cast(v, k) for k, v in config.items()} | python | def cast_config(cls, config: typing.Mapping[str, str]) -> typing.Dict[str, str]:
"""Cast `config` to grouped regular expressions."""
return {k: cls.cast(v, k) for k, v in config.items()} | [
"def",
"cast_config",
"(",
"cls",
",",
"config",
":",
"typing",
".",
"Mapping",
"[",
"str",
",",
"str",
"]",
")",
"->",
"typing",
".",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"return",
"{",
"k",
":",
"cls",
".",
"cast",
"(",
"v",
",",
"k",
... | Cast `config` to grouped regular expressions. | [
"Cast",
"config",
"to",
"grouped",
"regular",
"expressions",
"."
] | ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c | https://github.com/chrizzFTD/naming/blob/ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c/naming/base.py#L232-L234 |
38,898 | diamondman/proteusisc | proteusisc/cabledriver.py | CableDriver._execute_primitives | def _execute_primitives(self, commands):
"""Run a list of executable primitives on this controller, and distribute the returned data to the associated TDOPromises.
Args:
commands: A list of Executable Primitives to be run in order.
"""
for p in commands:
if self... | python | def _execute_primitives(self, commands):
"""Run a list of executable primitives on this controller, and distribute the returned data to the associated TDOPromises.
Args:
commands: A list of Executable Primitives to be run in order.
"""
for p in commands:
if self... | [
"def",
"_execute_primitives",
"(",
"self",
",",
"commands",
")",
":",
"for",
"p",
"in",
"commands",
":",
"if",
"self",
".",
"_scanchain",
"and",
"self",
".",
"_scanchain",
".",
"_debug",
":",
"print",
"(",
"\" Executing\"",
",",
"p",
")",
"#pragma: no cov... | Run a list of executable primitives on this controller, and distribute the returned data to the associated TDOPromises.
Args:
commands: A list of Executable Primitives to be run in order. | [
"Run",
"a",
"list",
"of",
"executable",
"primitives",
"on",
"this",
"controller",
"and",
"distribute",
"the",
"returned",
"data",
"to",
"the",
"associated",
"TDOPromises",
"."
] | 7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c | https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/cabledriver.py#L53-L63 |
38,899 | jic-dtool/dtool-cli | dtool_cli/cli.py | pretty_version_text | def pretty_version_text():
"""Return pretty version text listing all plugins."""
version_lines = ["dtool, version {}".format(dtool_version)]
version_lines.append("\nBase:")
version_lines.append("dtoolcore, version {}".format(dtoolcore.__version__))
version_lines.append("dtool-cli, version {}".format... | python | def pretty_version_text():
"""Return pretty version text listing all plugins."""
version_lines = ["dtool, version {}".format(dtool_version)]
version_lines.append("\nBase:")
version_lines.append("dtoolcore, version {}".format(dtoolcore.__version__))
version_lines.append("dtool-cli, version {}".format... | [
"def",
"pretty_version_text",
"(",
")",
":",
"version_lines",
"=",
"[",
"\"dtool, version {}\"",
".",
"format",
"(",
"dtool_version",
")",
"]",
"version_lines",
".",
"append",
"(",
"\"\\nBase:\"",
")",
"version_lines",
".",
"append",
"(",
"\"dtoolcore, version {}\""... | Return pretty version text listing all plugins. | [
"Return",
"pretty",
"version",
"text",
"listing",
"all",
"plugins",
"."
] | 010d573d98cfe870cf489844c3feaab4976425ff | https://github.com/jic-dtool/dtool-cli/blob/010d573d98cfe870cf489844c3feaab4976425ff/dtool_cli/cli.py#L89-L120 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.