7. API Documentation

7.1. API Proper

class bordered(text, width=160)

Create a fancy bordered textbox as used in Aspidites.api.Warn.

Return type

str

class Warn(stack, func, *args, **kwargs)

Creates a nice human-readable warning with a fancy border.

7.2. Compiler

class CheckedFileStack(initial=None, pre_size=128)

A convenience class for reading and checksumming file data streams.

create_file(fname, mode, root='', text='# THIS FILE IS GENERATED BY ASPIDITES v1.16.1 - DO NOT EDIT #')

API for creating and registering checked files

Return type

None

finalize()

Read and check all files against their stored digests.

Return type

None

register(fname)

Registers a filename to a checksum of its contents.

class CompilerArgs(**kwargs)

code: pyparsing.ParseResults

fname: pathlib.Path

force: bool

bytecode: bool

build_requires: typing.Union[typing.List, str]

verbose int

embed: typing.Union[str, None]

class Compiler(compile_args)
Parameters

compile_args (Aspidites.compiler.CompilerArgs) –

7.3. Monads

class Maybe(func, *args, **kwargs)

Sandboxes a Aspidites.monads.Surely call and handles ContractNotRespected by returning an instance of Aspidites.math.Undefined

__call__(warn_undefined=True)

Call self as a function.

Return type

Union[Aspidites.monads.Surely, Aspidites.math.Undefined, Any]

class Surely(instance__=Undefined(None, (), {}), *args, **kwargs)

A monad for a successful programmatic unit. Truthy, defers to an instance of a successful computation

7.4. Math

class Undefined(func=None, *args, **kwargs)

A monad for a failed programmatic unit; like NoneType but hashable. Falsy singleton acts as an absorbing element for division.

__init__(func=None, *args, **kwargs)
__new__(**kwargs)
SafeDiv(a, b)
Parameters
Return type

Union[int, float, complex, numpy.number, Aspidites.math.Undefined]

SafeExp(a, b)
Parameters
Return type

Union[int, float, complex, numpy.number, Aspidites.math.Undefined]

SafeFactorial(a)
Parameters

a (Union[int, float, complex, numpy.number]) –

Return type

Union[int, float, complex, numpy.number, Aspidites.math.Undefined]

SafeFloorDiv(a, b)
Parameters
Return type

Union[int, float, complex, numpy.number, Aspidites.math.Undefined]

SafeMod(a, b)
Parameters
Return type

Union[int, float, complex, numpy.number, Aspidites.math.Undefined]

SafeUnaryAdd(a)
Parameters

a (Union[int, float, complex, numpy.number]) –

Return type

Union[int, float, complex, numpy.number, Aspidites.math.Undefined]

SafeUnarySub(a)
Parameters

a (Union[int, float, complex, numpy.number]) –

Return type

Union[int, float, complex, numpy.number, Aspidites.math.Undefined]