From 909a04efbb8107f4926d343860b2bc640fa5363a Mon Sep 17 00:00:00 2001 From: JP-Ellis Date: Wed, 2 Oct 2024 13:38:54 +1000 Subject: [PATCH] chore: remove unnused generalisation The ability to add additional fields to either the integration JSON or FFI JSON representations is not used, and may never be needed. Signed-off-by: JP-Ellis --- src/pact/v3/generate/generator.py | 14 -------------- src/pact/v3/match/matcher.py | 16 +--------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src/pact/v3/generate/generator.py b/src/pact/v3/generate/generator.py index 21d5c34349..633740be6b 100644 --- a/src/pact/v3/generate/generator.py +++ b/src/pact/v3/generate/generator.py @@ -79,8 +79,6 @@ def __init__( type: GeneratorType, # noqa: A002 /, extra_fields: Mapping[str, Any] | None = None, - integration_fields: Mapping[str, Any] | None = None, - generator_json_fields: Mapping[str, Any] | None = None, **kwargs: Any, # noqa: ANN401 ) -> None: """ @@ -95,14 +93,6 @@ def __init__( These fields will be used when converting the generator to both an integration JSON object and a generator JSON object. - integration_fields: - Additional configuration elements to pass to the generator when - converting to an integration JSON object. - - generator_json_fields: - Additional configuration elements to pass to the generator when - converting to a generator JSON object. - **kwargs: Alternative way to pass additional configuration elements to the generator. See the `extra_fields` argument for more information. @@ -112,8 +102,6 @@ def __init__( The type of the generator. """ - self._integration_fields = integration_fields or {} - self._generator_json_fields = generator_json_fields or {} self._extra_fields = dict(chain((extra_fields or {}).items(), kwargs.items())) def to_integration_json(self) -> dict[str, Any]: @@ -133,7 +121,6 @@ def to_integration_json(self) -> dict[str, Any]: return { "pact:generator:type": self.type, **self._extra_fields, - **self._integration_fields, } def to_generator_json(self) -> dict[str, Any]: @@ -157,5 +144,4 @@ def to_generator_json(self) -> dict[str, Any]: return { "type": self.type, **self._extra_fields, - **self._generator_json_fields, } diff --git a/src/pact/v3/match/matcher.py b/src/pact/v3/match/matcher.py index ca83c5ff4e..1a24991919 100644 --- a/src/pact/v3/match/matcher.py +++ b/src/pact/v3/match/matcher.py @@ -83,15 +83,13 @@ class GenericMatcher(Matcher[_T]): for inclusion in the integration JSON object and matching rule. """ - def __init__( # noqa: PLR0913 + def __init__( self, type: MatcherType, # noqa: A002 /, value: _T | Unset = UNSET, generator: Generator | None = None, extra_fields: Mapping[str, Any] | None = None, - integration_fields: Mapping[str, Any] | None = None, - matching_rule_fields: Mapping[str, Any] | None = None, **kwargs: Matchable, ) -> None: """ @@ -116,14 +114,6 @@ def __init__( # noqa: PLR0913 fields will be used when converting the matcher to both an integration JSON object and a matching rule. - integration_fields: - Additional configuration elements to pass to the matcher when - converting it to an integration JSON object. - - matching_rule_fields: - Additional configuration elements to pass to the matcher when - converting it to a matching rule. - **kwargs: Alternative way to define extra fields. See the `extra_fields` argument for more information. @@ -143,8 +133,6 @@ def __init__( # noqa: PLR0913 Generator used to generate a value when the value is not provided. """ - self._integration_fields: Mapping[str, Any] = integration_fields or {} - self._matching_rule_fields: Mapping[str, Any] = matching_rule_fields or {} self._extra_fields: Mapping[str, Any] = dict( chain((extra_fields or {}).items(), kwargs.items()) ) @@ -179,7 +167,6 @@ def to_integration_json(self) -> dict[str, Any]: else {} ), **self._extra_fields, - **self._integration_fields, } def to_matching_rule(self) -> dict[str, Any]: @@ -205,7 +192,6 @@ def to_matching_rule(self) -> dict[str, Any]: "match": self.type, **({"value": self.value} if not isinstance(self.value, Unset) else {}), **self._extra_fields, - **self._matching_rule_fields, }