marvis.util

Internal utility functions.

Functions

network_color_for

Calculates a color on the hue-spectrum for a specific network.

once

Runs a method (successfully) only once per instance.

unique

unique_generator


marvis.util.once(func)[source]

Runs a method (successfully) only once per instance.

marvis.util.network_color_for(network, number_of_networks)[source]

Calculates a color on the hue-spectrum for a specific network.

Parameters
  • network (int) – The 0-based index of the network.

  • number_of_networks (int) – The overall number of networks available.

Returns

  • r (int) – The red value (0-255).

  • g (int) – The green value (0-255).

  • b (int) – The blue value (0-255).

marvis.util.unique(iterable)[source]
marvis.util.unique_generator(func)[source]