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
sequence
docstring
stringlengths
3
17.3k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
87
242
247,500
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfclass.py
get_rml_processors
def get_rml_processors(es_defs): """ Returns the es_defs with the instaniated rml_processor Args: ----- es_defs: the rdf_class elacticsearch defnitions cls_name: the name of the tied class """ proc_defs = es_defs.get("kds_esRmlProcessor", []) if proc_defs: new_defs = [] for proc in proc_defs: params = proc['kds_rmlProcessorParams'][0] proc_kwargs = {} if params.get("kds_rtn_format"): proc_kwargs["rtn_format"] = params.get("kds_rtn_format")[0] new_def = dict(name=proc['rdfs_label'][0], subj=params["kds_subjectKwarg"][0], proc_kwargs=proc_kwargs, force=proc.get('kds_forceNested',[False])[0], processor=CFG.rml.get_processor(\ proc['rdfs_label'][0], proc['kds_esRmlMapping'], proc['rdf_type'][0])) new_defs.append(new_def) es_defs['kds_esRmlProcessor'] = new_defs return es_defs
python
def get_rml_processors(es_defs): """ Returns the es_defs with the instaniated rml_processor Args: ----- es_defs: the rdf_class elacticsearch defnitions cls_name: the name of the tied class """ proc_defs = es_defs.get("kds_esRmlProcessor", []) if proc_defs: new_defs = [] for proc in proc_defs: params = proc['kds_rmlProcessorParams'][0] proc_kwargs = {} if params.get("kds_rtn_format"): proc_kwargs["rtn_format"] = params.get("kds_rtn_format")[0] new_def = dict(name=proc['rdfs_label'][0], subj=params["kds_subjectKwarg"][0], proc_kwargs=proc_kwargs, force=proc.get('kds_forceNested',[False])[0], processor=CFG.rml.get_processor(\ proc['rdfs_label'][0], proc['kds_esRmlMapping'], proc['rdf_type'][0])) new_defs.append(new_def) es_defs['kds_esRmlProcessor'] = new_defs return es_defs
[ "def", "get_rml_processors", "(", "es_defs", ")", ":", "proc_defs", "=", "es_defs", ".", "get", "(", "\"kds_esRmlProcessor\"", ",", "[", "]", ")", "if", "proc_defs", ":", "new_defs", "=", "[", "]", "for", "proc", "in", "proc_defs", ":", "params", "=", "proc", "[", "'kds_rmlProcessorParams'", "]", "[", "0", "]", "proc_kwargs", "=", "{", "}", "if", "params", ".", "get", "(", "\"kds_rtn_format\"", ")", ":", "proc_kwargs", "[", "\"rtn_format\"", "]", "=", "params", ".", "get", "(", "\"kds_rtn_format\"", ")", "[", "0", "]", "new_def", "=", "dict", "(", "name", "=", "proc", "[", "'rdfs_label'", "]", "[", "0", "]", ",", "subj", "=", "params", "[", "\"kds_subjectKwarg\"", "]", "[", "0", "]", ",", "proc_kwargs", "=", "proc_kwargs", ",", "force", "=", "proc", ".", "get", "(", "'kds_forceNested'", ",", "[", "False", "]", ")", "[", "0", "]", ",", "processor", "=", "CFG", ".", "rml", ".", "get_processor", "(", "proc", "[", "'rdfs_label'", "]", "[", "0", "]", ",", "proc", "[", "'kds_esRmlMapping'", "]", ",", "proc", "[", "'rdf_type'", "]", "[", "0", "]", ")", ")", "new_defs", ".", "append", "(", "new_def", ")", "es_defs", "[", "'kds_esRmlProcessor'", "]", "=", "new_defs", "return", "es_defs" ]
Returns the es_defs with the instaniated rml_processor Args: ----- es_defs: the rdf_class elacticsearch defnitions cls_name: the name of the tied class
[ "Returns", "the", "es_defs", "with", "the", "instaniated", "rml_processor" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfclass.py#L736-L763
247,501
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfclass.py
remove_parents
def remove_parents(bases): """ removes the parent classes if one base is subclass of another""" if len(bases) < 2: return bases remove_i = [] bases = list(bases) for i, base in enumerate(bases): for j, other in enumerate(bases): # print(i, j, base, other, remove_i) if j != i and (issubclass(other, base) or base == other): remove_i.append(i) remove_i = set(remove_i) remove_i = [i for i in remove_i] remove_i.sort(reverse=True) for index in remove_i: try: del bases[index] except IndexError: print("Unable to delete base: ", bases) return bases
python
def remove_parents(bases): """ removes the parent classes if one base is subclass of another""" if len(bases) < 2: return bases remove_i = [] bases = list(bases) for i, base in enumerate(bases): for j, other in enumerate(bases): # print(i, j, base, other, remove_i) if j != i and (issubclass(other, base) or base == other): remove_i.append(i) remove_i = set(remove_i) remove_i = [i for i in remove_i] remove_i.sort(reverse=True) for index in remove_i: try: del bases[index] except IndexError: print("Unable to delete base: ", bases) return bases
[ "def", "remove_parents", "(", "bases", ")", ":", "if", "len", "(", "bases", ")", "<", "2", ":", "return", "bases", "remove_i", "=", "[", "]", "bases", "=", "list", "(", "bases", ")", "for", "i", ",", "base", "in", "enumerate", "(", "bases", ")", ":", "for", "j", ",", "other", "in", "enumerate", "(", "bases", ")", ":", "# print(i, j, base, other, remove_i)", "if", "j", "!=", "i", "and", "(", "issubclass", "(", "other", ",", "base", ")", "or", "base", "==", "other", ")", ":", "remove_i", ".", "append", "(", "i", ")", "remove_i", "=", "set", "(", "remove_i", ")", "remove_i", "=", "[", "i", "for", "i", "in", "remove_i", "]", "remove_i", ".", "sort", "(", "reverse", "=", "True", ")", "for", "index", "in", "remove_i", ":", "try", ":", "del", "bases", "[", "index", "]", "except", "IndexError", ":", "print", "(", "\"Unable to delete base: \"", ",", "bases", ")", "return", "bases" ]
removes the parent classes if one base is subclass of another
[ "removes", "the", "parent", "classes", "if", "one", "base", "is", "subclass", "of", "another" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfclass.py#L789-L809
247,502
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfclass.py
get_query_kwargs
def get_query_kwargs(es_defs): """ Reads the es_defs and returns a dict of special kwargs to use when query for data of an instance of a class reference: rdfframework.sparl.queries.sparqlAllItemDataTemplate.rq """ rtn_dict = {} if es_defs: if es_defs.get("kds_esSpecialUnion"): rtn_dict['special_union'] = \ es_defs["kds_esSpecialUnion"][0] if es_defs.get("kds_esQueryFilter"): rtn_dict['filters'] = \ es_defs["kds_esQueryFilter"][0] return rtn_dict
python
def get_query_kwargs(es_defs): """ Reads the es_defs and returns a dict of special kwargs to use when query for data of an instance of a class reference: rdfframework.sparl.queries.sparqlAllItemDataTemplate.rq """ rtn_dict = {} if es_defs: if es_defs.get("kds_esSpecialUnion"): rtn_dict['special_union'] = \ es_defs["kds_esSpecialUnion"][0] if es_defs.get("kds_esQueryFilter"): rtn_dict['filters'] = \ es_defs["kds_esQueryFilter"][0] return rtn_dict
[ "def", "get_query_kwargs", "(", "es_defs", ")", ":", "rtn_dict", "=", "{", "}", "if", "es_defs", ":", "if", "es_defs", ".", "get", "(", "\"kds_esSpecialUnion\"", ")", ":", "rtn_dict", "[", "'special_union'", "]", "=", "es_defs", "[", "\"kds_esSpecialUnion\"", "]", "[", "0", "]", "if", "es_defs", ".", "get", "(", "\"kds_esQueryFilter\"", ")", ":", "rtn_dict", "[", "'filters'", "]", "=", "es_defs", "[", "\"kds_esQueryFilter\"", "]", "[", "0", "]", "return", "rtn_dict" ]
Reads the es_defs and returns a dict of special kwargs to use when query for data of an instance of a class reference: rdfframework.sparl.queries.sparqlAllItemDataTemplate.rq
[ "Reads", "the", "es_defs", "and", "returns", "a", "dict", "of", "special", "kwargs", "to", "use", "when", "query", "for", "data", "of", "an", "instance", "of", "a", "class" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfclass.py#L811-L826
247,503
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfclass.py
RdfClassBase.add_property
def add_property(self, pred, obj): """ adds a property and its value to the class instance args: pred: the predicate/property to add obj: the value/object to add obj_method: *** No longer used. """ pred = Uri(pred) try: self[pred].append(obj) # except AttributeError: # new_list = [self[pred]] # new_list.append(obj) # self[pred] = new_list except KeyError: try: new_prop = self.properties[pred] except AttributeError: self.properties = {} self.add_property(pred, obj) return except KeyError: try: new_prop = MODULE.rdfclass.properties[pred] except KeyError: new_prop = MODULE.rdfclass.make_property({}, pred, self.class_names) try: self.properties[pred] = new_prop except AttributeError: self.properties = {pred: new_prop} init_prop = new_prop(self, get_attr(self, "dataset")) setattr(self, pred, init_prop) self[pred] = init_prop self[pred].append(obj) if self.dataset: self.dataset.add_rmap_item(self, pred, obj)
python
def add_property(self, pred, obj): """ adds a property and its value to the class instance args: pred: the predicate/property to add obj: the value/object to add obj_method: *** No longer used. """ pred = Uri(pred) try: self[pred].append(obj) # except AttributeError: # new_list = [self[pred]] # new_list.append(obj) # self[pred] = new_list except KeyError: try: new_prop = self.properties[pred] except AttributeError: self.properties = {} self.add_property(pred, obj) return except KeyError: try: new_prop = MODULE.rdfclass.properties[pred] except KeyError: new_prop = MODULE.rdfclass.make_property({}, pred, self.class_names) try: self.properties[pred] = new_prop except AttributeError: self.properties = {pred: new_prop} init_prop = new_prop(self, get_attr(self, "dataset")) setattr(self, pred, init_prop) self[pred] = init_prop self[pred].append(obj) if self.dataset: self.dataset.add_rmap_item(self, pred, obj)
[ "def", "add_property", "(", "self", ",", "pred", ",", "obj", ")", ":", "pred", "=", "Uri", "(", "pred", ")", "try", ":", "self", "[", "pred", "]", ".", "append", "(", "obj", ")", "# except AttributeError:", "# new_list = [self[pred]]", "# new_list.append(obj)", "# self[pred] = new_list", "except", "KeyError", ":", "try", ":", "new_prop", "=", "self", ".", "properties", "[", "pred", "]", "except", "AttributeError", ":", "self", ".", "properties", "=", "{", "}", "self", ".", "add_property", "(", "pred", ",", "obj", ")", "return", "except", "KeyError", ":", "try", ":", "new_prop", "=", "MODULE", ".", "rdfclass", ".", "properties", "[", "pred", "]", "except", "KeyError", ":", "new_prop", "=", "MODULE", ".", "rdfclass", ".", "make_property", "(", "{", "}", ",", "pred", ",", "self", ".", "class_names", ")", "try", ":", "self", ".", "properties", "[", "pred", "]", "=", "new_prop", "except", "AttributeError", ":", "self", ".", "properties", "=", "{", "pred", ":", "new_prop", "}", "init_prop", "=", "new_prop", "(", "self", ",", "get_attr", "(", "self", ",", "\"dataset\"", ")", ")", "setattr", "(", "self", ",", "pred", ",", "init_prop", ")", "self", "[", "pred", "]", "=", "init_prop", "self", "[", "pred", "]", ".", "append", "(", "obj", ")", "if", "self", ".", "dataset", ":", "self", ".", "dataset", ".", "add_rmap_item", "(", "self", ",", "pred", ",", "obj", ")" ]
adds a property and its value to the class instance args: pred: the predicate/property to add obj: the value/object to add obj_method: *** No longer used.
[ "adds", "a", "property", "and", "its", "value", "to", "the", "class", "instance" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfclass.py#L194-L233
247,504
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfclass.py
RdfClassBase.conv_json
def conv_json(self, uri_format="sparql_uri", add_ids=False): """ converts the class to a json compatable python dictionary Args: uri_format('sparql_uri','pyuri'): The format that uri values will be returned Returns: dict: a json compatabile python dictionary """ def convert_item(ivalue): """ converts an idividual value to a json value Args: ivalue: value of the item to convert Returns: JSON serializable value """ nvalue = ivalue if isinstance(ivalue, BaseRdfDataType): if ivalue.type == 'uri': if ivalue.startswith("pyuri") and uri_format == "pyuri": nvalue = getattr(ivalue, "sparql") else: nvalue = getattr(ivalue, uri_format) else: nvalue = ivalue.to_json elif isinstance(ivalue, RdfClassBase): if ivalue.subject.type == "uri": nvalue = ivalue.conv_json(uri_format, add_ids) elif ivalue.subject.type == "bnode": nvalue = ivalue.conv_json(uri_format, add_ids) elif isinstance(ivalue, list): nvalue = [] for item in ivalue: temp = convert_item(item) nvalue.append(temp) return nvalue rtn_val = {key: convert_item(value) for key, value in self.items()} #pdb.set_trace() if add_ids: if self.subject.type == 'uri': rtn_val['uri'] = self.subject.sparql_uri rtn_val['id'] = sha1(rtn_val['uri'].encode()).hexdigest() #return {key: convert_item(value) for key, value in self.items()} return rtn_val
python
def conv_json(self, uri_format="sparql_uri", add_ids=False): """ converts the class to a json compatable python dictionary Args: uri_format('sparql_uri','pyuri'): The format that uri values will be returned Returns: dict: a json compatabile python dictionary """ def convert_item(ivalue): """ converts an idividual value to a json value Args: ivalue: value of the item to convert Returns: JSON serializable value """ nvalue = ivalue if isinstance(ivalue, BaseRdfDataType): if ivalue.type == 'uri': if ivalue.startswith("pyuri") and uri_format == "pyuri": nvalue = getattr(ivalue, "sparql") else: nvalue = getattr(ivalue, uri_format) else: nvalue = ivalue.to_json elif isinstance(ivalue, RdfClassBase): if ivalue.subject.type == "uri": nvalue = ivalue.conv_json(uri_format, add_ids) elif ivalue.subject.type == "bnode": nvalue = ivalue.conv_json(uri_format, add_ids) elif isinstance(ivalue, list): nvalue = [] for item in ivalue: temp = convert_item(item) nvalue.append(temp) return nvalue rtn_val = {key: convert_item(value) for key, value in self.items()} #pdb.set_trace() if add_ids: if self.subject.type == 'uri': rtn_val['uri'] = self.subject.sparql_uri rtn_val['id'] = sha1(rtn_val['uri'].encode()).hexdigest() #return {key: convert_item(value) for key, value in self.items()} return rtn_val
[ "def", "conv_json", "(", "self", ",", "uri_format", "=", "\"sparql_uri\"", ",", "add_ids", "=", "False", ")", ":", "def", "convert_item", "(", "ivalue", ")", ":", "\"\"\" converts an idividual value to a json value\n\n Args:\n ivalue: value of the item to convert\n\n Returns:\n JSON serializable value\n \"\"\"", "nvalue", "=", "ivalue", "if", "isinstance", "(", "ivalue", ",", "BaseRdfDataType", ")", ":", "if", "ivalue", ".", "type", "==", "'uri'", ":", "if", "ivalue", ".", "startswith", "(", "\"pyuri\"", ")", "and", "uri_format", "==", "\"pyuri\"", ":", "nvalue", "=", "getattr", "(", "ivalue", ",", "\"sparql\"", ")", "else", ":", "nvalue", "=", "getattr", "(", "ivalue", ",", "uri_format", ")", "else", ":", "nvalue", "=", "ivalue", ".", "to_json", "elif", "isinstance", "(", "ivalue", ",", "RdfClassBase", ")", ":", "if", "ivalue", ".", "subject", ".", "type", "==", "\"uri\"", ":", "nvalue", "=", "ivalue", ".", "conv_json", "(", "uri_format", ",", "add_ids", ")", "elif", "ivalue", ".", "subject", ".", "type", "==", "\"bnode\"", ":", "nvalue", "=", "ivalue", ".", "conv_json", "(", "uri_format", ",", "add_ids", ")", "elif", "isinstance", "(", "ivalue", ",", "list", ")", ":", "nvalue", "=", "[", "]", "for", "item", "in", "ivalue", ":", "temp", "=", "convert_item", "(", "item", ")", "nvalue", ".", "append", "(", "temp", ")", "return", "nvalue", "rtn_val", "=", "{", "key", ":", "convert_item", "(", "value", ")", "for", "key", ",", "value", "in", "self", ".", "items", "(", ")", "}", "#pdb.set_trace()", "if", "add_ids", ":", "if", "self", ".", "subject", ".", "type", "==", "'uri'", ":", "rtn_val", "[", "'uri'", "]", "=", "self", ".", "subject", ".", "sparql_uri", "rtn_val", "[", "'id'", "]", "=", "sha1", "(", "rtn_val", "[", "'uri'", "]", ".", "encode", "(", ")", ")", ".", "hexdigest", "(", ")", "#return {key: convert_item(value) for key, value in self.items()}", "return", "rtn_val" ]
converts the class to a json compatable python dictionary Args: uri_format('sparql_uri','pyuri'): The format that uri values will be returned Returns: dict: a json compatabile python dictionary
[ "converts", "the", "class", "to", "a", "json", "compatable", "python", "dictionary" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfclass.py#L245-L293
247,505
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfclass.py
RdfClassBase.bnode_id
def bnode_id(self): """ calculates the bnode id for the class """ if self.subject.type != 'bnode': return self.subject rtn_list = [] for prop in sorted(self): for value in sorted(self[prop]): rtn_list.append("%s%s" % (prop, value)) return sha1("".join(rtn_list).encode()).hexdigest()
python
def bnode_id(self): """ calculates the bnode id for the class """ if self.subject.type != 'bnode': return self.subject rtn_list = [] for prop in sorted(self): for value in sorted(self[prop]): rtn_list.append("%s%s" % (prop, value)) return sha1("".join(rtn_list).encode()).hexdigest()
[ "def", "bnode_id", "(", "self", ")", ":", "if", "self", ".", "subject", ".", "type", "!=", "'bnode'", ":", "return", "self", ".", "subject", "rtn_list", "=", "[", "]", "for", "prop", "in", "sorted", "(", "self", ")", ":", "for", "value", "in", "sorted", "(", "self", "[", "prop", "]", ")", ":", "rtn_list", ".", "append", "(", "\"%s%s\"", "%", "(", "prop", ",", "value", ")", ")", "return", "sha1", "(", "\"\"", ".", "join", "(", "rtn_list", ")", ".", "encode", "(", ")", ")", ".", "hexdigest", "(", ")" ]
calculates the bnode id for the class
[ "calculates", "the", "bnode", "id", "for", "the", "class" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfclass.py#L466-L476
247,506
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfclass.py
RdfClassBase.es_json
def es_json(self, role='rdf_class', remove_empty=True, **kwargs): """ Returns a JSON object of the class for insertion into es args: role: the role states how the class data should be returned depending upon whether it is used as a subject of an object. options are kds_esNested or rdf_class remove_empty: True removes empty items from es object """ def test_idx_status(cls_inst, **kwargs): """ Return True if the class has already been indexed in elastisearch Args: ----- cls_inst: the rdfclass instance Kwargs: ------- force[boolean]: True will return false to force a reindex of the class """ if kwargs.get("force") == True: return False idx_time = cls_inst.get("kds_esIndexTime", [None])[0] mod_time = cls_inst.get("dcterm_modified", [None])[0] error_msg = cls_inst.get("kds_esIndexError", [None])[0] if (not idx_time) or \ error_msg or \ (idx_time and mod_time and idx_time < mod_time): return False return True # if self.__class__.__name__ == 'rdf_type': # pdb.set_trace() rtn_obj = {} if kwargs.get("depth"): kwargs['depth'] += 1 else: kwargs['depth'] = 1 if role == 'rdf_class': if test_idx_status(self, **kwargs): return None for prop, value in self.items(): if prop in ['kds_esIndexTime', 'kds_esIndexError']: continue new_val = value.es_json() rtn_method = get_attr(self[prop], 'kds_esObjectType', []) if 'kdr_Array' in rtn_method: rtn_obj[prop] = new_val elif (remove_empty and new_val) or not remove_empty: if len(new_val) == 1: rtn_obj[prop] = new_val[0] else: rtn_obj[prop] = new_val nested_props = None else: try: nested_props = self.es_defs.get('kds_esNestedProps', list(self.keys())).copy() except AttributeError: nested_props = list(self.keys()) for prop, value in self.items(): # if prop == 'bf_hasInstance': # pdb.set_trace() if prop in ['kds_esIndexTime', 'kds_esIndexError']: continue new_val = value.es_json(**kwargs) rtn_method = get_attr(self[prop], 'kds_esObjectType', []) if 'kdr_Array' in rtn_method: rtn_obj[prop] = new_val elif (remove_empty and new_val) or not remove_empty: if len(new_val) == 1: rtn_obj[prop] = new_val[0] \ if not isinstance(new_val, dict) \ else new_val else: rtn_obj[prop] = new_val # if 'bf_Work' in self.hierarchy: # pdb.set_trace() rtn_obj = get_es_label(rtn_obj, self) rtn_obj = get_es_value(rtn_obj, self) rtn_obj = get_es_ids(rtn_obj, self) if nested_props: nested_props += ['value', 'id', 'uri'] rtn_obj = {key: value for key, value in rtn_obj.items() if key in nested_props} # rml_procs = self.es_defs.get("kds_esRmlProcessor", []) # # if role == 'rdf_class': # # pdb.set_trace() # rml_procs = [proc for proc in rml_procs # if role == 'rdf_class' or # proc['force']] # if rml_procs: # rml_maps = {} # for rml in rml_procs: # proc_kwargs = {rml['subj']: self.subject, # "dataset": self.dataset} # proc_kwargs.update(rml['proc_kwargs']) # rml_maps[rml['name']] = rml['processor'](**proc_kwargs) # if rml_maps: # rtn_obj['rml_map'] = rml_maps rml_maps = self.get_all_rml(role=role) if rml_maps: rtn_obj['rml_map'] = rml_maps # if self.get('bf_contribution'): # pdb.set_trace() return rtn_obj
python
def es_json(self, role='rdf_class', remove_empty=True, **kwargs): """ Returns a JSON object of the class for insertion into es args: role: the role states how the class data should be returned depending upon whether it is used as a subject of an object. options are kds_esNested or rdf_class remove_empty: True removes empty items from es object """ def test_idx_status(cls_inst, **kwargs): """ Return True if the class has already been indexed in elastisearch Args: ----- cls_inst: the rdfclass instance Kwargs: ------- force[boolean]: True will return false to force a reindex of the class """ if kwargs.get("force") == True: return False idx_time = cls_inst.get("kds_esIndexTime", [None])[0] mod_time = cls_inst.get("dcterm_modified", [None])[0] error_msg = cls_inst.get("kds_esIndexError", [None])[0] if (not idx_time) or \ error_msg or \ (idx_time and mod_time and idx_time < mod_time): return False return True # if self.__class__.__name__ == 'rdf_type': # pdb.set_trace() rtn_obj = {} if kwargs.get("depth"): kwargs['depth'] += 1 else: kwargs['depth'] = 1 if role == 'rdf_class': if test_idx_status(self, **kwargs): return None for prop, value in self.items(): if prop in ['kds_esIndexTime', 'kds_esIndexError']: continue new_val = value.es_json() rtn_method = get_attr(self[prop], 'kds_esObjectType', []) if 'kdr_Array' in rtn_method: rtn_obj[prop] = new_val elif (remove_empty and new_val) or not remove_empty: if len(new_val) == 1: rtn_obj[prop] = new_val[0] else: rtn_obj[prop] = new_val nested_props = None else: try: nested_props = self.es_defs.get('kds_esNestedProps', list(self.keys())).copy() except AttributeError: nested_props = list(self.keys()) for prop, value in self.items(): # if prop == 'bf_hasInstance': # pdb.set_trace() if prop in ['kds_esIndexTime', 'kds_esIndexError']: continue new_val = value.es_json(**kwargs) rtn_method = get_attr(self[prop], 'kds_esObjectType', []) if 'kdr_Array' in rtn_method: rtn_obj[prop] = new_val elif (remove_empty and new_val) or not remove_empty: if len(new_val) == 1: rtn_obj[prop] = new_val[0] \ if not isinstance(new_val, dict) \ else new_val else: rtn_obj[prop] = new_val # if 'bf_Work' in self.hierarchy: # pdb.set_trace() rtn_obj = get_es_label(rtn_obj, self) rtn_obj = get_es_value(rtn_obj, self) rtn_obj = get_es_ids(rtn_obj, self) if nested_props: nested_props += ['value', 'id', 'uri'] rtn_obj = {key: value for key, value in rtn_obj.items() if key in nested_props} # rml_procs = self.es_defs.get("kds_esRmlProcessor", []) # # if role == 'rdf_class': # # pdb.set_trace() # rml_procs = [proc for proc in rml_procs # if role == 'rdf_class' or # proc['force']] # if rml_procs: # rml_maps = {} # for rml in rml_procs: # proc_kwargs = {rml['subj']: self.subject, # "dataset": self.dataset} # proc_kwargs.update(rml['proc_kwargs']) # rml_maps[rml['name']] = rml['processor'](**proc_kwargs) # if rml_maps: # rtn_obj['rml_map'] = rml_maps rml_maps = self.get_all_rml(role=role) if rml_maps: rtn_obj['rml_map'] = rml_maps # if self.get('bf_contribution'): # pdb.set_trace() return rtn_obj
[ "def", "es_json", "(", "self", ",", "role", "=", "'rdf_class'", ",", "remove_empty", "=", "True", ",", "*", "*", "kwargs", ")", ":", "def", "test_idx_status", "(", "cls_inst", ",", "*", "*", "kwargs", ")", ":", "\"\"\"\n Return True if the class has already been indexed in elastisearch\n\n Args:\n -----\n cls_inst: the rdfclass instance\n\n Kwargs:\n -------\n force[boolean]: True will return false to force a reindex of the\n class\n \"\"\"", "if", "kwargs", ".", "get", "(", "\"force\"", ")", "==", "True", ":", "return", "False", "idx_time", "=", "cls_inst", ".", "get", "(", "\"kds_esIndexTime\"", ",", "[", "None", "]", ")", "[", "0", "]", "mod_time", "=", "cls_inst", ".", "get", "(", "\"dcterm_modified\"", ",", "[", "None", "]", ")", "[", "0", "]", "error_msg", "=", "cls_inst", ".", "get", "(", "\"kds_esIndexError\"", ",", "[", "None", "]", ")", "[", "0", "]", "if", "(", "not", "idx_time", ")", "or", "error_msg", "or", "(", "idx_time", "and", "mod_time", "and", "idx_time", "<", "mod_time", ")", ":", "return", "False", "return", "True", "# if self.__class__.__name__ == 'rdf_type':", "# pdb.set_trace()", "rtn_obj", "=", "{", "}", "if", "kwargs", ".", "get", "(", "\"depth\"", ")", ":", "kwargs", "[", "'depth'", "]", "+=", "1", "else", ":", "kwargs", "[", "'depth'", "]", "=", "1", "if", "role", "==", "'rdf_class'", ":", "if", "test_idx_status", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "None", "for", "prop", ",", "value", "in", "self", ".", "items", "(", ")", ":", "if", "prop", "in", "[", "'kds_esIndexTime'", ",", "'kds_esIndexError'", "]", ":", "continue", "new_val", "=", "value", ".", "es_json", "(", ")", "rtn_method", "=", "get_attr", "(", "self", "[", "prop", "]", ",", "'kds_esObjectType'", ",", "[", "]", ")", "if", "'kdr_Array'", "in", "rtn_method", ":", "rtn_obj", "[", "prop", "]", "=", "new_val", "elif", "(", "remove_empty", "and", "new_val", ")", "or", "not", "remove_empty", ":", "if", "len", "(", "new_val", ")", "==", "1", ":", "rtn_obj", "[", "prop", "]", "=", "new_val", "[", "0", "]", "else", ":", "rtn_obj", "[", "prop", "]", "=", "new_val", "nested_props", "=", "None", "else", ":", "try", ":", "nested_props", "=", "self", ".", "es_defs", ".", "get", "(", "'kds_esNestedProps'", ",", "list", "(", "self", ".", "keys", "(", ")", ")", ")", ".", "copy", "(", ")", "except", "AttributeError", ":", "nested_props", "=", "list", "(", "self", ".", "keys", "(", ")", ")", "for", "prop", ",", "value", "in", "self", ".", "items", "(", ")", ":", "# if prop == 'bf_hasInstance':", "# pdb.set_trace()", "if", "prop", "in", "[", "'kds_esIndexTime'", ",", "'kds_esIndexError'", "]", ":", "continue", "new_val", "=", "value", ".", "es_json", "(", "*", "*", "kwargs", ")", "rtn_method", "=", "get_attr", "(", "self", "[", "prop", "]", ",", "'kds_esObjectType'", ",", "[", "]", ")", "if", "'kdr_Array'", "in", "rtn_method", ":", "rtn_obj", "[", "prop", "]", "=", "new_val", "elif", "(", "remove_empty", "and", "new_val", ")", "or", "not", "remove_empty", ":", "if", "len", "(", "new_val", ")", "==", "1", ":", "rtn_obj", "[", "prop", "]", "=", "new_val", "[", "0", "]", "if", "not", "isinstance", "(", "new_val", ",", "dict", ")", "else", "new_val", "else", ":", "rtn_obj", "[", "prop", "]", "=", "new_val", "# if 'bf_Work' in self.hierarchy:", "# pdb.set_trace()", "rtn_obj", "=", "get_es_label", "(", "rtn_obj", ",", "self", ")", "rtn_obj", "=", "get_es_value", "(", "rtn_obj", ",", "self", ")", "rtn_obj", "=", "get_es_ids", "(", "rtn_obj", ",", "self", ")", "if", "nested_props", ":", "nested_props", "+=", "[", "'value'", ",", "'id'", ",", "'uri'", "]", "rtn_obj", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "rtn_obj", ".", "items", "(", ")", "if", "key", "in", "nested_props", "}", "# rml_procs = self.es_defs.get(\"kds_esRmlProcessor\", [])", "# # if role == 'rdf_class':", "# # pdb.set_trace()", "# rml_procs = [proc for proc in rml_procs", "# if role == 'rdf_class' or", "# proc['force']]", "# if rml_procs:", "# rml_maps = {}", "# for rml in rml_procs:", "# proc_kwargs = {rml['subj']: self.subject,", "# \"dataset\": self.dataset}", "# proc_kwargs.update(rml['proc_kwargs'])", "# rml_maps[rml['name']] = rml['processor'](**proc_kwargs)", "# if rml_maps:", "# rtn_obj['rml_map'] = rml_maps", "rml_maps", "=", "self", ".", "get_all_rml", "(", "role", "=", "role", ")", "if", "rml_maps", ":", "rtn_obj", "[", "'rml_map'", "]", "=", "rml_maps", "# if self.get('bf_contribution'):", "# pdb.set_trace()", "return", "rtn_obj" ]
Returns a JSON object of the class for insertion into es args: role: the role states how the class data should be returned depending upon whether it is used as a subject of an object. options are kds_esNested or rdf_class remove_empty: True removes empty items from es object
[ "Returns", "a", "JSON", "object", "of", "the", "class", "for", "insertion", "into", "es" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfclass.py#L479-L588
247,507
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfclass.py
RdfClassBase.get_rml
def get_rml(self, rml_def, **kwargs): """ returns the rml mapping output for specified mapping Args: ----- rml_def: The name of the mapping or a dictionary definition """ if isinstance(rml_def, str): rml_procs = self.es_defs.get("kds_esRmlProcessor", []) for item in rml_procs: if item['name'] == rml_def: rml_def = item break proc_kwargs = {rml_def['subj']: self.subject, "dataset": self.dataset} proc_kwargs.update(rml_def['proc_kwargs']) return rml_def['processor'](**proc_kwargs)
python
def get_rml(self, rml_def, **kwargs): """ returns the rml mapping output for specified mapping Args: ----- rml_def: The name of the mapping or a dictionary definition """ if isinstance(rml_def, str): rml_procs = self.es_defs.get("kds_esRmlProcessor", []) for item in rml_procs: if item['name'] == rml_def: rml_def = item break proc_kwargs = {rml_def['subj']: self.subject, "dataset": self.dataset} proc_kwargs.update(rml_def['proc_kwargs']) return rml_def['processor'](**proc_kwargs)
[ "def", "get_rml", "(", "self", ",", "rml_def", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "rml_def", ",", "str", ")", ":", "rml_procs", "=", "self", ".", "es_defs", ".", "get", "(", "\"kds_esRmlProcessor\"", ",", "[", "]", ")", "for", "item", "in", "rml_procs", ":", "if", "item", "[", "'name'", "]", "==", "rml_def", ":", "rml_def", "=", "item", "break", "proc_kwargs", "=", "{", "rml_def", "[", "'subj'", "]", ":", "self", ".", "subject", ",", "\"dataset\"", ":", "self", ".", "dataset", "}", "proc_kwargs", ".", "update", "(", "rml_def", "[", "'proc_kwargs'", "]", ")", "return", "rml_def", "[", "'processor'", "]", "(", "*", "*", "proc_kwargs", ")" ]
returns the rml mapping output for specified mapping Args: ----- rml_def: The name of the mapping or a dictionary definition
[ "returns", "the", "rml", "mapping", "output", "for", "specified", "mapping" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfclass.py#L590-L607
247,508
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfclass.py
RdfClassBase.get_all_rml
def get_all_rml(self, **kwargs): """ Returns a dictionary with the output of all the rml procceor results """ rml_procs = self.es_defs.get("kds_esRmlProcessor", []) role = kwargs.get('role') if role: rml_procs = [proc for proc in rml_procs if role == 'rdf_class' or proc['force']] rml_maps = {} for rml in rml_procs: rml_maps[rml['name']] = self.get_rml(rml, **kwargs) return rml_maps
python
def get_all_rml(self, **kwargs): """ Returns a dictionary with the output of all the rml procceor results """ rml_procs = self.es_defs.get("kds_esRmlProcessor", []) role = kwargs.get('role') if role: rml_procs = [proc for proc in rml_procs if role == 'rdf_class' or proc['force']] rml_maps = {} for rml in rml_procs: rml_maps[rml['name']] = self.get_rml(rml, **kwargs) return rml_maps
[ "def", "get_all_rml", "(", "self", ",", "*", "*", "kwargs", ")", ":", "rml_procs", "=", "self", ".", "es_defs", ".", "get", "(", "\"kds_esRmlProcessor\"", ",", "[", "]", ")", "role", "=", "kwargs", ".", "get", "(", "'role'", ")", "if", "role", ":", "rml_procs", "=", "[", "proc", "for", "proc", "in", "rml_procs", "if", "role", "==", "'rdf_class'", "or", "proc", "[", "'force'", "]", "]", "rml_maps", "=", "{", "}", "for", "rml", "in", "rml_procs", ":", "rml_maps", "[", "rml", "[", "'name'", "]", "]", "=", "self", ".", "get_rml", "(", "rml", ",", "*", "*", "kwargs", ")", "return", "rml_maps" ]
Returns a dictionary with the output of all the rml procceor results
[ "Returns", "a", "dictionary", "with", "the", "output", "of", "all", "the", "rml", "procceor", "results" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfclass.py#L609-L622
247,509
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfclass.py
RdfClassBase._set_subject
def _set_subject(self, subject): """ sets the subject value for the class instance Args: subject(dict, Uri, str): the subject for the class instance """ # if not subject: # self.subject = def test_uri(value): """ test to see if the value is a uri or bnode Returns: Uri or Bnode """ # .__wrapped__ if not isinstance(value, (Uri, BlankNode)): try: if value.startswith("_:"): return BlankNode(value) else: return Uri(value) except: return BlankNode() else: return value if isinstance(subject, dict): self.subject = test_uri(subject['s']) if isinstance(subject['o'], list): for item in subject['o']: self.add_property(subject['p'], item) else: self.add_property(subject['p'], subject['o']) else: self.subject = test_uri(subject)
python
def _set_subject(self, subject): """ sets the subject value for the class instance Args: subject(dict, Uri, str): the subject for the class instance """ # if not subject: # self.subject = def test_uri(value): """ test to see if the value is a uri or bnode Returns: Uri or Bnode """ # .__wrapped__ if not isinstance(value, (Uri, BlankNode)): try: if value.startswith("_:"): return BlankNode(value) else: return Uri(value) except: return BlankNode() else: return value if isinstance(subject, dict): self.subject = test_uri(subject['s']) if isinstance(subject['o'], list): for item in subject['o']: self.add_property(subject['p'], item) else: self.add_property(subject['p'], subject['o']) else: self.subject = test_uri(subject)
[ "def", "_set_subject", "(", "self", ",", "subject", ")", ":", "# if not subject:", "# self.subject =", "def", "test_uri", "(", "value", ")", ":", "\"\"\" test to see if the value is a uri or bnode\n\n Returns: Uri or Bnode \"\"\"", "# .__wrapped__", "if", "not", "isinstance", "(", "value", ",", "(", "Uri", ",", "BlankNode", ")", ")", ":", "try", ":", "if", "value", ".", "startswith", "(", "\"_:\"", ")", ":", "return", "BlankNode", "(", "value", ")", "else", ":", "return", "Uri", "(", "value", ")", "except", ":", "return", "BlankNode", "(", ")", "else", ":", "return", "value", "if", "isinstance", "(", "subject", ",", "dict", ")", ":", "self", ".", "subject", "=", "test_uri", "(", "subject", "[", "'s'", "]", ")", "if", "isinstance", "(", "subject", "[", "'o'", "]", ",", "list", ")", ":", "for", "item", "in", "subject", "[", "'o'", "]", ":", "self", ".", "add_property", "(", "subject", "[", "'p'", "]", ",", "item", ")", "else", ":", "self", ".", "add_property", "(", "subject", "[", "'p'", "]", ",", "subject", "[", "'o'", "]", ")", "else", ":", "self", ".", "subject", "=", "test_uri", "(", "subject", ")" ]
sets the subject value for the class instance Args: subject(dict, Uri, str): the subject for the class instance
[ "sets", "the", "subject", "value", "for", "the", "class", "instance" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfclass.py#L624-L658
247,510
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfclass.py
RdfClassBase._initilize_props
def _initilize_props(self): """ Adds an intialized property to the class dictionary """ # if self.subject == "pyuri_aHR0cDovL3R1dHQuZWR1Lw==_": # pdb.set_trace() try: # pdb.set_trace() for prop in self.es_props: self[prop] = self.properties[prop](self, self.dataset) setattr(self, prop, self[prop]) self[__a__] = self.properties[__a__](self, self.dataset) setattr(self, __a__, self[__a__]) # for prop, prop_class in self.properties.items(): # # passing in the current dataset tie # self[prop] = prop_class(self, self.dataset) # setattr(self, prop, self[prop]) # bases = remove_parents((self.__class__,) + # self.__class__.__bases__) # for base in bases: # if base.__name__ not in IGNORE_CLASSES: # base_name = Uri(base.__name__) # try: # self['rdf_type'].append(base_name) # except KeyError: # self[Uri('rdf_type')] = MODULE.rdfclass.make_property({}, # 'rdf_type', # self.__class__.__name__)(self, self.dataset) # self['rdf_type'].append(base_name) except (AttributeError, TypeError): pass
python
def _initilize_props(self): """ Adds an intialized property to the class dictionary """ # if self.subject == "pyuri_aHR0cDovL3R1dHQuZWR1Lw==_": # pdb.set_trace() try: # pdb.set_trace() for prop in self.es_props: self[prop] = self.properties[prop](self, self.dataset) setattr(self, prop, self[prop]) self[__a__] = self.properties[__a__](self, self.dataset) setattr(self, __a__, self[__a__]) # for prop, prop_class in self.properties.items(): # # passing in the current dataset tie # self[prop] = prop_class(self, self.dataset) # setattr(self, prop, self[prop]) # bases = remove_parents((self.__class__,) + # self.__class__.__bases__) # for base in bases: # if base.__name__ not in IGNORE_CLASSES: # base_name = Uri(base.__name__) # try: # self['rdf_type'].append(base_name) # except KeyError: # self[Uri('rdf_type')] = MODULE.rdfclass.make_property({}, # 'rdf_type', # self.__class__.__name__)(self, self.dataset) # self['rdf_type'].append(base_name) except (AttributeError, TypeError): pass
[ "def", "_initilize_props", "(", "self", ")", ":", "# if self.subject == \"pyuri_aHR0cDovL3R1dHQuZWR1Lw==_\":", "# pdb.set_trace()", "try", ":", "# pdb.set_trace()", "for", "prop", "in", "self", ".", "es_props", ":", "self", "[", "prop", "]", "=", "self", ".", "properties", "[", "prop", "]", "(", "self", ",", "self", ".", "dataset", ")", "setattr", "(", "self", ",", "prop", ",", "self", "[", "prop", "]", ")", "self", "[", "__a__", "]", "=", "self", ".", "properties", "[", "__a__", "]", "(", "self", ",", "self", ".", "dataset", ")", "setattr", "(", "self", ",", "__a__", ",", "self", "[", "__a__", "]", ")", "# for prop, prop_class in self.properties.items():", "# # passing in the current dataset tie", "# self[prop] = prop_class(self, self.dataset)", "# setattr(self, prop, self[prop])", "# bases = remove_parents((self.__class__,) +", "# self.__class__.__bases__)", "# for base in bases:", "# if base.__name__ not in IGNORE_CLASSES:", "# base_name = Uri(base.__name__)", "# try:", "# self['rdf_type'].append(base_name)", "# except KeyError:", "# self[Uri('rdf_type')] = MODULE.rdfclass.make_property({},", "# 'rdf_type',", "# self.__class__.__name__)(self, self.dataset)", "# self['rdf_type'].append(base_name)", "except", "(", "AttributeError", ",", "TypeError", ")", ":", "pass" ]
Adds an intialized property to the class dictionary
[ "Adds", "an", "intialized", "property", "to", "the", "class", "dictionary" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfclass.py#L660-L689
247,511
devricks/soft_drf
soft_drf/api/viewsets/__init__.py
GenericViewSet.get_serializer_class
def get_serializer_class(self, action=None): """ Return the serializer class depending on request method. Attribute of proper serializer should be defined. """ if action is not None: return getattr(self, '%s_serializer_class' % action) else: return super(GenericViewSet, self).get_serializer_class()
python
def get_serializer_class(self, action=None): """ Return the serializer class depending on request method. Attribute of proper serializer should be defined. """ if action is not None: return getattr(self, '%s_serializer_class' % action) else: return super(GenericViewSet, self).get_serializer_class()
[ "def", "get_serializer_class", "(", "self", ",", "action", "=", "None", ")", ":", "if", "action", "is", "not", "None", ":", "return", "getattr", "(", "self", ",", "'%s_serializer_class'", "%", "action", ")", "else", ":", "return", "super", "(", "GenericViewSet", ",", "self", ")", ".", "get_serializer_class", "(", ")" ]
Return the serializer class depending on request method. Attribute of proper serializer should be defined.
[ "Return", "the", "serializer", "class", "depending", "on", "request", "method", ".", "Attribute", "of", "proper", "serializer", "should", "be", "defined", "." ]
1869b13f9341bfcebd931059e93de2bc38570da3
https://github.com/devricks/soft_drf/blob/1869b13f9341bfcebd931059e93de2bc38570da3/soft_drf/api/viewsets/__init__.py#L11-L19
247,512
devricks/soft_drf
soft_drf/api/viewsets/__init__.py
GenericViewSet.get_serializer
def get_serializer(self, *args, **kwargs): """ Returns the serializer instance that should be used to the given action. If any action was given, returns the serializer_class """ action = kwargs.pop('action', None) serializer_class = self.get_serializer_class(action) kwargs['context'] = self.get_serializer_context() return serializer_class(*args, **kwargs)
python
def get_serializer(self, *args, **kwargs): """ Returns the serializer instance that should be used to the given action. If any action was given, returns the serializer_class """ action = kwargs.pop('action', None) serializer_class = self.get_serializer_class(action) kwargs['context'] = self.get_serializer_context() return serializer_class(*args, **kwargs)
[ "def", "get_serializer", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "action", "=", "kwargs", ".", "pop", "(", "'action'", ",", "None", ")", "serializer_class", "=", "self", ".", "get_serializer_class", "(", "action", ")", "kwargs", "[", "'context'", "]", "=", "self", ".", "get_serializer_context", "(", ")", "return", "serializer_class", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
Returns the serializer instance that should be used to the given action. If any action was given, returns the serializer_class
[ "Returns", "the", "serializer", "instance", "that", "should", "be", "used", "to", "the", "given", "action", ".", "If", "any", "action", "was", "given", "returns", "the", "serializer_class" ]
1869b13f9341bfcebd931059e93de2bc38570da3
https://github.com/devricks/soft_drf/blob/1869b13f9341bfcebd931059e93de2bc38570da3/soft_drf/api/viewsets/__init__.py#L21-L32
247,513
treycucco/bidon
bidon/experimental/transfer_tracker.py
TransferTracker.open
def open(self, autocommit=False): """Call-through to data_access.open.""" self.data_access.open(autocommit=autocommit) return self
python
def open(self, autocommit=False): """Call-through to data_access.open.""" self.data_access.open(autocommit=autocommit) return self
[ "def", "open", "(", "self", ",", "autocommit", "=", "False", ")", ":", "self", ".", "data_access", ".", "open", "(", "autocommit", "=", "autocommit", ")", "return", "self" ]
Call-through to data_access.open.
[ "Call", "-", "through", "to", "data_access", ".", "open", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/experimental/transfer_tracker.py#L34-L37
247,514
treycucco/bidon
bidon/experimental/transfer_tracker.py
TransferTracker.close
def close(self, commit=True): """Call-through to data_access.close.""" self.data_access.close(commit=commit) return self
python
def close(self, commit=True): """Call-through to data_access.close.""" self.data_access.close(commit=commit) return self
[ "def", "close", "(", "self", ",", "commit", "=", "True", ")", ":", "self", ".", "data_access", ".", "close", "(", "commit", "=", "commit", ")", "return", "self" ]
Call-through to data_access.close.
[ "Call", "-", "through", "to", "data_access", ".", "close", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/experimental/transfer_tracker.py#L39-L42
247,515
treycucco/bidon
bidon/experimental/transfer_tracker.py
TransferTracker.reset
def reset(self, relation_name=None): """Reset the transfer info for a particular relation, or if none is given, for all relations. """ if relation_name is not None: self.data_access.delete("relations", dict(name=relation_name)) else: self.data_access.delete("relations", "1=1") return self
python
def reset(self, relation_name=None): """Reset the transfer info for a particular relation, or if none is given, for all relations. """ if relation_name is not None: self.data_access.delete("relations", dict(name=relation_name)) else: self.data_access.delete("relations", "1=1") return self
[ "def", "reset", "(", "self", ",", "relation_name", "=", "None", ")", ":", "if", "relation_name", "is", "not", "None", ":", "self", ".", "data_access", ".", "delete", "(", "\"relations\"", ",", "dict", "(", "name", "=", "relation_name", ")", ")", "else", ":", "self", ".", "data_access", ".", "delete", "(", "\"relations\"", ",", "\"1=1\"", ")", "return", "self" ]
Reset the transfer info for a particular relation, or if none is given, for all relations.
[ "Reset", "the", "transfer", "info", "for", "a", "particular", "relation", "or", "if", "none", "is", "given", "for", "all", "relations", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/experimental/transfer_tracker.py#L89-L96
247,516
treycucco/bidon
bidon/experimental/transfer_tracker.py
TransferTracker.start_transfer
def start_transfer(self, relation_name): """Write records to the data source indicating that a transfer has been started for a particular relation. """ self.reset(relation_name) relation = Relation(name=relation_name) self.data_access.insert_model(relation) return relation
python
def start_transfer(self, relation_name): """Write records to the data source indicating that a transfer has been started for a particular relation. """ self.reset(relation_name) relation = Relation(name=relation_name) self.data_access.insert_model(relation) return relation
[ "def", "start_transfer", "(", "self", ",", "relation_name", ")", ":", "self", ".", "reset", "(", "relation_name", ")", "relation", "=", "Relation", "(", "name", "=", "relation_name", ")", "self", ".", "data_access", ".", "insert_model", "(", "relation", ")", "return", "relation" ]
Write records to the data source indicating that a transfer has been started for a particular relation.
[ "Write", "records", "to", "the", "data", "source", "indicating", "that", "a", "transfer", "has", "been", "started", "for", "a", "particular", "relation", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/experimental/transfer_tracker.py#L98-L105
247,517
treycucco/bidon
bidon/experimental/transfer_tracker.py
TransferTracker.register_transfer
def register_transfer(self, relation, old_id, new_id): """Register the old and new ids for a particular record in a relation.""" transfer = Transfer(relation_id=relation.id, old_id=old_id, new_id=new_id) self.data_access.insert_model(transfer) return transfer
python
def register_transfer(self, relation, old_id, new_id): """Register the old and new ids for a particular record in a relation.""" transfer = Transfer(relation_id=relation.id, old_id=old_id, new_id=new_id) self.data_access.insert_model(transfer) return transfer
[ "def", "register_transfer", "(", "self", ",", "relation", ",", "old_id", ",", "new_id", ")", ":", "transfer", "=", "Transfer", "(", "relation_id", "=", "relation", ".", "id", ",", "old_id", "=", "old_id", ",", "new_id", "=", "new_id", ")", "self", ".", "data_access", ".", "insert_model", "(", "transfer", ")", "return", "transfer" ]
Register the old and new ids for a particular record in a relation.
[ "Register", "the", "old", "and", "new", "ids", "for", "a", "particular", "record", "in", "a", "relation", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/experimental/transfer_tracker.py#L107-L111
247,518
treycucco/bidon
bidon/experimental/transfer_tracker.py
TransferTracker.complete_transfer
def complete_transfer(self, relation, cleanup=True): """Write records to the data source indicating that a transfer has been completed for a particular relation. """ relation.completed_at = utc_now().isoformat() self.data_access.update_model(relation) if cleanup: self.cleanup() return relation
python
def complete_transfer(self, relation, cleanup=True): """Write records to the data source indicating that a transfer has been completed for a particular relation. """ relation.completed_at = utc_now().isoformat() self.data_access.update_model(relation) if cleanup: self.cleanup() return relation
[ "def", "complete_transfer", "(", "self", ",", "relation", ",", "cleanup", "=", "True", ")", ":", "relation", ".", "completed_at", "=", "utc_now", "(", ")", ".", "isoformat", "(", ")", "self", ".", "data_access", ".", "update_model", "(", "relation", ")", "if", "cleanup", ":", "self", ".", "cleanup", "(", ")", "return", "relation" ]
Write records to the data source indicating that a transfer has been completed for a particular relation.
[ "Write", "records", "to", "the", "data", "source", "indicating", "that", "a", "transfer", "has", "been", "completed", "for", "a", "particular", "relation", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/experimental/transfer_tracker.py#L113-L121
247,519
treycucco/bidon
bidon/experimental/transfer_tracker.py
TransferTracker.is_transfer_complete
def is_transfer_complete(self, relation_name): """Checks to see if a tansfer has been completed.""" phold = self.data_access.sql_writer.to_placeholder() return self.data_access.find_model( Relation, ("name = {0} and completed_at is not null".format(phold), [relation_name])) is not None
python
def is_transfer_complete(self, relation_name): """Checks to see if a tansfer has been completed.""" phold = self.data_access.sql_writer.to_placeholder() return self.data_access.find_model( Relation, ("name = {0} and completed_at is not null".format(phold), [relation_name])) is not None
[ "def", "is_transfer_complete", "(", "self", ",", "relation_name", ")", ":", "phold", "=", "self", ".", "data_access", ".", "sql_writer", ".", "to_placeholder", "(", ")", "return", "self", ".", "data_access", ".", "find_model", "(", "Relation", ",", "(", "\"name = {0} and completed_at is not null\"", ".", "format", "(", "phold", ")", ",", "[", "relation_name", "]", ")", ")", "is", "not", "None" ]
Checks to see if a tansfer has been completed.
[ "Checks", "to", "see", "if", "a", "tansfer", "has", "been", "completed", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/experimental/transfer_tracker.py#L123-L128
247,520
treycucco/bidon
bidon/experimental/transfer_tracker.py
TransferTracker.get_new_id
def get_new_id(self, relation_name, old_id, strict=False): """Given a relation name and its old ID, get the new ID for a relation. If strict is true, an error is thrown if no record is found for the relation and old ID. """ record = self.data_access.find( "relations as r inner join transfers as t on r.id = t.relation_id", (("r.name", relation_name), ("t.old_id", old_id)), columns="new_id") if record: return record[0] else: if strict: raise KeyError("{0} with id {1} not found".format(relation_name, old_id))
python
def get_new_id(self, relation_name, old_id, strict=False): """Given a relation name and its old ID, get the new ID for a relation. If strict is true, an error is thrown if no record is found for the relation and old ID. """ record = self.data_access.find( "relations as r inner join transfers as t on r.id = t.relation_id", (("r.name", relation_name), ("t.old_id", old_id)), columns="new_id") if record: return record[0] else: if strict: raise KeyError("{0} with id {1} not found".format(relation_name, old_id))
[ "def", "get_new_id", "(", "self", ",", "relation_name", ",", "old_id", ",", "strict", "=", "False", ")", ":", "record", "=", "self", ".", "data_access", ".", "find", "(", "\"relations as r inner join transfers as t on r.id = t.relation_id\"", ",", "(", "(", "\"r.name\"", ",", "relation_name", ")", ",", "(", "\"t.old_id\"", ",", "old_id", ")", ")", ",", "columns", "=", "\"new_id\"", ")", "if", "record", ":", "return", "record", "[", "0", "]", "else", ":", "if", "strict", ":", "raise", "KeyError", "(", "\"{0} with id {1} not found\"", ".", "format", "(", "relation_name", ",", "old_id", ")", ")" ]
Given a relation name and its old ID, get the new ID for a relation. If strict is true, an error is thrown if no record is found for the relation and old ID.
[ "Given", "a", "relation", "name", "and", "its", "old", "ID", "get", "the", "new", "ID", "for", "a", "relation", ".", "If", "strict", "is", "true", "an", "error", "is", "thrown", "if", "no", "record", "is", "found", "for", "the", "relation", "and", "old", "ID", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/experimental/transfer_tracker.py#L130-L142
247,521
treycucco/bidon
bidon/experimental/transfer_tracker.py
TransferTracker.id_getter
def id_getter(self, relation_name, strict=False): """Returns a function that accepts an old_id and returns the new ID for the enclosed relation name.""" def get_id(old_id): """Get the new ID for the enclosed relation, given an old ID.""" return self.get_new_id(relation_name, old_id, strict) return get_id
python
def id_getter(self, relation_name, strict=False): """Returns a function that accepts an old_id and returns the new ID for the enclosed relation name.""" def get_id(old_id): """Get the new ID for the enclosed relation, given an old ID.""" return self.get_new_id(relation_name, old_id, strict) return get_id
[ "def", "id_getter", "(", "self", ",", "relation_name", ",", "strict", "=", "False", ")", ":", "def", "get_id", "(", "old_id", ")", ":", "\"\"\"Get the new ID for the enclosed relation, given an old ID.\"\"\"", "return", "self", ".", "get_new_id", "(", "relation_name", ",", "old_id", ",", "strict", ")", "return", "get_id" ]
Returns a function that accepts an old_id and returns the new ID for the enclosed relation name.
[ "Returns", "a", "function", "that", "accepts", "an", "old_id", "and", "returns", "the", "new", "ID", "for", "the", "enclosed", "relation", "name", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/experimental/transfer_tracker.py#L144-L150
247,522
henrysher/kotocore
kotocore/collections.py
CollectionDetails.requires_loaded
def requires_loaded(func): """ A decorator to ensure the resource data is loaded. """ def _wrapper(self, *args, **kwargs): # If we don't have data, go load it. if self._loaded_data is None: self._loaded_data = self.loader.load(self.service_name) return func(self, *args, **kwargs) return _wrapper
python
def requires_loaded(func): """ A decorator to ensure the resource data is loaded. """ def _wrapper(self, *args, **kwargs): # If we don't have data, go load it. if self._loaded_data is None: self._loaded_data = self.loader.load(self.service_name) return func(self, *args, **kwargs) return _wrapper
[ "def", "requires_loaded", "(", "func", ")", ":", "def", "_wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# If we don't have data, go load it.", "if", "self", ".", "_loaded_data", "is", "None", ":", "self", ".", "_loaded_data", "=", "self", ".", "loader", ".", "load", "(", "self", ".", "service_name", ")", "return", "func", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "return", "_wrapper" ]
A decorator to ensure the resource data is loaded.
[ "A", "decorator", "to", "ensure", "the", "resource", "data", "is", "loaded", "." ]
c52d2f3878b924ceabca07f61c91abcb1b230ecc
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/collections.py#L56-L67
247,523
henrysher/kotocore
kotocore/collections.py
Collection.full_update_params
def full_update_params(self, conn_method_name, params): """ When a API method on the collection is called, this goes through the params & run a series of hooks to allow for updating those parameters. Typically, this method is **NOT** call by the user. However, the user may wish to define other methods (i.e. ``update_params`` to work with multiple parameters at once or ``update_params_METHOD_NAME`` to manipulate a single parameter) on their class, which this method will call. :param conn_method_name: The name of the underlying connection method about to be called. Typically, this is a "snake_cased" variant of the API name (i.e. ``update_bucket`` in place of ``UpdateBucket``). :type conn_method_name: string :param params: A dictionary of all the key/value pairs passed to the method. This dictionary is transformed by this call into the final params to be passed to the underlying connection. :type params: dict """ # We'll check for custom methods to do addition, specific work. custom_method_name = 'update_params_{0}'.format(conn_method_name) custom_method = getattr(self, custom_method_name, None) if custom_method: # Let the specific method further process the data. params = custom_method(params) # Now that all the method-specific data is there, apply any further # service-wide changes here. params = self.update_params(conn_method_name, params) return params
python
def full_update_params(self, conn_method_name, params): """ When a API method on the collection is called, this goes through the params & run a series of hooks to allow for updating those parameters. Typically, this method is **NOT** call by the user. However, the user may wish to define other methods (i.e. ``update_params`` to work with multiple parameters at once or ``update_params_METHOD_NAME`` to manipulate a single parameter) on their class, which this method will call. :param conn_method_name: The name of the underlying connection method about to be called. Typically, this is a "snake_cased" variant of the API name (i.e. ``update_bucket`` in place of ``UpdateBucket``). :type conn_method_name: string :param params: A dictionary of all the key/value pairs passed to the method. This dictionary is transformed by this call into the final params to be passed to the underlying connection. :type params: dict """ # We'll check for custom methods to do addition, specific work. custom_method_name = 'update_params_{0}'.format(conn_method_name) custom_method = getattr(self, custom_method_name, None) if custom_method: # Let the specific method further process the data. params = custom_method(params) # Now that all the method-specific data is there, apply any further # service-wide changes here. params = self.update_params(conn_method_name, params) return params
[ "def", "full_update_params", "(", "self", ",", "conn_method_name", ",", "params", ")", ":", "# We'll check for custom methods to do addition, specific work.", "custom_method_name", "=", "'update_params_{0}'", ".", "format", "(", "conn_method_name", ")", "custom_method", "=", "getattr", "(", "self", ",", "custom_method_name", ",", "None", ")", "if", "custom_method", ":", "# Let the specific method further process the data.", "params", "=", "custom_method", "(", "params", ")", "# Now that all the method-specific data is there, apply any further", "# service-wide changes here.", "params", "=", "self", ".", "update_params", "(", "conn_method_name", ",", "params", ")", "return", "params" ]
When a API method on the collection is called, this goes through the params & run a series of hooks to allow for updating those parameters. Typically, this method is **NOT** call by the user. However, the user may wish to define other methods (i.e. ``update_params`` to work with multiple parameters at once or ``update_params_METHOD_NAME`` to manipulate a single parameter) on their class, which this method will call. :param conn_method_name: The name of the underlying connection method about to be called. Typically, this is a "snake_cased" variant of the API name (i.e. ``update_bucket`` in place of ``UpdateBucket``). :type conn_method_name: string :param params: A dictionary of all the key/value pairs passed to the method. This dictionary is transformed by this call into the final params to be passed to the underlying connection. :type params: dict
[ "When", "a", "API", "method", "on", "the", "collection", "is", "called", "this", "goes", "through", "the", "params", "&", "run", "a", "series", "of", "hooks", "to", "allow", "for", "updating", "those", "parameters", "." ]
c52d2f3878b924ceabca07f61c91abcb1b230ecc
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/collections.py#L312-L344
247,524
henrysher/kotocore
kotocore/collections.py
Collection.full_post_process
def full_post_process(self, conn_method_name, result): """ When a response from an API method call is received, this goes through the returned data & run a series of hooks to allow for handling that data. Typically, this method is **NOT** call by the user. However, the user may wish to define other methods (i.e. ``post_process`` to work with all the data at once or ``post_process_METHOD_NAME`` to handle a single piece of data) on their class, which this method will call. :param conn_method_name: The name of the underlying connection method about to be called. Typically, this is a "snake_cased" variant of the API name (i.e. ``update_bucket`` in place of ``UpdateBucket``). :type conn_method_name: string :param result: A dictionary of all the key/value pairs passed back from the API (server-side). This dictionary is transformed by this call into the final data to be passed back to the user. :type result: dict """ result = self.post_process(conn_method_name, result) # We'll check for custom methods to do addition, specific work. custom_method_name = 'post_process_{0}'.format(conn_method_name) custom_method = getattr(self, custom_method_name, None) if custom_method: # Let the specific method further process the data. result = custom_method(result) return result
python
def full_post_process(self, conn_method_name, result): """ When a response from an API method call is received, this goes through the returned data & run a series of hooks to allow for handling that data. Typically, this method is **NOT** call by the user. However, the user may wish to define other methods (i.e. ``post_process`` to work with all the data at once or ``post_process_METHOD_NAME`` to handle a single piece of data) on their class, which this method will call. :param conn_method_name: The name of the underlying connection method about to be called. Typically, this is a "snake_cased" variant of the API name (i.e. ``update_bucket`` in place of ``UpdateBucket``). :type conn_method_name: string :param result: A dictionary of all the key/value pairs passed back from the API (server-side). This dictionary is transformed by this call into the final data to be passed back to the user. :type result: dict """ result = self.post_process(conn_method_name, result) # We'll check for custom methods to do addition, specific work. custom_method_name = 'post_process_{0}'.format(conn_method_name) custom_method = getattr(self, custom_method_name, None) if custom_method: # Let the specific method further process the data. result = custom_method(result) return result
[ "def", "full_post_process", "(", "self", ",", "conn_method_name", ",", "result", ")", ":", "result", "=", "self", ".", "post_process", "(", "conn_method_name", ",", "result", ")", "# We'll check for custom methods to do addition, specific work.", "custom_method_name", "=", "'post_process_{0}'", ".", "format", "(", "conn_method_name", ")", "custom_method", "=", "getattr", "(", "self", ",", "custom_method_name", ",", "None", ")", "if", "custom_method", ":", "# Let the specific method further process the data.", "result", "=", "custom_method", "(", "result", ")", "return", "result" ]
When a response from an API method call is received, this goes through the returned data & run a series of hooks to allow for handling that data. Typically, this method is **NOT** call by the user. However, the user may wish to define other methods (i.e. ``post_process`` to work with all the data at once or ``post_process_METHOD_NAME`` to handle a single piece of data) on their class, which this method will call. :param conn_method_name: The name of the underlying connection method about to be called. Typically, this is a "snake_cased" variant of the API name (i.e. ``update_bucket`` in place of ``UpdateBucket``). :type conn_method_name: string :param result: A dictionary of all the key/value pairs passed back from the API (server-side). This dictionary is transformed by this call into the final data to be passed back to the user. :type result: dict
[ "When", "a", "response", "from", "an", "API", "method", "call", "is", "received", "this", "goes", "through", "the", "returned", "data", "&", "run", "a", "series", "of", "hooks", "to", "allow", "for", "handling", "that", "data", "." ]
c52d2f3878b924ceabca07f61c91abcb1b230ecc
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/collections.py#L371-L403
247,525
henrysher/kotocore
kotocore/collections.py
CollectionFactory.construct_for
def construct_for(self, service_name, collection_name, base_class=None): """ Builds a new, specialized ``Collection`` subclass as part of a given service. This will load the ``ResourceJSON``, determine the correct mappings/methods & constructs a brand new class with those methods on it. :param service_name: The name of the service to construct a resource for. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string :param collection_name: The name of the ``Collection``. Ex. ``QueueCollection``, ``NotificationCollection``, ``TableCollection``, etc. :type collection_name: string :returns: A new collection class for that service """ details = self.details_class( self.session, service_name, collection_name, loader=self.loader ) attrs = { '_details': details, } # Determine what we should call it. klass_name = self._build_class_name(collection_name) # Construct what the class ought to have on it. attrs.update(self._build_methods(details)) if base_class is None: base_class = self.base_collection_class # Create the class. return type( klass_name, (base_class,), attrs )
python
def construct_for(self, service_name, collection_name, base_class=None): """ Builds a new, specialized ``Collection`` subclass as part of a given service. This will load the ``ResourceJSON``, determine the correct mappings/methods & constructs a brand new class with those methods on it. :param service_name: The name of the service to construct a resource for. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string :param collection_name: The name of the ``Collection``. Ex. ``QueueCollection``, ``NotificationCollection``, ``TableCollection``, etc. :type collection_name: string :returns: A new collection class for that service """ details = self.details_class( self.session, service_name, collection_name, loader=self.loader ) attrs = { '_details': details, } # Determine what we should call it. klass_name = self._build_class_name(collection_name) # Construct what the class ought to have on it. attrs.update(self._build_methods(details)) if base_class is None: base_class = self.base_collection_class # Create the class. return type( klass_name, (base_class,), attrs )
[ "def", "construct_for", "(", "self", ",", "service_name", ",", "collection_name", ",", "base_class", "=", "None", ")", ":", "details", "=", "self", ".", "details_class", "(", "self", ".", "session", ",", "service_name", ",", "collection_name", ",", "loader", "=", "self", ".", "loader", ")", "attrs", "=", "{", "'_details'", ":", "details", ",", "}", "# Determine what we should call it.", "klass_name", "=", "self", ".", "_build_class_name", "(", "collection_name", ")", "# Construct what the class ought to have on it.", "attrs", ".", "update", "(", "self", ".", "_build_methods", "(", "details", ")", ")", "if", "base_class", "is", "None", ":", "base_class", "=", "self", ".", "base_collection_class", "# Create the class.", "return", "type", "(", "klass_name", ",", "(", "base_class", ",", ")", ",", "attrs", ")" ]
Builds a new, specialized ``Collection`` subclass as part of a given service. This will load the ``ResourceJSON``, determine the correct mappings/methods & constructs a brand new class with those methods on it. :param service_name: The name of the service to construct a resource for. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string :param collection_name: The name of the ``Collection``. Ex. ``QueueCollection``, ``NotificationCollection``, ``TableCollection``, etc. :type collection_name: string :returns: A new collection class for that service
[ "Builds", "a", "new", "specialized", "Collection", "subclass", "as", "part", "of", "a", "given", "service", "." ]
c52d2f3878b924ceabca07f61c91abcb1b230ecc
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/collections.py#L549-L594
247,526
svasilev94/GraphLibrary
graphlibrary/first_search.py
BFS
def BFS(G, start): """ Algorithm for breadth-first searching the vertices of a graph. """ if start not in G.vertices: raise GraphInsertError("Vertex %s doesn't exist." % (start,)) color = {} pred = {} dist = {} queue = Queue() queue.put(start) for vertex in G.vertices: color[vertex] = 'white' pred[vertex] = None dist[vertex] = 0 while queue.qsize() > 0: current = queue.get() for neighbor in G.vertices[current]: if color[neighbor] == 'white': color[neighbor] = 'grey' pred[neighbor] = current dist[neighbor] = dist[current] + 1 queue.put(neighbor) color[current] = 'black' return pred
python
def BFS(G, start): """ Algorithm for breadth-first searching the vertices of a graph. """ if start not in G.vertices: raise GraphInsertError("Vertex %s doesn't exist." % (start,)) color = {} pred = {} dist = {} queue = Queue() queue.put(start) for vertex in G.vertices: color[vertex] = 'white' pred[vertex] = None dist[vertex] = 0 while queue.qsize() > 0: current = queue.get() for neighbor in G.vertices[current]: if color[neighbor] == 'white': color[neighbor] = 'grey' pred[neighbor] = current dist[neighbor] = dist[current] + 1 queue.put(neighbor) color[current] = 'black' return pred
[ "def", "BFS", "(", "G", ",", "start", ")", ":", "if", "start", "not", "in", "G", ".", "vertices", ":", "raise", "GraphInsertError", "(", "\"Vertex %s doesn't exist.\"", "%", "(", "start", ",", ")", ")", "color", "=", "{", "}", "pred", "=", "{", "}", "dist", "=", "{", "}", "queue", "=", "Queue", "(", ")", "queue", ".", "put", "(", "start", ")", "for", "vertex", "in", "G", ".", "vertices", ":", "color", "[", "vertex", "]", "=", "'white'", "pred", "[", "vertex", "]", "=", "None", "dist", "[", "vertex", "]", "=", "0", "while", "queue", ".", "qsize", "(", ")", ">", "0", ":", "current", "=", "queue", ".", "get", "(", ")", "for", "neighbor", "in", "G", ".", "vertices", "[", "current", "]", ":", "if", "color", "[", "neighbor", "]", "==", "'white'", ":", "color", "[", "neighbor", "]", "=", "'grey'", "pred", "[", "neighbor", "]", "=", "current", "dist", "[", "neighbor", "]", "=", "dist", "[", "current", "]", "+", "1", "queue", ".", "put", "(", "neighbor", ")", "color", "[", "current", "]", "=", "'black'", "return", "pred" ]
Algorithm for breadth-first searching the vertices of a graph.
[ "Algorithm", "for", "breadth", "-", "first", "searching", "the", "vertices", "of", "a", "graph", "." ]
bf979a80bdea17eeb25955f0c119ca8f711ef62b
https://github.com/svasilev94/GraphLibrary/blob/bf979a80bdea17eeb25955f0c119ca8f711ef62b/graphlibrary/first_search.py#L8-L32
247,527
svasilev94/GraphLibrary
graphlibrary/first_search.py
BFS_Tree
def BFS_Tree(G, start): """ Return an oriented tree constructed from bfs starting at 'start'. """ if start not in G.vertices: raise GraphInsertError("Vertex %s doesn't exist." % (start,)) pred = BFS(G, start) T = digraph.DiGraph() queue = Queue() queue.put(start) while queue.qsize() > 0: current = queue.get() for element in pred: if pred[element] == current: T.add_edge(current, element) queue.put(element) return T
python
def BFS_Tree(G, start): """ Return an oriented tree constructed from bfs starting at 'start'. """ if start not in G.vertices: raise GraphInsertError("Vertex %s doesn't exist." % (start,)) pred = BFS(G, start) T = digraph.DiGraph() queue = Queue() queue.put(start) while queue.qsize() > 0: current = queue.get() for element in pred: if pred[element] == current: T.add_edge(current, element) queue.put(element) return T
[ "def", "BFS_Tree", "(", "G", ",", "start", ")", ":", "if", "start", "not", "in", "G", ".", "vertices", ":", "raise", "GraphInsertError", "(", "\"Vertex %s doesn't exist.\"", "%", "(", "start", ",", ")", ")", "pred", "=", "BFS", "(", "G", ",", "start", ")", "T", "=", "digraph", ".", "DiGraph", "(", ")", "queue", "=", "Queue", "(", ")", "queue", ".", "put", "(", "start", ")", "while", "queue", ".", "qsize", "(", ")", ">", "0", ":", "current", "=", "queue", ".", "get", "(", ")", "for", "element", "in", "pred", ":", "if", "pred", "[", "element", "]", "==", "current", ":", "T", ".", "add_edge", "(", "current", ",", "element", ")", "queue", ".", "put", "(", "element", ")", "return", "T" ]
Return an oriented tree constructed from bfs starting at 'start'.
[ "Return", "an", "oriented", "tree", "constructed", "from", "bfs", "starting", "at", "start", "." ]
bf979a80bdea17eeb25955f0c119ca8f711ef62b
https://github.com/svasilev94/GraphLibrary/blob/bf979a80bdea17eeb25955f0c119ca8f711ef62b/graphlibrary/first_search.py#L35-L51
247,528
svasilev94/GraphLibrary
graphlibrary/first_search.py
DFS
def DFS(G): """ Algorithm for depth-first searching the vertices of a graph. """ if not G.vertices: raise GraphInsertError("This graph have no vertices.") color = {} pred = {} reach = {} finish = {} def DFSvisit(G, current, time): color[current] = 'grey' time += 1 reach[current] = time for vertex in G.vertices[current]: if color[vertex] == 'white': pred[vertex] = current time = DFSvisit(G, vertex, time) color[current] = 'black' time += 1 finish[current] = time return time for vertex in G.vertices: color[vertex] = 'white' pred[vertex] = None reach[vertex] = 0 finish[vertex] = 0 time = 0 for vertex in G.vertices: if color[vertex] == 'white': time = DFSvisit(G, vertex, time) # Dictionary for vertex data after DFS # -> vertex_data = {vertex: (predecessor, reach, finish), } vertex_data = {} for vertex in G.vertices: vertex_data[vertex] = (pred[vertex], reach[vertex], finish[vertex]) return vertex_data
python
def DFS(G): """ Algorithm for depth-first searching the vertices of a graph. """ if not G.vertices: raise GraphInsertError("This graph have no vertices.") color = {} pred = {} reach = {} finish = {} def DFSvisit(G, current, time): color[current] = 'grey' time += 1 reach[current] = time for vertex in G.vertices[current]: if color[vertex] == 'white': pred[vertex] = current time = DFSvisit(G, vertex, time) color[current] = 'black' time += 1 finish[current] = time return time for vertex in G.vertices: color[vertex] = 'white' pred[vertex] = None reach[vertex] = 0 finish[vertex] = 0 time = 0 for vertex in G.vertices: if color[vertex] == 'white': time = DFSvisit(G, vertex, time) # Dictionary for vertex data after DFS # -> vertex_data = {vertex: (predecessor, reach, finish), } vertex_data = {} for vertex in G.vertices: vertex_data[vertex] = (pred[vertex], reach[vertex], finish[vertex]) return vertex_data
[ "def", "DFS", "(", "G", ")", ":", "if", "not", "G", ".", "vertices", ":", "raise", "GraphInsertError", "(", "\"This graph have no vertices.\"", ")", "color", "=", "{", "}", "pred", "=", "{", "}", "reach", "=", "{", "}", "finish", "=", "{", "}", "def", "DFSvisit", "(", "G", ",", "current", ",", "time", ")", ":", "color", "[", "current", "]", "=", "'grey'", "time", "+=", "1", "reach", "[", "current", "]", "=", "time", "for", "vertex", "in", "G", ".", "vertices", "[", "current", "]", ":", "if", "color", "[", "vertex", "]", "==", "'white'", ":", "pred", "[", "vertex", "]", "=", "current", "time", "=", "DFSvisit", "(", "G", ",", "vertex", ",", "time", ")", "color", "[", "current", "]", "=", "'black'", "time", "+=", "1", "finish", "[", "current", "]", "=", "time", "return", "time", "for", "vertex", "in", "G", ".", "vertices", ":", "color", "[", "vertex", "]", "=", "'white'", "pred", "[", "vertex", "]", "=", "None", "reach", "[", "vertex", "]", "=", "0", "finish", "[", "vertex", "]", "=", "0", "time", "=", "0", "for", "vertex", "in", "G", ".", "vertices", ":", "if", "color", "[", "vertex", "]", "==", "'white'", ":", "time", "=", "DFSvisit", "(", "G", ",", "vertex", ",", "time", ")", "# Dictionary for vertex data after DFS\r", "# -> vertex_data = {vertex: (predecessor, reach, finish), }\r", "vertex_data", "=", "{", "}", "for", "vertex", "in", "G", ".", "vertices", ":", "vertex_data", "[", "vertex", "]", "=", "(", "pred", "[", "vertex", "]", ",", "reach", "[", "vertex", "]", ",", "finish", "[", "vertex", "]", ")", "return", "vertex_data" ]
Algorithm for depth-first searching the vertices of a graph.
[ "Algorithm", "for", "depth", "-", "first", "searching", "the", "vertices", "of", "a", "graph", "." ]
bf979a80bdea17eeb25955f0c119ca8f711ef62b
https://github.com/svasilev94/GraphLibrary/blob/bf979a80bdea17eeb25955f0c119ca8f711ef62b/graphlibrary/first_search.py#L54-L92
247,529
svasilev94/GraphLibrary
graphlibrary/first_search.py
DFS_Tree
def DFS_Tree(G): """ Return an oriented tree constructed from dfs. """ if not G.vertices: raise GraphInsertError("This graph have no vertices.") pred = {} T = digraph.DiGraph() vertex_data = DFS(G) for vertex in vertex_data: pred[vertex] = vertex_data[vertex][0] queue = Queue() for vertex in pred: if pred[vertex] == None: queue.put(vertex) while queue.qsize() > 0: current = queue.get() for element in pred: if pred[element] == current: T.add_edge(current, element) queue.put(element) return T
python
def DFS_Tree(G): """ Return an oriented tree constructed from dfs. """ if not G.vertices: raise GraphInsertError("This graph have no vertices.") pred = {} T = digraph.DiGraph() vertex_data = DFS(G) for vertex in vertex_data: pred[vertex] = vertex_data[vertex][0] queue = Queue() for vertex in pred: if pred[vertex] == None: queue.put(vertex) while queue.qsize() > 0: current = queue.get() for element in pred: if pred[element] == current: T.add_edge(current, element) queue.put(element) return T
[ "def", "DFS_Tree", "(", "G", ")", ":", "if", "not", "G", ".", "vertices", ":", "raise", "GraphInsertError", "(", "\"This graph have no vertices.\"", ")", "pred", "=", "{", "}", "T", "=", "digraph", ".", "DiGraph", "(", ")", "vertex_data", "=", "DFS", "(", "G", ")", "for", "vertex", "in", "vertex_data", ":", "pred", "[", "vertex", "]", "=", "vertex_data", "[", "vertex", "]", "[", "0", "]", "queue", "=", "Queue", "(", ")", "for", "vertex", "in", "pred", ":", "if", "pred", "[", "vertex", "]", "==", "None", ":", "queue", ".", "put", "(", "vertex", ")", "while", "queue", ".", "qsize", "(", ")", ">", "0", ":", "current", "=", "queue", ".", "get", "(", ")", "for", "element", "in", "pred", ":", "if", "pred", "[", "element", "]", "==", "current", ":", "T", ".", "add_edge", "(", "current", ",", "element", ")", "queue", ".", "put", "(", "element", ")", "return", "T" ]
Return an oriented tree constructed from dfs.
[ "Return", "an", "oriented", "tree", "constructed", "from", "dfs", "." ]
bf979a80bdea17eeb25955f0c119ca8f711ef62b
https://github.com/svasilev94/GraphLibrary/blob/bf979a80bdea17eeb25955f0c119ca8f711ef62b/graphlibrary/first_search.py#L95-L116
247,530
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
exception_handler_v20
def exception_handler_v20(status_code, error_content): """Exception handler for API v2.0 client. This routine generates the appropriate Neutron exception according to the contents of the response body. :param status_code: HTTP error status code :param error_content: deserialized body of error response """ error_dict = None request_ids = error_content.request_ids if isinstance(error_content, dict): error_dict = error_content.get('NeutronError') # Find real error type client_exc = None if error_dict: # If Neutron key is found, it will definitely contain # a 'message' and 'type' keys? try: error_type = error_dict['type'] error_message = error_dict['message'] if error_dict['detail']: error_message += "\n" + error_dict['detail'] # If corresponding exception is defined, use it. client_exc = getattr(exceptions, '%sClient' % error_type, None) except Exception: error_message = "%s" % error_dict else: error_message = None if isinstance(error_content, dict): error_message = error_content.get('message') if not error_message: # If we end up here the exception was not a neutron error error_message = "%s-%s" % (status_code, error_content) # If an exception corresponding to the error type is not found, # look up per status-code client exception. if not client_exc: client_exc = exceptions.HTTP_EXCEPTION_MAP.get(status_code) # If there is no exception per status-code, # Use NeutronClientException as fallback. if not client_exc: client_exc = exceptions.NeutronClientException raise client_exc(message=error_message, status_code=status_code, request_ids=request_ids)
python
def exception_handler_v20(status_code, error_content): """Exception handler for API v2.0 client. This routine generates the appropriate Neutron exception according to the contents of the response body. :param status_code: HTTP error status code :param error_content: deserialized body of error response """ error_dict = None request_ids = error_content.request_ids if isinstance(error_content, dict): error_dict = error_content.get('NeutronError') # Find real error type client_exc = None if error_dict: # If Neutron key is found, it will definitely contain # a 'message' and 'type' keys? try: error_type = error_dict['type'] error_message = error_dict['message'] if error_dict['detail']: error_message += "\n" + error_dict['detail'] # If corresponding exception is defined, use it. client_exc = getattr(exceptions, '%sClient' % error_type, None) except Exception: error_message = "%s" % error_dict else: error_message = None if isinstance(error_content, dict): error_message = error_content.get('message') if not error_message: # If we end up here the exception was not a neutron error error_message = "%s-%s" % (status_code, error_content) # If an exception corresponding to the error type is not found, # look up per status-code client exception. if not client_exc: client_exc = exceptions.HTTP_EXCEPTION_MAP.get(status_code) # If there is no exception per status-code, # Use NeutronClientException as fallback. if not client_exc: client_exc = exceptions.NeutronClientException raise client_exc(message=error_message, status_code=status_code, request_ids=request_ids)
[ "def", "exception_handler_v20", "(", "status_code", ",", "error_content", ")", ":", "error_dict", "=", "None", "request_ids", "=", "error_content", ".", "request_ids", "if", "isinstance", "(", "error_content", ",", "dict", ")", ":", "error_dict", "=", "error_content", ".", "get", "(", "'NeutronError'", ")", "# Find real error type", "client_exc", "=", "None", "if", "error_dict", ":", "# If Neutron key is found, it will definitely contain", "# a 'message' and 'type' keys?", "try", ":", "error_type", "=", "error_dict", "[", "'type'", "]", "error_message", "=", "error_dict", "[", "'message'", "]", "if", "error_dict", "[", "'detail'", "]", ":", "error_message", "+=", "\"\\n\"", "+", "error_dict", "[", "'detail'", "]", "# If corresponding exception is defined, use it.", "client_exc", "=", "getattr", "(", "exceptions", ",", "'%sClient'", "%", "error_type", ",", "None", ")", "except", "Exception", ":", "error_message", "=", "\"%s\"", "%", "error_dict", "else", ":", "error_message", "=", "None", "if", "isinstance", "(", "error_content", ",", "dict", ")", ":", "error_message", "=", "error_content", ".", "get", "(", "'message'", ")", "if", "not", "error_message", ":", "# If we end up here the exception was not a neutron error", "error_message", "=", "\"%s-%s\"", "%", "(", "status_code", ",", "error_content", ")", "# If an exception corresponding to the error type is not found,", "# look up per status-code client exception.", "if", "not", "client_exc", ":", "client_exc", "=", "exceptions", ".", "HTTP_EXCEPTION_MAP", ".", "get", "(", "status_code", ")", "# If there is no exception per status-code,", "# Use NeutronClientException as fallback.", "if", "not", "client_exc", ":", "client_exc", "=", "exceptions", ".", "NeutronClientException", "raise", "client_exc", "(", "message", "=", "error_message", ",", "status_code", "=", "status_code", ",", "request_ids", "=", "request_ids", ")" ]
Exception handler for API v2.0 client. This routine generates the appropriate Neutron exception according to the contents of the response body. :param status_code: HTTP error status code :param error_content: deserialized body of error response
[ "Exception", "handler", "for", "API", "v2", ".", "0", "client", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L39-L85
247,531
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
_RequestIdMixin._append_request_ids
def _append_request_ids(self, resp): """Add request_ids as an attribute to the object :param resp: Response object or list of Response objects """ if isinstance(resp, list): # Add list of request_ids if response is of type list. for resp_obj in resp: self._append_request_id(resp_obj) elif resp is not None: # Add request_ids if response contains single object. self._append_request_id(resp)
python
def _append_request_ids(self, resp): """Add request_ids as an attribute to the object :param resp: Response object or list of Response objects """ if isinstance(resp, list): # Add list of request_ids if response is of type list. for resp_obj in resp: self._append_request_id(resp_obj) elif resp is not None: # Add request_ids if response contains single object. self._append_request_id(resp)
[ "def", "_append_request_ids", "(", "self", ",", "resp", ")", ":", "if", "isinstance", "(", "resp", ",", "list", ")", ":", "# Add list of request_ids if response is of type list.", "for", "resp_obj", "in", "resp", ":", "self", ".", "_append_request_id", "(", "resp_obj", ")", "elif", "resp", "is", "not", "None", ":", "# Add request_ids if response contains single object.", "self", ".", "_append_request_id", "(", "resp", ")" ]
Add request_ids as an attribute to the object :param resp: Response object or list of Response objects
[ "Add", "request_ids", "as", "an", "attribute", "to", "the", "object" ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L97-L108
247,532
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
ClientBase.serialize
def serialize(self, data): """Serializes a dictionary into JSON. A dictionary with a single key can be passed and it can contain any structure. """ if data is None: return None elif isinstance(data, dict): return serializer.Serializer().serialize(data) else: raise Exception(_("Unable to serialize object of type = '%s'") % type(data))
python
def serialize(self, data): """Serializes a dictionary into JSON. A dictionary with a single key can be passed and it can contain any structure. """ if data is None: return None elif isinstance(data, dict): return serializer.Serializer().serialize(data) else: raise Exception(_("Unable to serialize object of type = '%s'") % type(data))
[ "def", "serialize", "(", "self", ",", "data", ")", ":", "if", "data", "is", "None", ":", "return", "None", "elif", "isinstance", "(", "data", ",", "dict", ")", ":", "return", "serializer", ".", "Serializer", "(", ")", ".", "serialize", "(", "data", ")", "else", ":", "raise", "Exception", "(", "_", "(", "\"Unable to serialize object of type = '%s'\"", ")", "%", "type", "(", "data", ")", ")" ]
Serializes a dictionary into JSON. A dictionary with a single key can be passed and it can contain any structure.
[ "Serializes", "a", "dictionary", "into", "JSON", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L292-L304
247,533
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
ClientBase.deserialize
def deserialize(self, data, status_code): """Deserializes a JSON string into a dictionary.""" if status_code == 204: return data return serializer.Serializer().deserialize( data)['body']
python
def deserialize(self, data, status_code): """Deserializes a JSON string into a dictionary.""" if status_code == 204: return data return serializer.Serializer().deserialize( data)['body']
[ "def", "deserialize", "(", "self", ",", "data", ",", "status_code", ")", ":", "if", "status_code", "==", "204", ":", "return", "data", "return", "serializer", ".", "Serializer", "(", ")", ".", "deserialize", "(", "data", ")", "[", "'body'", "]" ]
Deserializes a JSON string into a dictionary.
[ "Deserializes", "a", "JSON", "string", "into", "a", "dictionary", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L306-L311
247,534
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
ClientBase.retry_request
def retry_request(self, method, action, body=None, headers=None, params=None): """Call do_request with the default retry configuration. Only idempotent requests should retry failed connection attempts. :raises: ConnectionFailed if the maximum # of retries is exceeded """ max_attempts = self.retries + 1 for i in range(max_attempts): try: return self.do_request(method, action, body=body, headers=headers, params=params) except exceptions.ConnectionFailed: # Exception has already been logged by do_request() if i < self.retries: _logger.debug('Retrying connection to Neutron service') time.sleep(self.retry_interval) elif self.raise_errors: raise if self.retries: msg = (_("Failed to connect to Neutron server after %d attempts") % max_attempts) else: msg = _("Failed to connect Neutron server") raise exceptions.ConnectionFailed(reason=msg)
python
def retry_request(self, method, action, body=None, headers=None, params=None): """Call do_request with the default retry configuration. Only idempotent requests should retry failed connection attempts. :raises: ConnectionFailed if the maximum # of retries is exceeded """ max_attempts = self.retries + 1 for i in range(max_attempts): try: return self.do_request(method, action, body=body, headers=headers, params=params) except exceptions.ConnectionFailed: # Exception has already been logged by do_request() if i < self.retries: _logger.debug('Retrying connection to Neutron service') time.sleep(self.retry_interval) elif self.raise_errors: raise if self.retries: msg = (_("Failed to connect to Neutron server after %d attempts") % max_attempts) else: msg = _("Failed to connect Neutron server") raise exceptions.ConnectionFailed(reason=msg)
[ "def", "retry_request", "(", "self", ",", "method", ",", "action", ",", "body", "=", "None", ",", "headers", "=", "None", ",", "params", "=", "None", ")", ":", "max_attempts", "=", "self", ".", "retries", "+", "1", "for", "i", "in", "range", "(", "max_attempts", ")", ":", "try", ":", "return", "self", ".", "do_request", "(", "method", ",", "action", ",", "body", "=", "body", ",", "headers", "=", "headers", ",", "params", "=", "params", ")", "except", "exceptions", ".", "ConnectionFailed", ":", "# Exception has already been logged by do_request()", "if", "i", "<", "self", ".", "retries", ":", "_logger", ".", "debug", "(", "'Retrying connection to Neutron service'", ")", "time", ".", "sleep", "(", "self", ".", "retry_interval", ")", "elif", "self", ".", "raise_errors", ":", "raise", "if", "self", ".", "retries", ":", "msg", "=", "(", "_", "(", "\"Failed to connect to Neutron server after %d attempts\"", ")", "%", "max_attempts", ")", "else", ":", "msg", "=", "_", "(", "\"Failed to connect Neutron server\"", ")", "raise", "exceptions", ".", "ConnectionFailed", "(", "reason", "=", "msg", ")" ]
Call do_request with the default retry configuration. Only idempotent requests should retry failed connection attempts. :raises: ConnectionFailed if the maximum # of retries is exceeded
[ "Call", "do_request", "with", "the", "default", "retry", "configuration", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L313-L339
247,535
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_ext
def list_ext(self, collection, path, retrieve_all, **_params): """Client extension hook for list.""" return self.list(collection, path, retrieve_all, **_params)
python
def list_ext(self, collection, path, retrieve_all, **_params): """Client extension hook for list.""" return self.list(collection, path, retrieve_all, **_params)
[ "def", "list_ext", "(", "self", ",", "collection", ",", "path", ",", "retrieve_all", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "collection", ",", "path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Client extension hook for list.
[ "Client", "extension", "hook", "for", "list", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L571-L573
247,536
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_ext
def show_ext(self, path, id, **_params): """Client extension hook for show.""" return self.get(path % id, params=_params)
python
def show_ext(self, path, id, **_params): """Client extension hook for show.""" return self.get(path % id, params=_params)
[ "def", "show_ext", "(", "self", ",", "path", ",", "id", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "path", "%", "id", ",", "params", "=", "_params", ")" ]
Client extension hook for show.
[ "Client", "extension", "hook", "for", "show", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L575-L577
247,537
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_ext
def update_ext(self, path, id, body=None): """Client extension hook for update.""" return self.put(path % id, body=body)
python
def update_ext(self, path, id, body=None): """Client extension hook for update.""" return self.put(path % id, body=body)
[ "def", "update_ext", "(", "self", ",", "path", ",", "id", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "path", "%", "id", ",", "body", "=", "body", ")" ]
Client extension hook for update.
[ "Client", "extension", "hook", "for", "update", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L583-L585
247,538
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_quota
def show_quota(self, project_id, **_params): """Fetch information of a certain project's quotas.""" return self.get(self.quota_path % (project_id), params=_params)
python
def show_quota(self, project_id, **_params): """Fetch information of a certain project's quotas.""" return self.get(self.quota_path % (project_id), params=_params)
[ "def", "show_quota", "(", "self", ",", "project_id", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "quota_path", "%", "(", "project_id", ")", ",", "params", "=", "_params", ")" ]
Fetch information of a certain project's quotas.
[ "Fetch", "information", "of", "a", "certain", "project", "s", "quotas", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L601-L603
247,539
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_quota
def update_quota(self, project_id, body=None): """Update a project's quotas.""" return self.put(self.quota_path % (project_id), body=body)
python
def update_quota(self, project_id, body=None): """Update a project's quotas.""" return self.put(self.quota_path % (project_id), body=body)
[ "def", "update_quota", "(", "self", ",", "project_id", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "quota_path", "%", "(", "project_id", ")", ",", "body", "=", "body", ")" ]
Update a project's quotas.
[ "Update", "a", "project", "s", "quotas", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L607-L609
247,540
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_extension
def show_extension(self, ext_alias, **_params): """Fetches information of a certain extension.""" return self.get(self.extension_path % ext_alias, params=_params)
python
def show_extension(self, ext_alias, **_params): """Fetches information of a certain extension.""" return self.get(self.extension_path % ext_alias, params=_params)
[ "def", "show_extension", "(", "self", ",", "ext_alias", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "extension_path", "%", "ext_alias", ",", "params", "=", "_params", ")" ]
Fetches information of a certain extension.
[ "Fetches", "information", "of", "a", "certain", "extension", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L621-L623
247,541
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_ports
def list_ports(self, retrieve_all=True, **_params): """Fetches a list of all ports for a project.""" # Pass filters in "params" argument to do_request return self.list('ports', self.ports_path, retrieve_all, **_params)
python
def list_ports(self, retrieve_all=True, **_params): """Fetches a list of all ports for a project.""" # Pass filters in "params" argument to do_request return self.list('ports', self.ports_path, retrieve_all, **_params)
[ "def", "list_ports", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "# Pass filters in \"params\" argument to do_request", "return", "self", ".", "list", "(", "'ports'", ",", "self", ".", "ports_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all ports for a project.
[ "Fetches", "a", "list", "of", "all", "ports", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L625-L629
247,542
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_port
def show_port(self, port, **_params): """Fetches information of a certain port.""" return self.get(self.port_path % (port), params=_params)
python
def show_port(self, port, **_params): """Fetches information of a certain port.""" return self.get(self.port_path % (port), params=_params)
[ "def", "show_port", "(", "self", ",", "port", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "port_path", "%", "(", "port", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a certain port.
[ "Fetches", "information", "of", "a", "certain", "port", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L631-L633
247,543
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_port
def update_port(self, port, body=None): """Updates a port.""" return self.put(self.port_path % (port), body=body)
python
def update_port(self, port, body=None): """Updates a port.""" return self.put(self.port_path % (port), body=body)
[ "def", "update_port", "(", "self", ",", "port", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "port_path", "%", "(", "port", ")", ",", "body", "=", "body", ")" ]
Updates a port.
[ "Updates", "a", "port", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L639-L641
247,544
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_networks
def list_networks(self, retrieve_all=True, **_params): """Fetches a list of all networks for a project.""" # Pass filters in "params" argument to do_request return self.list('networks', self.networks_path, retrieve_all, **_params)
python
def list_networks(self, retrieve_all=True, **_params): """Fetches a list of all networks for a project.""" # Pass filters in "params" argument to do_request return self.list('networks', self.networks_path, retrieve_all, **_params)
[ "def", "list_networks", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "# Pass filters in \"params\" argument to do_request", "return", "self", ".", "list", "(", "'networks'", ",", "self", ".", "networks_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all networks for a project.
[ "Fetches", "a", "list", "of", "all", "networks", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L647-L651
247,545
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_network
def show_network(self, network, **_params): """Fetches information of a certain network.""" return self.get(self.network_path % (network), params=_params)
python
def show_network(self, network, **_params): """Fetches information of a certain network.""" return self.get(self.network_path % (network), params=_params)
[ "def", "show_network", "(", "self", ",", "network", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "network_path", "%", "(", "network", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a certain network.
[ "Fetches", "information", "of", "a", "certain", "network", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L653-L655
247,546
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_network
def update_network(self, network, body=None): """Updates a network.""" return self.put(self.network_path % (network), body=body)
python
def update_network(self, network, body=None): """Updates a network.""" return self.put(self.network_path % (network), body=body)
[ "def", "update_network", "(", "self", ",", "network", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "network_path", "%", "(", "network", ")", ",", "body", "=", "body", ")" ]
Updates a network.
[ "Updates", "a", "network", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L661-L663
247,547
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_subnets
def list_subnets(self, retrieve_all=True, **_params): """Fetches a list of all subnets for a project.""" return self.list('subnets', self.subnets_path, retrieve_all, **_params)
python
def list_subnets(self, retrieve_all=True, **_params): """Fetches a list of all subnets for a project.""" return self.list('subnets', self.subnets_path, retrieve_all, **_params)
[ "def", "list_subnets", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'subnets'", ",", "self", ".", "subnets_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all subnets for a project.
[ "Fetches", "a", "list", "of", "all", "subnets", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L669-L672
247,548
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_subnet
def show_subnet(self, subnet, **_params): """Fetches information of a certain subnet.""" return self.get(self.subnet_path % (subnet), params=_params)
python
def show_subnet(self, subnet, **_params): """Fetches information of a certain subnet.""" return self.get(self.subnet_path % (subnet), params=_params)
[ "def", "show_subnet", "(", "self", ",", "subnet", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "subnet_path", "%", "(", "subnet", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a certain subnet.
[ "Fetches", "information", "of", "a", "certain", "subnet", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L674-L676
247,549
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_subnet
def update_subnet(self, subnet, body=None): """Updates a subnet.""" return self.put(self.subnet_path % (subnet), body=body)
python
def update_subnet(self, subnet, body=None): """Updates a subnet.""" return self.put(self.subnet_path % (subnet), body=body)
[ "def", "update_subnet", "(", "self", ",", "subnet", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "subnet_path", "%", "(", "subnet", ")", ",", "body", "=", "body", ")" ]
Updates a subnet.
[ "Updates", "a", "subnet", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L682-L684
247,550
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_subnetpools
def list_subnetpools(self, retrieve_all=True, **_params): """Fetches a list of all subnetpools for a project.""" return self.list('subnetpools', self.subnetpools_path, retrieve_all, **_params)
python
def list_subnetpools(self, retrieve_all=True, **_params): """Fetches a list of all subnetpools for a project.""" return self.list('subnetpools', self.subnetpools_path, retrieve_all, **_params)
[ "def", "list_subnetpools", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'subnetpools'", ",", "self", ".", "subnetpools_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all subnetpools for a project.
[ "Fetches", "a", "list", "of", "all", "subnetpools", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L690-L693
247,551
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_subnetpool
def show_subnetpool(self, subnetpool, **_params): """Fetches information of a certain subnetpool.""" return self.get(self.subnetpool_path % (subnetpool), params=_params)
python
def show_subnetpool(self, subnetpool, **_params): """Fetches information of a certain subnetpool.""" return self.get(self.subnetpool_path % (subnetpool), params=_params)
[ "def", "show_subnetpool", "(", "self", ",", "subnetpool", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "subnetpool_path", "%", "(", "subnetpool", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a certain subnetpool.
[ "Fetches", "information", "of", "a", "certain", "subnetpool", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L695-L697
247,552
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_subnetpool
def update_subnetpool(self, subnetpool, body=None): """Updates a subnetpool.""" return self.put(self.subnetpool_path % (subnetpool), body=body)
python
def update_subnetpool(self, subnetpool, body=None): """Updates a subnetpool.""" return self.put(self.subnetpool_path % (subnetpool), body=body)
[ "def", "update_subnetpool", "(", "self", ",", "subnetpool", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "subnetpool_path", "%", "(", "subnetpool", ")", ",", "body", "=", "body", ")" ]
Updates a subnetpool.
[ "Updates", "a", "subnetpool", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L703-L705
247,553
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_routers
def list_routers(self, retrieve_all=True, **_params): """Fetches a list of all routers for a project.""" # Pass filters in "params" argument to do_request return self.list('routers', self.routers_path, retrieve_all, **_params)
python
def list_routers(self, retrieve_all=True, **_params): """Fetches a list of all routers for a project.""" # Pass filters in "params" argument to do_request return self.list('routers', self.routers_path, retrieve_all, **_params)
[ "def", "list_routers", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "# Pass filters in \"params\" argument to do_request", "return", "self", ".", "list", "(", "'routers'", ",", "self", ".", "routers_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all routers for a project.
[ "Fetches", "a", "list", "of", "all", "routers", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L711-L715
247,554
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_router
def show_router(self, router, **_params): """Fetches information of a certain router.""" return self.get(self.router_path % (router), params=_params)
python
def show_router(self, router, **_params): """Fetches information of a certain router.""" return self.get(self.router_path % (router), params=_params)
[ "def", "show_router", "(", "self", ",", "router", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "router_path", "%", "(", "router", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a certain router.
[ "Fetches", "information", "of", "a", "certain", "router", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L717-L719
247,555
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_router
def update_router(self, router, body=None): """Updates a router.""" return self.put(self.router_path % (router), body=body)
python
def update_router(self, router, body=None): """Updates a router.""" return self.put(self.router_path % (router), body=body)
[ "def", "update_router", "(", "self", ",", "router", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "router_path", "%", "(", "router", ")", ",", "body", "=", "body", ")" ]
Updates a router.
[ "Updates", "a", "router", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L725-L727
247,556
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_address_scopes
def list_address_scopes(self, retrieve_all=True, **_params): """Fetches a list of all address scopes for a project.""" return self.list('address_scopes', self.address_scopes_path, retrieve_all, **_params)
python
def list_address_scopes(self, retrieve_all=True, **_params): """Fetches a list of all address scopes for a project.""" return self.list('address_scopes', self.address_scopes_path, retrieve_all, **_params)
[ "def", "list_address_scopes", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'address_scopes'", ",", "self", ".", "address_scopes_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all address scopes for a project.
[ "Fetches", "a", "list", "of", "all", "address", "scopes", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L733-L736
247,557
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_address_scope
def show_address_scope(self, address_scope, **_params): """Fetches information of a certain address scope.""" return self.get(self.address_scope_path % (address_scope), params=_params)
python
def show_address_scope(self, address_scope, **_params): """Fetches information of a certain address scope.""" return self.get(self.address_scope_path % (address_scope), params=_params)
[ "def", "show_address_scope", "(", "self", ",", "address_scope", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "address_scope_path", "%", "(", "address_scope", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a certain address scope.
[ "Fetches", "information", "of", "a", "certain", "address", "scope", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L738-L741
247,558
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_address_scope
def update_address_scope(self, address_scope, body=None): """Updates a address scope.""" return self.put(self.address_scope_path % (address_scope), body=body)
python
def update_address_scope(self, address_scope, body=None): """Updates a address scope.""" return self.put(self.address_scope_path % (address_scope), body=body)
[ "def", "update_address_scope", "(", "self", ",", "address_scope", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "address_scope_path", "%", "(", "address_scope", ")", ",", "body", "=", "body", ")" ]
Updates a address scope.
[ "Updates", "a", "address", "scope", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L747-L749
247,559
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.add_interface_router
def add_interface_router(self, router, body=None): """Adds an internal network interface to the specified router.""" return self.put((self.router_path % router) + "/add_router_interface", body=body)
python
def add_interface_router(self, router, body=None): """Adds an internal network interface to the specified router.""" return self.put((self.router_path % router) + "/add_router_interface", body=body)
[ "def", "add_interface_router", "(", "self", ",", "router", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "(", "self", ".", "router_path", "%", "router", ")", "+", "\"/add_router_interface\"", ",", "body", "=", "body", ")" ]
Adds an internal network interface to the specified router.
[ "Adds", "an", "internal", "network", "interface", "to", "the", "specified", "router", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L755-L758
247,560
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.remove_interface_router
def remove_interface_router(self, router, body=None): """Removes an internal network interface from the specified router.""" return self.put((self.router_path % router) + "/remove_router_interface", body=body)
python
def remove_interface_router(self, router, body=None): """Removes an internal network interface from the specified router.""" return self.put((self.router_path % router) + "/remove_router_interface", body=body)
[ "def", "remove_interface_router", "(", "self", ",", "router", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "(", "self", ".", "router_path", "%", "router", ")", "+", "\"/remove_router_interface\"", ",", "body", "=", "body", ")" ]
Removes an internal network interface from the specified router.
[ "Removes", "an", "internal", "network", "interface", "from", "the", "specified", "router", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L760-L763
247,561
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.add_gateway_router
def add_gateway_router(self, router, body=None): """Adds an external network gateway to the specified router.""" return self.put((self.router_path % router), body={'router': {'external_gateway_info': body}})
python
def add_gateway_router(self, router, body=None): """Adds an external network gateway to the specified router.""" return self.put((self.router_path % router), body={'router': {'external_gateway_info': body}})
[ "def", "add_gateway_router", "(", "self", ",", "router", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "(", "self", ".", "router_path", "%", "router", ")", ",", "body", "=", "{", "'router'", ":", "{", "'external_gateway_info'", ":", "body", "}", "}", ")" ]
Adds an external network gateway to the specified router.
[ "Adds", "an", "external", "network", "gateway", "to", "the", "specified", "router", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L765-L768
247,562
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_floatingips
def list_floatingips(self, retrieve_all=True, **_params): """Fetches a list of all floatingips for a project.""" # Pass filters in "params" argument to do_request return self.list('floatingips', self.floatingips_path, retrieve_all, **_params)
python
def list_floatingips(self, retrieve_all=True, **_params): """Fetches a list of all floatingips for a project.""" # Pass filters in "params" argument to do_request return self.list('floatingips', self.floatingips_path, retrieve_all, **_params)
[ "def", "list_floatingips", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "# Pass filters in \"params\" argument to do_request", "return", "self", ".", "list", "(", "'floatingips'", ",", "self", ".", "floatingips_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all floatingips for a project.
[ "Fetches", "a", "list", "of", "all", "floatingips", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L775-L779
247,563
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_floatingip
def show_floatingip(self, floatingip, **_params): """Fetches information of a certain floatingip.""" return self.get(self.floatingip_path % (floatingip), params=_params)
python
def show_floatingip(self, floatingip, **_params): """Fetches information of a certain floatingip.""" return self.get(self.floatingip_path % (floatingip), params=_params)
[ "def", "show_floatingip", "(", "self", ",", "floatingip", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "floatingip_path", "%", "(", "floatingip", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a certain floatingip.
[ "Fetches", "information", "of", "a", "certain", "floatingip", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L781-L783
247,564
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_floatingip
def update_floatingip(self, floatingip, body=None): """Updates a floatingip.""" return self.put(self.floatingip_path % (floatingip), body=body)
python
def update_floatingip(self, floatingip, body=None): """Updates a floatingip.""" return self.put(self.floatingip_path % (floatingip), body=body)
[ "def", "update_floatingip", "(", "self", ",", "floatingip", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "floatingip_path", "%", "(", "floatingip", ")", ",", "body", "=", "body", ")" ]
Updates a floatingip.
[ "Updates", "a", "floatingip", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L789-L791
247,565
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_security_group
def update_security_group(self, security_group, body=None): """Updates a security group.""" return self.put(self.security_group_path % security_group, body=body)
python
def update_security_group(self, security_group, body=None): """Updates a security group.""" return self.put(self.security_group_path % security_group, body=body)
[ "def", "update_security_group", "(", "self", ",", "security_group", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "security_group_path", "%", "security_group", ",", "body", "=", "body", ")" ]
Updates a security group.
[ "Updates", "a", "security", "group", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L801-L804
247,566
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_security_groups
def list_security_groups(self, retrieve_all=True, **_params): """Fetches a list of all security groups for a project.""" return self.list('security_groups', self.security_groups_path, retrieve_all, **_params)
python
def list_security_groups(self, retrieve_all=True, **_params): """Fetches a list of all security groups for a project.""" return self.list('security_groups', self.security_groups_path, retrieve_all, **_params)
[ "def", "list_security_groups", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'security_groups'", ",", "self", ".", "security_groups_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all security groups for a project.
[ "Fetches", "a", "list", "of", "all", "security", "groups", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L806-L809
247,567
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_security_group
def show_security_group(self, security_group, **_params): """Fetches information of a certain security group.""" return self.get(self.security_group_path % (security_group), params=_params)
python
def show_security_group(self, security_group, **_params): """Fetches information of a certain security group.""" return self.get(self.security_group_path % (security_group), params=_params)
[ "def", "show_security_group", "(", "self", ",", "security_group", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "security_group_path", "%", "(", "security_group", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a certain security group.
[ "Fetches", "information", "of", "a", "certain", "security", "group", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L811-L814
247,568
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_security_group_rules
def list_security_group_rules(self, retrieve_all=True, **_params): """Fetches a list of all security group rules for a project.""" return self.list('security_group_rules', self.security_group_rules_path, retrieve_all, **_params)
python
def list_security_group_rules(self, retrieve_all=True, **_params): """Fetches a list of all security group rules for a project.""" return self.list('security_group_rules', self.security_group_rules_path, retrieve_all, **_params)
[ "def", "list_security_group_rules", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'security_group_rules'", ",", "self", ".", "security_group_rules_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all security group rules for a project.
[ "Fetches", "a", "list", "of", "all", "security", "group", "rules", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L829-L833
247,569
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_security_group_rule
def show_security_group_rule(self, security_group_rule, **_params): """Fetches information of a certain security group rule.""" return self.get(self.security_group_rule_path % (security_group_rule), params=_params)
python
def show_security_group_rule(self, security_group_rule, **_params): """Fetches information of a certain security group rule.""" return self.get(self.security_group_rule_path % (security_group_rule), params=_params)
[ "def", "show_security_group_rule", "(", "self", ",", "security_group_rule", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "security_group_rule_path", "%", "(", "security_group_rule", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a certain security group rule.
[ "Fetches", "information", "of", "a", "certain", "security", "group", "rule", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L835-L838
247,570
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_endpoint_groups
def list_endpoint_groups(self, retrieve_all=True, **_params): """Fetches a list of all VPN endpoint groups for a project.""" return self.list('endpoint_groups', self.endpoint_groups_path, retrieve_all, **_params)
python
def list_endpoint_groups(self, retrieve_all=True, **_params): """Fetches a list of all VPN endpoint groups for a project.""" return self.list('endpoint_groups', self.endpoint_groups_path, retrieve_all, **_params)
[ "def", "list_endpoint_groups", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'endpoint_groups'", ",", "self", ".", "endpoint_groups_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all VPN endpoint groups for a project.
[ "Fetches", "a", "list", "of", "all", "VPN", "endpoint", "groups", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L840-L843
247,571
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_endpoint_group
def show_endpoint_group(self, endpointgroup, **_params): """Fetches information for a specific VPN endpoint group.""" return self.get(self.endpoint_group_path % endpointgroup, params=_params)
python
def show_endpoint_group(self, endpointgroup, **_params): """Fetches information for a specific VPN endpoint group.""" return self.get(self.endpoint_group_path % endpointgroup, params=_params)
[ "def", "show_endpoint_group", "(", "self", ",", "endpointgroup", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "endpoint_group_path", "%", "endpointgroup", ",", "params", "=", "_params", ")" ]
Fetches information for a specific VPN endpoint group.
[ "Fetches", "information", "for", "a", "specific", "VPN", "endpoint", "group", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L845-L848
247,572
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_endpoint_group
def update_endpoint_group(self, endpoint_group, body=None): """Updates a VPN endpoint group.""" return self.put(self.endpoint_group_path % endpoint_group, body=body)
python
def update_endpoint_group(self, endpoint_group, body=None): """Updates a VPN endpoint group.""" return self.put(self.endpoint_group_path % endpoint_group, body=body)
[ "def", "update_endpoint_group", "(", "self", ",", "endpoint_group", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "endpoint_group_path", "%", "endpoint_group", ",", "body", "=", "body", ")" ]
Updates a VPN endpoint group.
[ "Updates", "a", "VPN", "endpoint", "group", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L854-L856
247,573
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_vpnservices
def list_vpnservices(self, retrieve_all=True, **_params): """Fetches a list of all configured VPN services for a project.""" return self.list('vpnservices', self.vpnservices_path, retrieve_all, **_params)
python
def list_vpnservices(self, retrieve_all=True, **_params): """Fetches a list of all configured VPN services for a project.""" return self.list('vpnservices', self.vpnservices_path, retrieve_all, **_params)
[ "def", "list_vpnservices", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'vpnservices'", ",", "self", ".", "vpnservices_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all configured VPN services for a project.
[ "Fetches", "a", "list", "of", "all", "configured", "VPN", "services", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L862-L865
247,574
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_vpnservice
def show_vpnservice(self, vpnservice, **_params): """Fetches information of a specific VPN service.""" return self.get(self.vpnservice_path % (vpnservice), params=_params)
python
def show_vpnservice(self, vpnservice, **_params): """Fetches information of a specific VPN service.""" return self.get(self.vpnservice_path % (vpnservice), params=_params)
[ "def", "show_vpnservice", "(", "self", ",", "vpnservice", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "vpnservice_path", "%", "(", "vpnservice", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a specific VPN service.
[ "Fetches", "information", "of", "a", "specific", "VPN", "service", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L867-L869
247,575
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_vpnservice
def update_vpnservice(self, vpnservice, body=None): """Updates a VPN service.""" return self.put(self.vpnservice_path % (vpnservice), body=body)
python
def update_vpnservice(self, vpnservice, body=None): """Updates a VPN service.""" return self.put(self.vpnservice_path % (vpnservice), body=body)
[ "def", "update_vpnservice", "(", "self", ",", "vpnservice", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "vpnservice_path", "%", "(", "vpnservice", ")", ",", "body", "=", "body", ")" ]
Updates a VPN service.
[ "Updates", "a", "VPN", "service", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L875-L877
247,576
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_ipsec_site_connections
def list_ipsec_site_connections(self, retrieve_all=True, **_params): """Fetches all configured IPsecSiteConnections for a project.""" return self.list('ipsec_site_connections', self.ipsec_site_connections_path, retrieve_all, **_params)
python
def list_ipsec_site_connections(self, retrieve_all=True, **_params): """Fetches all configured IPsecSiteConnections for a project.""" return self.list('ipsec_site_connections', self.ipsec_site_connections_path, retrieve_all, **_params)
[ "def", "list_ipsec_site_connections", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'ipsec_site_connections'", ",", "self", ".", "ipsec_site_connections_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches all configured IPsecSiteConnections for a project.
[ "Fetches", "all", "configured", "IPsecSiteConnections", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L883-L888
247,577
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_ipsec_site_connection
def show_ipsec_site_connection(self, ipsecsite_conn, **_params): """Fetches information of a specific IPsecSiteConnection.""" return self.get( self.ipsec_site_connection_path % (ipsecsite_conn), params=_params )
python
def show_ipsec_site_connection(self, ipsecsite_conn, **_params): """Fetches information of a specific IPsecSiteConnection.""" return self.get( self.ipsec_site_connection_path % (ipsecsite_conn), params=_params )
[ "def", "show_ipsec_site_connection", "(", "self", ",", "ipsecsite_conn", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "ipsec_site_connection_path", "%", "(", "ipsecsite_conn", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a specific IPsecSiteConnection.
[ "Fetches", "information", "of", "a", "specific", "IPsecSiteConnection", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L890-L894
247,578
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_ipsec_site_connection
def update_ipsec_site_connection(self, ipsecsite_conn, body=None): """Updates an IPsecSiteConnection.""" return self.put( self.ipsec_site_connection_path % (ipsecsite_conn), body=body )
python
def update_ipsec_site_connection(self, ipsecsite_conn, body=None): """Updates an IPsecSiteConnection.""" return self.put( self.ipsec_site_connection_path % (ipsecsite_conn), body=body )
[ "def", "update_ipsec_site_connection", "(", "self", ",", "ipsecsite_conn", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "ipsec_site_connection_path", "%", "(", "ipsecsite_conn", ")", ",", "body", "=", "body", ")" ]
Updates an IPsecSiteConnection.
[ "Updates", "an", "IPsecSiteConnection", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L900-L904
247,579
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_ikepolicies
def list_ikepolicies(self, retrieve_all=True, **_params): """Fetches a list of all configured IKEPolicies for a project.""" return self.list('ikepolicies', self.ikepolicies_path, retrieve_all, **_params)
python
def list_ikepolicies(self, retrieve_all=True, **_params): """Fetches a list of all configured IKEPolicies for a project.""" return self.list('ikepolicies', self.ikepolicies_path, retrieve_all, **_params)
[ "def", "list_ikepolicies", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'ikepolicies'", ",", "self", ".", "ikepolicies_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all configured IKEPolicies for a project.
[ "Fetches", "a", "list", "of", "all", "configured", "IKEPolicies", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L910-L913
247,580
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_ikepolicy
def show_ikepolicy(self, ikepolicy, **_params): """Fetches information of a specific IKEPolicy.""" return self.get(self.ikepolicy_path % (ikepolicy), params=_params)
python
def show_ikepolicy(self, ikepolicy, **_params): """Fetches information of a specific IKEPolicy.""" return self.get(self.ikepolicy_path % (ikepolicy), params=_params)
[ "def", "show_ikepolicy", "(", "self", ",", "ikepolicy", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "ikepolicy_path", "%", "(", "ikepolicy", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a specific IKEPolicy.
[ "Fetches", "information", "of", "a", "specific", "IKEPolicy", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L915-L917
247,581
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_ikepolicy
def update_ikepolicy(self, ikepolicy, body=None): """Updates an IKEPolicy.""" return self.put(self.ikepolicy_path % (ikepolicy), body=body)
python
def update_ikepolicy(self, ikepolicy, body=None): """Updates an IKEPolicy.""" return self.put(self.ikepolicy_path % (ikepolicy), body=body)
[ "def", "update_ikepolicy", "(", "self", ",", "ikepolicy", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "ikepolicy_path", "%", "(", "ikepolicy", ")", ",", "body", "=", "body", ")" ]
Updates an IKEPolicy.
[ "Updates", "an", "IKEPolicy", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L923-L925
247,582
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_ipsecpolicies
def list_ipsecpolicies(self, retrieve_all=True, **_params): """Fetches a list of all configured IPsecPolicies for a project.""" return self.list('ipsecpolicies', self.ipsecpolicies_path, retrieve_all, **_params)
python
def list_ipsecpolicies(self, retrieve_all=True, **_params): """Fetches a list of all configured IPsecPolicies for a project.""" return self.list('ipsecpolicies', self.ipsecpolicies_path, retrieve_all, **_params)
[ "def", "list_ipsecpolicies", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'ipsecpolicies'", ",", "self", ".", "ipsecpolicies_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all configured IPsecPolicies for a project.
[ "Fetches", "a", "list", "of", "all", "configured", "IPsecPolicies", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L931-L936
247,583
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_ipsecpolicy
def show_ipsecpolicy(self, ipsecpolicy, **_params): """Fetches information of a specific IPsecPolicy.""" return self.get(self.ipsecpolicy_path % (ipsecpolicy), params=_params)
python
def show_ipsecpolicy(self, ipsecpolicy, **_params): """Fetches information of a specific IPsecPolicy.""" return self.get(self.ipsecpolicy_path % (ipsecpolicy), params=_params)
[ "def", "show_ipsecpolicy", "(", "self", ",", "ipsecpolicy", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "ipsecpolicy_path", "%", "(", "ipsecpolicy", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a specific IPsecPolicy.
[ "Fetches", "information", "of", "a", "specific", "IPsecPolicy", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L938-L940
247,584
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_ipsecpolicy
def update_ipsecpolicy(self, ipsecpolicy, body=None): """Updates an IPsecPolicy.""" return self.put(self.ipsecpolicy_path % (ipsecpolicy), body=body)
python
def update_ipsecpolicy(self, ipsecpolicy, body=None): """Updates an IPsecPolicy.""" return self.put(self.ipsecpolicy_path % (ipsecpolicy), body=body)
[ "def", "update_ipsecpolicy", "(", "self", ",", "ipsecpolicy", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "ipsecpolicy_path", "%", "(", "ipsecpolicy", ")", ",", "body", "=", "body", ")" ]
Updates an IPsecPolicy.
[ "Updates", "an", "IPsecPolicy", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L946-L948
247,585
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_loadbalancers
def list_loadbalancers(self, retrieve_all=True, **_params): """Fetches a list of all loadbalancers for a project.""" return self.list('loadbalancers', self.lbaas_loadbalancers_path, retrieve_all, **_params)
python
def list_loadbalancers(self, retrieve_all=True, **_params): """Fetches a list of all loadbalancers for a project.""" return self.list('loadbalancers', self.lbaas_loadbalancers_path, retrieve_all, **_params)
[ "def", "list_loadbalancers", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'loadbalancers'", ",", "self", ".", "lbaas_loadbalancers_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all loadbalancers for a project.
[ "Fetches", "a", "list", "of", "all", "loadbalancers", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L954-L957
247,586
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_loadbalancer
def show_loadbalancer(self, lbaas_loadbalancer, **_params): """Fetches information for a load balancer.""" return self.get(self.lbaas_loadbalancer_path % (lbaas_loadbalancer), params=_params)
python
def show_loadbalancer(self, lbaas_loadbalancer, **_params): """Fetches information for a load balancer.""" return self.get(self.lbaas_loadbalancer_path % (lbaas_loadbalancer), params=_params)
[ "def", "show_loadbalancer", "(", "self", ",", "lbaas_loadbalancer", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "lbaas_loadbalancer_path", "%", "(", "lbaas_loadbalancer", ")", ",", "params", "=", "_params", ")" ]
Fetches information for a load balancer.
[ "Fetches", "information", "for", "a", "load", "balancer", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L959-L962
247,587
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_loadbalancer
def update_loadbalancer(self, lbaas_loadbalancer, body=None): """Updates a load balancer.""" return self.put(self.lbaas_loadbalancer_path % (lbaas_loadbalancer), body=body)
python
def update_loadbalancer(self, lbaas_loadbalancer, body=None): """Updates a load balancer.""" return self.put(self.lbaas_loadbalancer_path % (lbaas_loadbalancer), body=body)
[ "def", "update_loadbalancer", "(", "self", ",", "lbaas_loadbalancer", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "lbaas_loadbalancer_path", "%", "(", "lbaas_loadbalancer", ")", ",", "body", "=", "body", ")" ]
Updates a load balancer.
[ "Updates", "a", "load", "balancer", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L968-L971
247,588
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.retrieve_loadbalancer_stats
def retrieve_loadbalancer_stats(self, loadbalancer, **_params): """Retrieves stats for a certain load balancer.""" return self.get(self.lbaas_loadbalancer_path_stats % (loadbalancer), params=_params)
python
def retrieve_loadbalancer_stats(self, loadbalancer, **_params): """Retrieves stats for a certain load balancer.""" return self.get(self.lbaas_loadbalancer_path_stats % (loadbalancer), params=_params)
[ "def", "retrieve_loadbalancer_stats", "(", "self", ",", "loadbalancer", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "lbaas_loadbalancer_path_stats", "%", "(", "loadbalancer", ")", ",", "params", "=", "_params", ")" ]
Retrieves stats for a certain load balancer.
[ "Retrieves", "stats", "for", "a", "certain", "load", "balancer", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L978-L981
247,589
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.retrieve_loadbalancer_status
def retrieve_loadbalancer_status(self, loadbalancer, **_params): """Retrieves status for a certain load balancer.""" return self.get(self.lbaas_loadbalancer_path_status % (loadbalancer), params=_params)
python
def retrieve_loadbalancer_status(self, loadbalancer, **_params): """Retrieves status for a certain load balancer.""" return self.get(self.lbaas_loadbalancer_path_status % (loadbalancer), params=_params)
[ "def", "retrieve_loadbalancer_status", "(", "self", ",", "loadbalancer", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "lbaas_loadbalancer_path_status", "%", "(", "loadbalancer", ")", ",", "params", "=", "_params", ")" ]
Retrieves status for a certain load balancer.
[ "Retrieves", "status", "for", "a", "certain", "load", "balancer", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L983-L986
247,590
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_listeners
def list_listeners(self, retrieve_all=True, **_params): """Fetches a list of all lbaas_listeners for a project.""" return self.list('listeners', self.lbaas_listeners_path, retrieve_all, **_params)
python
def list_listeners(self, retrieve_all=True, **_params): """Fetches a list of all lbaas_listeners for a project.""" return self.list('listeners', self.lbaas_listeners_path, retrieve_all, **_params)
[ "def", "list_listeners", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'listeners'", ",", "self", ".", "lbaas_listeners_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all lbaas_listeners for a project.
[ "Fetches", "a", "list", "of", "all", "lbaas_listeners", "for", "a", "project", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L988-L991
247,591
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_listener
def show_listener(self, lbaas_listener, **_params): """Fetches information for a lbaas_listener.""" return self.get(self.lbaas_listener_path % (lbaas_listener), params=_params)
python
def show_listener(self, lbaas_listener, **_params): """Fetches information for a lbaas_listener.""" return self.get(self.lbaas_listener_path % (lbaas_listener), params=_params)
[ "def", "show_listener", "(", "self", ",", "lbaas_listener", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "lbaas_listener_path", "%", "(", "lbaas_listener", ")", ",", "params", "=", "_params", ")" ]
Fetches information for a lbaas_listener.
[ "Fetches", "information", "for", "a", "lbaas_listener", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L993-L996
247,592
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_listener
def update_listener(self, lbaas_listener, body=None): """Updates a lbaas_listener.""" return self.put(self.lbaas_listener_path % (lbaas_listener), body=body)
python
def update_listener(self, lbaas_listener, body=None): """Updates a lbaas_listener.""" return self.put(self.lbaas_listener_path % (lbaas_listener), body=body)
[ "def", "update_listener", "(", "self", ",", "lbaas_listener", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "lbaas_listener_path", "%", "(", "lbaas_listener", ")", ",", "body", "=", "body", ")" ]
Updates a lbaas_listener.
[ "Updates", "a", "lbaas_listener", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1002-L1005
247,593
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_lbaas_l7policies
def list_lbaas_l7policies(self, retrieve_all=True, **_params): """Fetches a list of all L7 policies for a listener.""" return self.list('l7policies', self.lbaas_l7policies_path, retrieve_all, **_params)
python
def list_lbaas_l7policies(self, retrieve_all=True, **_params): """Fetches a list of all L7 policies for a listener.""" return self.list('l7policies', self.lbaas_l7policies_path, retrieve_all, **_params)
[ "def", "list_lbaas_l7policies", "(", "self", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'l7policies'", ",", "self", ".", "lbaas_l7policies_path", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all L7 policies for a listener.
[ "Fetches", "a", "list", "of", "all", "L7", "policies", "for", "a", "listener", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1011-L1014
247,594
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_lbaas_l7policy
def show_lbaas_l7policy(self, l7policy, **_params): """Fetches information of a certain listener's L7 policy.""" return self.get(self.lbaas_l7policy_path % l7policy, params=_params)
python
def show_lbaas_l7policy(self, l7policy, **_params): """Fetches information of a certain listener's L7 policy.""" return self.get(self.lbaas_l7policy_path % l7policy, params=_params)
[ "def", "show_lbaas_l7policy", "(", "self", ",", "l7policy", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "lbaas_l7policy_path", "%", "l7policy", ",", "params", "=", "_params", ")" ]
Fetches information of a certain listener's L7 policy.
[ "Fetches", "information", "of", "a", "certain", "listener", "s", "L7", "policy", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1016-L1019
247,595
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_lbaas_l7policy
def update_lbaas_l7policy(self, l7policy, body=None): """Updates L7 policy.""" return self.put(self.lbaas_l7policy_path % l7policy, body=body)
python
def update_lbaas_l7policy(self, l7policy, body=None): """Updates L7 policy.""" return self.put(self.lbaas_l7policy_path % l7policy, body=body)
[ "def", "update_lbaas_l7policy", "(", "self", ",", "l7policy", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "lbaas_l7policy_path", "%", "l7policy", ",", "body", "=", "body", ")" ]
Updates L7 policy.
[ "Updates", "L7", "policy", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1025-L1028
247,596
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_lbaas_l7rules
def list_lbaas_l7rules(self, l7policy, retrieve_all=True, **_params): """Fetches a list of all rules for L7 policy.""" return self.list('rules', self.lbaas_l7rules_path % l7policy, retrieve_all, **_params)
python
def list_lbaas_l7rules(self, l7policy, retrieve_all=True, **_params): """Fetches a list of all rules for L7 policy.""" return self.list('rules', self.lbaas_l7rules_path % l7policy, retrieve_all, **_params)
[ "def", "list_lbaas_l7rules", "(", "self", ",", "l7policy", ",", "retrieve_all", "=", "True", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "list", "(", "'rules'", ",", "self", ".", "lbaas_l7rules_path", "%", "l7policy", ",", "retrieve_all", ",", "*", "*", "_params", ")" ]
Fetches a list of all rules for L7 policy.
[ "Fetches", "a", "list", "of", "all", "rules", "for", "L7", "policy", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1034-L1037
247,597
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.show_lbaas_l7rule
def show_lbaas_l7rule(self, l7rule, l7policy, **_params): """Fetches information of a certain L7 policy's rule.""" return self.get(self.lbaas_l7rule_path % (l7policy, l7rule), params=_params)
python
def show_lbaas_l7rule(self, l7rule, l7policy, **_params): """Fetches information of a certain L7 policy's rule.""" return self.get(self.lbaas_l7rule_path % (l7policy, l7rule), params=_params)
[ "def", "show_lbaas_l7rule", "(", "self", ",", "l7rule", ",", "l7policy", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "self", ".", "lbaas_l7rule_path", "%", "(", "l7policy", ",", "l7rule", ")", ",", "params", "=", "_params", ")" ]
Fetches information of a certain L7 policy's rule.
[ "Fetches", "information", "of", "a", "certain", "L7", "policy", "s", "rule", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1039-L1042
247,598
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.create_lbaas_l7rule
def create_lbaas_l7rule(self, l7policy, body=None): """Creates rule for a certain L7 policy.""" return self.post(self.lbaas_l7rules_path % l7policy, body=body)
python
def create_lbaas_l7rule(self, l7policy, body=None): """Creates rule for a certain L7 policy.""" return self.post(self.lbaas_l7rules_path % l7policy, body=body)
[ "def", "create_lbaas_l7rule", "(", "self", ",", "l7policy", ",", "body", "=", "None", ")", ":", "return", "self", ".", "post", "(", "self", ".", "lbaas_l7rules_path", "%", "l7policy", ",", "body", "=", "body", ")" ]
Creates rule for a certain L7 policy.
[ "Creates", "rule", "for", "a", "certain", "L7", "policy", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1044-L1046
247,599
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.update_lbaas_l7rule
def update_lbaas_l7rule(self, l7rule, l7policy, body=None): """Updates L7 rule.""" return self.put(self.lbaas_l7rule_path % (l7policy, l7rule), body=body)
python
def update_lbaas_l7rule(self, l7rule, l7policy, body=None): """Updates L7 rule.""" return self.put(self.lbaas_l7rule_path % (l7policy, l7rule), body=body)
[ "def", "update_lbaas_l7rule", "(", "self", ",", "l7rule", ",", "l7policy", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "lbaas_l7rule_path", "%", "(", "l7policy", ",", "l7rule", ")", ",", "body", "=", "body", ")" ]
Updates L7 rule.
[ "Updates", "L7", "rule", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1048-L1051