@@ -129,8 +129,12 @@ def get_licences_from_pattern(self, licence_descriptor_pattern: Pattern) -> Opti
129129 self .load ()
130130 if not self ._licence_store or not self ._licence_list :
131131 return None
132- matching_licences = [l for l in self ._licence_list if licence_descriptor_pattern .match (l )]
133- return [cast (Licence , self ._licence_store .get (l )) for l in matching_licences ] if matching_licences else None
132+ matching_licences = [licence for licence in self ._licence_list if licence_descriptor_pattern .match (licence )]
133+ return (
134+ [cast (Licence , self ._licence_store .get (licence )) for licence in matching_licences ]
135+ if matching_licences
136+ else None
137+ )
134138
135139 def get_licence (self , licence_descriptor : Optional [str ]) -> Optional [Licence ]:
136140 """Determines the licence based on a string descriptor e.g. Apache 2."""
@@ -218,8 +222,8 @@ def determine_licences_not_in_list(licence_expression: str, licence_list: Iterat
218222def determine_whether_licence_expression_is_compliant (licence_expression : str , licence_list : list ) -> bool :
219223 """Checks whether an expression is compliant with a list of licences."""
220224 licensing_util = Licensing ()
221- for l in licence_list :
222- if licensing_util .contains (licence_expression , l ):
225+ for licence in licence_list :
226+ if licensing_util .contains (licence_expression , licence ):
223227 return True
224228 return False
225229
@@ -231,9 +235,9 @@ def _is_expression_or(licence_expression: str) -> bool:
231235
232236def is_licence_accepted (licence_expression : str ) -> bool :
233237 """Determines whether the licence expressed is valid with regards to project's accepted licences."""
234- authorised_licences = [l .identifier for l in get_allowed_opensource_licences ()]
238+ authorised_licences = [licence .identifier for licence in get_allowed_opensource_licences ()]
235239 is_or = _is_expression_or (licence_expression )
236- if bool ([l for l in determine_licences_not_in_list (licence_expression , iter (authorised_licences ))]):
240+ if bool ([licence for licence in determine_licences_not_in_list (licence_expression , iter (authorised_licences ))]):
237241 return (
238242 determine_whether_licence_expression_is_compliant (licence_expression , authorised_licences )
239243 if is_or
0 commit comments