Merge "rename parameters"

This commit is contained in:
Jenkins
2016-03-20 13:39:49 +00:00
committed by Gerrit Code Review
5 changed files with 28 additions and 28 deletions

View File

@@ -83,8 +83,8 @@ class EntityGraph(NXGraph):
@staticmethod
def get_vertex_category(vertex):
category = vertex[VProps.CATEGORY]
type = vertex[VProps.TYPE]
return category, type
type_ = vertex[VProps.TYPE]
return category, type_
def check_update_validation(self, graph_vertex, updated_vertex):
"""Checks current and updated validation

View File

@@ -80,11 +80,11 @@ class StateManager(object):
is_normalized)
state_properties.pop(0)
for property in state_properties:
for property_ in state_properties:
tmp_normalized_state, tmp_state_priority = \
self._find_normalized_state_and_priority(new_vertex,
graph_vertex,
property,
property_,
category,
plugin_name,
is_normalized)
@@ -185,13 +185,13 @@ class StateManager(object):
def _find_normalized_state_and_priority(self,
new_vertex,
graph_vertex,
property,
property_,
category,
plugin_name,
is_normalized=False):
state = self._get_updated_property(new_vertex,
graph_vertex,
property)
property_)
upper_state1 = state if not state else state.upper()

View File

@@ -200,16 +200,16 @@ class Template(object):
def _extract_or_condition(self, or_condition):
vars = []
vars_ = []
for var in or_condition.args:
if isinstance(var, And):
vars.append(self._extract_and_condition(var))
vars_.append(self._extract_and_condition(var))
else:
is_symbol = isinstance(var, Symbol)
vars.append([self._extract_condition_var(var, is_symbol)])
vars_.append([self._extract_condition_var(var, is_symbol)])
return vars
return vars_
def _extract_and_condition(self, and_condition):
return [self._extract_condition_var(arg, isinstance(arg, Symbol))

View File

@@ -48,22 +48,22 @@ class StaticPhysicalSynchronizer(SynchronizerBase):
files = file_utils.load_files(
self.cfg.static_physical.directory, '.yaml')
for file in files:
for file_ in files:
full_path = self.cfg.static_physical.directory \
+ '/' + file
static_entities += self._get_entities_from_file(file,
+ '/' + file_
static_entities += self._get_entities_from_file(file_,
full_path)
return static_entities
def _get_entities_from_file(self, file, path):
def _get_entities_from_file(self, file_, path):
static_entities = []
config = file_utils.load_yaml_file(path)
for entity in config[self.ENTITIES_SECTION]:
static_entities.append(entity.copy())
self.cache[file] = config
self.cache[file_] = config
return static_entities
@@ -74,31 +74,31 @@ class StaticPhysicalSynchronizer(SynchronizerBase):
files = file_utils.load_files(
self.cfg.static_physical.directory, '.yaml')
for file in files:
for file_ in files:
full_path = self.cfg.static_physical.directory +\
'/' + file
'/' + file_
config = file_utils.load_yaml_file(full_path)
if config:
if file in self.cache:
if str(config) != str(self.cache[file]):
if file_ in self.cache:
if str(config) != str(self.cache[file_]):
# TODO(alexey_weyl): need also to remove deleted
# files from cache
self._update_on_existing_entities(
self.cache[file][self.ENTITIES_SECTION],
self.cache[file_][self.ENTITIES_SECTION],
config[self.ENTITIES_SECTION],
entities_updates)
self._update_on_new_entities(
config[self.ENTITIES_SECTION],
self.cache[file][self.ENTITIES_SECTION],
self.cache[file_][self.ENTITIES_SECTION],
entities_updates)
self.cache[file] = config
self.cache[file_] = config
else:
self.cache[file] = config
self.cache[file_] = config
entities_updates += \
self._get_entities_from_file(file, full_path)
self._get_entities_from_file(file_, full_path)
return entities_updates

View File

@@ -31,20 +31,20 @@ class TestBaseProcessor(TestEntityGraphUnitBase):
self.transform = transformer_manager.TransformerManager(self.conf)
@staticmethod
def _update_vertex_to_graph(entity_graph, category, type, id,
def _update_vertex_to_graph(entity_graph, category, type_, id_,
is_deleted, is_placeholder_data,
additional_prop):
# create vertex properties
prop = {key: value for key, value in additional_prop.items()}
prop[VertexProperties.CATEGORY] = category
prop[VertexProperties.TYPE] = type
prop[VertexProperties.ID] = id
prop[VertexProperties.TYPE] = type_
prop[VertexProperties.ID] = id_
prop[VertexProperties.IS_DELETED] = is_deleted
prop[VertexProperties.IS_PLACEHOLDER] = is_placeholder_data
# TODO(Alexey): change back to original method
# vertex_id = self.transform.get_key(prop)
vertex_id = category + "_" + type + "_" + id
vertex_id = category + "_" + type_ + "_" + id_
vertex = graph.Vertex(vertex_id, prop)
entity_graph.add_vertex(vertex)