Skip to content

Commit

Permalink
fix pep8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtapolasek committed Nov 23, 2021
1 parent 0bc0c3e commit cf639b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions ssg/build_cpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,10 @@ def __init__(self, cpe_products):
self.platforms = []
self.cpe_products = cpe_products


def parse_platform(self, expression):
"""
parses the expression and returns a CPEALPlatform instance
It either creates a new one or if equal instance already exists, it returns the existing one.
parses the expression and returns a CPEALPlatform instance It either creates a
new one or if equal instance already exists, it returns the existing one.
"""
platform = CPEALPlatform(expression, self.algebra, self.cpe_products)
if platform not in self.platforms:
Expand Down Expand Up @@ -245,6 +244,7 @@ def __eq__(self, other):
else:
return self.test == other.test


class CPEALLogicalTest(Function):

prefix = "cpe-lang"
Expand Down Expand Up @@ -277,7 +277,7 @@ class CPEALFactRef (Symbol):

def __init__(self, obj):
super(CPEALFactRef, self).__init__(obj)
self.cpe_name = "" # we do not want to modify original name used for platforms
self.cpe_name = "" # we do not want to modify original name used for platforms

def to_xml_element(self):
cpe_factref = ET.Element("{%s}fact-ref" % CPEALFactRef.ns)
Expand Down
12 changes: 8 additions & 4 deletions ssg/build_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,8 @@ def process_input_dict(cls, input_contents, env_yaml):
# parse platform definition and get CPEAL platform
if data["platforms"]:
for platform in data["platforms"]:
cpe_platform = env_yaml["product_cpes"].cpe_platform_specification.parse_platform(platform)
cpe_platform = env_yaml[
"product_cpes"].cpe_platform_specification.parse_platform(platform)
data["cpe_platform_names"].add(cpe_platform.id)
return data

Expand Down Expand Up @@ -1191,7 +1192,8 @@ def add_group(self, group, env_yaml=None):
# Once the group has inherited properties, update cpe_names
if env_yaml:
for platform in group.platforms:
cpe_platform = env_yaml["product_cpes"].cpe_platform_specification.parse_platform(platform)
cpe_platform = env_yaml[
"product_cpes"].cpe_platform_specification.parse_platform(platform)
group.cpe_platform_names.add(cpe_platform.id)

def _pass_our_properties_on_to(self, obj):
Expand All @@ -1210,7 +1212,8 @@ def add_rule(self, rule, env_yaml=None):
# Once the rule has inherited properties, update cpe_platform_names
if env_yaml:
for platform in rule.platforms:
cpe_platform = env_yaml["product_cpes"].cpe_platform_specification.parse_platform(platform)
cpe_platform = env_yaml[
"product_cpes"].cpe_platform_specification.parse_platform(platform)
rule.cpe_platform_names.add(cpe_platform.id)

def __str__(self):
Expand Down Expand Up @@ -1310,7 +1313,8 @@ def from_yaml(cls, yaml_file, env_yaml=None, sce_metadata=None):
or env_yaml and rule.prodtype == "all"):
# parse platform definition and get CPEAL platform
for platform in rule.platforms:
cpe_platform = env_yaml["product_cpes"].cpe_platform_specification.parse_platform(platform)
cpe_platform = env_yaml[
"product_cpes"].cpe_platform_specification.parse_platform(platform)
rule.cpe_platform_names.add(cpe_platform.id)


Expand Down

0 comments on commit cf639b6

Please sign in to comment.