Skip to content

Commit a7ac6a9

Browse files
committed
docs: fix internal references
An update to MkDocstrings means we can use scoped references. Signed-off-by: JP-Ellis <josh@jpellis.me>
1 parent e587558 commit a7ac6a9

File tree

14 files changed

+97
-109
lines changed

14 files changed

+97
-109
lines changed

examples/plugins/proto/person_pb2_grpc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ def GetPerson(
104104
The response containing the person's details.
105105
106106
Raises:
107-
If the method is not implemented.
107+
NotImplementedError:
108+
If the method is not implemented.
108109
"""
109110
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
110111
context.set_details("Method not implemented!")

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ plugins:
6161
ignore_init_summary: true
6262
docstring_section_style: spacy
6363
merge_init_into_class: true
64-
relative_crossrefs: true
64+
# relative_crossrefs: true
6565
scoped_crossrefs: true
6666
show_if_no_docstring: true
6767
# Signature

src/pact/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
1414
The primary entry points for contract testing are:
1515
16-
- [`Pact`][pact.Pact]: For consumer-side contract testing, defining expected
16+
- [`Pact`][Pact]: For consumer-side contract testing, defining expected
1717
interactions and generating contract files.
18-
- [`Verifier`][pact.Verifier]: For provider-side contract verification,
18+
- [`Verifier`][Verifier]: For provider-side contract verification,
1919
validating that a provider implementation satisfies consumer contracts.
2020
21-
These functions are defined in [`pact.pact`][pact.pact] and
22-
[`pact.verifier`][pact.verifier] and re-exported for convenience.
21+
These functions are defined in [`pact.pact`][pact] and
22+
[`pact.verifier`][verifier] and re-exported for convenience.
2323
2424
### Matching and Generation
2525

src/pact/error.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ class PactVerificationError(PactError):
7777
All of the errors that occurred during the verification of all of the
7878
interactions are stored in the `errors` attribute.
7979
80-
This is different from the [`MismatchesError`][pact.error.MismatchesError]
81-
which is raised when there are mismatches detected by the mock server.
80+
This is different from the [`MismatchesError`][error.MismatchesError] which
81+
is raised when there are mismatches detected by the mock server.
8282
"""
8383

8484
def __init__(self, errors: list[InteractionVerificationError]) -> None:

src/pact/generate/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def integer(
202202
max: builtins.int | None = None,
203203
) -> AbstractGenerator:
204204
"""
205-
Alias for [`generate.int`][pact.generate.int].
205+
Alias for [`generate.int`][int].
206206
207207
Args:
208208
min:
@@ -239,7 +239,7 @@ def float(precision: builtins.int | None = None) -> AbstractGenerator:
239239

240240
def decimal(precision: builtins.int | None = None) -> AbstractGenerator:
241241
"""
242-
Alias for [`generate.float`][pact.generate.float].
242+
Alias for [`generate.float`][float].
243243
244244
Args:
245245
precision:
@@ -270,7 +270,7 @@ def hex(digits: builtins.int | None = None) -> AbstractGenerator:
270270

271271
def hexadecimal(digits: builtins.int | None = None) -> AbstractGenerator:
272272
"""
273-
Alias for [`generate.hex`][pact.generate.hex].
273+
Alias for [`generate.hex`][hex].
274274
275275
Args:
276276
digits:
@@ -301,7 +301,7 @@ def str(size: builtins.int | None = None) -> AbstractGenerator:
301301

302302
def string(size: builtins.int | None = None) -> AbstractGenerator:
303303
"""
304-
Alias for [`generate.str`][pact.generate.str].
304+
Alias for [`generate.str`][str].
305305
306306
Args:
307307
size:
@@ -448,7 +448,7 @@ def timestamp(
448448
disable_conversion: builtins.bool = False,
449449
) -> AbstractGenerator:
450450
"""
451-
Alias for [`generate.datetime`][pact.generate.datetime].
451+
Alias for [`generate.datetime`][datetime].
452452
453453
Returns:
454454
Generator producing datetimes in the specified format.
@@ -468,7 +468,7 @@ def bool() -> AbstractGenerator:
468468

469469
def boolean() -> AbstractGenerator:
470470
"""
471-
Alias for [`generate.bool`][pact.generate.bool].
471+
Alias for [`generate.bool`][bool].
472472
473473
Returns:
474474
Generator producing random boolean values.

src/pact/generate/generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def to_integration_json(self) -> dict[str, Any]:
3737
Convert the generator to an integration JSON object.
3838
3939
See
40-
[`AbstractGenerator.to_integration_json`][pact.generate.generator.AbstractGenerator.to_integration_json]
40+
[`AbstractGenerator.to_integration_json`][AbstractGenerator.to_integration_json]
4141
for more information.
4242
"""
4343

@@ -102,7 +102,7 @@ def to_integration_json(self) -> dict[str, Any]:
102102
Convert the generator to an integration JSON object.
103103
104104
See
105-
[`AbstractGenerator.to_integration_json`][pact.generate.generator.AbstractGenerator.to_integration_json]
105+
[`AbstractGenerator.to_integration_json`][AbstractGenerator.to_integration_json]
106106
for more information.
107107
"""
108108
return {
@@ -115,7 +115,7 @@ def to_generator_json(self) -> dict[str, Any]:
115115
Convert the generator to a generator JSON object.
116116
117117
See
118-
[`AbstractGenerator.to_generator_json`][pact.generate.generator.AbstractGenerator.to_generator_json]
118+
[`AbstractGenerator.to_generator_json`][AbstractGenerator.to_generator_json]
119119
for more information.
120120
"""
121121
return {

src/pact/interaction/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Interaction module.
33
44
This module defines the classes that are used to define individual interactions
5-
within a [`Pact`][pact.pact.Pact] between a consumer and a provider. These
5+
within a [`Pact`][pact.Pact] between a consumer and a provider. These
66
interactions can be of different types, such as HTTP requests, synchronous
77
messages, or asynchronous messages.
88

src/pact/interaction/_base.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class Interaction(abc.ABC):
3434
provider. The concrete subclasses define the type of interaction, and
3535
include:
3636
37-
- [`HttpInteraction`][pact.interaction.HttpInteraction]
38-
- [`AsyncMessageInteraction`][pact.interaction.AsyncMessageInteraction]
39-
- [`SyncMessageInteraction`][pact.interaction.SyncMessageInteraction]
37+
- [`HttpInteraction`][HttpInteraction]
38+
- [`AsyncMessageInteraction`][AsyncMessageInteraction]
39+
- [`SyncMessageInteraction`][SyncMessageInteraction]
4040
4141
# Interaction Part
4242
@@ -244,8 +244,7 @@ def with_binary_body(
244244
Adds a binary body to the request or response.
245245
246246
Note that for HTTP interactions, this function will overwrite the body
247-
if it has been set using
248-
[`with_body`][pact.interaction.Interaction.with_body].
247+
if it has been set using [`with_body`][with_body].
249248
250249
Args:
251250
body:
@@ -295,8 +294,8 @@ def with_metadata(
295294
The values must be serializable to JSON using [`json.dumps`][json.dumps]
296295
and may contain matchers and generators. If you wish to use a valid
297296
JSON-encoded string as a metadata value, prefer the
298-
[`set_metadata`][pact.interaction.Interaction.set_metadata] method as
299-
this does not perform any additional parsing of the string.
297+
[`set_metadata`][set_metadata] method as this does not perform any
298+
additional parsing of the string.
300299
301300
Args:
302301
metadata:
@@ -340,10 +339,9 @@ def set_metadata(
340339
"""
341340
Add metadata for the interaction.
342341
343-
This function behaves exactly like
344-
[`with_metadata`][pact.interaction.Interaction.with_metadata] but does
345-
not perform any parsing of the value strings. The strings must be valid
346-
JSON-encoded strings.
342+
This function behaves exactly like [`with_metadata`][with_metadata] but
343+
does not perform any parsing of the value strings. The strings must be
344+
valid JSON-encoded strings.
347345
348346
The value of `None` will remove the metadata key from the interaction.
349347
This is distinct from using an empty string or a string containing the
@@ -452,7 +450,8 @@ def set_comment(self, key: str, value: Any | None) -> Self: # noqa: ANN401
452450
# Warning
453451
454452
This function will overwrite any existing comment with the same key. In
455-
particular, the `text` key is used by `add_text_comment`.
453+
particular, the `text` key is used by
454+
[`add_text_comment`][add_text_comment].
456455
"""
457456
if isinstance(value, str) or value is None:
458457
pact_ffi.set_comment(self._handle, key, value)
@@ -475,7 +474,7 @@ def add_text_comment(self, comment: str) -> Self:
475474
476475
Internally, the comments are appended to an array under the `text`
477476
comment key. Care should be taken to ensure that conflicts are not
478-
introduced by [`set_comment`][pact.interaction.Interaction.set_comment].
477+
introduced by [`set_comment`][set_comment].
479478
"""
480479
pact_ffi.add_text_comment(self._handle, comment)
481480
return self

src/pact/interaction/_http_interaction.py

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ class HttpInteraction(Interaction):
3232
HTTP interaction. As many elements are shared between the request and
3333
response, this class provides a common interface for both. The functions
3434
intelligently determine whether the element should be added to the request
35-
or the response based on whether
36-
[`will_respond_with`][pact.interaction.HttpInteraction.will_respond_with]
35+
or the response based on whether [`will_respond_with`][will_respond_with]
3736
has been called.
3837
3938
For example, the following two interactions are equivalent:
@@ -165,9 +164,8 @@ def with_header(
165164
166165
If `None`, then the function intelligently determines whether
167166
the header should be added to the request or the response, based
168-
on whether the
169-
[`will_respond_with`][pact.interaction.HttpInteraction.will_respond_with]
170-
method has been called.
167+
on whether the [`will_respond_with`][will_respond_with] method
168+
has been called.
171169
"""
172170
interaction_part = self._parse_interaction_part(part)
173171
name_lower = name.lower()
@@ -204,10 +202,10 @@ def with_headers(
204202
- Passing in an iterable of key-value tuples.
205203
206204
- Make multiple calls to this function or
207-
[`with_header`][pact.interaction.HttpInteraction.with_header].
205+
[`with_header`][with_header].
208206
209207
See
210-
[`with_header`][pact.interaction.HttpInteraction.with_header]
208+
[`with_header`][with_header]
211209
for more information.
212210
213211
Args:
@@ -220,9 +218,8 @@ def with_headers(
220218
221219
If `None`, then the function intelligently determines whether
222220
the header should be added to the request or the response, based
223-
on whether the
224-
[`will_respond_with`][pact.interaction.HttpInteraction.will_respond_with]
225-
method has been called.
221+
on whether the [`will_respond_with`][will_respond_with] method
222+
has been called.
226223
"""
227224
if isinstance(headers, dict):
228225
headers = headers.items()
@@ -239,10 +236,9 @@ def set_header(
239236
r"""
240237
Add a header to the request.
241238
242-
Unlike
243-
[`with_header`][pact.interaction.HttpInteraction.with_header], this
244-
function does no additional processing of the header value. This is
245-
useful for headers that contain a JSON object.
239+
Unlike [`with_header`][with_header], this function does no additional
240+
processing of the header value. This is useful for headers that contain
241+
a JSON object.
246242
247243
Args:
248244
name:
@@ -257,9 +253,8 @@ def set_header(
257253
258254
If `None`, then the function intelligently determines whether
259255
the header should be added to the request or the response, based
260-
on whether the
261-
[`will_respond_with`][pact.interaction.HttpInteraction.will_respond_with]
262-
method has been called.
256+
on whether the [`will_respond_with`][will_respond_with] method
257+
has been called.
263258
"""
264259
pact_ffi.set_header(
265260
self._handle,
@@ -287,10 +282,9 @@ def set_headers(
287282
- Passing in an iterable of key-value tuples.
288283
289284
- Make multiple calls to this function or
290-
[`with_header`][pact.interaction.HttpInteraction.with_header].
285+
[`with_header`][with_header].
291286
292-
See [`set_header`][pact.interaction.HttpInteraction.set_header] for
293-
more information.
287+
See [`set_header`][set_header] for more information.
294288
295289
Args:
296290
headers:
@@ -302,8 +296,7 @@ def set_headers(
302296
303297
If `None`, then the function intelligently determines whether
304298
the headers should be added to the request or the response,
305-
based on whether the
306-
[`will_respond_with`][pact.interaction.HttpInteraction.will_respond_with]
299+
based on whether the [`will_respond_with`][will_respond_with]
307300
method has been called.
308301
"""
309302
if isinstance(headers, dict):
@@ -372,11 +365,9 @@ def with_query_parameters(
372365
- Passing in an iterable of key-value tuples.
373366
374367
- Make multiple calls to this function or
375-
[`with_query_parameter`][pact.interaction.HttpInteraction.with_query_parameter].
368+
[`with_query_parameter`][with_query_parameter].
376369
377-
See
378-
[`with_query_parameter`][pact.interaction.HttpInteraction.with_query_parameter]
379-
for more information.
370+
See [`with_query_parameter`][with_query_parameter] for more information.
380371
381372
Args:
382373
parameters:
@@ -393,9 +384,8 @@ def will_respond_with(self, status: int) -> Self:
393384
Set the response status.
394385
395386
Ideally, this function is called once all of the request information has
396-
been set. This allows functions such as
397-
[`with_header`][pact.interaction.HttpInteraction.with_header]
398-
to intelligently determine whether this is a request or response header.
387+
been set. This allows functions such as [`with_header`][with_header] to
388+
intelligently determine whether this is a request or response header.
399389
400390
Alternatively, the `part` argument can be used to explicitly specify
401391
whether the header should be added to the request or the response.

src/pact/interaction/_sync_message_interaction.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SyncMessageInteraction(Interaction):
1818
A synchronous message interaction.
1919
2020
This class defines a synchronous message interaction between a consumer and
21-
a provider. As with [`HttpInteraction`][pact.pact.HttpInteraction], it
21+
a provider. As with [`HttpInteraction`][HttpInteraction], it
2222
defines a specific request that the consumer makes to the provider, and the
2323
response that the provider should return.
2424
"""
@@ -29,8 +29,8 @@ def __init__(self, pact_handle: pact_ffi.PactHandle, description: str) -> None:
2929
3030
This function should not be called directly. Instead, an
3131
AsyncMessageInteraction should be created using the
32-
[`upon_receiving`][pact.Pact.upon_receiving] method of a
33-
[`Pact`][pact.Pact] instance using the `"Sync"` interaction type.
32+
[`upon_receiving`][Pact.upon_receiving] method of a
33+
[`Pact`][Pact] instance using the `"Sync"` interaction type.
3434
3535
Args:
3636
pact_handle:
@@ -67,9 +67,8 @@ def will_respond_with(self) -> Self:
6767
6868
This method is a convenience method to separate the request and response
6969
parts of the interaction. This function is analogous to the
70-
[`will_respond_with()`][pact.pact.HttpInteraction.will_respond_with]
71-
method of the [`HttpInteraction`][pact.pact.HttpInteraction] class,
72-
albeit more generic for synchronous message interactions.
70+
[`HttpInteraction.will_respond_with()`][HttpInteraction.will_respond_with]
71+
method, albeit more generic for synchronous message interactions.
7372
7473
For example, the following two snippets are equivalent:
7574

0 commit comments

Comments
 (0)