generative_ai.dataset_generation.utils_generation module#

Define functionalities for type annotations in dataset generation step.

class AttributeDetails(*, attribute_name: str)#

Bases: BaseModel

Store details of an attribute of a class.

attribute_name#

name of the attribute

Type:

str

attribute_name: str#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'attribute_name': FieldInfo(annotation=str, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class ClassDetails(*, member_type: Literal[MemberType.CLASS], class_parameters: list[ParameterDetails], class_methods: list[MethodDetails], class_attributes: list[AttributeDetails], class_summary: str | None = None, class_notes: str | None = None)#

Bases: BaseModel

Store details of a class.

member_type#

type of the member

Type:

typing.Literal[MemberType.CLASS]

class_parameters#

parameters of the class

Type:

list[ParameterDetails]

class_methods#

methods of the class

Type:

list[MethodDetails]

class_attributes#

attributes of the class

Type:

list[AttributeDetails]

class_summary#

Summary and Extended Summary sections from the class docstring, if any, by default None

Type:

str | None, optional

class_notes#

Notes and See Also sections from the class docstring, if any, by default None

Type:

str | None, optional

member_type: Literal[MemberType.CLASS]#
class_parameters: list[ParameterDetails]#
class_methods: list[MethodDetails]#
class_attributes: list[AttributeDetails]#
class_summary: str | None#
class_notes: str | None#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'class_attributes': FieldInfo(annotation=list[AttributeDetails], required=True), 'class_methods': FieldInfo(annotation=list[MethodDetails], required=True), 'class_notes': FieldInfo(annotation=Union[str, NoneType], required=False), 'class_parameters': FieldInfo(annotation=list[ParameterDetails], required=True), 'class_summary': FieldInfo(annotation=Union[str, NoneType], required=False), 'member_type': FieldInfo(annotation=Literal[<MemberType.CLASS: 'class'>], required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class Dataset(*, retrieval_chunks: list[str], tuning_documents: list[Document])#

Bases: BaseModel

Store details of a dataset.

retrieval_chunks#

chunks of text to be used for retrieval

Type:

list[str]

tuning_triplets#

pairs of question and answer to be used for tuning and their split allocation

Type:

list[tuple[str, str, SplitName]]

retrieval_chunks: list[str]#
tuning_documents: list[Document]#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'retrieval_chunks': FieldInfo(annotation=list[str], required=True), 'tuning_documents': FieldInfo(annotation=list[Document], required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class Document(*, context: str, question: str, answer: str, split: SplitName)#

Bases: BaseModel

Store details of a document.

context#

details containing the description

Type:

str

question#

question to be answered or instructions to follow using the context

Type:

str

answer#

answer to the question or instruction based on the context

Type:

str

context: str#
question: str#
answer: str#
split: SplitName#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'answer': FieldInfo(annotation=str, required=True), 'context': FieldInfo(annotation=str, required=True), 'question': FieldInfo(annotation=str, required=True), 'split': FieldInfo(annotation=SplitName, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class EnumDetails(*, member_type: Literal[MemberType.ENUM], enum_members: list[EnumMemberDetails])#

Bases: BaseModel

Store details of an enum.

member_type#

type of the member

Type:

typing.Literal[MemberType.ENUM]

enum_members#

members of the enum

Type:

list[EnumMemberDetails]

member_type: Literal[MemberType.ENUM]#
enum_members: list[EnumMemberDetails]#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'enum_members': FieldInfo(annotation=list[EnumMemberDetails], required=True), 'member_type': FieldInfo(annotation=Literal[<MemberType.ENUM: 'enum'>], required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class EnumMemberDetails(*, enum_member_name: str, enum_member_value: Any)#

Bases: BaseModel

Store details of an enum member.

enum_member_name#

name of the enum member

Type:

str

enum_member_value#

value of the enum member

Type:

typing.Any

enum_member_name: str#
enum_member_value: Any#
property enum_member: str#

Store name and value of the enum member.

Returns:

name and value of the enum member

Return type:

str

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {'enum_member': ComputedFieldInfo(wrapped_property=<functools.cached_property object>, return_type=<class 'str'>, alias=None, alias_priority=None, title=None, description='Store name and value of the enum member.\n\nReturns\n-------\nstr\n    name and value of the enum member', examples=None, json_schema_extra=None, repr=True)}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'enum_member_name': FieldInfo(annotation=str, required=True), 'enum_member_value': FieldInfo(annotation=Any, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class FunctionDetails(*, member_type: Literal[MemberType.FUNCTION], function_parameters: list[ParameterDetails], function_returns: ReturnDetails, function_summary: str | None = None, function_raises: list[RaiseDetails] | None = None, function_warns: list[WarnDetails] | None = None, function_notes: str | None = None, function_references: str | None = None, function_examples: str | None = None)#

Bases: BaseModel

Store details of a function.

member_type#

type of the member

Type:

typing.Literal[MemberType.FUNCTION]

function_parameters#

parameters of the function

Type:

list[ParameterDetails]

function_returns#

return type of the function

Type:

Returns

function_summary#

Summary and Extended Summary sections from the function docstring, if any, by default None

Type:

str | None, optional

function_raises#

exceptions raised by the function, if any, by default None

Type:

list[Raises] | None, optional

function_warns#

warnings raised by the function, if any, by default None

Type:

list[Warns] | None, optional

function_notes#

Notes and See Also sections from the function docstring, if any, by default None

Type:

str | None, optional

function_references#

References section from the function docstring, if any, by default None

Type:

str | None, optional

function_examples#

Examples section from the function docstring, if any, by default None

Type:

str | None, optional

member_type: Literal[MemberType.FUNCTION]#
function_parameters: list[ParameterDetails]#
function_returns: ReturnDetails#
function_summary: str | None#
function_raises: list[RaiseDetails] | None#
function_warns: list[WarnDetails] | None#
function_notes: str | None#
function_references: str | None#
function_examples: str | None#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'function_examples': FieldInfo(annotation=Union[str, NoneType], required=False), 'function_notes': FieldInfo(annotation=Union[str, NoneType], required=False), 'function_parameters': FieldInfo(annotation=list[ParameterDetails], required=True), 'function_raises': FieldInfo(annotation=Union[list[RaiseDetails], NoneType], required=False), 'function_references': FieldInfo(annotation=Union[str, NoneType], required=False), 'function_returns': FieldInfo(annotation=ReturnDetails, required=True), 'function_summary': FieldInfo(annotation=Union[str, NoneType], required=False), 'function_warns': FieldInfo(annotation=Union[list[WarnDetails], NoneType], required=False), 'member_type': FieldInfo(annotation=Literal[<MemberType.FUNCTION: 'function'>], required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class JSONDataset(*, retrieval_documents: list[str], tuning_documents: list[JSONDocument])#

Bases: BaseModel

Store all details for querying a package documentation in JSON format.

retrieval_documents#

chunks of text to be used for retrieval

Type:

list[str]

tuning_documents#

pairs of question and answer to be used for tuning

Type:

list[JSONDocument]

retrieval_documents: list[str]#
tuning_documents: list[JSONDocument]#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'retrieval_documents': FieldInfo(annotation=list[str], required=True), 'tuning_documents': FieldInfo(annotation=list[JSONDocument], required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class JSONDocument(*, context: str, question: str, answer: str, split: SplitName)#

Bases: BaseModel

Store details of a document in JSON format.

context#

details containing the description

Type:

str

question#

question to be answered or instructions to follow using the context

Type:

str

answer#

answer to the question or instruction based on the context

Type:

str

split#

split allocation of the document

Type:

SplitName

context: str#
question: str#
answer: str#
split: SplitName#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'answer': FieldInfo(annotation=str, required=True), 'context': FieldInfo(annotation=str, required=True), 'question': FieldInfo(annotation=str, required=True), 'split': FieldInfo(annotation=SplitName, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class MemberDetails(*, member_name: str, member_qualified_name: str, member_hierarchy: list[str], member_module: str, member_docstring: str, member_type_details: EnumDetails | ClassDetails | FunctionDetails | None = None)#

Bases: BaseModel

Store details of a member of a module.

member_name#

name of the member

Type:

str

member_qualified_name#

fully qualified name of the member that can be used to import the member

Type:

str

member_hierarchy#

hierarchy of the member with respect to the root package

Type:

list[str]

member_module#

name of the module which contains the member

Type:

str

member_docstring#

__doc__ attribute of the member, if any

Type:

str

member_type_details#

details of the member, if any, by default None

Type:

EnumDetails | ClassDetails | FunctionDetails | None, optional

member_name: str#
member_qualified_name: str#
member_hierarchy: list[str]#
member_module: str#
member_docstring: str#
member_type_details: EnumDetails | ClassDetails | FunctionDetails | None#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'member_docstring': FieldInfo(annotation=str, required=True), 'member_hierarchy': FieldInfo(annotation=list[str], required=True), 'member_module': FieldInfo(annotation=str, required=True), 'member_name': FieldInfo(annotation=str, required=True), 'member_qualified_name': FieldInfo(annotation=str, required=True), 'member_type_details': FieldInfo(annotation=Union[EnumDetails, ClassDetails, FunctionDetails, NoneType], required=False, discriminator='member_type')}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class MemberType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: str, Enum

Define supported member types.

ENUM = 'enum'#
CLASS = 'class'#
FUNCTION = 'function'#
class MethodDetails(*, method_name: str, method_parameters: list[str], method_summary: str | None = None)#

Bases: BaseModel

Store details of a method of a class.

method_name#

name of the method

Type:

str

method_parameters#

parameters of the method

Type:

list[str]

method_summary#

__doc__ attribute of the method, if any, by default None

Type:

str | None, optional

method_name: str#
method_parameters: list[str]#
method_summary: str | None#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'method_name': FieldInfo(annotation=str, required=True), 'method_parameters': FieldInfo(annotation=list[str], required=True), 'method_summary': FieldInfo(annotation=Union[str, NoneType], required=False)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class ModuleDetails(*, module_name: str, module_qualified_name: str, module_hierarchy: list[str], package_name: str, module_members: list[ModuleMemberDetails], module_summary: str | None = None, module_all_exports: list[str] | None = None)#

Bases: BaseModel

Store details of a python module.

module_name#

name of the module

Type:

str

module_qualified_name#

fully qualified name of the module that can be used to import the module

Type:

str

module_hierarchy#

hierarchy of the module with respect to the root package

Type:

list[str]

package_name#

name of the package which contains the module

Type:

str

module_members#

objects in the module

Type:

list[ModuleMemberDetails]

module_summary#

__doc__ attribute of the module, if any, by default None

Type:

str | None, optional

module_all_exports#

publicly exported objects that can be imported from the module, if any, by default None

Type:

list[str] | None, optional

module_name: str#
module_qualified_name: str#
module_hierarchy: list[str]#
package_name: str#
module_members: list[ModuleMemberDetails]#
module_summary: str | None#
module_all_exports: list[str] | None#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'module_all_exports': FieldInfo(annotation=Union[list[str], NoneType], required=False), 'module_hierarchy': FieldInfo(annotation=list[str], required=True), 'module_members': FieldInfo(annotation=list[ModuleMemberDetails], required=True), 'module_name': FieldInfo(annotation=str, required=True), 'module_qualified_name': FieldInfo(annotation=str, required=True), 'module_summary': FieldInfo(annotation=Union[str, NoneType], required=False), 'package_name': FieldInfo(annotation=str, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class ModuleMemberDetails(*, member_name: str, member_object: Any)#

Bases: BaseModel

Store details of an object of a python module.

member_name#

name of the object

Type:

str

member_object#

original object

Type:

typing.Any

member_name: str#
member_object: Any#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'member_name': FieldInfo(annotation=str, required=True), 'member_object': FieldInfo(annotation=Any, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class PackageDetails(*, package_name: str, package_qualified_name: str, package_hierarchy: list[str], parent_package_name: str | None, children_sub_packages_names: list[str], children_modules_names: list[str], package_summary: str | None = None, package_all_exports: list[str] | None = None)#

Bases: BaseModel

Store details of a python package.

package_name#

name of the package

Type:

str

package_qualified_name#

fully qualified name of the package that can be used to import the package

Type:

str

package_hierarchy#

hierarchy of the package, with respect to the root package, if any

Type:

list[str]

parent_package_name#

name of the package of which it is a sub-package, is any

Type:

str | None

children_sub_packages_names#

names of sub-packages in the package, if any

Type:

list[str]

children_modules_names#

names of any modules in the package, if any

Type:

list[str]

package_summary#

__doc__ attribute of the package, if any, by default None

Type:

str | None, optional

package_all_exports#

publicly exported objects that can be imported from the package, if any, by default None

Type:

list[str] | None, optional

package_name: str#
package_qualified_name: str#
package_hierarchy: list[str]#
parent_package_name: str | None#
children_sub_packages_names: list[str]#
children_modules_names: list[str]#
package_summary: str | None#
package_all_exports: list[str] | None#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'children_modules_names': FieldInfo(annotation=list[str], required=True), 'children_sub_packages_names': FieldInfo(annotation=list[str], required=True), 'package_all_exports': FieldInfo(annotation=Union[list[str], NoneType], required=False), 'package_hierarchy': FieldInfo(annotation=list[str], required=True), 'package_name': FieldInfo(annotation=str, required=True), 'package_qualified_name': FieldInfo(annotation=str, required=True), 'package_summary': FieldInfo(annotation=Union[str, NoneType], required=False), 'parent_package_name': FieldInfo(annotation=Union[str, NoneType], required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class ParameterDetails(*, parameter_name: str, parameter_default: Any, parameter_annotation: Any, parameter_kind: str, parameter_summary: str | None = None)#

Bases: BaseModel

Store details of an argument of a class or a function.

parameter_name#

name of the parameter

Type:

str

parameter_default#

default value of the parameter

Type:

typing.Any

parameter_annotation#

type annotation of the parameter

Type:

typing.Any

parameter_kind#

kind of argument, see Notes for possible values

Type:

str

parameter_summary#

argument description in class or function docstring, if any, by default None

Type:

str | None, optional

Notes

  • The kind must take a value from inspect._ParameterKind:

    • positional-only

    • positional or keyword

    • variadic positional

    • keyword-only

    • variadic keyword

parameter_name: str#
parameter_default: Any#
parameter_annotation: Any#
parameter_kind: str#
parameter_summary: str | None#
property parameter_details: str#

Store name and kind of the parameter.

Returns:

name and kind of the parameter

Return type:

str

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {'parameter_details': ComputedFieldInfo(wrapped_property=<functools.cached_property object>, return_type=<class 'str'>, alias=None, alias_priority=None, title=None, description='Store name and kind of the parameter.\n\nReturns\n-------\nstr\n    name and kind of the parameter', examples=None, json_schema_extra=None, repr=True)}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'parameter_annotation': FieldInfo(annotation=Any, required=True), 'parameter_default': FieldInfo(annotation=Any, required=True), 'parameter_kind': FieldInfo(annotation=str, required=True), 'parameter_name': FieldInfo(annotation=str, required=True), 'parameter_summary': FieldInfo(annotation=Union[str, NoneType], required=False)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class RaiseDetails(*, raises_type: str | None = None, raises_summary: str | None = None)#

Bases: BaseModel

Store details of the exception raised by a function.

raises_type#

type of the exception, if any, by default None

Type:

str | None, optional

raises_summary#

description of exception in function docstring, if any, by default None

Type:

str | None, optional

raises_type: str | None#
raises_summary: str | None#
property raises_details: str#

Store type and summary of the exception.

Returns:

type and summary of the exception

Return type:

str

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {'raises_details': ComputedFieldInfo(wrapped_property=<functools.cached_property object>, return_type=<class 'str'>, alias=None, alias_priority=None, title=None, description='Store type and summary of the exception.\n\nReturns\n-------\nstr\n    type and summary of the exception', examples=None, json_schema_extra=None, repr=True)}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'raises_summary': FieldInfo(annotation=Union[str, NoneType], required=False), 'raises_type': FieldInfo(annotation=Union[str, NoneType], required=False)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class ReturnDetails(*, returns_annotation: Any, returns_summary: str | None = None)#

Bases: BaseModel

Store details of the return type of a function.

returns_annotation#

type annotation of the return

Type:

typing.Any

returns_summary#

description of return in function docstring, if any, by default None

Type:

str | None, optional

returns_annotation: Any#
returns_summary: str | None#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'returns_annotation': FieldInfo(annotation=Any, required=True), 'returns_summary': FieldInfo(annotation=Union[str, NoneType], required=False)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class SplitName(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: str, Enum

Define supported split names.

TRAIN = 'train'#
VALIDATION = 'validation'#
TEST = 'test'#
class SplitProportions(*, train_proportion: float, validation_proportion: float, test_proportion: float)#

Bases: BaseModel

Specify proportions of train, validation and test subsets.

train_proportion#

proportion of train subset, must be in (0, 1)

Type:

float

validation_proportion#

proportion of validation subset, must be in (0, 1)

Type:

float

test_proportion#

proportion of test subset, must be in (0, 1)

Type:

float

Notes

  • The proportions must add up to 1.

train_proportion: float#
validation_proportion: float#
test_proportion: float#
validate_proportions() SplitProportions#

Ensure that specified proportions add up to 1.

Returns:

instance of the class itself

Return type:

SplitProportions

Raises:

ValueError -- if specified proportions do not sum up to 1

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'test_proportion': FieldInfo(annotation=float, required=True, metadata=[Gt(gt=0), Lt(lt=1)]), 'train_proportion': FieldInfo(annotation=float, required=True, metadata=[Gt(gt=0), Lt(lt=1)]), 'validation_proportion': FieldInfo(annotation=float, required=True, metadata=[Gt(gt=0), Lt(lt=1)])}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class WarnDetails(*, warns_type: str | None = None, warns_summary: str | None = None)#

Bases: BaseModel

Store details of the warning raised by a function.

warns_type#

type of the warning, if any, by default None

Type:

str | None, optional

warns_summary#

description of warning in function docstring, if any, by default None

Type:

str | None, optional

warns_type: str | None#
warns_summary: str | None#
property warns_details: str#

Store type and summary of the warning.

Returns:

type and summary of the warning

Return type:

str

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {'warns_details': ComputedFieldInfo(wrapped_property=<functools.cached_property object>, return_type=<class 'str'>, alias=None, alias_priority=None, title=None, description='Store type and summary of the warning.\n\nReturns\n-------\nstr\n    type and summary of the warning', examples=None, json_schema_extra=None, repr=True)}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'warns_summary': FieldInfo(annotation=Union[str, NoneType], required=False), 'warns_type': FieldInfo(annotation=Union[str, NoneType], required=False)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.