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
247,100
openpermissions/perch
perch/model.py
SubResource._save
def _save(self): """Save the sub-resource within the parent resource""" yield self.validate() try: self._parent = yield self.parent_resource.get(self.parent_id) except couch.NotFound: msg = '{}_id {} not found'.format( self.parent_resource.resourc...
python
def _save(self): """Save the sub-resource within the parent resource""" yield self.validate() try: self._parent = yield self.parent_resource.get(self.parent_id) except couch.NotFound: msg = '{}_id {} not found'.format( self.parent_resource.resourc...
[ "def", "_save", "(", "self", ")", ":", "yield", "self", ".", "validate", "(", ")", "try", ":", "self", ".", "_parent", "=", "yield", "self", ".", "parent_resource", ".", "get", "(", "self", ".", "parent_id", ")", "except", "couch", ".", "NotFound", "...
Save the sub-resource within the parent resource
[ "Save", "the", "sub", "-", "resource", "within", "the", "parent", "resource" ]
36d78994133918f3c52c187f19e50132960a0156
https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/model.py#L552-L564
247,101
openpermissions/perch
perch/model.py
SubResource.delete
def delete(self, user): """Delete a sub-resource""" if user: can_delete = yield self.can_delete(user) else: can_delete = False if not can_delete: raise exceptions.Unauthorized('User may not delete the resource') try: parent = yiel...
python
def delete(self, user): """Delete a sub-resource""" if user: can_delete = yield self.can_delete(user) else: can_delete = False if not can_delete: raise exceptions.Unauthorized('User may not delete the resource') try: parent = yiel...
[ "def", "delete", "(", "self", ",", "user", ")", ":", "if", "user", ":", "can_delete", "=", "yield", "self", ".", "can_delete", "(", "user", ")", "else", ":", "can_delete", "=", "False", "if", "not", "can_delete", ":", "raise", "exceptions", ".", "Unaut...
Delete a sub-resource
[ "Delete", "a", "sub", "-", "resource" ]
36d78994133918f3c52c187f19e50132960a0156
https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/model.py#L609-L627
247,102
openpermissions/perch
perch/model.py
SubResource.state
def state(self): """ Get the SubResource state If the parents state has a higher priority, then it overrides the SubResource state ..note:: This assumes that self.parent is populated """ state = self._resource.get('state', self.default_state) if state no...
python
def state(self): """ Get the SubResource state If the parents state has a higher priority, then it overrides the SubResource state ..note:: This assumes that self.parent is populated """ state = self._resource.get('state', self.default_state) if state no...
[ "def", "state", "(", "self", ")", ":", "state", "=", "self", ".", "_resource", ".", "get", "(", "'state'", ",", "self", ".", "default_state", ")", "if", "state", "not", "in", "State", ":", "state", "=", "getattr", "(", "State", ",", "state", ")", "...
Get the SubResource state If the parents state has a higher priority, then it overrides the SubResource state ..note:: This assumes that self.parent is populated
[ "Get", "the", "SubResource", "state" ]
36d78994133918f3c52c187f19e50132960a0156
https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/model.py#L630-L648
247,103
ktdreyer/txproductpages
txproductpages/release.py
Release.schedule_tasks
def schedule_tasks(self): """ Get all the tasks for a release. :param release_id: int, release id number. :returns: deferred that when fired returns a list of Munch (dict-like) objects representing all tasks. """ url = 'api/v6/releases/%d/schedule-tasks...
python
def schedule_tasks(self): """ Get all the tasks for a release. :param release_id: int, release id number. :returns: deferred that when fired returns a list of Munch (dict-like) objects representing all tasks. """ url = 'api/v6/releases/%d/schedule-tasks...
[ "def", "schedule_tasks", "(", "self", ")", ":", "url", "=", "'api/v6/releases/%d/schedule-tasks'", "%", "self", ".", "id", "tasks", "=", "yield", "self", ".", "connection", ".", "_get", "(", "url", ")", "defer", ".", "returnValue", "(", "munchify", "(", "t...
Get all the tasks for a release. :param release_id: int, release id number. :returns: deferred that when fired returns a list of Munch (dict-like) objects representing all tasks.
[ "Get", "all", "the", "tasks", "for", "a", "release", "." ]
96c85c498c0eef1d37cddb031db32e8b885fcbd9
https://github.com/ktdreyer/txproductpages/blob/96c85c498c0eef1d37cddb031db32e8b885fcbd9/txproductpages/release.py#L11-L21
247,104
ktdreyer/txproductpages
txproductpages/release.py
Release.task_date
def task_date(self, task_re): """ Get a datetime.date object for the last task that matches a regex. :param task_re: regex, eg re.compile('Development Freeze'). See txproductpages.milestones for some useful regex constants to pass in here. :return...
python
def task_date(self, task_re): """ Get a datetime.date object for the last task that matches a regex. :param task_re: regex, eg re.compile('Development Freeze'). See txproductpages.milestones for some useful regex constants to pass in here. :return...
[ "def", "task_date", "(", "self", ",", "task_re", ")", ":", "tasks", "=", "yield", "self", ".", "schedule_tasks", "(", ")", "task_date", "=", "None", "for", "task", "in", "tasks", ":", "if", "task_re", ".", "match", "(", "task", "[", "'name'", "]", ")...
Get a datetime.date object for the last task that matches a regex. :param task_re: regex, eg re.compile('Development Freeze'). See txproductpages.milestones for some useful regex constants to pass in here. :returns: deferred that when fired returns a date...
[ "Get", "a", "datetime", ".", "date", "object", "for", "the", "last", "task", "that", "matches", "a", "regex", "." ]
96c85c498c0eef1d37cddb031db32e8b885fcbd9
https://github.com/ktdreyer/txproductpages/blob/96c85c498c0eef1d37cddb031db32e8b885fcbd9/txproductpages/release.py#L24-L41
247,105
chrisnorman7/confmanager
confmanager/confframe.py
ConfFrame.apply
def apply(self, event = None): """Before self.onOk closes the window, it calls this function to sync the config changes from the GUI back to self.config.""" for section in self.config.sections(): # Run through the sections to check all the option values: for option, o in self.config.config[section].items(...
python
def apply(self, event = None): """Before self.onOk closes the window, it calls this function to sync the config changes from the GUI back to self.config.""" for section in self.config.sections(): # Run through the sections to check all the option values: for option, o in self.config.config[section].items(...
[ "def", "apply", "(", "self", ",", "event", "=", "None", ")", ":", "for", "section", "in", "self", ".", "config", ".", "sections", "(", ")", ":", "# Run through the sections to check all the option values:\r", "for", "option", ",", "o", "in", "self", ".", "co...
Before self.onOk closes the window, it calls this function to sync the config changes from the GUI back to self.config.
[ "Before", "self", ".", "onOk", "closes", "the", "window", "it", "calls", "this", "function", "to", "sync", "the", "config", "changes", "from", "the", "GUI", "back", "to", "self", ".", "config", "." ]
54a3ce0b596f9da32ae82fd4ff4cb46bb1cf23b1
https://github.com/chrisnorman7/confmanager/blob/54a3ce0b596f9da32ae82fd4ff4cb46bb1cf23b1/confmanager/confframe.py#L55-L78
247,106
jwkvam/piecharts
piecharts/__init__.py
_detect_notebook
def _detect_notebook(): """ This isn't 100% correct but seems good enough Returns ------- bool True if it detects this is a notebook, otherwise False. """ try: from IPython import get_ipython from ipykernel import zmqshell except ImportError: return False...
python
def _detect_notebook(): """ This isn't 100% correct but seems good enough Returns ------- bool True if it detects this is a notebook, otherwise False. """ try: from IPython import get_ipython from ipykernel import zmqshell except ImportError: return False...
[ "def", "_detect_notebook", "(", ")", ":", "try", ":", "from", "IPython", "import", "get_ipython", "from", "ipykernel", "import", "zmqshell", "except", "ImportError", ":", "return", "False", "kernel", "=", "get_ipython", "(", ")", "return", "isinstance", "(", "...
This isn't 100% correct but seems good enough Returns ------- bool True if it detects this is a notebook, otherwise False.
[ "This", "isn", "t", "100%", "correct", "but", "seems", "good", "enough" ]
b6cd6102c01f0761c991adb2ba949128aebeb818
https://github.com/jwkvam/piecharts/blob/b6cd6102c01f0761c991adb2ba949128aebeb818/piecharts/__init__.py#L41-L56
247,107
jwkvam/piecharts
piecharts/__init__.py
Chart.xlim
def xlim(self, low, high): """Set xaxis limits Parameters ---------- low : number high : number Returns ------- Chart """ self.chart['xAxis'][0]['min'] = low self.chart['xAxis'][0]['max'] = high return self
python
def xlim(self, low, high): """Set xaxis limits Parameters ---------- low : number high : number Returns ------- Chart """ self.chart['xAxis'][0]['min'] = low self.chart['xAxis'][0]['max'] = high return self
[ "def", "xlim", "(", "self", ",", "low", ",", "high", ")", ":", "self", ".", "chart", "[", "'xAxis'", "]", "[", "0", "]", "[", "'min'", "]", "=", "low", "self", ".", "chart", "[", "'xAxis'", "]", "[", "0", "]", "[", "'max'", "]", "=", "high", ...
Set xaxis limits Parameters ---------- low : number high : number Returns ------- Chart
[ "Set", "xaxis", "limits" ]
b6cd6102c01f0761c991adb2ba949128aebeb818
https://github.com/jwkvam/piecharts/blob/b6cd6102c01f0761c991adb2ba949128aebeb818/piecharts/__init__.py#L372-L387
247,108
jwkvam/piecharts
piecharts/__init__.py
Chart.ylim
def ylim(self, low, high): """Set yaxis limits Parameters ---------- low : number high : number index : int, optional Returns ------- Chart """ self.chart['yAxis'][0]['min'] = low self.chart['yAxis'][0]['max'] = high ...
python
def ylim(self, low, high): """Set yaxis limits Parameters ---------- low : number high : number index : int, optional Returns ------- Chart """ self.chart['yAxis'][0]['min'] = low self.chart['yAxis'][0]['max'] = high ...
[ "def", "ylim", "(", "self", ",", "low", ",", "high", ")", ":", "self", ".", "chart", "[", "'yAxis'", "]", "[", "0", "]", "[", "'min'", "]", "=", "low", "self", ".", "chart", "[", "'yAxis'", "]", "[", "0", "]", "[", "'max'", "]", "=", "high", ...
Set yaxis limits Parameters ---------- low : number high : number index : int, optional Returns ------- Chart
[ "Set", "yaxis", "limits" ]
b6cd6102c01f0761c991adb2ba949128aebeb818
https://github.com/jwkvam/piecharts/blob/b6cd6102c01f0761c991adb2ba949128aebeb818/piecharts/__init__.py#L389-L405
247,109
treycucco/bidon
bidon/util/transform.py
get_val
def get_val(source, extract=None, transform=None): """Extract a value from a source, transform and return it.""" if extract is None: raw_value = source else: raw_value = extract(source) if transform is None: return raw_value else: return transform(raw_value)
python
def get_val(source, extract=None, transform=None): """Extract a value from a source, transform and return it.""" if extract is None: raw_value = source else: raw_value = extract(source) if transform is None: return raw_value else: return transform(raw_value)
[ "def", "get_val", "(", "source", ",", "extract", "=", "None", ",", "transform", "=", "None", ")", ":", "if", "extract", "is", "None", ":", "raw_value", "=", "source", "else", ":", "raw_value", "=", "extract", "(", "source", ")", "if", "transform", "is"...
Extract a value from a source, transform and return it.
[ "Extract", "a", "value", "from", "a", "source", "transform", "and", "return", "it", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L10-L20
247,110
treycucco/bidon
bidon/util/transform.py
get_obj
def get_obj(source, extract=None, child_transform=None, transform=None): """Maps an object based on a key->extractor child_transform dict.""" if extract is None: obj = source else: obj = extract(source) if child_transform is None: data = obj else: data = dict() for k, v in child_transform...
python
def get_obj(source, extract=None, child_transform=None, transform=None): """Maps an object based on a key->extractor child_transform dict.""" if extract is None: obj = source else: obj = extract(source) if child_transform is None: data = obj else: data = dict() for k, v in child_transform...
[ "def", "get_obj", "(", "source", ",", "extract", "=", "None", ",", "child_transform", "=", "None", ",", "transform", "=", "None", ")", ":", "if", "extract", "is", "None", ":", "obj", "=", "source", "else", ":", "obj", "=", "extract", "(", "source", "...
Maps an object based on a key->extractor child_transform dict.
[ "Maps", "an", "object", "based", "on", "a", "key", "-", ">", "extractor", "child_transform", "dict", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L23-L43
247,111
treycucco/bidon
bidon/util/transform.py
get_lst
def get_lst(source, extract=None, transform=None): """Extract a list from a source, transform each item, and return the result.""" if extract is None: raw_list = source else: raw_list = extract(source) if transform is None: return raw_list else: tlist = [] for idx, item in enumerate(raw_l...
python
def get_lst(source, extract=None, transform=None): """Extract a list from a source, transform each item, and return the result.""" if extract is None: raw_list = source else: raw_list = extract(source) if transform is None: return raw_list else: tlist = [] for idx, item in enumerate(raw_l...
[ "def", "get_lst", "(", "source", ",", "extract", "=", "None", ",", "transform", "=", "None", ")", ":", "if", "extract", "is", "None", ":", "raw_list", "=", "source", "else", ":", "raw_list", "=", "extract", "(", "source", ")", "if", "transform", "is", ...
Extract a list from a source, transform each item, and return the result.
[ "Extract", "a", "list", "from", "a", "source", "transform", "each", "item", "and", "return", "the", "result", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L46-L62
247,112
treycucco/bidon
bidon/util/transform.py
get_composition
def get_composition(source, *fxns): """Compose several extractors together, on a source.""" val = source for fxn in fxns: val = fxn(val) return val
python
def get_composition(source, *fxns): """Compose several extractors together, on a source.""" val = source for fxn in fxns: val = fxn(val) return val
[ "def", "get_composition", "(", "source", ",", "*", "fxns", ")", ":", "val", "=", "source", "for", "fxn", "in", "fxns", ":", "val", "=", "fxn", "(", "val", ")", "return", "val" ]
Compose several extractors together, on a source.
[ "Compose", "several", "extractors", "together", "on", "a", "source", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L65-L70
247,113
treycucco/bidon
bidon/util/transform.py
get_flattened
def get_flattened(dct, names, path_joiner="_"): """Flatten a child dicts, whose resulting keys are joined by path_joiner. E.G. { "valuation": { "currency": "USD", "amount": "100" } } -> { "valuation_currency": "USD", "valuation_amount": "100" } """ new_dct = dict() for key, val in dct.items(): if ...
python
def get_flattened(dct, names, path_joiner="_"): """Flatten a child dicts, whose resulting keys are joined by path_joiner. E.G. { "valuation": { "currency": "USD", "amount": "100" } } -> { "valuation_currency": "USD", "valuation_amount": "100" } """ new_dct = dict() for key, val in dct.items(): if ...
[ "def", "get_flattened", "(", "dct", ",", "names", ",", "path_joiner", "=", "\"_\"", ")", ":", "new_dct", "=", "dict", "(", ")", "for", "key", ",", "val", "in", "dct", ".", "items", "(", ")", ":", "if", "key", "in", "names", ":", "child", "=", "{"...
Flatten a child dicts, whose resulting keys are joined by path_joiner. E.G. { "valuation": { "currency": "USD", "amount": "100" } } -> { "valuation_currency": "USD", "valuation_amount": "100" }
[ "Flatten", "a", "child", "dicts", "whose", "resulting", "keys", "are", "joined", "by", "path_joiner", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L73-L86
247,114
treycucco/bidon
bidon/util/transform.py
get_hoisted
def get_hoisted(dct, child_name): """Pulls all of a child's keys up to the parent, with the names unchanged.""" child = dct[child_name] del dct[child_name] dct.update(child) return dct
python
def get_hoisted(dct, child_name): """Pulls all of a child's keys up to the parent, with the names unchanged.""" child = dct[child_name] del dct[child_name] dct.update(child) return dct
[ "def", "get_hoisted", "(", "dct", ",", "child_name", ")", ":", "child", "=", "dct", "[", "child_name", "]", "del", "dct", "[", "child_name", "]", "dct", ".", "update", "(", "child", ")", "return", "dct" ]
Pulls all of a child's keys up to the parent, with the names unchanged.
[ "Pulls", "all", "of", "a", "child", "s", "keys", "up", "to", "the", "parent", "with", "the", "names", "unchanged", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L89-L94
247,115
treycucco/bidon
bidon/util/transform.py
obj
def obj(extract=None, child_transform=None, transform=None): """Returns a partial of get_obj that only needs a source argument.""" return lambda source: get_obj(source, extract, child_transform, transform)
python
def obj(extract=None, child_transform=None, transform=None): """Returns a partial of get_obj that only needs a source argument.""" return lambda source: get_obj(source, extract, child_transform, transform)
[ "def", "obj", "(", "extract", "=", "None", ",", "child_transform", "=", "None", ",", "transform", "=", "None", ")", ":", "return", "lambda", "source", ":", "get_obj", "(", "source", ",", "extract", ",", "child_transform", ",", "transform", ")" ]
Returns a partial of get_obj that only needs a source argument.
[ "Returns", "a", "partial", "of", "get_obj", "that", "only", "needs", "a", "source", "argument", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L102-L104
247,116
treycucco/bidon
bidon/util/transform.py
get_xml_attr
def get_xml_attr(source, name, path=None): """Get the XML attribute with name from source. If path is not Mone, it will instead get the XML attribute with name from the child indicated by path. """ if path is None: return source.attrib[name] else: return get_xml_attr(get_xml_child(source, path), name)
python
def get_xml_attr(source, name, path=None): """Get the XML attribute with name from source. If path is not Mone, it will instead get the XML attribute with name from the child indicated by path. """ if path is None: return source.attrib[name] else: return get_xml_attr(get_xml_child(source, path), name)
[ "def", "get_xml_attr", "(", "source", ",", "name", ",", "path", "=", "None", ")", ":", "if", "path", "is", "None", ":", "return", "source", ".", "attrib", "[", "name", "]", "else", ":", "return", "get_xml_attr", "(", "get_xml_child", "(", "source", ","...
Get the XML attribute with name from source. If path is not Mone, it will instead get the XML attribute with name from the child indicated by path.
[ "Get", "the", "XML", "attribute", "with", "name", "from", "source", ".", "If", "path", "is", "not", "Mone", "it", "will", "instead", "get", "the", "XML", "attribute", "with", "name", "from", "the", "child", "indicated", "by", "path", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L127-L134
247,117
treycucco/bidon
bidon/util/transform.py
get_xml_text
def get_xml_text(source, path=None): """Get the text of the XML node. If path is not None, it will get the text of the descendant of source indicated by path. """ if path is None: return source.text else: return get_xml_text(get_xml_child(source, path))
python
def get_xml_text(source, path=None): """Get the text of the XML node. If path is not None, it will get the text of the descendant of source indicated by path. """ if path is None: return source.text else: return get_xml_text(get_xml_child(source, path))
[ "def", "get_xml_text", "(", "source", ",", "path", "=", "None", ")", ":", "if", "path", "is", "None", ":", "return", "source", ".", "text", "else", ":", "return", "get_xml_text", "(", "get_xml_child", "(", "source", ",", "path", ")", ")" ]
Get the text of the XML node. If path is not None, it will get the text of the descendant of source indicated by path.
[ "Get", "the", "text", "of", "the", "XML", "node", ".", "If", "path", "is", "not", "None", "it", "will", "get", "the", "text", "of", "the", "descendant", "of", "source", "indicated", "by", "path", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L137-L144
247,118
treycucco/bidon
bidon/util/transform.py
get_xml_child
def get_xml_child(source, path): """Get the first descendant of source identified by path. Path must be either a an xpath string, or a 2-tuple of (xpath, namespace_dict). """ if isinstance(path, (tuple, list)): return source.find(*path) else: return source.find(path)
python
def get_xml_child(source, path): """Get the first descendant of source identified by path. Path must be either a an xpath string, or a 2-tuple of (xpath, namespace_dict). """ if isinstance(path, (tuple, list)): return source.find(*path) else: return source.find(path)
[ "def", "get_xml_child", "(", "source", ",", "path", ")", ":", "if", "isinstance", "(", "path", ",", "(", "tuple", ",", "list", ")", ")", ":", "return", "source", ".", "find", "(", "*", "path", ")", "else", ":", "return", "source", ".", "find", "(",...
Get the first descendant of source identified by path. Path must be either a an xpath string, or a 2-tuple of (xpath, namespace_dict).
[ "Get", "the", "first", "descendant", "of", "source", "identified", "by", "path", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L147-L155
247,119
treycucco/bidon
bidon/util/transform.py
get_xml_children
def get_xml_children(source, path): """Get all the descendants of source identified by path. Path must be either a an xpath string, or a 2-tuple of (xpath, namespace_dict). """ if isinstance(path, (tuple, list)): return source.findall(*path) else: return source.findall(path)
python
def get_xml_children(source, path): """Get all the descendants of source identified by path. Path must be either a an xpath string, or a 2-tuple of (xpath, namespace_dict). """ if isinstance(path, (tuple, list)): return source.findall(*path) else: return source.findall(path)
[ "def", "get_xml_children", "(", "source", ",", "path", ")", ":", "if", "isinstance", "(", "path", ",", "(", "tuple", ",", "list", ")", ")", ":", "return", "source", ".", "findall", "(", "*", "path", ")", "else", ":", "return", "source", ".", "findall...
Get all the descendants of source identified by path. Path must be either a an xpath string, or a 2-tuple of (xpath, namespace_dict).
[ "Get", "all", "the", "descendants", "of", "source", "identified", "by", "path", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L158-L166
247,120
treycucco/bidon
bidon/util/transform.py
get_json_val
def get_json_val(source, path, *, ignore_bad_path=False): """Get the nested value identified by the json path, rooted at source.""" try: return JP.find(source, path) except JP.JSONPathError as ex: if ignore_bad_path: return None else: raise
python
def get_json_val(source, path, *, ignore_bad_path=False): """Get the nested value identified by the json path, rooted at source.""" try: return JP.find(source, path) except JP.JSONPathError as ex: if ignore_bad_path: return None else: raise
[ "def", "get_json_val", "(", "source", ",", "path", ",", "*", ",", "ignore_bad_path", "=", "False", ")", ":", "try", ":", "return", "JP", ".", "find", "(", "source", ",", "path", ")", "except", "JP", ".", "JSONPathError", "as", "ex", ":", "if", "ignor...
Get the nested value identified by the json path, rooted at source.
[ "Get", "the", "nested", "value", "identified", "by", "the", "json", "path", "rooted", "at", "source", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L189-L197
247,121
treycucco/bidon
bidon/util/transform.py
json_val
def json_val(path, *, ignore_bad_path=False): """Returns a partial of get_json_val that only needs a source argument.""" return lambda source: get_json_val(source, path, ignore_bad_path=ignore_bad_path)
python
def json_val(path, *, ignore_bad_path=False): """Returns a partial of get_json_val that only needs a source argument.""" return lambda source: get_json_val(source, path, ignore_bad_path=ignore_bad_path)
[ "def", "json_val", "(", "path", ",", "*", ",", "ignore_bad_path", "=", "False", ")", ":", "return", "lambda", "source", ":", "get_json_val", "(", "source", ",", "path", ",", "ignore_bad_path", "=", "ignore_bad_path", ")" ]
Returns a partial of get_json_val that only needs a source argument.
[ "Returns", "a", "partial", "of", "get_json_val", "that", "only", "needs", "a", "source", "argument", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L205-L207
247,122
KnowledgeLinks/rdfframework
rdfframework/rml/rmlmanager.py
RmlManager.register_defs
def register_defs(self, def_list, **kwargs): """ Registers a list of Rml defintions objects Args: ----- def_list: list of objects defining the rml definitons """ for item in def_list: if isinstance(item, tuple): self.register_rml_d...
python
def register_defs(self, def_list, **kwargs): """ Registers a list of Rml defintions objects Args: ----- def_list: list of objects defining the rml definitons """ for item in def_list: if isinstance(item, tuple): self.register_rml_d...
[ "def", "register_defs", "(", "self", ",", "def_list", ",", "*", "*", "kwargs", ")", ":", "for", "item", "in", "def_list", ":", "if", "isinstance", "(", "item", ",", "tuple", ")", ":", "self", ".", "register_rml_def", "(", "*", "item", ",", "*", "*", ...
Registers a list of Rml defintions objects Args: ----- def_list: list of objects defining the rml definitons
[ "Registers", "a", "list", "of", "Rml", "defintions", "objects" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rml/rmlmanager.py#L43-L57
247,123
KnowledgeLinks/rdfframework
rdfframework/rml/rmlmanager.py
RmlManager.register_rml_def
def register_rml_def(self, location_type, location, filename=None, **kwargs): """ Registers the rml file locations for easy access Args: ----- location_type: ['package_all', ...
python
def register_rml_def(self, location_type, location, filename=None, **kwargs): """ Registers the rml file locations for easy access Args: ----- location_type: ['package_all', ...
[ "def", "register_rml_def", "(", "self", ",", "location_type", ",", "location", ",", "filename", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "location_type", "==", "'directory'", ":", "self", ".", "register_directory", "(", "location", ",", "*", "...
Registers the rml file locations for easy access Args: ----- location_type: ['package_all', 'package_file', 'directory', 'filepath'] location: The correlated location string based on the location...
[ "Registers", "the", "rml", "file", "locations", "for", "easy", "access" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rml/rmlmanager.py#L59-L105
247,124
KnowledgeLinks/rdfframework
rdfframework/rml/rmlmanager.py
RmlManager.register_rml
def register_rml(self, filepath, **kwargs): """ Registers the filepath for an rml mapping Args: ----- filepath: the path the rml file """ name = os.path.split(filepath)[-1] if name in self.rml_maps and self.rml_maps[name] != filepath: rais...
python
def register_rml(self, filepath, **kwargs): """ Registers the filepath for an rml mapping Args: ----- filepath: the path the rml file """ name = os.path.split(filepath)[-1] if name in self.rml_maps and self.rml_maps[name] != filepath: rais...
[ "def", "register_rml", "(", "self", ",", "filepath", ",", "*", "*", "kwargs", ")", ":", "name", "=", "os", ".", "path", ".", "split", "(", "filepath", ")", "[", "-", "1", "]", "if", "name", "in", "self", ".", "rml_maps", "and", "self", ".", "rml_...
Registers the filepath for an rml mapping Args: ----- filepath: the path the rml file
[ "Registers", "the", "filepath", "for", "an", "rml", "mapping" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rml/rmlmanager.py#L107-L120
247,125
KnowledgeLinks/rdfframework
rdfframework/rml/rmlmanager.py
RmlManager.register_directory
def register_directory(self, dirpath, **kwargs): """ Registers all of the files in the the directory path """ kwargs['file_extensions'] = kwargs.get("file_extensions", self.rdf_formats) files = list_files(file_directory=dirpath, **k...
python
def register_directory(self, dirpath, **kwargs): """ Registers all of the files in the the directory path """ kwargs['file_extensions'] = kwargs.get("file_extensions", self.rdf_formats) files = list_files(file_directory=dirpath, **k...
[ "def", "register_directory", "(", "self", ",", "dirpath", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'file_extensions'", "]", "=", "kwargs", ".", "get", "(", "\"file_extensions\"", ",", "self", ".", "rdf_formats", ")", "files", "=", "list_files", "...
Registers all of the files in the the directory path
[ "Registers", "all", "of", "the", "files", "in", "the", "the", "directory", "path" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rml/rmlmanager.py#L122-L131
247,126
KnowledgeLinks/rdfframework
rdfframework/rml/rmlmanager.py
RmlManager.make_processor
def make_processor(self, name, mappings, processor_type, **kwargs): """ Instantiates a RmlProcessor and registers it in the manager Args: ----- name: the name to register the processor mappings: the list RML mapping definitions to use processor_type: ...
python
def make_processor(self, name, mappings, processor_type, **kwargs): """ Instantiates a RmlProcessor and registers it in the manager Args: ----- name: the name to register the processor mappings: the list RML mapping definitions to use processor_type: ...
[ "def", "make_processor", "(", "self", ",", "name", ",", "mappings", ",", "processor_type", ",", "*", "*", "kwargs", ")", ":", "from", ".", "processor", "import", "Processor", "if", "self", ".", "processors", ".", "get", "(", "name", ")", ":", "raise", ...
Instantiates a RmlProcessor and registers it in the manager Args: ----- name: the name to register the processor mappings: the list RML mapping definitions to use processor_type: the name of the RML processor to use
[ "Instantiates", "a", "RmlProcessor", "and", "registers", "it", "in", "the", "manager" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rml/rmlmanager.py#L133-L152
247,127
KnowledgeLinks/rdfframework
rdfframework/rml/rmlmanager.py
RmlManager.get_processor
def get_processor(self, name, mappings=None, processor_type=None, **kwargs): """ Returns the specified RML Processor """ try: return self.processors[name] except KeyError: ...
python
def get_processor(self, name, mappings=None, processor_type=None, **kwargs): """ Returns the specified RML Processor """ try: return self.processors[name] except KeyError: ...
[ "def", "get_processor", "(", "self", ",", "name", ",", "mappings", "=", "None", ",", "processor_type", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "self", ".", "processors", "[", "name", "]", "except", "KeyError", ":", "return...
Returns the specified RML Processor
[ "Returns", "the", "specified", "RML", "Processor" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rml/rmlmanager.py#L154-L168
247,128
KnowledgeLinks/rdfframework
rdfframework/rml/rmlmanager.py
RmlManager.get_rml
def get_rml(self, rml_name, rtn_format="filepath"): """ returns the rml mapping filepath rml_name(str): Name of the rml mapping to retrieve rtn_format: ['filepath', 'data'] """ try: rml_path = self.rml_maps[rml_name] except KeyError: if rml_name ...
python
def get_rml(self, rml_name, rtn_format="filepath"): """ returns the rml mapping filepath rml_name(str): Name of the rml mapping to retrieve rtn_format: ['filepath', 'data'] """ try: rml_path = self.rml_maps[rml_name] except KeyError: if rml_name ...
[ "def", "get_rml", "(", "self", ",", "rml_name", ",", "rtn_format", "=", "\"filepath\"", ")", ":", "try", ":", "rml_path", "=", "self", ".", "rml_maps", "[", "rml_name", "]", "except", "KeyError", ":", "if", "rml_name", "in", "self", ".", "rml_maps", ".",...
returns the rml mapping filepath rml_name(str): Name of the rml mapping to retrieve rtn_format: ['filepath', 'data']
[ "returns", "the", "rml", "mapping", "filepath" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rml/rmlmanager.py#L193-L210
247,129
tlevine/vlermv
vlermv/_abstract.py
AbstractVlermv.filename
def filename(self, index): ''' Get the absolute filename corresponding to a key; run the key_transformer on the key and do a few other small things. :raises TypeError: if the key_transformer returns something other than a :py:class:`tuple` of :py:class:`strings <str>` ...
python
def filename(self, index): ''' Get the absolute filename corresponding to a key; run the key_transformer on the key and do a few other small things. :raises TypeError: if the key_transformer returns something other than a :py:class:`tuple` of :py:class:`strings <str>` ...
[ "def", "filename", "(", "self", ",", "index", ")", ":", "subpath", "=", "self", ".", "key_transformer", ".", "to_path", "(", "index", ")", "if", "not", "isinstance", "(", "subpath", ",", "tuple", ")", ":", "msg", "=", "'subpath is a %s, but it should be a tu...
Get the absolute filename corresponding to a key; run the key_transformer on the key and do a few other small things. :raises TypeError: if the key_transformer returns something other than a :py:class:`tuple` of :py:class:`strings <str>` :raises KeyError: if the key_transformer retu...
[ "Get", "the", "absolute", "filename", "corresponding", "to", "a", "key", ";", "run", "the", "key_transformer", "on", "the", "key", "and", "do", "a", "few", "other", "small", "things", "." ]
0b332ea1c20e4065b30f5e3ec0c1d0fffbce6b20
https://github.com/tlevine/vlermv/blob/0b332ea1c20e4065b30f5e3ec0c1d0fffbce6b20/vlermv/_abstract.py#L147-L167
247,130
tlevine/vlermv
vlermv/_abstract.py
AbstractVlermv.from_filename
def from_filename(self, filename): ''' Convert an absolute filename into key. ''' i = len(self.base_directory) if filename[:i] != self.base_directory: raise ValueError('Filename needs to start with "%s";\nyou passed "%s".' % (self.base_directory, filename)) i...
python
def from_filename(self, filename): ''' Convert an absolute filename into key. ''' i = len(self.base_directory) if filename[:i] != self.base_directory: raise ValueError('Filename needs to start with "%s";\nyou passed "%s".' % (self.base_directory, filename)) i...
[ "def", "from_filename", "(", "self", ",", "filename", ")", ":", "i", "=", "len", "(", "self", ".", "base_directory", ")", "if", "filename", "[", ":", "i", "]", "!=", "self", ".", "base_directory", ":", "raise", "ValueError", "(", "'Filename needs to start ...
Convert an absolute filename into key.
[ "Convert", "an", "absolute", "filename", "into", "key", "." ]
0b332ea1c20e4065b30f5e3ec0c1d0fffbce6b20
https://github.com/tlevine/vlermv/blob/0b332ea1c20e4065b30f5e3ec0c1d0fffbce6b20/vlermv/_abstract.py#L169-L182
247,131
untwisted/quickirc
quickirc.py
Irc.main
def main(self, spin, data): """ The function which uses irc rfc regex to extract the basic arguments from the msg. """ data = data.decode(self.encoding) field = re.match(RFC_REG, data) if not field: return prefix = self.extract...
python
def main(self, spin, data): """ The function which uses irc rfc regex to extract the basic arguments from the msg. """ data = data.decode(self.encoding) field = re.match(RFC_REG, data) if not field: return prefix = self.extract...
[ "def", "main", "(", "self", ",", "spin", ",", "data", ")", ":", "data", "=", "data", ".", "decode", "(", "self", ".", "encoding", ")", "field", "=", "re", ".", "match", "(", "RFC_REG", ",", "data", ")", "if", "not", "field", ":", "return", "prefi...
The function which uses irc rfc regex to extract the basic arguments from the msg.
[ "The", "function", "which", "uses", "irc", "rfc", "regex", "to", "extract", "the", "basic", "arguments", "from", "the", "msg", "." ]
4e92ffd45eef03eee2ba0b659b19b4f40a2dbf99
https://github.com/untwisted/quickirc/blob/4e92ffd45eef03eee2ba0b659b19b4f40a2dbf99/quickirc.py#L135-L149
247,132
untwisted/quickirc
quickirc.py
Irc.extract_prefix
def extract_prefix(self, prefix): """ It extracts an irc msg prefix chunk """ field = re.match(PREFIX_REG, prefix if prefix else '') return (prefix,) if not field else field.group(1, 2, 3)
python
def extract_prefix(self, prefix): """ It extracts an irc msg prefix chunk """ field = re.match(PREFIX_REG, prefix if prefix else '') return (prefix,) if not field else field.group(1, 2, 3)
[ "def", "extract_prefix", "(", "self", ",", "prefix", ")", ":", "field", "=", "re", ".", "match", "(", "PREFIX_REG", ",", "prefix", "if", "prefix", "else", "''", ")", "return", "(", "prefix", ",", ")", "if", "not", "field", "else", "field", ".", "grou...
It extracts an irc msg prefix chunk
[ "It", "extracts", "an", "irc", "msg", "prefix", "chunk" ]
4e92ffd45eef03eee2ba0b659b19b4f40a2dbf99
https://github.com/untwisted/quickirc/blob/4e92ffd45eef03eee2ba0b659b19b4f40a2dbf99/quickirc.py#L151-L158
247,133
untwisted/quickirc
quickirc.py
Irc.extract_args
def extract_args(self, data): """ It extracts irc msg arguments. """ args = [] data = data.strip(' ') if ':' in data: lhs, rhs = data.split(':', 1) if lhs: args.extend(lhs.rstrip(' ').split(' ')) args.append(rhs) else: ...
python
def extract_args(self, data): """ It extracts irc msg arguments. """ args = [] data = data.strip(' ') if ':' in data: lhs, rhs = data.split(':', 1) if lhs: args.extend(lhs.rstrip(' ').split(' ')) args.append(rhs) else: ...
[ "def", "extract_args", "(", "self", ",", "data", ")", ":", "args", "=", "[", "]", "data", "=", "data", ".", "strip", "(", "' '", ")", "if", "':'", "in", "data", ":", "lhs", ",", "rhs", "=", "data", ".", "split", "(", "':'", ",", "1", ")", "if...
It extracts irc msg arguments.
[ "It", "extracts", "irc", "msg", "arguments", "." ]
4e92ffd45eef03eee2ba0b659b19b4f40a2dbf99
https://github.com/untwisted/quickirc/blob/4e92ffd45eef03eee2ba0b659b19b4f40a2dbf99/quickirc.py#L160-L172
247,134
untwisted/quickirc
quickirc.py
CTCP.extract_ctcp
def extract_ctcp(self, spin, nick, user, host, target, msg): """ it is used to extract ctcp requests into pieces. """ # The ctcp delimiter token. DELIM = '\001' if not msg.startswith(DELIM) or not msg.endswith(DELIM): return ctcp_args =...
python
def extract_ctcp(self, spin, nick, user, host, target, msg): """ it is used to extract ctcp requests into pieces. """ # The ctcp delimiter token. DELIM = '\001' if not msg.startswith(DELIM) or not msg.endswith(DELIM): return ctcp_args =...
[ "def", "extract_ctcp", "(", "self", ",", "spin", ",", "nick", ",", "user", ",", "host", ",", "target", ",", "msg", ")", ":", "# The ctcp delimiter token.", "DELIM", "=", "'\\001'", "if", "not", "msg", ".", "startswith", "(", "DELIM", ")", "or", "not", ...
it is used to extract ctcp requests into pieces.
[ "it", "is", "used", "to", "extract", "ctcp", "requests", "into", "pieces", "." ]
4e92ffd45eef03eee2ba0b659b19b4f40a2dbf99
https://github.com/untwisted/quickirc/blob/4e92ffd45eef03eee2ba0b659b19b4f40a2dbf99/quickirc.py#L184-L197
247,135
untwisted/quickirc
quickirc.py
CTCP.patch
def patch(self, spin, header, *args): """ It spawns DCC TYPE as event. """ spawn(spin, 'DCC %s' % args[0], header, *args[1:])
python
def patch(self, spin, header, *args): """ It spawns DCC TYPE as event. """ spawn(spin, 'DCC %s' % args[0], header, *args[1:])
[ "def", "patch", "(", "self", ",", "spin", ",", "header", ",", "*", "args", ")", ":", "spawn", "(", "spin", ",", "'DCC %s'", "%", "args", "[", "0", "]", ",", "header", ",", "*", "args", "[", "1", ":", "]", ")" ]
It spawns DCC TYPE as event.
[ "It", "spawns", "DCC", "TYPE", "as", "event", "." ]
4e92ffd45eef03eee2ba0b659b19b4f40a2dbf99
https://github.com/untwisted/quickirc/blob/4e92ffd45eef03eee2ba0b659b19b4f40a2dbf99/quickirc.py#L199-L204
247,136
fopina/tgbotplug
tgbot/tgbot.py
TGBot.print_commands
def print_commands(self, out=sys.stdout): ''' utility method to print commands and descriptions for @BotFather ''' cmds = self.list_commands() for ck in cmds: if ck.printable: out.write('%s\n' % ck)
python
def print_commands(self, out=sys.stdout): ''' utility method to print commands and descriptions for @BotFather ''' cmds = self.list_commands() for ck in cmds: if ck.printable: out.write('%s\n' % ck)
[ "def", "print_commands", "(", "self", ",", "out", "=", "sys", ".", "stdout", ")", ":", "cmds", "=", "self", ".", "list_commands", "(", ")", "for", "ck", "in", "cmds", ":", "if", "ck", ".", "printable", ":", "out", ".", "write", "(", "'%s\\n'", "%",...
utility method to print commands and descriptions for @BotFather
[ "utility", "method", "to", "print", "commands", "and", "descriptions", "for" ]
c115733b03f2e23ddcdecfce588d1a6a1e5bde91
https://github.com/fopina/tgbotplug/blob/c115733b03f2e23ddcdecfce588d1a6a1e5bde91/tgbot/tgbot.py#L161-L169
247,137
udoprog/mimeprovider
mimeprovider/client/requests.py
RequestsClient.request
def request(self, method, uri, **kw): """ The money maker. """ expect = kw.pop("expect", []) mime_body = kw.pop("mime_body", None) headers = kw.pop("headers", {}) data = kw.pop("data", None) if mime_body: mimevalues = self.mimeobjects.get(mim...
python
def request(self, method, uri, **kw): """ The money maker. """ expect = kw.pop("expect", []) mime_body = kw.pop("mime_body", None) headers = kw.pop("headers", {}) data = kw.pop("data", None) if mime_body: mimevalues = self.mimeobjects.get(mim...
[ "def", "request", "(", "self", ",", "method", ",", "uri", ",", "*", "*", "kw", ")", ":", "expect", "=", "kw", ".", "pop", "(", "\"expect\"", ",", "[", "]", ")", "mime_body", "=", "kw", ".", "pop", "(", "\"mime_body\"", ",", "None", ")", "headers"...
The money maker.
[ "The", "money", "maker", "." ]
5acd61eb0ef813b4a2eb6bbe75d07af1e11847a4
https://github.com/udoprog/mimeprovider/blob/5acd61eb0ef813b4a2eb6bbe75d07af1e11847a4/mimeprovider/client/requests.py#L56-L123
247,138
onenameio/onename-python
onename/client.py
OnenameClient.update_user
def update_user(self, username, profile, owner_privkey): """ Update profile_hash on blockchain """ url = self.base_url + "/users/" + username + "/update" owner_pubkey = get_pubkey_from_privkey(owner_privkey) payload = { 'profile': profile, '...
python
def update_user(self, username, profile, owner_privkey): """ Update profile_hash on blockchain """ url = self.base_url + "/users/" + username + "/update" owner_pubkey = get_pubkey_from_privkey(owner_privkey) payload = { 'profile': profile, '...
[ "def", "update_user", "(", "self", ",", "username", ",", "profile", ",", "owner_privkey", ")", ":", "url", "=", "self", ".", "base_url", "+", "\"/users/\"", "+", "username", "+", "\"/update\"", "owner_pubkey", "=", "get_pubkey_from_privkey", "(", "owner_privkey"...
Update profile_hash on blockchain
[ "Update", "profile_hash", "on", "blockchain" ]
74c583282f18ad9582c6b57b826126d045321494
https://github.com/onenameio/onename-python/blob/74c583282f18ad9582c6b57b826126d045321494/onename/client.py#L142-L172
247,139
onenameio/onename-python
onename/client.py
OnenameClient.transfer_user
def transfer_user(self, username, transfer_address, owner_privkey): """ Transfer name on blockchain """ url = self.base_url + "/users/" + username + "/update" owner_pubkey = get_pubkey_from_privkey(owner_privkey) payload = { 'transfer_address': transfer...
python
def transfer_user(self, username, transfer_address, owner_privkey): """ Transfer name on blockchain """ url = self.base_url + "/users/" + username + "/update" owner_pubkey = get_pubkey_from_privkey(owner_privkey) payload = { 'transfer_address': transfer...
[ "def", "transfer_user", "(", "self", ",", "username", ",", "transfer_address", ",", "owner_privkey", ")", ":", "url", "=", "self", ".", "base_url", "+", "\"/users/\"", "+", "username", "+", "\"/update\"", "owner_pubkey", "=", "get_pubkey_from_privkey", "(", "own...
Transfer name on blockchain
[ "Transfer", "name", "on", "blockchain" ]
74c583282f18ad9582c6b57b826126d045321494
https://github.com/onenameio/onename-python/blob/74c583282f18ad9582c6b57b826126d045321494/onename/client.py#L174-L198
247,140
kervi/kervi-core
kervi/controllers/__init__.py
Controller.create
def create(controller_id, name): """Turn class into a kervi controller""" def _decorator(cls): class _ControllerClass(cls, Controller): def __init__(self): Controller.__init__(self, controller_id, name) for key in cls.__dict__.keys(): ...
python
def create(controller_id, name): """Turn class into a kervi controller""" def _decorator(cls): class _ControllerClass(cls, Controller): def __init__(self): Controller.__init__(self, controller_id, name) for key in cls.__dict__.keys(): ...
[ "def", "create", "(", "controller_id", ",", "name", ")", ":", "def", "_decorator", "(", "cls", ")", ":", "class", "_ControllerClass", "(", "cls", ",", "Controller", ")", ":", "def", "__init__", "(", "self", ")", ":", "Controller", ".", "__init__", "(", ...
Turn class into a kervi controller
[ "Turn", "class", "into", "a", "kervi", "controller" ]
3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23
https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/controllers/__init__.py#L205-L220
247,141
kervi/kervi-core
kervi/controllers/__init__.py
Controller.input
def input(input_id, name, value_class=NumberValue): """Add input to controller""" def _init(): return value_class( name, input_id=input_id, is_input=True, index=-1 ) def _decorator(cls): setattr(c...
python
def input(input_id, name, value_class=NumberValue): """Add input to controller""" def _init(): return value_class( name, input_id=input_id, is_input=True, index=-1 ) def _decorator(cls): setattr(c...
[ "def", "input", "(", "input_id", ",", "name", ",", "value_class", "=", "NumberValue", ")", ":", "def", "_init", "(", ")", ":", "return", "value_class", "(", "name", ",", "input_id", "=", "input_id", ",", "is_input", "=", "True", ",", "index", "=", "-",...
Add input to controller
[ "Add", "input", "to", "controller" ]
3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23
https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/controllers/__init__.py#L223-L235
247,142
kervi/kervi-core
kervi/controllers/__init__.py
Controller.output
def output(output_id, name, value_class=NumberValue): """Add output to controller""" def _init(): return value_class( name, input_id=output_id, is_input=False, index=-1 ) def _decorator(cls): seta...
python
def output(output_id, name, value_class=NumberValue): """Add output to controller""" def _init(): return value_class( name, input_id=output_id, is_input=False, index=-1 ) def _decorator(cls): seta...
[ "def", "output", "(", "output_id", ",", "name", ",", "value_class", "=", "NumberValue", ")", ":", "def", "_init", "(", ")", ":", "return", "value_class", "(", "name", ",", "input_id", "=", "output_id", ",", "is_input", "=", "False", ",", "index", "=", ...
Add output to controller
[ "Add", "output", "to", "controller" ]
3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23
https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/controllers/__init__.py#L238-L250
247,143
b3j0f/utils
b3j0f/utils/ut.py
_subset
def _subset(subset, superset): """True if subset is a subset of superset. :param dict subset: subset to compare. :param dict superset: superset to compare. :return: True iif all pairs (key, value) of subset are in superset. :rtype: bool """ result = True for k in subset: result...
python
def _subset(subset, superset): """True if subset is a subset of superset. :param dict subset: subset to compare. :param dict superset: superset to compare. :return: True iif all pairs (key, value) of subset are in superset. :rtype: bool """ result = True for k in subset: result...
[ "def", "_subset", "(", "subset", ",", "superset", ")", ":", "result", "=", "True", "for", "k", "in", "subset", ":", "result", "=", "k", "in", "superset", "and", "subset", "[", "k", "]", "==", "superset", "[", "k", "]", "if", "not", "result", ":", ...
True if subset is a subset of superset. :param dict subset: subset to compare. :param dict superset: superset to compare. :return: True iif all pairs (key, value) of subset are in superset. :rtype: bool
[ "True", "if", "subset", "is", "a", "subset", "of", "superset", "." ]
793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff
https://github.com/b3j0f/utils/blob/793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff/b3j0f/utils/ut.py#L40-L54
247,144
alexhayes/django-toolkit
django_toolkit/templatetags/buttons.py
button_with_image
def button_with_image(size='medium', icon=None, text=None, title=None, button=False, name=None, target=False, disabled=False, extra_css=None, modal=None, data_target='#modal', viewname=None, next=None, extra_href=False, href=False, fancyajax=False, vie...
python
def button_with_image(size='medium', icon=None, text=None, title=None, button=False, name=None, target=False, disabled=False, extra_css=None, modal=None, data_target='#modal', viewname=None, next=None, extra_href=False, href=False, fancyajax=False, vie...
[ "def", "button_with_image", "(", "size", "=", "'medium'", ",", "icon", "=", "None", ",", "text", "=", "None", ",", "title", "=", "None", ",", "button", "=", "False", ",", "name", "=", "None", ",", "target", "=", "False", ",", "disabled", "=", "False"...
Output a button using Bingo's button html. @param size: The size that refers to the icon css class. @param icon: A css class that refers to an icon - for example 'send_mail' @param text: Text to display on the button @param title: Title parameter for the button or if button=False the data-tip for a...
[ "Output", "a", "button", "using", "Bingo", "s", "button", "html", "." ]
b64106392fad596defc915b8235fe6e1d0013b5b
https://github.com/alexhayes/django-toolkit/blob/b64106392fad596defc915b8235fe6e1d0013b5b/django_toolkit/templatetags/buttons.py#L7-L83
247,145
rmed/dev-init
dev_init/dev_init.py
init_parser
def init_parser(): """ Initialize the arguments parser. """ parser = argparse.ArgumentParser( description="Automated development environment initialization") parser.add_argument('--version', action='version', version='%(prog)s ' + __version__) subparsers = parser.add_subparsers(title="...
python
def init_parser(): """ Initialize the arguments parser. """ parser = argparse.ArgumentParser( description="Automated development environment initialization") parser.add_argument('--version', action='version', version='%(prog)s ' + __version__) subparsers = parser.add_subparsers(title="...
[ "def", "init_parser", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Automated development environment initialization\"", ")", "parser", ".", "add_argument", "(", "'--version'", ",", "action", "=", "'version'", ",", "ver...
Initialize the arguments parser.
[ "Initialize", "the", "arguments", "parser", "." ]
afc5da13002e563324c6291dede0bf2e0f58171f
https://github.com/rmed/dev-init/blob/afc5da13002e563324c6291dede0bf2e0f58171f/dev_init/dev_init.py#L39-L75
247,146
rmed/dev-init
dev_init/dev_init.py
new_env
def new_env(environment): """ Create a new environment in the configuration and ask the user for the commands for this specific environment. """ if not environment: print("You need to supply an environment name") return parser = read_config() if environment in parser.sectio...
python
def new_env(environment): """ Create a new environment in the configuration and ask the user for the commands for this specific environment. """ if not environment: print("You need to supply an environment name") return parser = read_config() if environment in parser.sectio...
[ "def", "new_env", "(", "environment", ")", ":", "if", "not", "environment", ":", "print", "(", "\"You need to supply an environment name\"", ")", "return", "parser", "=", "read_config", "(", ")", "if", "environment", "in", "parser", ".", "sections", "(", ")", ...
Create a new environment in the configuration and ask the user for the commands for this specific environment.
[ "Create", "a", "new", "environment", "in", "the", "configuration", "and", "ask", "the", "user", "for", "the", "commands", "for", "this", "specific", "environment", "." ]
afc5da13002e563324c6291dede0bf2e0f58171f
https://github.com/rmed/dev-init/blob/afc5da13002e563324c6291dede0bf2e0f58171f/dev_init/dev_init.py#L84-L121
247,147
rmed/dev-init
dev_init/dev_init.py
remove_env
def remove_env(environment): """ Remove an environment from the configuration. """ if not environment: print("You need to supply an environment name") return parser = read_config() if not parser.remove_section(environment): print("Unknown environment type '%s'" % environment) ...
python
def remove_env(environment): """ Remove an environment from the configuration. """ if not environment: print("You need to supply an environment name") return parser = read_config() if not parser.remove_section(environment): print("Unknown environment type '%s'" % environment) ...
[ "def", "remove_env", "(", "environment", ")", ":", "if", "not", "environment", ":", "print", "(", "\"You need to supply an environment name\"", ")", "return", "parser", "=", "read_config", "(", ")", "if", "not", "parser", ".", "remove_section", "(", "environment",...
Remove an environment from the configuration.
[ "Remove", "an", "environment", "from", "the", "configuration", "." ]
afc5da13002e563324c6291dede0bf2e0f58171f
https://github.com/rmed/dev-init/blob/afc5da13002e563324c6291dede0bf2e0f58171f/dev_init/dev_init.py#L123-L137
247,148
rmed/dev-init
dev_init/dev_init.py
show_env
def show_env(environment): """ Show the commands for a given environment. """ if not environment: print("You need to supply an environment name") return parser = read_config() try: commands = parser.get(environment, "cmd").split("\n") except KeyError: print("Unknow...
python
def show_env(environment): """ Show the commands for a given environment. """ if not environment: print("You need to supply an environment name") return parser = read_config() try: commands = parser.get(environment, "cmd").split("\n") except KeyError: print("Unknow...
[ "def", "show_env", "(", "environment", ")", ":", "if", "not", "environment", ":", "print", "(", "\"You need to supply an environment name\"", ")", "return", "parser", "=", "read_config", "(", ")", "try", ":", "commands", "=", "parser", ".", "get", "(", "enviro...
Show the commands for a given environment.
[ "Show", "the", "commands", "for", "a", "given", "environment", "." ]
afc5da13002e563324c6291dede0bf2e0f58171f
https://github.com/rmed/dev-init/blob/afc5da13002e563324c6291dede0bf2e0f58171f/dev_init/dev_init.py#L139-L157
247,149
rmed/dev-init
dev_init/dev_init.py
start_env
def start_env(environment, path): """ Initialize a new environment in specified directory. If path does not exist, will try to create the directory structure recursively. If the path is not provided, will use current working directory. """ parser = read_config() if environment...
python
def start_env(environment, path): """ Initialize a new environment in specified directory. If path does not exist, will try to create the directory structure recursively. If the path is not provided, will use current working directory. """ parser = read_config() if environment...
[ "def", "start_env", "(", "environment", ",", "path", ")", ":", "parser", "=", "read_config", "(", ")", "if", "environment", "not", "in", "parser", ".", "sections", "(", ")", ":", "print", "(", "\"Unknown environment type '%s'\"", "%", "environment", ")", "re...
Initialize a new environment in specified directory. If path does not exist, will try to create the directory structure recursively. If the path is not provided, will use current working directory.
[ "Initialize", "a", "new", "environment", "in", "specified", "directory", "." ]
afc5da13002e563324c6291dede0bf2e0f58171f
https://github.com/rmed/dev-init/blob/afc5da13002e563324c6291dede0bf2e0f58171f/dev_init/dev_init.py#L159-L190
247,150
rmed/dev-init
dev_init/dev_init.py
read_config
def read_config(): """ Read the configuration file and parse the different environments. Returns: ConfigParser object """ if not os.path.isfile(CONFIG): with open(CONFIG, "w"): pass parser = ConfigParser() parser.read(CONFIG) return parser
python
def read_config(): """ Read the configuration file and parse the different environments. Returns: ConfigParser object """ if not os.path.isfile(CONFIG): with open(CONFIG, "w"): pass parser = ConfigParser() parser.read(CONFIG) return parser
[ "def", "read_config", "(", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "CONFIG", ")", ":", "with", "open", "(", "CONFIG", ",", "\"w\"", ")", ":", "pass", "parser", "=", "ConfigParser", "(", ")", "parser", ".", "read", "(", "CONFIG...
Read the configuration file and parse the different environments. Returns: ConfigParser object
[ "Read", "the", "configuration", "file", "and", "parse", "the", "different", "environments", "." ]
afc5da13002e563324c6291dede0bf2e0f58171f
https://github.com/rmed/dev-init/blob/afc5da13002e563324c6291dede0bf2e0f58171f/dev_init/dev_init.py#L192-L204
247,151
rmed/dev-init
dev_init/dev_init.py
parse_action
def parse_action(action, parsed): """ Parse the action to execute. """ if action == "list": list_env() elif action == "new": new_env(parsed.environment) elif action == "remove": remove_env(parsed.environment) elif action == "show": show_env(parsed.environment) ...
python
def parse_action(action, parsed): """ Parse the action to execute. """ if action == "list": list_env() elif action == "new": new_env(parsed.environment) elif action == "remove": remove_env(parsed.environment) elif action == "show": show_env(parsed.environment) ...
[ "def", "parse_action", "(", "action", ",", "parsed", ")", ":", "if", "action", "==", "\"list\"", ":", "list_env", "(", ")", "elif", "action", "==", "\"new\"", ":", "new_env", "(", "parsed", ".", "environment", ")", "elif", "action", "==", "\"remove\"", "...
Parse the action to execute.
[ "Parse", "the", "action", "to", "execute", "." ]
afc5da13002e563324c6291dede0bf2e0f58171f
https://github.com/rmed/dev-init/blob/afc5da13002e563324c6291dede0bf2e0f58171f/dev_init/dev_init.py#L211-L226
247,152
edeposit/edeposit.amqp.pdfgen
src/edeposit/amqp/pdfgen/translator.py
gen_pdf
def gen_pdf(rst_content, style_text, header=None, footer=FOOTER): """ Create PDF file from `rst_content` using `style_text` as style. Optinally, add `header` or `footer`. Args: rst_content (str): Content of the PDF file in restructured text markup. style_text (str): Style for the :mod:...
python
def gen_pdf(rst_content, style_text, header=None, footer=FOOTER): """ Create PDF file from `rst_content` using `style_text` as style. Optinally, add `header` or `footer`. Args: rst_content (str): Content of the PDF file in restructured text markup. style_text (str): Style for the :mod:...
[ "def", "gen_pdf", "(", "rst_content", ",", "style_text", ",", "header", "=", "None", ",", "footer", "=", "FOOTER", ")", ":", "out_file_obj", "=", "StringIO", "(", ")", "with", "NamedTemporaryFile", "(", ")", "as", "f", ":", "f", ".", "write", "(", "sty...
Create PDF file from `rst_content` using `style_text` as style. Optinally, add `header` or `footer`. Args: rst_content (str): Content of the PDF file in restructured text markup. style_text (str): Style for the :mod:`rst2pdf` module. header (str, default None): Header which will be ren...
[ "Create", "PDF", "file", "from", "rst_content", "using", "style_text", "as", "style", "." ]
1022d6d01196f4928d664a71e49273c2d8c67e63
https://github.com/edeposit/edeposit.amqp.pdfgen/blob/1022d6d01196f4928d664a71e49273c2d8c67e63/src/edeposit/amqp/pdfgen/translator.py#L49-L79
247,153
townsenddw/jhubctl
jhubctl/clusters/providers/aws/aws.py
define_parameters
def define_parameters(**parameters): """Get a list of parameters to pass to AWS boto call.""" params = [] for key, value in parameters.items(): param = dict(ParameterKey=key, ParameterValue=value) params.append(param) return params
python
def define_parameters(**parameters): """Get a list of parameters to pass to AWS boto call.""" params = [] for key, value in parameters.items(): param = dict(ParameterKey=key, ParameterValue=value) params.append(param) return params
[ "def", "define_parameters", "(", "*", "*", "parameters", ")", ":", "params", "=", "[", "]", "for", "key", ",", "value", "in", "parameters", ".", "items", "(", ")", ":", "param", "=", "dict", "(", "ParameterKey", "=", "key", ",", "ParameterValue", "=", ...
Get a list of parameters to pass to AWS boto call.
[ "Get", "a", "list", "of", "parameters", "to", "pass", "to", "AWS", "boto", "call", "." ]
c8c20f86a16e9d01dd90e4607d81423417cc773b
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/clusters/providers/aws/aws.py#L75-L81
247,154
townsenddw/jhubctl
jhubctl/clusters/providers/aws/aws.py
AwsEKS.create
def create(self): """Deploy a cluster on Amazon's EKS Service configured for Jupyterhub Deployments. """ steps = [ (self.create_role, (), {}), (self.create_vpc, (), {}), (self.create_cluster, (), {}), (self.create_node_group, (), {}), ...
python
def create(self): """Deploy a cluster on Amazon's EKS Service configured for Jupyterhub Deployments. """ steps = [ (self.create_role, (), {}), (self.create_vpc, (), {}), (self.create_cluster, (), {}), (self.create_node_group, (), {}), ...
[ "def", "create", "(", "self", ")", ":", "steps", "=", "[", "(", "self", ".", "create_role", ",", "(", ")", ",", "{", "}", ")", ",", "(", "self", ".", "create_vpc", ",", "(", ")", ",", "{", "}", ")", ",", "(", "self", ".", "create_cluster", ",...
Deploy a cluster on Amazon's EKS Service configured for Jupyterhub Deployments.
[ "Deploy", "a", "cluster", "on", "Amazon", "s", "EKS", "Service", "configured", "for", "Jupyterhub", "Deployments", "." ]
c8c20f86a16e9d01dd90e4607d81423417cc773b
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/clusters/providers/aws/aws.py#L238-L253
247,155
townsenddw/jhubctl
jhubctl/clusters/providers/aws/aws.py
AwsEKS.delete
def delete(self): """Delete a running cluster.""" stacks = [ self.utilities_name, self.spot_nodes_name, self.node_group_name, self.cluster_name, self.vpc_name, self.role_name ] # Execute creation. for stack i...
python
def delete(self): """Delete a running cluster.""" stacks = [ self.utilities_name, self.spot_nodes_name, self.node_group_name, self.cluster_name, self.vpc_name, self.role_name ] # Execute creation. for stack i...
[ "def", "delete", "(", "self", ")", ":", "stacks", "=", "[", "self", ".", "utilities_name", ",", "self", ".", "spot_nodes_name", ",", "self", ".", "node_group_name", ",", "self", ".", "cluster_name", ",", "self", ".", "vpc_name", ",", "self", ".", "role_n...
Delete a running cluster.
[ "Delete", "a", "running", "cluster", "." ]
c8c20f86a16e9d01dd90e4607d81423417cc773b
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/clusters/providers/aws/aws.py#L255-L267
247,156
townsenddw/jhubctl
jhubctl/clusters/providers/aws/aws.py
AwsEKS.get_template
def get_template(self, template_name, **parameters): """Pull templates from the AWS templates folder""" template_path = pathlib.Path(self.template_dir).joinpath(template_name) return get_template(template_path, **parameters)
python
def get_template(self, template_name, **parameters): """Pull templates from the AWS templates folder""" template_path = pathlib.Path(self.template_dir).joinpath(template_name) return get_template(template_path, **parameters)
[ "def", "get_template", "(", "self", ",", "template_name", ",", "*", "*", "parameters", ")", ":", "template_path", "=", "pathlib", ".", "Path", "(", "self", ".", "template_dir", ")", ".", "joinpath", "(", "template_name", ")", "return", "get_template", "(", ...
Pull templates from the AWS templates folder
[ "Pull", "templates", "from", "the", "AWS", "templates", "folder" ]
c8c20f86a16e9d01dd90e4607d81423417cc773b
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/clusters/providers/aws/aws.py#L285-L288
247,157
townsenddw/jhubctl
jhubctl/clusters/providers/aws/aws.py
AwsEKS.delete_stack
def delete_stack(self, stack_name): """Teardown a stack.""" get_stack(stack_name) CLIENT.delete_stack( StackName=stack_name ) DELETE_WAITER.wait(StackName=stack_name)
python
def delete_stack(self, stack_name): """Teardown a stack.""" get_stack(stack_name) CLIENT.delete_stack( StackName=stack_name ) DELETE_WAITER.wait(StackName=stack_name)
[ "def", "delete_stack", "(", "self", ",", "stack_name", ")", ":", "get_stack", "(", "stack_name", ")", "CLIENT", ".", "delete_stack", "(", "StackName", "=", "stack_name", ")", "DELETE_WAITER", ".", "wait", "(", "StackName", "=", "stack_name", ")" ]
Teardown a stack.
[ "Teardown", "a", "stack", "." ]
c8c20f86a16e9d01dd90e4607d81423417cc773b
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/clusters/providers/aws/aws.py#L290-L296
247,158
townsenddw/jhubctl
jhubctl/clusters/providers/aws/aws.py
AwsEKS.create_stack
def create_stack( self, stack_name, stack_template_name, parameters=None, capabilities=None ): """Create a stack using Amazon's Cloud formation""" # Build template_path stack_template_path = pathlib.Path( self.template_dir).joinpath(st...
python
def create_stack( self, stack_name, stack_template_name, parameters=None, capabilities=None ): """Create a stack using Amazon's Cloud formation""" # Build template_path stack_template_path = pathlib.Path( self.template_dir).joinpath(st...
[ "def", "create_stack", "(", "self", ",", "stack_name", ",", "stack_template_name", ",", "parameters", "=", "None", ",", "capabilities", "=", "None", ")", ":", "# Build template_path", "stack_template_path", "=", "pathlib", ".", "Path", "(", "self", ".", "templat...
Create a stack using Amazon's Cloud formation
[ "Create", "a", "stack", "using", "Amazon", "s", "Cloud", "formation" ]
c8c20f86a16e9d01dd90e4607d81423417cc773b
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/clusters/providers/aws/aws.py#L298-L316
247,159
townsenddw/jhubctl
jhubctl/clusters/providers/aws/aws.py
AwsEKS.create_vpc
def create_vpc(self): """Create a virtual private cloud on Amazon's Web services configured for deploying JupyterHubs. """ self.create_stack( self.vpc_name, 'amazon-eks-vpc.yaml', parameters=define_parameters( VpcBlock="10.42.0.0/16", ...
python
def create_vpc(self): """Create a virtual private cloud on Amazon's Web services configured for deploying JupyterHubs. """ self.create_stack( self.vpc_name, 'amazon-eks-vpc.yaml', parameters=define_parameters( VpcBlock="10.42.0.0/16", ...
[ "def", "create_vpc", "(", "self", ")", ":", "self", ".", "create_stack", "(", "self", ".", "vpc_name", ",", "'amazon-eks-vpc.yaml'", ",", "parameters", "=", "define_parameters", "(", "VpcBlock", "=", "\"10.42.0.0/16\"", ",", "Subnet01Block", "=", "\"10.42.1.0/24\"...
Create a virtual private cloud on Amazon's Web services configured for deploying JupyterHubs.
[ "Create", "a", "virtual", "private", "cloud", "on", "Amazon", "s", "Web", "services", "configured", "for", "deploying", "JupyterHubs", "." ]
c8c20f86a16e9d01dd90e4607d81423417cc773b
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/clusters/providers/aws/aws.py#L328-L341
247,160
townsenddw/jhubctl
jhubctl/clusters/providers/aws/aws.py
AwsEKS.create_cluster
def create_cluster(self): """Creates a cluster on Amazon EKS . """ self.create_stack( self.cluster_name, 'amazon-eks-cluster.yaml', parameters=define_parameters( ClusterName=self.cluster_name, ControlPlaneSecurityGroup=self.secu...
python
def create_cluster(self): """Creates a cluster on Amazon EKS . """ self.create_stack( self.cluster_name, 'amazon-eks-cluster.yaml', parameters=define_parameters( ClusterName=self.cluster_name, ControlPlaneSecurityGroup=self.secu...
[ "def", "create_cluster", "(", "self", ")", ":", "self", ".", "create_stack", "(", "self", ".", "cluster_name", ",", "'amazon-eks-cluster.yaml'", ",", "parameters", "=", "define_parameters", "(", "ClusterName", "=", "self", ".", "cluster_name", ",", "ControlPlaneSe...
Creates a cluster on Amazon EKS .
[ "Creates", "a", "cluster", "on", "Amazon", "EKS", "." ]
c8c20f86a16e9d01dd90e4607d81423417cc773b
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/clusters/providers/aws/aws.py#L343-L354
247,161
townsenddw/jhubctl
jhubctl/clusters/providers/aws/aws.py
AwsEKS.create_node_group
def create_node_group(self): """Create on-demand node group on Amazon EKS. """ self.create_stack( self.node_group_name, 'amazon-eks-nodegroup.yaml', capabilities=['CAPABILITY_IAM'], parameters=define_parameters( ClusterName=self.clu...
python
def create_node_group(self): """Create on-demand node group on Amazon EKS. """ self.create_stack( self.node_group_name, 'amazon-eks-nodegroup.yaml', capabilities=['CAPABILITY_IAM'], parameters=define_parameters( ClusterName=self.clu...
[ "def", "create_node_group", "(", "self", ")", ":", "self", ".", "create_stack", "(", "self", ".", "node_group_name", ",", "'amazon-eks-nodegroup.yaml'", ",", "capabilities", "=", "[", "'CAPABILITY_IAM'", "]", ",", "parameters", "=", "define_parameters", "(", "Clus...
Create on-demand node group on Amazon EKS.
[ "Create", "on", "-", "demand", "node", "group", "on", "Amazon", "EKS", "." ]
c8c20f86a16e9d01dd90e4607d81423417cc773b
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/clusters/providers/aws/aws.py#L356-L374
247,162
townsenddw/jhubctl
jhubctl/clusters/providers/aws/aws.py
AwsEKS.create_spot_nodes
def create_spot_nodes(self): """Create spot nodes. """ self.create_stack( self.spot_nodes_name, 'amazon-spot-nodes.yaml', parameters=define_parameters( ClusterName=self.cluster_name, Subnets=self.subnet_ids, Node...
python
def create_spot_nodes(self): """Create spot nodes. """ self.create_stack( self.spot_nodes_name, 'amazon-spot-nodes.yaml', parameters=define_parameters( ClusterName=self.cluster_name, Subnets=self.subnet_ids, Node...
[ "def", "create_spot_nodes", "(", "self", ")", ":", "self", ".", "create_stack", "(", "self", ".", "spot_nodes_name", ",", "'amazon-spot-nodes.yaml'", ",", "parameters", "=", "define_parameters", "(", "ClusterName", "=", "self", ".", "cluster_name", ",", "Subnets",...
Create spot nodes.
[ "Create", "spot", "nodes", "." ]
c8c20f86a16e9d01dd90e4607d81423417cc773b
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/clusters/providers/aws/aws.py#L376-L390
247,163
townsenddw/jhubctl
jhubctl/clusters/providers/aws/aws.py
AwsEKS.create_utilities
def create_utilities(self): """Create utitilies stack. """ self.create_stack( self.utilities_name, 'amazon-utilities.yaml', parameters=define_parameters( Subnets=self.subnet_ids, NodeSecurityGroup=self.node_security_group ...
python
def create_utilities(self): """Create utitilies stack. """ self.create_stack( self.utilities_name, 'amazon-utilities.yaml', parameters=define_parameters( Subnets=self.subnet_ids, NodeSecurityGroup=self.node_security_group ...
[ "def", "create_utilities", "(", "self", ")", ":", "self", ".", "create_stack", "(", "self", ".", "utilities_name", ",", "'amazon-utilities.yaml'", ",", "parameters", "=", "define_parameters", "(", "Subnets", "=", "self", ".", "subnet_ids", ",", "NodeSecurityGroup"...
Create utitilies stack.
[ "Create", "utitilies", "stack", "." ]
c8c20f86a16e9d01dd90e4607d81423417cc773b
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/clusters/providers/aws/aws.py#L392-L402
247,164
klen/muffin-debugtoolbar
muffin_debugtoolbar/plugin.py
debugtoolbar_middleware_factory
def debugtoolbar_middleware_factory(app, handler): """Setup Debug middleware.""" dbtb = app.ps.debugtoolbar @asyncio.coroutine def debugtoolbar_middleware(request): """Integrate to application.""" # Check for debugtoolbar is enabled for the request if not dbtb.cfg.enabled or an...
python
def debugtoolbar_middleware_factory(app, handler): """Setup Debug middleware.""" dbtb = app.ps.debugtoolbar @asyncio.coroutine def debugtoolbar_middleware(request): """Integrate to application.""" # Check for debugtoolbar is enabled for the request if not dbtb.cfg.enabled or an...
[ "def", "debugtoolbar_middleware_factory", "(", "app", ",", "handler", ")", ":", "dbtb", "=", "app", ".", "ps", ".", "debugtoolbar", "@", "asyncio", ".", "coroutine", "def", "debugtoolbar_middleware", "(", "request", ")", ":", "\"\"\"Integrate to application.\"\"\"",...
Setup Debug middleware.
[ "Setup", "Debug", "middleware", "." ]
b650b35fbe2035888f6bba5dac3073ef01c94dc6
https://github.com/klen/muffin-debugtoolbar/blob/b650b35fbe2035888f6bba5dac3073ef01c94dc6/muffin_debugtoolbar/plugin.py#L28-L89
247,165
klen/muffin-debugtoolbar
muffin_debugtoolbar/plugin.py
Plugin.setup
def setup(self, app): """Setup the plugin and prepare application.""" super(Plugin, self).setup(app) if 'jinja2' not in app.plugins: raise PluginException('The plugin requires Muffin-Jinja2 plugin installed.') self.cfg.prefix = self.cfg.prefix.rstrip('/') + '/' self...
python
def setup(self, app): """Setup the plugin and prepare application.""" super(Plugin, self).setup(app) if 'jinja2' not in app.plugins: raise PluginException('The plugin requires Muffin-Jinja2 plugin installed.') self.cfg.prefix = self.cfg.prefix.rstrip('/') + '/' self...
[ "def", "setup", "(", "self", ",", "app", ")", ":", "super", "(", "Plugin", ",", "self", ")", ".", "setup", "(", "app", ")", "if", "'jinja2'", "not", "in", "app", ".", "plugins", ":", "raise", "PluginException", "(", "'The plugin requires Muffin-Jinja2 plug...
Setup the plugin and prepare application.
[ "Setup", "the", "plugin", "and", "prepare", "application", "." ]
b650b35fbe2035888f6bba5dac3073ef01c94dc6
https://github.com/klen/muffin-debugtoolbar/blob/b650b35fbe2035888f6bba5dac3073ef01c94dc6/muffin_debugtoolbar/plugin.py#L119-L164
247,166
klen/muffin-debugtoolbar
muffin_debugtoolbar/plugin.py
Plugin.inject
def inject(self, state, response): """ Inject Debug Toolbar code to response body. """ html = yield from self.app.ps.jinja2.render( 'debugtoolbar/inject.html', static_path=self.cfg.prefix + 'static', toolbar_url=self.cfg.prefix + state.id, ) html = htm...
python
def inject(self, state, response): """ Inject Debug Toolbar code to response body. """ html = yield from self.app.ps.jinja2.render( 'debugtoolbar/inject.html', static_path=self.cfg.prefix + 'static', toolbar_url=self.cfg.prefix + state.id, ) html = htm...
[ "def", "inject", "(", "self", ",", "state", ",", "response", ")", ":", "html", "=", "yield", "from", "self", ".", "app", ".", "ps", ".", "jinja2", ".", "render", "(", "'debugtoolbar/inject.html'", ",", "static_path", "=", "self", ".", "cfg", ".", "pref...
Inject Debug Toolbar code to response body.
[ "Inject", "Debug", "Toolbar", "code", "to", "response", "body", "." ]
b650b35fbe2035888f6bba5dac3073ef01c94dc6
https://github.com/klen/muffin-debugtoolbar/blob/b650b35fbe2035888f6bba5dac3073ef01c94dc6/muffin_debugtoolbar/plugin.py#L173-L182
247,167
klen/muffin-debugtoolbar
muffin_debugtoolbar/plugin.py
Plugin.view
def view(self, request): """ Debug Toolbar. """ auth = yield from self.authorize(request) if not auth: raise HTTPForbidden() request_id = request.match_info.get('request_id') state = self.history.get(request_id, None) response = yield from self.app.ps.jinja2...
python
def view(self, request): """ Debug Toolbar. """ auth = yield from self.authorize(request) if not auth: raise HTTPForbidden() request_id = request.match_info.get('request_id') state = self.history.get(request_id, None) response = yield from self.app.ps.jinja2...
[ "def", "view", "(", "self", ",", "request", ")", ":", "auth", "=", "yield", "from", "self", ".", "authorize", "(", "request", ")", "if", "not", "auth", ":", "raise", "HTTPForbidden", "(", ")", "request_id", "=", "request", ".", "match_info", ".", "get"...
Debug Toolbar.
[ "Debug", "Toolbar", "." ]
b650b35fbe2035888f6bba5dac3073ef01c94dc6
https://github.com/klen/muffin-debugtoolbar/blob/b650b35fbe2035888f6bba5dac3073ef01c94dc6/muffin_debugtoolbar/plugin.py#L185-L203
247,168
qbicsoftware/mtb-parser-lib
mtbparser/snv_item.py
SNVItem._format_dict
def _format_dict(self, info_dict): """Replaces empty content with 'NA's""" for key, value in info_dict.items(): if not value: info_dict[key] = "NA" return info_dict
python
def _format_dict(self, info_dict): """Replaces empty content with 'NA's""" for key, value in info_dict.items(): if not value: info_dict[key] = "NA" return info_dict
[ "def", "_format_dict", "(", "self", ",", "info_dict", ")", ":", "for", "key", ",", "value", "in", "info_dict", ".", "items", "(", ")", ":", "if", "not", "value", ":", "info_dict", "[", "key", "]", "=", "\"NA\"", "return", "info_dict" ]
Replaces empty content with 'NA's
[ "Replaces", "empty", "content", "with", "NA", "s" ]
e8b96e34b27e457ea7def2927fe44017fa173ba7
https://github.com/qbicsoftware/mtb-parser-lib/blob/e8b96e34b27e457ea7def2927fe44017fa173ba7/mtbparser/snv_item.py#L6-L11
247,169
minhhoit/yacms
yacms/utils/email.py
split_addresses
def split_addresses(email_string_list): """ Converts a string containing comma separated email addresses into a list of email addresses. """ return [f for f in [s.strip() for s in email_string_list.split(",")] if f]
python
def split_addresses(email_string_list): """ Converts a string containing comma separated email addresses into a list of email addresses. """ return [f for f in [s.strip() for s in email_string_list.split(",")] if f]
[ "def", "split_addresses", "(", "email_string_list", ")", ":", "return", "[", "f", "for", "f", "in", "[", "s", ".", "strip", "(", ")", "for", "s", "in", "email_string_list", ".", "split", "(", "\",\"", ")", "]", "if", "f", "]" ]
Converts a string containing comma separated email addresses into a list of email addresses.
[ "Converts", "a", "string", "containing", "comma", "separated", "email", "addresses", "into", "a", "list", "of", "email", "addresses", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/email.py#L15-L20
247,170
minhhoit/yacms
yacms/utils/email.py
subject_template
def subject_template(template, context): """ Loads and renders an email subject template, returning the subject string. """ subject = loader.get_template(template).render(Context(context)) return " ".join(subject.splitlines()).strip()
python
def subject_template(template, context): """ Loads and renders an email subject template, returning the subject string. """ subject = loader.get_template(template).render(Context(context)) return " ".join(subject.splitlines()).strip()
[ "def", "subject_template", "(", "template", ",", "context", ")", ":", "subject", "=", "loader", ".", "get_template", "(", "template", ")", ".", "render", "(", "Context", "(", "context", ")", ")", "return", "\" \"", ".", "join", "(", "subject", ".", "spli...
Loads and renders an email subject template, returning the subject string.
[ "Loads", "and", "renders", "an", "email", "subject", "template", "returning", "the", "subject", "string", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/email.py#L23-L29
247,171
minhhoit/yacms
yacms/utils/email.py
send_verification_mail
def send_verification_mail(request, user, verification_type): """ Sends an email with a verification link to users when ``ACCOUNTS_VERIFICATION_REQUIRED`` is ```True`` and they're signing up, or when they reset a lost password. The ``verification_type`` arg is both the name of the urlpattern for ...
python
def send_verification_mail(request, user, verification_type): """ Sends an email with a verification link to users when ``ACCOUNTS_VERIFICATION_REQUIRED`` is ```True`` and they're signing up, or when they reset a lost password. The ``verification_type`` arg is both the name of the urlpattern for ...
[ "def", "send_verification_mail", "(", "request", ",", "user", ",", "verification_type", ")", ":", "verify_url", "=", "reverse", "(", "verification_type", ",", "kwargs", "=", "{", "\"uidb36\"", ":", "int_to_base36", "(", "user", ".", "id", ")", ",", "\"token\""...
Sends an email with a verification link to users when ``ACCOUNTS_VERIFICATION_REQUIRED`` is ```True`` and they're signing up, or when they reset a lost password. The ``verification_type`` arg is both the name of the urlpattern for the verification link, as well as the names of the email templates to...
[ "Sends", "an", "email", "with", "a", "verification", "link", "to", "users", "when", "ACCOUNTS_VERIFICATION_REQUIRED", "is", "True", "and", "they", "re", "signing", "up", "or", "when", "they", "reset", "a", "lost", "password", ".", "The", "verification_type", "...
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/email.py#L69-L91
247,172
minhhoit/yacms
yacms/utils/email.py
send_approve_mail
def send_approve_mail(request, user): """ Sends an email to staff in listed in the setting ``ACCOUNTS_APPROVAL_EMAILS``, when a new user signs up and the ``ACCOUNTS_APPROVAL_REQUIRED`` setting is ``True``. """ approval_emails = split_addresses(settings.ACCOUNTS_APPROVAL_EMAILS) if not approv...
python
def send_approve_mail(request, user): """ Sends an email to staff in listed in the setting ``ACCOUNTS_APPROVAL_EMAILS``, when a new user signs up and the ``ACCOUNTS_APPROVAL_REQUIRED`` setting is ``True``. """ approval_emails = split_addresses(settings.ACCOUNTS_APPROVAL_EMAILS) if not approv...
[ "def", "send_approve_mail", "(", "request", ",", "user", ")", ":", "approval_emails", "=", "split_addresses", "(", "settings", ".", "ACCOUNTS_APPROVAL_EMAILS", ")", "if", "not", "approval_emails", ":", "return", "context", "=", "{", "\"request\"", ":", "request", ...
Sends an email to staff in listed in the setting ``ACCOUNTS_APPROVAL_EMAILS``, when a new user signs up and the ``ACCOUNTS_APPROVAL_REQUIRED`` setting is ``True``.
[ "Sends", "an", "email", "to", "staff", "in", "listed", "in", "the", "setting", "ACCOUNTS_APPROVAL_EMAILS", "when", "a", "new", "user", "signs", "up", "and", "the", "ACCOUNTS_APPROVAL_REQUIRED", "setting", "is", "True", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/email.py#L94-L111
247,173
minhhoit/yacms
yacms/utils/email.py
send_approved_mail
def send_approved_mail(request, user): """ Sends an email to a user once their ``is_active`` status goes from ``False`` to ``True`` when the ``ACCOUNTS_APPROVAL_REQUIRED`` setting is ``True``. """ context = {"request": request, "user": user} subject = subject_template("email/account_approved...
python
def send_approved_mail(request, user): """ Sends an email to a user once their ``is_active`` status goes from ``False`` to ``True`` when the ``ACCOUNTS_APPROVAL_REQUIRED`` setting is ``True``. """ context = {"request": request, "user": user} subject = subject_template("email/account_approved...
[ "def", "send_approved_mail", "(", "request", ",", "user", ")", ":", "context", "=", "{", "\"request\"", ":", "request", ",", "\"user\"", ":", "user", "}", "subject", "=", "subject_template", "(", "\"email/account_approved_subject.txt\"", ",", "context", ")", "se...
Sends an email to a user once their ``is_active`` status goes from ``False`` to ``True`` when the ``ACCOUNTS_APPROVAL_REQUIRED`` setting is ``True``.
[ "Sends", "an", "email", "to", "a", "user", "once", "their", "is_active", "status", "goes", "from", "False", "to", "True", "when", "the", "ACCOUNTS_APPROVAL_REQUIRED", "setting", "is", "True", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/email.py#L114-L124
247,174
OpenGov/python_data_wrap
datawrap/external/xmlparse.py
Worksheet.GetColumnNumber
def GetColumnNumber (self, columnName): """returns the column number for a given column heading name, 0 if not found""" for row in range(1, self.maxRow + 1): for column in range(1, self.maxColumn + 1): if self.GetCellValue(colum...
python
def GetColumnNumber (self, columnName): """returns the column number for a given column heading name, 0 if not found""" for row in range(1, self.maxRow + 1): for column in range(1, self.maxColumn + 1): if self.GetCellValue(colum...
[ "def", "GetColumnNumber", "(", "self", ",", "columnName", ")", ":", "for", "row", "in", "range", "(", "1", ",", "self", ".", "maxRow", "+", "1", ")", ":", "for", "column", "in", "range", "(", "1", ",", "self", ".", "maxColumn", "+", "1", ")", ":"...
returns the column number for a given column heading name, 0 if not found
[ "returns", "the", "column", "number", "for", "a", "given", "column", "heading", "name", "0", "if", "not", "found" ]
7de38bb30d7a500adc336a4a7999528d753e5600
https://github.com/OpenGov/python_data_wrap/blob/7de38bb30d7a500adc336a4a7999528d753e5600/datawrap/external/xmlparse.py#L341-L347
247,175
OpenGov/python_data_wrap
datawrap/external/xmlparse.py
Worksheet.DumpAsCSV
def DumpAsCSV (self, separator=",", file=sys.stdout): """dump as a comma separated value file""" for row in range(1, self.maxRow + 1): sep = "" for column in range(1, self.maxColumn + 1): file.write("%s\...
python
def DumpAsCSV (self, separator=",", file=sys.stdout): """dump as a comma separated value file""" for row in range(1, self.maxRow + 1): sep = "" for column in range(1, self.maxColumn + 1): file.write("%s\...
[ "def", "DumpAsCSV", "(", "self", ",", "separator", "=", "\",\"", ",", "file", "=", "sys", ".", "stdout", ")", ":", "for", "row", "in", "range", "(", "1", ",", "self", ".", "maxRow", "+", "1", ")", ":", "sep", "=", "\"\"", "for", "column", "in", ...
dump as a comma separated value file
[ "dump", "as", "a", "comma", "separated", "value", "file" ]
7de38bb30d7a500adc336a4a7999528d753e5600
https://github.com/OpenGov/python_data_wrap/blob/7de38bb30d7a500adc336a4a7999528d753e5600/datawrap/external/xmlparse.py#L349-L356
247,176
OpenGov/python_data_wrap
datawrap/external/xmlparse.py
ExcelFile.GetWorksheet
def GetWorksheet(self, nameOrNumber): """get a sheet by number""" if isinstance(nameOrNumber, int): return self.worksheets[nameOrNumber] else: return self.worksheetsByName[nameOrNumber]
python
def GetWorksheet(self, nameOrNumber): """get a sheet by number""" if isinstance(nameOrNumber, int): return self.worksheets[nameOrNumber] else: return self.worksheetsByName[nameOrNumber]
[ "def", "GetWorksheet", "(", "self", ",", "nameOrNumber", ")", ":", "if", "isinstance", "(", "nameOrNumber", ",", "int", ")", ":", "return", "self", ".", "worksheets", "[", "nameOrNumber", "]", "else", ":", "return", "self", ".", "worksheetsByName", "[", "n...
get a sheet by number
[ "get", "a", "sheet", "by", "number" ]
7de38bb30d7a500adc336a4a7999528d753e5600
https://github.com/OpenGov/python_data_wrap/blob/7de38bb30d7a500adc336a4a7999528d753e5600/datawrap/external/xmlparse.py#L399-L404
247,177
OpenGov/python_data_wrap
datawrap/external/xmlparse.py
ExcelToSparseArrayHandler.startElement
def startElement (self, name, attrs): '''if there's a start method for this element, call it ''' func = getattr(self, 'start_' + name, None) if func: func(attrs)
python
def startElement (self, name, attrs): '''if there's a start method for this element, call it ''' func = getattr(self, 'start_' + name, None) if func: func(attrs)
[ "def", "startElement", "(", "self", ",", "name", ",", "attrs", ")", ":", "func", "=", "getattr", "(", "self", ",", "'start_'", "+", "name", ",", "None", ")", "if", "func", ":", "func", "(", "attrs", ")" ]
if there's a start method for this element, call it
[ "if", "there", "s", "a", "start", "method", "for", "this", "element", "call", "it" ]
7de38bb30d7a500adc336a4a7999528d753e5600
https://github.com/OpenGov/python_data_wrap/blob/7de38bb30d7a500adc336a4a7999528d753e5600/datawrap/external/xmlparse.py#L521-L526
247,178
heikomuller/sco-engine
scoengine/reqbuf_worker.py
handle_request
def handle_request(request): """Convert a model run request from the buffer into a message in a RabbitMQ queue. Parameters ---------- request : dict Buffer entry containing 'connector' and 'request' field """ connector = request['connector'] hostname = connector['host'] port...
python
def handle_request(request): """Convert a model run request from the buffer into a message in a RabbitMQ queue. Parameters ---------- request : dict Buffer entry containing 'connector' and 'request' field """ connector = request['connector'] hostname = connector['host'] port...
[ "def", "handle_request", "(", "request", ")", ":", "connector", "=", "request", "[", "'connector'", "]", "hostname", "=", "connector", "[", "'host'", "]", "port", "=", "connector", "[", "'port'", "]", "virtual_host", "=", "connector", "[", "'virtualHost'", "...
Convert a model run request from the buffer into a message in a RabbitMQ queue. Parameters ---------- request : dict Buffer entry containing 'connector' and 'request' field
[ "Convert", "a", "model", "run", "request", "from", "the", "buffer", "into", "a", "message", "in", "a", "RabbitMQ", "queue", "." ]
3e7782d059ec808d930f0992794b6f5a8fd73c2c
https://github.com/heikomuller/sco-engine/blob/3e7782d059ec808d930f0992794b6f5a8fd73c2c/scoengine/reqbuf_worker.py#L19-L64
247,179
spookey/photon
photon/util/locations.py
get_locations
def get_locations(): ''' Compiles default locations :returns: A dictionary with folders as values: * 'home_dir': Your home-directory (:file:`~`) * 'call_dir': Where you called the first Python script from. (``argv[0]``) * 'conf_dir': The :envvar:`XDG_CONFIG_HOME`-directory + \ ``...
python
def get_locations(): ''' Compiles default locations :returns: A dictionary with folders as values: * 'home_dir': Your home-directory (:file:`~`) * 'call_dir': Where you called the first Python script from. (``argv[0]``) * 'conf_dir': The :envvar:`XDG_CONFIG_HOME`-directory + \ ``...
[ "def", "get_locations", "(", ")", ":", "home_dir", "=", "_path", ".", "expanduser", "(", "'~'", ")", "conf_dir", "=", "_path", ".", "join", "(", "_environ", ".", "get", "(", "'XDG_CONFIG_HOME'", ",", "_path", ".", "join", "(", "home_dir", ",", "'.config'...
Compiles default locations :returns: A dictionary with folders as values: * 'home_dir': Your home-directory (:file:`~`) * 'call_dir': Where you called the first Python script from. (``argv[0]``) * 'conf_dir': The :envvar:`XDG_CONFIG_HOME`-directory + \ ``photon`` (:file:`~/.config/photon...
[ "Compiles", "default", "locations" ]
57212a26ce713ab7723910ee49e3d0ba1697799f
https://github.com/spookey/photon/blob/57212a26ce713ab7723910ee49e3d0ba1697799f/photon/util/locations.py#L24-L70
247,180
spookey/photon
photon/util/locations.py
backup_location
def backup_location(src, loc=None): ''' Writes Backups of locations :param src: The source file/folder to backup :param loc: The target folder to backup into The backup will be called `src` + :func:`util.system.get_timestamp`. * If `loc` left to none, the backup gets wr...
python
def backup_location(src, loc=None): ''' Writes Backups of locations :param src: The source file/folder to backup :param loc: The target folder to backup into The backup will be called `src` + :func:`util.system.get_timestamp`. * If `loc` left to none, the backup gets wr...
[ "def", "backup_location", "(", "src", ",", "loc", "=", "None", ")", ":", "from", "photon", ".", "util", ".", "system", "import", "get_timestamp", "src", "=", "_path", ".", "realpath", "(", "src", ")", "if", "not", "loc", "or", "not", "loc", ".", "sta...
Writes Backups of locations :param src: The source file/folder to backup :param loc: The target folder to backup into The backup will be called `src` + :func:`util.system.get_timestamp`. * If `loc` left to none, the backup gets written in the same \ folder like `src` re...
[ "Writes", "Backups", "of", "locations" ]
57212a26ce713ab7723910ee49e3d0ba1697799f
https://github.com/spookey/photon/blob/57212a26ce713ab7723910ee49e3d0ba1697799f/photon/util/locations.py#L220-L245
247,181
nir0s/serv
serv/serv.py
status
def status(name, init_system, verbose): """WIP! Try at your own expense """ try: status = Serv(init_system, verbose=verbose).status(name) except ServError as ex: sys.exit(ex) click.echo(json.dumps(status, indent=4, sort_keys=True))
python
def status(name, init_system, verbose): """WIP! Try at your own expense """ try: status = Serv(init_system, verbose=verbose).status(name) except ServError as ex: sys.exit(ex) click.echo(json.dumps(status, indent=4, sort_keys=True))
[ "def", "status", "(", "name", ",", "init_system", ",", "verbose", ")", ":", "try", ":", "status", "=", "Serv", "(", "init_system", ",", "verbose", "=", "verbose", ")", ".", "status", "(", "name", ")", "except", "ServError", "as", "ex", ":", "sys", "....
WIP! Try at your own expense
[ "WIP!", "Try", "at", "your", "own", "expense" ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/serv.py#L432-L439
247,182
nir0s/serv
serv/serv.py
Serv._parse_service_env_vars
def _parse_service_env_vars(self, env_vars): """Return a dict based on `key=value` pair strings. """ env = {} for var in env_vars: # Yeah yeah.. it's less performant.. splitting twice.. who cares. k, v = var.split('=') env.update({k: v}) return...
python
def _parse_service_env_vars(self, env_vars): """Return a dict based on `key=value` pair strings. """ env = {} for var in env_vars: # Yeah yeah.. it's less performant.. splitting twice.. who cares. k, v = var.split('=') env.update({k: v}) return...
[ "def", "_parse_service_env_vars", "(", "self", ",", "env_vars", ")", ":", "env", "=", "{", "}", "for", "var", "in", "env_vars", ":", "# Yeah yeah.. it's less performant.. splitting twice.. who cares.", "k", ",", "v", "=", "var", ".", "split", "(", "'='", ")", ...
Return a dict based on `key=value` pair strings.
[ "Return", "a", "dict", "based", "on", "key", "=", "value", "pair", "strings", "." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/serv.py#L71-L79
247,183
nir0s/serv
serv/serv.py
Serv._set_service_name_from_command
def _set_service_name_from_command(self, cmd): """Set the name of a service according to the command. This is only relevant if the name wasn't explicitly provided. Note that this is risky as it sets the name according to the name of the file the command is using. If two services ...
python
def _set_service_name_from_command(self, cmd): """Set the name of a service according to the command. This is only relevant if the name wasn't explicitly provided. Note that this is risky as it sets the name according to the name of the file the command is using. If two services ...
[ "def", "_set_service_name_from_command", "(", "self", ",", "cmd", ")", ":", "# TODO: Consider assign incremental integers to the name if a service", "# with the same name already exists.", "name", "=", "os", ".", "path", ".", "basename", "(", "cmd", ")", "logger", ".", "i...
Set the name of a service according to the command. This is only relevant if the name wasn't explicitly provided. Note that this is risky as it sets the name according to the name of the file the command is using. If two services use the same binary, even if their args are different, th...
[ "Set", "the", "name", "of", "a", "service", "according", "to", "the", "command", "." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/serv.py#L81-L96
247,184
nir0s/serv
serv/serv.py
Serv.generate
def generate(self, cmd, name='', overwrite=False, deploy=False, start=False, **params): """Generate service files and returns a list of the generated files. It will generate configuration file(s) for t...
python
def generate(self, cmd, name='', overwrite=False, deploy=False, start=False, **params): """Generate service files and returns a list of the generated files. It will generate configuration file(s) for t...
[ "def", "generate", "(", "self", ",", "cmd", ",", "name", "=", "''", ",", "overwrite", "=", "False", ",", "deploy", "=", "False", ",", "start", "=", "False", ",", "*", "*", "params", ")", ":", "# TODO: parsing env vars and setting the name should probably be un...
Generate service files and returns a list of the generated files. It will generate configuration file(s) for the service and deploy them to the tmp dir on your os. If `deploy` is True, the service will be configured to run on the current machine. If `start` is True, the service...
[ "Generate", "service", "files", "and", "returns", "a", "list", "of", "the", "generated", "files", "." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/serv.py#L98-L145
247,185
nir0s/serv
serv/serv.py
Serv.remove
def remove(self, name): """Remove a service completely. It will try to stop the service and then uninstall it. The implementation is, of course, system specific. For instance, for upstart, it will `stop <name` and then delete /etc/init/<name>.conf. """ init = sel...
python
def remove(self, name): """Remove a service completely. It will try to stop the service and then uninstall it. The implementation is, of course, system specific. For instance, for upstart, it will `stop <name` and then delete /etc/init/<name>.conf. """ init = sel...
[ "def", "remove", "(", "self", ",", "name", ")", ":", "init", "=", "self", ".", "_get_implementation", "(", "name", ")", "self", ".", "_assert_service_installed", "(", "init", ",", "name", ")", "logger", ".", "info", "(", "'Removing %s service %s...'", ",", ...
Remove a service completely. It will try to stop the service and then uninstall it. The implementation is, of course, system specific. For instance, for upstart, it will `stop <name` and then delete /etc/init/<name>.conf.
[ "Remove", "a", "service", "completely", "." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/serv.py#L147-L160
247,186
nir0s/serv
serv/serv.py
Serv.status
def status(self, name=''): """Return a list containing a single service's info if `name` is supplied, else returns a list of all services' info. """ logger.warn( 'Note that `status` is currently not so robust and may break on ' 'different systems') init = ...
python
def status(self, name=''): """Return a list containing a single service's info if `name` is supplied, else returns a list of all services' info. """ logger.warn( 'Note that `status` is currently not so robust and may break on ' 'different systems') init = ...
[ "def", "status", "(", "self", ",", "name", "=", "''", ")", ":", "logger", ".", "warn", "(", "'Note that `status` is currently not so robust and may break on '", "'different systems'", ")", "init", "=", "self", ".", "_get_implementation", "(", "name", ")", "if", "n...
Return a list containing a single service's info if `name` is supplied, else returns a list of all services' info.
[ "Return", "a", "list", "containing", "a", "single", "service", "s", "info", "if", "name", "is", "supplied", "else", "returns", "a", "list", "of", "all", "services", "info", "." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/serv.py#L162-L173
247,187
nir0s/serv
serv/serv.py
Serv.stop
def stop(self, name): """Stop a service """ init = self._get_implementation(name) self._assert_service_installed(init, name) logger.info('Stopping service: %s...', name) init.stop()
python
def stop(self, name): """Stop a service """ init = self._get_implementation(name) self._assert_service_installed(init, name) logger.info('Stopping service: %s...', name) init.stop()
[ "def", "stop", "(", "self", ",", "name", ")", ":", "init", "=", "self", ".", "_get_implementation", "(", "name", ")", "self", ".", "_assert_service_installed", "(", "init", ",", "name", ")", "logger", ".", "info", "(", "'Stopping service: %s...'", ",", "na...
Stop a service
[ "Stop", "a", "service" ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/serv.py#L175-L181
247,188
nir0s/serv
serv/serv.py
Serv.restart
def restart(self, name): """Restart a service """ init = self._get_implementation(name) self._assert_service_installed(init, name) logger.info('Restarting service: %s...', name) init.stop() # Here we would use status to verify that the service stopped # be...
python
def restart(self, name): """Restart a service """ init = self._get_implementation(name) self._assert_service_installed(init, name) logger.info('Restarting service: %s...', name) init.stop() # Here we would use status to verify that the service stopped # be...
[ "def", "restart", "(", "self", ",", "name", ")", ":", "init", "=", "self", ".", "_get_implementation", "(", "name", ")", "self", ".", "_assert_service_installed", "(", "init", ",", "name", ")", "logger", ".", "info", "(", "'Restarting service: %s...'", ",", ...
Restart a service
[ "Restart", "a", "service" ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/serv.py#L191-L202
247,189
nir0s/serv
serv/serv.py
Serv.lookup_init_systems
def lookup_init_systems(self): """Return the relevant init system and its version. This will try to look at the mapping first. If the mapping doesn't exist, it will try to identify it automatically. Windows lookup is not supported and `nssm` is assumed. """ if utils.IS_...
python
def lookup_init_systems(self): """Return the relevant init system and its version. This will try to look at the mapping first. If the mapping doesn't exist, it will try to identify it automatically. Windows lookup is not supported and `nssm` is assumed. """ if utils.IS_...
[ "def", "lookup_init_systems", "(", "self", ")", ":", "if", "utils", ".", "IS_WIN", ":", "logger", ".", "debug", "(", "'Lookup is not supported on Windows. Assuming nssm...'", ")", "return", "[", "'nssm'", "]", "if", "utils", ".", "IS_DARWIN", ":", "logger", ".",...
Return the relevant init system and its version. This will try to look at the mapping first. If the mapping doesn't exist, it will try to identify it automatically. Windows lookup is not supported and `nssm` is assumed.
[ "Return", "the", "relevant", "init", "system", "and", "its", "version", "." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/serv.py#L214-L233
247,190
nir0s/serv
serv/serv.py
Serv._init_sys_auto_lookup
def _init_sys_auto_lookup(self): """Return a list of tuples of available init systems on the current machine. Note that in some situations (Ubuntu 14.04 for instance) more than one init system can be found. """ # TODO: Instead, check for executables for systemd and upsta...
python
def _init_sys_auto_lookup(self): """Return a list of tuples of available init systems on the current machine. Note that in some situations (Ubuntu 14.04 for instance) more than one init system can be found. """ # TODO: Instead, check for executables for systemd and upsta...
[ "def", "_init_sys_auto_lookup", "(", "self", ")", ":", "# TODO: Instead, check for executables for systemd and upstart", "# systemctl for systemd and initctl for upstart.", "# An alternative might be to check the second answer here:", "# http://unix.stackexchange.com/questions/196166/how-to-find-o...
Return a list of tuples of available init systems on the current machine. Note that in some situations (Ubuntu 14.04 for instance) more than one init system can be found.
[ "Return", "a", "list", "of", "tuples", "of", "available", "init", "systems", "on", "the", "current", "machine", "." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/serv.py#L238-L257
247,191
nir0s/serv
serv/serv.py
Serv._lookup_by_mapping
def _lookup_by_mapping(): """Return a the init system based on a constant mapping of distribution+version to init system.. See constants.py for the mapping. A failover of the version is proposed for when no version is supplied. For instance, Arch Linux's version will most probab...
python
def _lookup_by_mapping(): """Return a the init system based on a constant mapping of distribution+version to init system.. See constants.py for the mapping. A failover of the version is proposed for when no version is supplied. For instance, Arch Linux's version will most probab...
[ "def", "_lookup_by_mapping", "(", ")", ":", "like", "=", "distro", ".", "like", "(", ")", ".", "lower", "(", ")", "distribution_id", "=", "distro", ".", "id", "(", ")", ".", "lower", "(", ")", "version", "=", "distro", ".", "major_version", "(", ")",...
Return a the init system based on a constant mapping of distribution+version to init system.. See constants.py for the mapping. A failover of the version is proposed for when no version is supplied. For instance, Arch Linux's version will most probably be "rolling" at any given ...
[ "Return", "a", "the", "init", "system", "based", "on", "a", "constant", "mapping", "of", "distribution", "+", "version", "to", "init", "system", ".." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/serv.py#L260-L284
247,192
doptio/heywood
src/heywood/watchdog.py
all_files
def all_files(file_or_directory): 'return all files under file_or_directory.' if os.path.isdir(file_or_directory): return [os.path.join(dirname, filename) for dirname, dirnames, filenames in os.walk(file_or_directory) for filename in filenames] else: return [f...
python
def all_files(file_or_directory): 'return all files under file_or_directory.' if os.path.isdir(file_or_directory): return [os.path.join(dirname, filename) for dirname, dirnames, filenames in os.walk(file_or_directory) for filename in filenames] else: return [f...
[ "def", "all_files", "(", "file_or_directory", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "file_or_directory", ")", ":", "return", "[", "os", ".", "path", ".", "join", "(", "dirname", ",", "filename", ")", "for", "dirname", ",", "dirnames", "...
return all files under file_or_directory.
[ "return", "all", "files", "under", "file_or_directory", "." ]
40c2b1f28d43524a16b390fd3a4f6832f16fec41
https://github.com/doptio/heywood/blob/40c2b1f28d43524a16b390fd3a4f6832f16fec41/src/heywood/watchdog.py#L41-L48
247,193
knagra/farnsworth
base/views.py
add_context
def add_context(request): """ Add variables to all dictionaries passed to templates. """ # Whether the user has president privileges try: PRESIDENT = Manager.objects.filter( incumbent__user=request.user, president=True, ).count() > 0 except TypeError: PRES...
python
def add_context(request): """ Add variables to all dictionaries passed to templates. """ # Whether the user has president privileges try: PRESIDENT = Manager.objects.filter( incumbent__user=request.user, president=True, ).count() > 0 except TypeError: PRES...
[ "def", "add_context", "(", "request", ")", ":", "# Whether the user has president privileges", "try", ":", "PRESIDENT", "=", "Manager", ".", "objects", ".", "filter", "(", "incumbent__user", "=", "request", ".", "user", ",", "president", "=", "True", ",", ")", ...
Add variables to all dictionaries passed to templates.
[ "Add", "variables", "to", "all", "dictionaries", "passed", "to", "templates", "." ]
1b6589f0d9fea154f0a1e2231ed906764ed26d26
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/views.py#L54-L99
247,194
knagra/farnsworth
base/views.py
landing_view
def landing_view(request): ''' The external landing.''' revision = None can_edit = False edit_url = None if "farnswiki" in settings.INSTALLED_APPS: from wiki.models import Page from wiki.hooks import hookset binder = settings.WIKI_BINDERS[0] wiki = binder.lookup() ...
python
def landing_view(request): ''' The external landing.''' revision = None can_edit = False edit_url = None if "farnswiki" in settings.INSTALLED_APPS: from wiki.models import Page from wiki.hooks import hookset binder = settings.WIKI_BINDERS[0] wiki = binder.lookup() ...
[ "def", "landing_view", "(", "request", ")", ":", "revision", "=", "None", "can_edit", "=", "False", "edit_url", "=", "None", "if", "\"farnswiki\"", "in", "settings", ".", "INSTALLED_APPS", ":", "from", "wiki", ".", "models", "import", "Page", "from", "wiki",...
The external landing.
[ "The", "external", "landing", "." ]
1b6589f0d9fea154f0a1e2231ed906764ed26d26
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/views.py#L101-L130
247,195
knagra/farnsworth
base/views.py
my_profile_view
def my_profile_view(request): ''' The view of the profile page. ''' page_name = "Profile Page" if request.user.username == ANONYMOUS_USERNAME: return red_home(request, MESSAGES['SPINELESS']) userProfile = UserProfile.objects.get(user=request.user) change_password_form = PasswordChangeForm( ...
python
def my_profile_view(request): ''' The view of the profile page. ''' page_name = "Profile Page" if request.user.username == ANONYMOUS_USERNAME: return red_home(request, MESSAGES['SPINELESS']) userProfile = UserProfile.objects.get(user=request.user) change_password_form = PasswordChangeForm( ...
[ "def", "my_profile_view", "(", "request", ")", ":", "page_name", "=", "\"Profile Page\"", "if", "request", ".", "user", ".", "username", "==", "ANONYMOUS_USERNAME", ":", "return", "red_home", "(", "request", ",", "MESSAGES", "[", "'SPINELESS'", "]", ")", "user...
The view of the profile page.
[ "The", "view", "of", "the", "profile", "page", "." ]
1b6589f0d9fea154f0a1e2231ed906764ed26d26
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/views.py#L305-L341
247,196
knagra/farnsworth
base/views.py
notifications_view
def notifications_view(request): """ Show a user their notifications. """ page_name = "Your Notifications" # Copy the notifications so that they are still unread when we render the page notifications = list(request.user.notifications.all()) request.user.notifications.mark_all_as_read() r...
python
def notifications_view(request): """ Show a user their notifications. """ page_name = "Your Notifications" # Copy the notifications so that they are still unread when we render the page notifications = list(request.user.notifications.all()) request.user.notifications.mark_all_as_read() r...
[ "def", "notifications_view", "(", "request", ")", ":", "page_name", "=", "\"Your Notifications\"", "# Copy the notifications so that they are still unread when we render the page", "notifications", "=", "list", "(", "request", ".", "user", ".", "notifications", ".", "all", ...
Show a user their notifications.
[ "Show", "a", "user", "their", "notifications", "." ]
1b6589f0d9fea154f0a1e2231ed906764ed26d26
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/views.py#L344-L355
247,197
knagra/farnsworth
base/views.py
login_view
def login_view(request): ''' The view of the login page. ''' ANONYMOUS_SESSION = request.session.get('ANONYMOUS_SESSION', False) page_name = "Login Page" redirect_to = request.GET.get('next', reverse('homepage')) if (request.user.is_authenticated() and not ANONYMOUS_SESSION) or (ANONYMOUS_SESSION an...
python
def login_view(request): ''' The view of the login page. ''' ANONYMOUS_SESSION = request.session.get('ANONYMOUS_SESSION', False) page_name = "Login Page" redirect_to = request.GET.get('next', reverse('homepage')) if (request.user.is_authenticated() and not ANONYMOUS_SESSION) or (ANONYMOUS_SESSION an...
[ "def", "login_view", "(", "request", ")", ":", "ANONYMOUS_SESSION", "=", "request", ".", "session", ".", "get", "(", "'ANONYMOUS_SESSION'", ",", "False", ")", "page_name", "=", "\"Login Page\"", "redirect_to", "=", "request", ".", "GET", ".", "get", "(", "'n...
The view of the login page.
[ "The", "view", "of", "the", "login", "page", "." ]
1b6589f0d9fea154f0a1e2231ed906764ed26d26
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/views.py#L357-L381
247,198
knagra/farnsworth
base/views.py
member_profile_view
def member_profile_view(request, targetUsername): ''' View a member's Profile. ''' if targetUsername == request.user.username and targetUsername != ANONYMOUS_USERNAME: return HttpResponseRedirect(reverse('my_profile')) page_name = "{0}'s Profile".format(targetUsername) targetUser = get_object_or...
python
def member_profile_view(request, targetUsername): ''' View a member's Profile. ''' if targetUsername == request.user.username and targetUsername != ANONYMOUS_USERNAME: return HttpResponseRedirect(reverse('my_profile')) page_name = "{0}'s Profile".format(targetUsername) targetUser = get_object_or...
[ "def", "member_profile_view", "(", "request", ",", "targetUsername", ")", ":", "if", "targetUsername", "==", "request", ".", "user", ".", "username", "and", "targetUsername", "!=", "ANONYMOUS_USERNAME", ":", "return", "HttpResponseRedirect", "(", "reverse", "(", "...
View a member's Profile.
[ "View", "a", "member", "s", "Profile", "." ]
1b6589f0d9fea154f0a1e2231ed906764ed26d26
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/views.py#L444-L465
247,199
knagra/farnsworth
base/views.py
request_profile_view
def request_profile_view(request): ''' The page to request a user profile on the site. ''' page_name = "Profile Request Page" redirect_to = request.GET.get('next', reverse('homepage')) if request.user.is_authenticated() and request.user.username != ANONYMOUS_USERNAME: return HttpResponseRedirect...
python
def request_profile_view(request): ''' The page to request a user profile on the site. ''' page_name = "Profile Request Page" redirect_to = request.GET.get('next', reverse('homepage')) if request.user.is_authenticated() and request.user.username != ANONYMOUS_USERNAME: return HttpResponseRedirect...
[ "def", "request_profile_view", "(", "request", ")", ":", "page_name", "=", "\"Profile Request Page\"", "redirect_to", "=", "request", ".", "GET", ".", "get", "(", "'next'", ",", "reverse", "(", "'homepage'", ")", ")", "if", "request", ".", "user", ".", "is_a...
The page to request a user profile on the site.
[ "The", "page", "to", "request", "a", "user", "profile", "on", "the", "site", "." ]
1b6589f0d9fea154f0a1e2231ed906764ed26d26
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/views.py#L467-L518