core.internals.types¶
Submodule of khiops.core.internals
Khiops task argument mini-type system
Functions¶
DictType factory method |
|
ListType factory method |
|
TupleType factory method |
|
Returns True if the type is simple |
Classes¶
Base class for DictType containers |
|
Base class for ListType containers |
|
Base class for TupleTypes |
|
Boolean argument type |
|
Float argument type |
|
Integer argument type |
|
An argument for a Khiops task |
|
String like argument type |
- class khiops.core.internals.types.AbstractDictType¶
Bases:
KhiopsTaskArgumentType
Base class for DictType containers
See the factory method
DictType
.- abstract classmethod get_key_type()¶
Returns the type of the dictionary keys
- abstract classmethod get_value_type()¶
Return the type of the dictionary values
- classmethod is_of_this_type(arg)¶
Test if the argument belongs to this type
- classmethod short_name()¶
Returns a short name for this type
- classmethod to_scenario_arg(arg)¶
Returns a string representation to be used in an scenario file
- class khiops.core.internals.types.AbstractListType¶
Bases:
KhiopsTaskArgumentType
Base class for ListType containers
See the factory method
ListType
.- abstract classmethod get_value_type()¶
Return the type of the list values
- classmethod is_of_this_type(arg)¶
Test if the argument belongs to this type
- classmethod short_name()¶
Returns a short name for this type
- classmethod to_scenario_arg(arg)¶
Returns a string representation to be used in an scenario file
- class khiops.core.internals.types.AbstractTupleType¶
Bases:
KhiopsTaskArgumentType
Base class for TupleTypes
See the factory method
TupleType
.- abstract classmethod get_value_types()¶
Return the types of the tuple values
- classmethod is_of_this_type(arg)¶
Test if the argument belongs to this type
- classmethod short_name()¶
Returns a short name for this type
- classmethod to_scenario_arg(arg)¶
Returns a string representation to be used in an scenario file
- class khiops.core.internals.types.BoolType¶
Bases:
KhiopsTaskArgumentType
Boolean argument type
- classmethod is_of_this_type(arg)¶
Test if the argument belongs to this type
- classmethod short_name()¶
Returns a short name for this type
- classmethod to_scenario_arg(arg)¶
Returns a string representation to be used in an scenario file
- khiops.core.internals.types.DictType(key_type, value_type)¶
DictType factory method
Dicts are themselves of type
dict
and they contain key-value relations with fixed key and value types.- Parameters:
- key_type
KhiopsTaskArgumentType
Type of the dictionary’s keys.
- value_type
KhiopsTaskArgumentType
Type of the dictionary’s values.
- key_type
- Returns:
- type
A class which inherits from
AbstractDictType
.
- class khiops.core.internals.types.FloatType¶
Bases:
KhiopsTaskArgumentType
Float argument type
Note that literal int’s are valid float in this mini-type system. We accept int’s because it isn’t an error for a user to set a float argument to 2 instead of 2.0.
- classmethod is_of_this_type(arg)¶
Test if the argument belongs to this type
- classmethod short_name()¶
Returns a short name for this type
- classmethod to_scenario_arg(arg)¶
Returns a string representation to be used in an scenario file
- class khiops.core.internals.types.IntType¶
Bases:
KhiopsTaskArgumentType
Integer argument type
- classmethod is_of_this_type(arg)¶
Test if the argument belongs to this type
- classmethod short_name()¶
Returns a short name for this type
- classmethod to_scenario_arg(arg)¶
Returns a string representation to be used in an scenario file
- class khiops.core.internals.types.KhiopsTaskArgumentType¶
Bases:
ABC
An argument for a Khiops task
It provides the services to:
Verify that an argument belongs to the type
Transform the argument to an “scenario language” argument
This class is not instantiable.
- classmethod check(arg, arg_name)¶
Raises TypeError if the argument does not belongs to this type
- abstract classmethod is_of_this_type(arg)¶
Test if the argument belongs to this type
- abstract classmethod short_name()¶
Returns a short name for this type
- abstract classmethod to_scenario_arg(arg)¶
Returns a string representation to be used in an scenario file
- khiops.core.internals.types.ListType(value_type)¶
ListType factory method
Lists are themselves of type
list
and they may contain a variable number of elements of a single type.- Parameters:
- value_type
KhiopsTaskArgumentType
The type for the values contained in the list.
- value_type
- Returns:
- type
A class which inherits from
AbstractListType
.
- class khiops.core.internals.types.StringLikeType¶
Bases:
KhiopsTaskArgumentType
String like argument type
The string-like type is defined as the union of
str
andbytes
.- classmethod is_of_this_type(arg)¶
Test if the argument belongs to this type
- classmethod short_name()¶
Returns a short name for this type
- classmethod to_scenario_arg(arg)¶
Returns a string representation to be used in an scenario file
- khiops.core.internals.types.TupleType(*value_types)¶
TupleType factory method
Tuples are themselves of type
tuple
and they may contain a fixed number of elements each one with a fixed type.- Parameters:
- value_typeslist of
KhiopsTaskArgumentType
Type of the tuples value types. The resulting tuple type will admit only tuples of the same size of
value_types
.
- value_typeslist of
- Returns:
- type
A class which inherits from
AbstractTupleType
.
- khiops.core.internals.types.is_simple_type(arg_type)¶
Returns True if the type is simple
In this mini type system simple means that they are not generic containers.