@@ -165,12 +165,18 @@ def _validate_aws_entity_usage(value: str) -> bool:
165165 Count all bare AWS occurrences overall.
166166 If these counts differ, there's an invalid usage.
167167 """
168- xval = value .replace ('&' , ' &' )
168+ xval = value .replace ("&" , " &" )
169169 xtree = xml_tree .fromstring (f"<fake><para>{ xval } </para></fake>" )
170- blocks = xtree .findall (".//programlisting" ) + xtree .findall (".//code" ) + xtree .findall (".//noloc" )
170+ blocks = (
171+ xtree .findall (".//programlisting" )
172+ + xtree .findall (".//code" )
173+ + xtree .findall (".//noloc" )
174+ )
171175 aws_in_blocks = 0
172176 for element in blocks :
173- aws_in_blocks += len (re .findall ("(?<![&0-9a-zA-Z])AWS(?![;0-9a-zA-Z])" , element .text ))
177+ aws_in_blocks += len (
178+ re .findall ("(?<![&0-9a-zA-Z])AWS(?![;0-9a-zA-Z])" , str (element .text ))
179+ )
174180 aws_everywhere = len (re .findall ("(?<![&0-9a-zA-Z])AWS(?![;0-9a-zA-Z])" , value ))
175181 return aws_everywhere == aws_in_blocks
176182
@@ -203,7 +209,9 @@ def validate_files(
203209 return errors
204210
205211
206- def validate_metadata (doc_gen_root : Path , strict : bool , errors : MetadataErrors ) -> MetadataErrors :
212+ def validate_metadata (
213+ doc_gen_root : Path , strict : bool , errors : MetadataErrors
214+ ) -> MetadataErrors :
207215 config = Path (__file__ ).parent / "config"
208216 with open (config / "sdks.yaml" ) as sdks_file :
209217 sdks_yaml : Dict [str , Any ] = yaml .safe_load (sdks_file )
@@ -235,7 +243,11 @@ def validate_metadata(doc_gen_root: Path, strict: bool, errors: MetadataErrors)
235243 # (schema, metadata_glob)
236244 (config_root / "sdks_schema.yaml" , config_root , "sdks.yaml" ),
237245 (config_root / "services_schema.yaml" , config_root , "services.yaml" ),
238- (config_root / example_schema , doc_gen_root / ".doc_gen" / "metadata" , "*_metadata.yaml" ),
246+ (
247+ config_root / example_schema ,
248+ doc_gen_root / ".doc_gen" / "metadata" ,
249+ "*_metadata.yaml" ,
250+ ),
239251 ]
240252 for schema , meta_root , metadata in to_validate :
241253 validate_files (
0 commit comments