Skip to content

Commit

Permalink
Update code to incorporate new rules in pylint
Browse files Browse the repository at this point in the history
1) Lines 837, 844, 851, 873, 896, 915, 948 in model.py has been affected
by new rule "Unnecessary use of a comprehension". Rationale for the
changes can be found here: pylint-dev/pylint#2905

2) Line 84 in service.py has been affected by new rule "Unnecessary
"else" after "break"". In our case exiting if block is granted
by brake statement, therefore else is not necessary
  • Loading branch information
mamiksik committed Sep 27, 2019
1 parent a6dc340 commit 1546d07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 31 deletions.
36 changes: 7 additions & 29 deletions pyodata/v2/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,24 +832,15 @@ def get_type(self, type_info):

@property
def entity_types(self):
return [
entity_type
for entity_type in itertools.chain(*(decl.list_entity_types() for decl in list(self._decls.values())))
]
return list(itertools.chain(*(decl.list_entity_types() for decl in list(self._decls.values()))))

@property
def complex_types(self):
return [
complex_type
for complex_type in itertools.chain(*(decl.list_complex_types() for decl in list(self._decls.values())))
]
return list(itertools.chain(*(decl.list_complex_types() for decl in list(self._decls.values()))))

@property
def enum_types(self):
return [
enum_type
for enum_type in itertools.chain(*(decl.list_enum_types() for decl in list(self._decls.values())))
]
return list(itertools.chain(*(decl.list_enum_types() for decl in list(self._decls.values()))))

def entity_set(self, set_name, namespace=None):
if namespace is not None:
Expand All @@ -868,10 +859,7 @@ def entity_set(self, set_name, namespace=None):

@property
def entity_sets(self):
return [
entity_set
for entity_set in itertools.chain(*(decl.list_entity_sets() for decl in list(self._decls.values())))
]
return list(itertools.chain(*(decl.list_entity_sets() for decl in list(self._decls.values()))))

def function_import(self, function_import, namespace=None):
if namespace is not None:
Expand All @@ -891,10 +879,7 @@ def function_import(self, function_import, namespace=None):

@property
def function_imports(self):
return [
func_import
for func_import in itertools.chain(*(decl.list_function_imports() for decl in list(self._decls.values())))
]
return list(itertools.chain(*(decl.list_function_imports() for decl in list(self._decls.values()))))

def association(self, association_name, namespace=None):
if namespace is not None:
Expand All @@ -910,10 +895,7 @@ def association(self, association_name, namespace=None):

@property
def associations(self):
return [
association
for association in itertools.chain(*(decl.list_associations() for decl in list(self._decls.values())))
]
return list(itertools.chain(*(decl.list_associations() for decl in list(self._decls.values()))))

def association_set_by_association(self, association_name, namespace=None):
if namespace is not None:
Expand Down Expand Up @@ -943,11 +925,7 @@ def association_set(self, set_name, namespace=None):

@property
def association_sets(self):
return [
association_set
for association_set in itertools.chain(*(decl.list_association_sets()
for decl in list(self._decls.values())))
]
return list(itertools.chain(*(decl.list_association_sets() for decl in list(self._decls.values()))))

def check_role_property_names(self, role, entity_type_name, namespace):
for proprty in role.property_names:
Expand Down
3 changes: 1 addition & 2 deletions pyodata/v2/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ def decode(message):
for submessage in part.get_payload():
messages.append(decode(submessage))
break
else:
messages.append(part.get_payload())
messages.append(part.get_payload())
return messages

data = "Content-Type: {}\n".format(content_type) + data
Expand Down

0 comments on commit 1546d07

Please sign in to comment.