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.TypeCheckErrorThe 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.WrongTypeErrorError when provided an
objof the wrong type for aAnum- Parameters
target_cls (Anum) – the requested wrapped enumeration
obj (Any) – caller provided object, that is not of type
target_cls
- Return type
- exception adorn.exception.type_check_error.ComplexTypeMismatchError(target_cls, possibilities, obj)
Bases:
adorn.exception.type_check_error.TypeCheckErrorThe 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_clsobj (Params) –
Paramswith a value fortypethat doesn’t map to any of the subclasses oftarget_cls
- Return type
None
- exception adorn.exception.type_check_error.ExtraLiteralError(target_cls, extras)
Bases:
adorn.exception.type_check_error.TypeCheckErrortyping.Literalcontains additional keys not specified in the constructor.- Parameters
target_cls (Type) – the type which contains the problem
typing.Literalextras (List[str]) – the additional arguments specified in the
typing.Literalargument
- Return type
None
- exception adorn.exception.type_check_error.HashableError(target_cls, unit, obj)
Bases:
adorn.exception.type_check_error.TypeCheckErrorError 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_clsobj (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.TypeCheckErrorParamsobject had missing and/or additional information- Parameters
target_cls (type) – the type that the
objwas intended to createparameter_kv (Optional[Dict[str, type]]) – missing information from the
objobj_kv (Optional[Dict[str, type]]) – additional information in the
objobj (Params) – the
Paramsobject 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.TypeCheckErrorError when dependencies of the given
target_clsproduce 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.TypeCheckErrorDependenttype 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.TypeCheckErrortyping.Literalargument wasn’t of the correct type- Parameters
target_cls (Type) – the type which contained the problem
typing.Literalliteral_type (Type) – the required type of the
typing.Literalargumentchild (TypeCheckError) – the error produced by the
typing.Literalargument
- Return type
None
- exception adorn.exception.type_check_error.MissingDependencyError(target_cls, missing_dependency)
Bases:
adorn.exception.type_check_error.TypeCheckErrortyping.Literalrequested a dependency that doesn’t exist in local state- Parameters
target_cls (Type) – the type which contains the problem
typing.Literalmissing_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.TypeCheckErrorDependenttype’s first argument was not atyping.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.TypeCheckErrorError when an obj of not type
Paramsis 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
- exception adorn.exception.type_check_error.ParameterOrderError(target_cls, too_few, too_many)
Bases:
adorn.exception.type_check_error.TypeCheckErrorThe
parameter_orderattr contained too many and/or too few parameters- Parameters
target_cls (type) – the type with a malformed
parameter_orderattrtoo_few (Set[str]) – parameters not in
parameter_ordertoo_many (Set[str]) – additional parameters in
parameter_orderthat 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.TypeCheckErrortyping.Literalspecified a dependency that goes beyond one layer deepAn example would be “a.b.c”.
- Parameters
target_cls (Type) – the type which contains the problem
typing.Literalbad_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.TypeCheckErrorException 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:
ExceptionGeneric
Exceptionthat 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.TypeCheckErrorError when a
Unitdoes not cotain a given type.- Parameters
target_cls (type) – The requested type that can’t be expressed by the
Unitunit (Unit) – a collection of types that can’t express
target_clsobj (Any) – the caller created object that was supposed to map to
target_cls
- Return type
- exception adorn.exception.type_check_error.UnaryLiteralError(target_cls)
Bases:
adorn.exception.type_check_error.TypeCheckErrortyping.Literalthat was passed more than one arg- Parameters
target_cls (Type) – Type with a dependency that had a
typing.Literalwith 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.TypeCheckErrorReport an error during the from_obj step of
UserDictAlter- Parameters
alter_type (Type) – the type of
Alterbeing performedtarget_cls (Parameter) – the parameter the alter was trying to convert the
objintoobj (Any) – the alter request that produced an exception
exception (Exception) – the
Exceptionproduced from trying to convertobjinto the requested data.
- Return type
None
- exception adorn.exception.type_check_error.WrongTypeError(target_cls, obj)
Bases:
adorn.exception.type_check_error.TypeCheckErrorError when provided an
objof 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