@@ -53,16 +53,17 @@ def validate_fields(
5353 :param field_type: A string indicating the field type ('option' or 'link').
5454 """
5555
56- def remove_prefix (values : list [str ], prefixes : list [str ]) -> Generator [str , None ,None ]:
56+ def remove_prefix (
57+ values : list [str ], prefixes : list [str ]
58+ ) -> Generator [str , None , None ]:
5759 # Memory and allocation wise better to use a generator here.
5860 # Removes any prefix allowed by configuration, if prefix is there.
5961 return (
60- next ((text .removeprefix (p ) for p in prefixes if text .startswith (p )), text ) for text in values
62+ next ((text .removeprefix (p ) for p in prefixes if text .startswith (p )), text )
63+ for text in values
6164 )
6265
63-
6466 for field , pattern in fields .items ():
65-
6667 raw_value : str | list [str ] | None = need .get (field , None )
6768 if raw_value in [None , [], "" ]:
6869 if required :
@@ -82,7 +83,7 @@ def remove_prefix(values: list[str], prefixes: list[str]) -> Generator[str, None
8283
8384 # The filter ensures that the function is only called when needed.
8485 if field_type == "link" and allowed_prefixes :
85- values = list (remove_prefix (values ,allowed_prefixes ))
86+ values = list (remove_prefix (values , allowed_prefixes ))
8687
8788 for value in values :
8889 try :
@@ -140,7 +141,7 @@ def check_options(
140141
141142 # If undefined this is an empty list
142143 allowed_prefixes = app .config .allowed_external_prefixes
143-
144+
144145 for field_type , check_fields in checking_dict .items ():
145146 for field_values , is_required in check_fields :
146147 validate_fields (
@@ -149,7 +150,7 @@ def check_options(
149150 field_values ,
150151 required = is_required ,
151152 field_type = field_type ,
152- allowed_prefixes = allowed_prefixes
153+ allowed_prefixes = allowed_prefixes ,
153154 )
154155
155156
0 commit comments