Classes

class lasersafety.classes.LaserClass(*values)

An enumeration of laser classes, with ordering.

The enumeration is equipped with a total ordering that can be used to compare a class with either another class such that

>>> LaserClass.ONE < LaserClass.THREE_R
True
>>> LaserClass.TWO_M >= THREE_B
False

but also compare to a an int

>>> LaserClass.THREE == 3
True
>>> LaserClass.TWO_M < 3
True

Store the absolute order and the overall class.

Parameters:
  • _ (str) – the name of the class, already stored in new.

  • order (int) – the absolute order of the class.

  • overall_class (int) – the overall class for each class.

ONE = '1'

Class 1

ONE_M = '1M'

Class 1M

TWO = '2'

Class 2

TWO_M = '2M'

Class 2M

THREE_R = '3R'

Class 3R

THREE_B = '3B'

Class 3B

FOUR = '4'

Class 4

_is_valid_operand(other: Any) bool

Check that the other operand of a comparison is valid.

Comparisons are valid with LaserClass and int instances.

Parameters:

other (Any) – the other operand.

Returns:

wether the other operand is valid or not.

Return type:

bool