Skip to content

Commit

Permalink
chore: remove unnused generalisation
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
JP-Ellis committed Oct 2, 2024
1 parent fbb18fc commit 909a04e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
14 changes: 0 additions & 14 deletions src/pact/v3/generate/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand All @@ -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.
Expand All @@ -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]:
Expand All @@ -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]:
Expand All @@ -157,5 +144,4 @@ def to_generator_json(self) -> dict[str, Any]:
return {
"type": self.type,
**self._extra_fields,
**self._generator_json_fields,
}
16 changes: 1 addition & 15 deletions src/pact/v3/match/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand All @@ -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.
Expand All @@ -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())
)
Expand Down Expand Up @@ -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]:
Expand All @@ -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,
}


Expand Down

0 comments on commit 909a04e

Please sign in to comment.