types

from susi_lib.types import *
# takto sa importujú všetky triedy odtiaľto

Braille

Provides Braille class for work with braille.

class susi_lib.types.braille.Braille(characters: str | list[BrailleChar])[source]

Represents a string in braille.

Can be subscripted, iterated through, compared for equality, added with other Braille objects, strings or BrailleChars. Can get its length by len function.

Creates Braille object from characters.

Parameters:

characters (str | list[BrailleChar]) – String of alphabet and spaces

static get_dict() dict[str, int][source]

Returns dictionary for translating from chars to unicode braille values.

Returns:

Translation dictionary

Return type:

dict[str, int]

Semaphore

Provides Semaphore class for representing strings in semaphore encoding.

class susi_lib.types.semaphore.Semaphore(characters: str | list[SemaphoreChar])[source]

Represents a string in semaphore.

Can be subscripted, iterated through, compared for equality, added with other Semaphore objects, strings or SemaphoreChars. Can get its length by len() function.

Creates Semaphore object from characters.

Parameters:

characters (str | list[SemaphoreChar]) – String of alphabet and spaces

static get_dict() dict[str, tuple[int, int]][source]

Returns dictionary for translating from chars to direction pairs.

Returns:

Translation dictionary

Return type:

dict[str, tuple[int, int]]

Morse

Provides Morse class for representing a string in morse encoding.

class susi_lib.types.morse.Morse(data: str | MorseSymbol | MorseSequence)[source]

Represents a string in morse.

Can be subscripted, iterated through, compared for equality, added with other Morse objects, strings. Can get its length by len function.

Parameters:

data (str | MorseSymbol | MorseSequence)

get() list[MorseSymbol][source]
Returns:

Underlying sequence of MorseSymbols

Return type:

list[MorseSymbol]

static get_dict() dict[str, str][source]

Returns dictionary for translating from chars to morse.

Returns:

Translation dictionary

Return type:

dict[str, str]

NumberSystems

Provides NumberSystems class for representing strings as numbers.

class susi_lib.types.number_systems.NumberSystems(characters: str | list[NumberChar], base=10)[source]

Represents a string as number.

Can be subscripted, iterated through, compared for equality, added with other NumberSystems objects, strings or NumberChars. Can get its length by len function.

Parameters:

characters (str | list[NumberChar])

change_base(base: int) None[source]

Changes the base used to convert the char to number.

Parameters:

base (int) – Int base of the desired system (2, 10, 16)

Return type:

None

static get_dict() dict[str, int][source]

Returns dictionary for translating from chars to base 10 ints.

Returns:

Translation dictionary

Return type:

dict[str, int]

Symbols

Provides Symbols class for easy converting between encodings of one string.

class susi_lib.types.symbols.Symbols(characters: str)[source]

Class for storing a string and getting its encodings.

Can be subscripted, iterated through, compared for equality, added with other Symbols objects or strings. Can get its length by len function. Provides functions to get other encodings.

Creates Symbols from characters.

Parameters:

characters (str) – String to store

classmethod from_string(string: str) str[source]

Decodes a string in either braille, morse, numbers or semaphore encoding.

Parameters:

string (str) – String to decode

Returns:

Decoded string

Return type:

str

to_braille() Braille[source]
Returns:

Braille representation

Return type:

Braille

to_morse() Morse[source]
Returns:

Morse representation

Return type:

Morse

to_number_systems(base: int = 10) NumberSystems[source]
Parameters:

base (int) – Int base of the desired system (2, 10, 16)

Returns:

Numbers representation

Return type:

NumberSystems

to_semaphore() Semaphore[source]
Returns:

Semaphore representation

Return type:

Semaphore