adorn.exception.type_check_error module

Exceptions specifying why a request was malformed

exception adorn.exception.type_check_error.AnumMemberError(target_cls, obj)

Bases: adorn.exception.type_check_error.TypeCheckError

The str specified doesn’t match any of the members of target_cls

Parameters
  • target_cls (Anum) – the requested wrapped enumeration

  • obj (str) – requested member that does not exist

Return type

None

exception adorn.exception.type_check_error.AnumWrongTypeError(target_cls, obj)

Bases: adorn.exception.type_check_error.WrongTypeError

Error when provided an obj of the wrong type for a Anum

Parameters
  • target_cls (Anum) – the requested wrapped enumeration

  • obj (Any) – caller provided object, that is not of type target_cls

Return type

TypeCheckError

exception adorn.exception.type_check_error.ComplexTypeMismatchError(target_cls, possibilities, obj)

Bases: adorn.exception.type_check_error.TypeCheckError

The type specified doesn’t match any of the options for the target_cls

Parameters
  • target_cls (Type) – the requested type

  • possibilities (Dict[str, type]) – the different subclasses that can be requested for target_cls

  • obj (Params) – Params with a value for type that doesn’t map to any of the subclasses of target_cls

Return type

None

exception adorn.exception.type_check_error.ExtraLiteralError(target_cls, extras)

Bases: adorn.exception.type_check_error.TypeCheckError

typing.Literal contains additional keys not specified in the constructor.

Parameters
  • target_cls (Type) – the type which contains the problem typing.Literal

  • extras (List[str]) – the additional arguments specified in the typing.Literal argument

Return type

None

exception adorn.exception.type_check_error.HashableError(target_cls, unit, obj)

Bases: adorn.exception.type_check_error.TypeCheckError

Error when a Unit’s subtype is not hashable.

This is typically caused when a type is wrapped in a Set, but the wrapped type is not hashable.

Parameters
  • target_cls (Type) – The requested type, that isn’t hashable

  • unit (Unit) – the collection of types that contained target_cls

  • obj (Optional[Any]) – the caller created object that maps to the unhashable type

Return type

None

exception adorn.exception.type_check_error.KeyValueDiffError(target_cls, parameter_kv, obj_kv, obj)

Bases: adorn.exception.type_check_error.TypeCheckError

Params object had missing and/or additional information

Parameters
  • target_cls (type) – the type that the obj was intended to create

  • parameter_kv (Optional[Dict[str, type]]) – missing information from the obj

  • obj_kv (Optional[Dict[str, type]]) – additional information in the obj

  • obj (Params) – the Params object that has missing and/or additional information

Return type

None

exception adorn.exception.type_check_error.KeyValueError(target_cls, key_values, obj)

Bases: adorn.exception.type_check_error.TypeCheckError

Error when dependencies of the given target_cls produce an error.

Parameters
  • target_cls (type) – the requested type, whose dependencies produced error(s)

  • key_values (DictOrList) – a collection of the name of the dependency and error the dependency produced

  • obj (Union[List[Any], Dict[str, Any]]) – caller specified values for the dependencies

Return type

None

static get_msg(target_cls, key_values)

Generate the msg containing why the dependencies produced an error.

Parameters
  • target_cls (type) – the requested type, whose dependencies produced error(s)

  • key_values (DictOrList) – a collection of the name of the dependency and error the dependency produced

Returns

message containing the reasons why the dependencies produced

errors

Return type

List[str]

exception adorn.exception.type_check_error.MalformedDependencyError(target_cls)

Bases: adorn.exception.type_check_error.TypeCheckError

Dependent type was not provided all the necessary information.

Parameters

target_cls (Type) – The type with malformed dependency information

Return type

None

exception adorn.exception.type_check_error.MalformedLiteralError(target_cls, literal_type, child)

Bases: adorn.exception.type_check_error.TypeCheckError

typing.Literal argument wasn’t of the correct type

Parameters
  • target_cls (Type) – the type which contained the problem typing.Literal

  • literal_type (Type) – the required type of the typing.Literal argument

  • child (TypeCheckError) – the error produced by the typing.Literal argument

Return type

None

exception adorn.exception.type_check_error.MissingDependencyError(target_cls, missing_dependency)

Bases: adorn.exception.type_check_error.TypeCheckError

typing.Literal requested a dependency that doesn’t exist in local state

Parameters
  • target_cls (Type) – the type which contains the problem typing.Literal

  • missing_dependency (Dict[str, str]) – the dependency requests that didn’t exist in the local state

Return type

None

exception adorn.exception.type_check_error.MissingLiteralError(target_cls)

Bases: adorn.exception.type_check_error.TypeCheckError

Dependent type’s first argument was not a typing.Literal.

Parameters

target_cls (Type) – Type with a dependency that didn’t have a typing.Literal

Return type

None

exception adorn.exception.type_check_error.ParamError(target_cls, obj)

Bases: adorn.exception.type_check_error.TypeCheckError

Error when an obj of not type Params is passed

Parameters
  • target_cls (type) – the requested type to perform an action against

  • obj (Any) – caller provided object, that is not of type Params

Return type

TypeCheckError

exception adorn.exception.type_check_error.ParameterOrderError(target_cls, too_few, too_many)

Bases: adorn.exception.type_check_error.TypeCheckError

The parameter_order attr contained too many and/or too few parameters

Parameters
  • target_cls (type) – the type with a malformed parameter_order attr

  • too_few (Set[str]) – parameters not in parameter_order

  • too_many (Set[str]) – additional parameters in parameter_order that aren’t in the constructor

Return type

None

exception adorn.exception.type_check_error.TooDeepLiteralError(target_cls, bad_literal)

Bases: adorn.exception.type_check_error.TypeCheckError

typing.Literal specified a dependency that goes beyond one layer deep

An example would be “a.b.c”.

Parameters
  • target_cls (Type) – the type which contains the problem typing.Literal

  • bad_literal (List[str]) – the dependency requests that went too deep

Return type

None

exception adorn.exception.type_check_error.TupleArgLenError(target_cls, obj)

Bases: adorn.exception.type_check_error.TypeCheckError

Exception when the number of args specified in the Tuple does not match the object’s length.

Parameters
  • target_cls (Type) – the tuple type

  • obj (Optional[Any]) – the caller created object that has a length different than that specified by target_cls

Return type

None

exception adorn.exception.type_check_error.TypeCheckError(target_cls, msg, child=None, obj=None)

Bases: Exception

Generic Exception that contains the state the produced the error.

Parameters
  • target_cls (Type) – the requested type to perform an action against

  • msg (List[str]) – explanation about the exception

  • child (Optional[TypeCheckError]) – an excpetion produced by a downstream process

  • obj (Optional[Any]) – the caller provided object, that was innvolved in causing the error

Return type

None

to_str(seed='')

Create a sting with the reason/explanation of the error.

Parameters

seed (str) – spacing used to compose error statements in a cute way

Returns

information about the error

Return type

str

exception adorn.exception.type_check_error.UnRepresentedTypeError(target_cls, unit, obj)

Bases: adorn.exception.type_check_error.TypeCheckError

Error when a Unit does not cotain a given type.

Parameters
  • target_cls (type) – The requested type that can’t be expressed by the Unit

  • unit (Unit) – a collection of types that can’t express target_cls

  • obj (Any) – the caller created object that was supposed to map to target_cls

Return type

TypeCheckError

exception adorn.exception.type_check_error.UnaryLiteralError(target_cls)

Bases: adorn.exception.type_check_error.TypeCheckError

typing.Literal that was passed more than one arg

Parameters

target_cls (Type) – Type with a dependency that had a typing.Literal with more than one arg

Return type

None

exception adorn.exception.type_check_error.UserDictError(alter_type, target_cls, obj, exception)

Bases: adorn.exception.type_check_error.TypeCheckError

Report an error during the from_obj step of UserDictAlter

Parameters
  • alter_type (Type) – the type of Alter being performed

  • target_cls (Parameter) – the parameter the alter was trying to convert the obj into

  • obj (Any) – the alter request that produced an exception

  • exception (Exception) – the Exception produced from trying to convert obj into the requested data.

Return type

None

exception adorn.exception.type_check_error.WrongTypeError(target_cls, obj)

Bases: adorn.exception.type_check_error.TypeCheckError

Error when provided an obj of the wrong type

Parameters
  • target_cls (type) – the requested type to perform an action against

  • obj (Any) – caller provided object, that is not of type target_cls

Return type

TypeCheckError