Skip to content

Library

Information dataclass

Information about the library.

Attributes

author class-attribute instance-attribute

author: Final[str] = 'Juan Rada-Vilela, PhD'

author_email class-attribute instance-attribute

author_email: Final[str] = 'jcrada@fuzzylite.com'

company class-attribute instance-attribute

company: Final[str] = 'FuzzyLite'

copyright class-attribute instance-attribute

copyright: Final[str] = 'Copyright (C) 2010-2024 FuzzyLite by Juan Rada-Vilela. All rights reserved.'

description class-attribute instance-attribute

description: Final[str] = 'a fuzzy logic control library in Python'

license class-attribute instance-attribute

license: Final[str] = 'FuzzyLite License'

name class-attribute instance-attribute

name: Final[str] = 'fuzzylite'

version property

version: str

Automatic version of the library handled by poetry using [tool.poetry_bumpversion.file."fuzzylite/library.py"].

Returns:

Type Description
str

version of the library

website class-attribute instance-attribute

website: Final[str] = 'https://fuzzylite.com/'

Functions

__init__

__init__(
    name: Final[str] = "fuzzylite",
    description: Final[str] = "a fuzzy logic control library in Python",
    license: Final[str] = "FuzzyLite License",
    author: Final[str] = "Juan Rada-Vilela, PhD",
    author_email: Final[str] = "jcrada@fuzzylite.com",
    company: Final[str] = "FuzzyLite",
    website: Final[str] = "https://fuzzylite.com/",
    copyright: Final[str] = "Copyright (C) 2010-2024 FuzzyLite by Juan Rada-Vilela. All rights reserved.",
) -> None

__repr__

__repr__() -> str

Return code to construct the information in Python.

Returns:

Type Description
str

code to construct the information in Python

Representation

Bases: Repr

Representation class for the library.

Attributes

T class-attribute instance-attribute

T = TypeVar('T')

fll instance-attribute

fll: Final = FllExporter()

maxlevel instance-attribute

maxlevel = 10

repr_float128 class-attribute instance-attribute

repr_float128 = repr_float

repr_float16 class-attribute instance-attribute

repr_float16 = repr_float

repr_float32 class-attribute instance-attribute

repr_float32 = repr_float

repr_float64 class-attribute instance-attribute

repr_float64 = repr_float

Functions

__init__

__init__() -> None

Constructor.

__repr__

__repr__() -> str

Return code to construct the representation in Python.

Returns:

Type Description
str

code to construct the representation in Python

as_constructor

as_constructor(
    x: T, /, fields: dict[str, Any] | None = None, *, positional: bool = False, cast_as: type[T] | None = None
) -> str

Return the Python code to use the constructor of the object.

Parameters:

Name Type Description Default
x T

object to construct

required
fields dict[str, Any] | None

override the parameters and arguments to use in the constructor

None
positional bool

use positional parameters if true, and keyword parameters otherwise

False
cast_as type[T] | None

type to upcast the object (useful in inheritance approaches)

None

Returns:

Type Description
str

Python code to use the constructor of the object.

construction_arguments

construction_arguments(
    x: T, /, fields: dict[str, Any] | None = None, *, positional: bool = False, cast_as: type[T] | None = None
) -> list[str]

Return the list of parameters and arguments for the constructor of the object.

Parameters:

Name Type Description Default
x T

object to construct

required
fields dict[str, Any] | None

override the parameters and arguments to use in the constructor

None
positional bool

use positional parameters if true, and keyword parameters otherwise

False
cast_as type[T] | None

type to upcast the object (useful in inheritance approaches)

None

Returns:

Type Description
list[str]

list of parameters and arguments for the constructor of the object.

import_statement

import_statement() -> str

Return the library's import statement based on the alias in the settings.

related

Returns:

Type Description
str

library's import statement based on the alias in the settings.

package_of

package_of(x: Any) -> str

Return the qualified class name of the object.

Parameters:

Name Type Description Default
x Any

object to get package of

required

Returns:

Type Description
str

qualified class name of the object.

repr_float

repr_float(x: float | floating[Any], level: int) -> str

Return the string representation of the floating-point value in Python.

Parameters:

Name Type Description Default
x float | floating[Any]

float to represent

required
level int

irrelevant

required

Returns:

Type Description
str

string representation of the floating-point value in Python.

repr_ndarray

repr_ndarray(x: Array[Any], level: int) -> str

Return the string representation of the numpy array in Python.

Parameters:

Name Type Description Default
x Array[Any]

numpy array to represent

required
level int

level for recursion control

required

Returns:

Type Description
str

string representation of the numpy array in Python

Settings

Settings for the library.

Attributes

_factory_manager instance-attribute

_factory_manager = factory_manager

alias instance-attribute

alias = alias

atol instance-attribute

atol = atol

debugging property writable

debugging: bool

Get/Set the library in debug mode.

Getter

Returns:

Type Description
bool

whether the library is in debug mode

Setter

Parameters:

Name Type Description Default
value bool

set logging level to DEBUG if true, and to ERROR otherwise

required

decimals instance-attribute

decimals = decimals

factory_manager property writable

factory_manager: FactoryManager

Get/Set the factory manager.

Getter

Returns:

Type Description
FactoryManager

factory manager

Setter

Parameters:

Name Type Description Default
value FactoryManager

factory manager

required

float_type instance-attribute

float_type = float_type

logger instance-attribute

logger = logger or getLogger('fuzzylite')

rtol instance-attribute

rtol = rtol

Functions

__init__

__init__(
    float_type: Any = float64,
    decimals: int = 3,
    atol: float = 0.001,
    rtol: float = 0.0,
    alias: str = "fl",
    logger: Logger | None = None,
    factory_manager: FactoryManager | None = None,
) -> None

Constructor.

Parameters:

Name Type Description Default
float_type Any

floating point type.

float64
decimals int

number of decimals.

3
atol float

absolute tolerance.

0.001
rtol float

relative tolerance.

0.0
alias str

alias to use when representing objects (ie, __repr__()). Cases: - fully qualified package when alias == "" (eg, fuzzylite.term.Constant(name="A", height=1.0)) - no prefixes when alias == "*" (eg, Constant(name="A", height=1.0)) - alias otherwise (eg, {alias}.Constant(name="A", height=1.0)

'fl'
logger Logger | None

logger.

None
factory_manager FactoryManager | None

factory manager.

None

__repr__

__repr__() -> str

Return code to construct the settings in Python.

Returns:

Type Description
str

code to construct the settings in Python

context

context(
    *,
    float_type: Any | None = None,
    decimals: int | None = None,
    atol: float | None = None,
    rtol: float | None = None,
    alias: str | None = None,
    logger: Logger | None = None,
    factory_manager: FactoryManager | None = None
) -> Generator[None, None, None]

Create a context with specific settings.

Parameters:

Name Type Description Default
float_type Any | None

floating point type

None
decimals int | None

number of decimals.

None
atol float | None

absolute tolerance.

None
rtol float | None

relative tolerance.

None
alias str | None

alias for the library.

None
logger Logger | None

logger.

None
factory_manager FactoryManager | None

factory manager.

None

Returns:

Type Description
None

context with specific settings.

array module-attribute

array: Final = array

inf module-attribute

inf: Final = inf

information module-attribute

information: Final = Information()

nan module-attribute

nan: Final = nan

repr module-attribute

repr: Final = repr

representation module-attribute

representation: Final = Representation()

scalar

scalar(x: Sequence[Any] | Array[Any]) -> ScalarArray
scalar(x: Any) -> Scalar
scalar(x: Sequence[Any] | Array[Any] | Any, /, **kwargs: Any) -> ScalarArray | Scalar

Convert the values into a floating point value defined by the library.

Parameters:

Name Type Description Default
x Sequence[Any] | Array[Any] | Any

value to convert.

required
**kwargs Any

keyword arguments to pass to numpy.asarray

{}

Returns:

Type Description
ScalarArray | Scalar

array of converted values

settings module-attribute

settings: Final = Settings()

to_float

to_float(x: Any) -> float

Convert the value into a floating point defined by the library.

Parameters:

Name Type Description Default
x Any

value to convert.

required

Returns:

Type Description
float

converted value