@@ -81,26 +81,22 @@ class Tailoring:
81
81
elif attribute == "severity" :
82
82
enumeration = SEVERITIES
83
83
else :
84
- msg = (
85
- "Unsupported refine-rule attribute {attribute}" .format (
86
- attribute = attribute ))
84
+ msg = f"Unsupported refine-rule attribute { attribute } "
87
85
raise ValueError (msg )
88
86
return enumeration
89
87
90
88
@staticmethod
91
89
def _validate_rule_refinement_params (rule_id , attribute , value ):
92
90
if not is_valid_xccdf_id (rule_id ):
93
- msg = "Rule id '{rule_id}' is invalid!" . format ( rule_id = rule_id )
91
+ msg = f "Rule id '{ rule_id } ' is invalid!"
94
92
raise ValueError (msg )
95
93
enumeration = Tailoring ._find_enumeration (attribute )
96
94
if value in enumeration :
97
95
return
98
96
allowed = ", " .join (map (quote , enumeration ))
99
97
msg = (
100
- "Can't refine {attribute} of rule '{rule_id}' to '{value}'. "
101
- "Allowed {attribute} values are: {allowed}." .format (
102
- attribute = attribute , rule_id = rule_id , value = value ,
103
- allowed = allowed ))
98
+ f"Can't refine { attribute } of rule '{ rule_id } ' to '{ value } '. "
99
+ f"Allowed { attribute } values are: { allowed } ." )
104
100
raise ValueError (msg )
105
101
106
102
def _prevent_duplicate_rule_refinement (self , attribute , rule_id , value ):
@@ -109,10 +105,8 @@ class Tailoring:
109
105
return
110
106
current = refinements [attribute ]
111
107
msg = (
112
- "Can't refine {attribute} of rule '{rule_id}' to '{value}'. "
113
- "This rule {attribute} is already refined to '{current}'." .format (
114
- attribute = attribute , rule_id = rule_id , value = value ,
115
- current = current ))
108
+ f"Can't refine { attribute } of rule '{ rule_id } ' to '{ value } '. "
109
+ f"This rule { attribute } is already refined to '{ current } '." )
116
110
raise ValueError (msg )
117
111
118
112
def refine_rule (self , rule_id , attribute , value ):
@@ -140,9 +134,7 @@ class Tailoring:
140
134
def _full_id (self , string , el_type ):
141
135
if is_valid_xccdf_id (string ):
142
136
return string
143
- default_prefix = "xccdf_{namespace}_{el_type}_" .format (
144
- namespace = self .reverse_dns , el_type = el_type )
145
- return default_prefix + string
137
+ return f"xccdf_{ self .reverse_dns } _{ el_type } _{ string } "
146
138
147
139
def _full_profile_id (self , string ):
148
140
return self ._full_id (string , "profile" )
0 commit comments