Skip to main content

A python version of guava's preconditions

Project description

guava_preconditions

This library provides some simple functions from guava

Module guava_preconditions

Functions

checkArgument(expression: bool, errorMessageTemplate: Optional[str] = None, *errorMessageArgs: Any) ‑> None : Ensures the truth of an expression involving one or more parameters to the calling method.

checkElementIndex(index: int, size: int, desc: str = None) ‑> int : Ensures that index specifies a valid element in an array, list or string of size size.

checkNotNull(reference: Optional[~T], errorMessageTemplate: str, *errorMessageArgs: Any) ‑> ~T : Ensures that an object reference passed as a parameter to the calling method is not null.

checkPositionIndex(index: int, size: int, desc: str = None) ‑> int : Ensures that index specifies a valid position in an array, list or string of size size.

checkPositionIndexes(start: int, end: int, size: int) ‑> None : Ensures that start and end specify a valid positions in an array, list or string of size size, and are in order.

checkState(expression: bool, errorMessageTemplate: str = None, *errorMessageArgs: Any) ‑> None : Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.

Classes

IllegalArgumentException(*args, **kwargs) : Common base class for all non-exit exceptions.

### Ancestors (in MRO)

* builtins.Exception
* builtins.BaseException

IllegalStateException(*args, **kwargs) : Common base class for all non-exit exceptions.

### Ancestors (in MRO)

* builtins.Exception
* builtins.BaseException

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guava_preconditions-0.1.4.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

guava_preconditions-0.1.4-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page