93
93
94
94
from pact ._util import strftime_to_simple_date_format
95
95
from pact .generate .generator import (
96
- Generator ,
96
+ AbstractGenerator ,
97
97
GenericGenerator ,
98
98
)
99
99
116
116
#
117
117
# <https://github.com/pact-foundation/pact-reference/blob/303073c/rust/pact_models/src/generators/mod.rs#L121>
118
118
__all__ = [
119
- "Generator " ,
119
+ "AbstractGenerator " ,
120
120
"bool" ,
121
121
"boolean" ,
122
122
"date" ,
@@ -172,7 +172,7 @@ def int(
172
172
* ,
173
173
min : builtins .int | None = None ,
174
174
max : builtins .int | None = None ,
175
- ) -> Generator :
175
+ ) -> AbstractGenerator :
176
176
"""
177
177
Generate a random integer.
178
178
@@ -198,7 +198,7 @@ def integer(
198
198
* ,
199
199
min : builtins .int | None = None ,
200
200
max : builtins .int | None = None ,
201
- ) -> Generator :
201
+ ) -> AbstractGenerator :
202
202
"""
203
203
Alias for [`generate.int`][pact.generate.int].
204
204
@@ -215,7 +215,7 @@ def integer(
215
215
return int (min = min , max = max )
216
216
217
217
218
- def float (precision : builtins .int | None = None ) -> Generator :
218
+ def float (precision : builtins .int | None = None ) -> AbstractGenerator :
219
219
"""
220
220
Generate a random decimal number.
221
221
@@ -235,7 +235,7 @@ def float(precision: builtins.int | None = None) -> Generator:
235
235
return GenericGenerator ("RandomDecimal" , extra_fields = params )
236
236
237
237
238
- def decimal (precision : builtins .int | None = None ) -> Generator :
238
+ def decimal (precision : builtins .int | None = None ) -> AbstractGenerator :
239
239
"""
240
240
Alias for [`generate.float`][pact.generate.float].
241
241
@@ -249,7 +249,7 @@ def decimal(precision: builtins.int | None = None) -> Generator:
249
249
return float (precision = precision )
250
250
251
251
252
- def hex (digits : builtins .int | None = None ) -> Generator :
252
+ def hex (digits : builtins .int | None = None ) -> AbstractGenerator :
253
253
"""
254
254
Generate a random hexadecimal value.
255
255
@@ -266,7 +266,7 @@ def hex(digits: builtins.int | None = None) -> Generator:
266
266
return GenericGenerator ("RandomHexadecimal" , extra_fields = params )
267
267
268
268
269
- def hexadecimal (digits : builtins .int | None = None ) -> Generator :
269
+ def hexadecimal (digits : builtins .int | None = None ) -> AbstractGenerator :
270
270
"""
271
271
Alias for [`generate.hex`][pact.generate.hex].
272
272
@@ -280,7 +280,7 @@ def hexadecimal(digits: builtins.int | None = None) -> Generator:
280
280
return hex (digits = digits )
281
281
282
282
283
- def str (size : builtins .int | None = None ) -> Generator :
283
+ def str (size : builtins .int | None = None ) -> AbstractGenerator :
284
284
"""
285
285
Generate a random string.
286
286
@@ -297,7 +297,7 @@ def str(size: builtins.int | None = None) -> Generator:
297
297
return GenericGenerator ("RandomString" , extra_fields = params )
298
298
299
299
300
- def string (size : builtins .int | None = None ) -> Generator :
300
+ def string (size : builtins .int | None = None ) -> AbstractGenerator :
301
301
"""
302
302
Alias for [`generate.str`][pact.generate.str].
303
303
@@ -311,7 +311,7 @@ def string(size: builtins.int | None = None) -> Generator:
311
311
return str (size = size )
312
312
313
313
314
- def regex (regex : builtins .str ) -> Generator :
314
+ def regex (regex : builtins .str ) -> AbstractGenerator :
315
315
"""
316
316
Generate a string matching a regex pattern.
317
317
@@ -336,7 +336,7 @@ def regex(regex: builtins.str) -> Generator:
336
336
337
337
def uuid (
338
338
format : _UUID_FORMAT_NAMES = "lowercase" ,
339
- ) -> Generator :
339
+ ) -> AbstractGenerator :
340
340
"""
341
341
Generate a UUID.
342
342
@@ -354,7 +354,7 @@ def date(
354
354
format : builtins .str = "%Y-%m-%d" ,
355
355
* ,
356
356
disable_conversion : builtins .bool = False ,
357
- ) -> Generator :
357
+ ) -> AbstractGenerator :
358
358
"""
359
359
Generate a date value.
360
360
@@ -384,7 +384,7 @@ def time(
384
384
format : builtins .str = "%H:%M:%S" ,
385
385
* ,
386
386
disable_conversion : builtins .bool = False ,
387
- ) -> Generator :
387
+ ) -> AbstractGenerator :
388
388
"""
389
389
Generate a time value.
390
390
@@ -413,7 +413,7 @@ def datetime(
413
413
format : builtins .str ,
414
414
* ,
415
415
disable_conversion : builtins .bool = False ,
416
- ) -> Generator :
416
+ ) -> AbstractGenerator :
417
417
"""
418
418
Generate a datetime value.
419
419
@@ -444,7 +444,7 @@ def timestamp(
444
444
format : builtins .str ,
445
445
* ,
446
446
disable_conversion : builtins .bool = False ,
447
- ) -> Generator :
447
+ ) -> AbstractGenerator :
448
448
"""
449
449
Alias for [`generate.datetime`][pact.generate.datetime].
450
450
@@ -454,7 +454,7 @@ def timestamp(
454
454
return datetime (format = format , disable_conversion = disable_conversion )
455
455
456
456
457
- def bool () -> Generator :
457
+ def bool () -> AbstractGenerator :
458
458
"""
459
459
Generate a random boolean value.
460
460
@@ -464,7 +464,7 @@ def bool() -> Generator:
464
464
return GenericGenerator ("RandomBoolean" )
465
465
466
466
467
- def boolean () -> Generator :
467
+ def boolean () -> AbstractGenerator :
468
468
"""
469
469
Alias for [`generate.bool`][pact.generate.bool].
470
470
@@ -474,7 +474,7 @@ def boolean() -> Generator:
474
474
return bool ()
475
475
476
476
477
- def provider_state (expression : builtins .str | None = None ) -> Generator :
477
+ def provider_state (expression : builtins .str | None = None ) -> AbstractGenerator :
478
478
"""
479
479
Generate a value from provider state context.
480
480
@@ -494,7 +494,7 @@ def provider_state(expression: builtins.str | None = None) -> Generator:
494
494
def mock_server_url (
495
495
regex : builtins .str | None = None ,
496
496
example : builtins .str | None = None ,
497
- ) -> Generator :
497
+ ) -> AbstractGenerator :
498
498
"""
499
499
Generate a mock server URL.
500
500
0 commit comments