Skip to main content

Anticipate

Build Status

Expect the unexpected, but get what you want.

@anticipate(int)
def get_int():
  return '1'

assert get_int() == 1

@anticipate(str)
def get_str():
  return 22

assert get_str() == '22'

@anticipate([str])
def get_strs(*args):
  return args

assert list(get_strs(1, 2, 3)) == ['1', '2', '3']

Works much better with your own objects or with SpringField

Changelog

0.9.0

  • Dropped support for Python 2.6, added support for Python 3.7.

  • Cleaned up code formatting

Bug Fixes

  • Fixed issue that prevented use of an adaptable object (has an adapt method) as an anticipated list of type.

0.8.0

  • Change so that anticipating an iterable using [type] will always return a list instead of generator

  • Added anticipate_input_factory to make it easier to implement input handlers that need to inject values or handle input errors differently

  • Made it so you can use any object that implements adapt as an anticipate type so you can use SpringField fields as input types

  • Improved error messages

  • Split anticipate input and output handling into separate functions to make it easier to intercept input or output handling

  • Check that the params being anticipated exist in the function signature

Release files for anticipate 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anticipate 0.9.1
File Size Uploaded
anticipate-0.9.1.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anticipate 0.9.1
File Interpreter ABI Platform
anticipate-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / anticipate-0.9.1.tar.gz

Download URL anticipate-0.9.1.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
591c4312a55ba177754d7c13b718c5bdd3f834ed1ff572b53fa886ac7fd5b8f3
BLAKE2b-256 checksum
How to use checksums
decae2ba302ba20253352d7750b693d0cca2134e18cb50c5cb03b46fe28a3779
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.4

Release files / anticipate-0.9.1-py3-none-any.whl

Download URL anticipate-0.9.1-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
890f09cb730a8200fb5ea9ccc4bad256e5efc0245fd43f50d02f6d600e53c5c9
BLAKE2b-256 checksum
How to use checksums
3b8d8accc695ae0314b1615861424fb42148cd5635f7e773ccf572ffd610e5e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.4

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.8.0

1 release file

0.7.8

1 release file

0.7.7

1 release file

0.7.6

1 release file

0.7.5

1 release file

0.7.4

1 release file

0.7.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page