Misc Utility Functions#

class arcade.utils.ByteRangeError(var_name: str, value: int)[source]#

Bases: IntOutsideRangeError

An int was outside the range of 0 to 255 inclusive

Parameters:
  • var_name – the name of the variable or argument

  • value – the value to fall outside the expected range

class arcade.utils.FloatOutsideRangeError(var_name: str, value: float, lower: float, upper: float)[source]#

Bases: OutsideRangeError

A float value was outside an expected range

Parameters:
  • var_name – the name of the variable or argument

  • value – the value to fall outside the expected range

  • lower – the lower bound, inclusive, of the range

  • upper – the upper bound, inclusive, of the range

class arcade.utils.IntOutsideRangeError(var_name: str, value: int, lower: int, upper: int)[source]#

Bases: OutsideRangeError

An integer was outside an expected range

This class was originally intended to assist deserialization from data packed into ints, such as Color.

Parameters:
  • var_name – the name of the variable or argument

  • value – the value to fall outside the expected range

  • lower – the lower bound, inclusive, of the range

  • upper – the upper bound, inclusive, of the range

class arcade.utils.NormalizedRangeError(var_name: str, value: float)[source]#

Bases: FloatOutsideRangeError

A float was not between 0.0 and 1.0, inclusive

Note that normalized floats should not normally be bound-checked as before drawing as this is taken care of on the GPU side.

The exceptions to this are when processing data on the Python side, especially when it is cheaper to bound check two floats than call clamping functions.

Parameters:
  • var_name – the name of the variable or argument

  • value – the value to fall outside the expected range

class arcade.utils.OutsideRangeError(var_name: str, value: _CT, lower: _CT, upper: _CT)[source]#

Bases: ValueError

Raised when a value is outside and expected range

This class and its subclasses are intended to be arcade-internal helpers to clearly signal exactly what went wrong. Each helps type annotate and template a string describing exactly what went wrong.

Parameters:
  • var_name – the name of the variable or argument

  • value – the value to fall outside the expected range

  • lower – the lower bound, inclusive, of the range

  • upper – the upper bound, inclusive, of the range

class arcade.utils.PerformanceWarning[source]#

Bases: Warning

Use this for issuing performance warnings.

class arcade.utils.ReplacementWarning[source]#

Bases: Warning

Use this for issuing warnings about naming and functionality changes.

arcade.utils.generate_uuid_from_kwargs(**kwargs) str[source]#

Given key/pair combos, returns a string in uuid format. Such as text=’hi’, size=32 it will return “text-hi-size-32”. Called with no parameters, id does NOT return a random unique id.

arcade.utils.get_raspberry_pi_info() Tuple[bool, str, str][source]#

Determine if the host is a raspberry pi with additional info.

Returns:

3 component tuple. bool (is host a raspi) str (architecture) str (model name)

arcade.utils.is_raspberry_pi() bool[source]#

Determine if the host is a raspberry pi.

Returns:

bool

arcade.utils.warning(warning_type: Type[Warning], message: str = '', **kwargs)[source]#
arcade.configure_logging(level: int | None = None)[source]#

Set up basic logging. :param level: The log level. Defaults to DEBUG.