From d69bec3254bfd00075c6a2ca088936de2cd9bc09 Mon Sep 17 00:00:00 2001 From: Vlad Emelianov Date: Fri, 8 Nov 2024 01:51:34 +0300 Subject: [PATCH] Rename to mark_safe_typed_dicts --- mypy_boto3_builder/generators/base_generator.py | 4 ++-- .../parsers/service_package_parser.py | 4 ++-- vulture_whitelist.txt | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mypy_boto3_builder/generators/base_generator.py b/mypy_boto3_builder/generators/base_generator.py index 3f0a665c..d73a6c15 100644 --- a/mypy_boto3_builder/generators/base_generator.py +++ b/mypy_boto3_builder/generators/base_generator.py @@ -147,7 +147,7 @@ def _generate_full_stubs_services(self, package: Package) -> None: service_package = self._parse_service_package( service_name, package.version, package.data ) - ServicePackageParser.mark_unsafe_typed_dicts(service_package) + ServicePackageParser.mark_safe_typed_dicts(service_package) service_package.pypi_name = package.pypi_name service_package.version = package.version @@ -204,7 +204,7 @@ def _process_service( templates_path: Path, ) -> ServicePackage: service_package = self._parse_service_package(service_name, version, package_data) - ServicePackageParser.mark_unsafe_typed_dicts(service_package) + ServicePackageParser.mark_safe_typed_dicts(service_package) self.logger.debug(f"Writing {service_name.boto3_name}") self.package_writer.write_service_package( diff --git a/mypy_boto3_builder/parsers/service_package_parser.py b/mypy_boto3_builder/parsers/service_package_parser.py index 472044d6..3998f884 100644 --- a/mypy_boto3_builder/parsers/service_package_parser.py +++ b/mypy_boto3_builder/parsers/service_package_parser.py @@ -88,9 +88,9 @@ def parse(self) -> ServicePackage: return result @staticmethod - def mark_unsafe_typed_dicts(service_package: ServicePackage) -> None: + def mark_safe_typed_dicts(service_package: ServicePackage) -> None: """ - Mark TypedDicts that can't be rendered as classes safely. + Mark TypedDicts that can be rendered as classes safely. TypedDict cannot be rendered as class if its name or any attribute is a reserver word, or if any argument is names as another TypeDef. diff --git a/vulture_whitelist.txt b/vulture_whitelist.txt index dafba64a..349cd749 100644 --- a/vulture_whitelist.txt +++ b/vulture_whitelist.txt @@ -23,11 +23,11 @@ actions # unused variable (mypy_boto3_builder/parsers/shape_parser_types.py:104 has # unused variable (mypy_boto3_builder/parsers/shape_parser_types.py:106) service # unused variable (mypy_boto3_builder/parsers/shape_parser_types.py:114) resources # unused variable (mypy_boto3_builder/parsers/shape_parser_types.py:115) -_.boto3_version # unused attribute (mypy_boto3_builder/service_name.py:47) -_.import_name # unused property (mypy_boto3_builder/service_name.py:76) -_.extras_name # unused property (mypy_boto3_builder/service_name.py:87) -_.is_conda_forge_available # unused method (mypy_boto3_builder/service_name.py:100) -_.get_md_doc_link # unused method (mypy_boto3_builder/service_name.py:125) +_.boto3_version # unused attribute (mypy_boto3_builder/service_name.py:48) +_.import_name # unused property (mypy_boto3_builder/service_name.py:77) +_.extras_name # unused property (mypy_boto3_builder/service_name.py:88) +_.is_conda_forge_available # unused method (mypy_boto3_builder/service_name.py:101) +_.get_md_doc_link # unused method (mypy_boto3_builder/service_name.py:126) _.variable_name # unused property (mypy_boto3_builder/structures/class_record.py:91) _.method_names # unused property (mypy_boto3_builder/structures/class_record.py:98) _.client_error_class # unused attribute (mypy_boto3_builder/structures/client.py:40) @@ -56,7 +56,7 @@ _.essential_service_names # unused property (mypy_boto3_builder/structures/wrap _.get_init_required_import_records # unused method (mypy_boto3_builder/structures/wrapper_package.py:40) _.get_session_required_import_records # unused method (mypy_boto3_builder/structures/wrapper_package.py:50) _.type_hint_annotations # unused property (mypy_boto3_builder/type_annotations/type_def_sortable.py:33) -_.render_attribute # unused method (mypy_boto3_builder/type_annotations/type_typed_dict.py:62) -_.has_both # unused method (mypy_boto3_builder/type_annotations/type_typed_dict.py:211) -_.type_hint_annotations # unused property (mypy_boto3_builder/type_annotations/type_typed_dict.py:290) +_.render_attribute # unused method (mypy_boto3_builder/type_annotations/type_typed_dict.py:61) +_.has_both # unused method (mypy_boto3_builder/type_annotations/type_typed_dict.py:204) +_.type_hint_annotations # unused property (mypy_boto3_builder/type_annotations/type_typed_dict.py:283) _.type_hint_annotations # unused property (mypy_boto3_builder/type_annotations/type_union.py:148)