MCPcopy Create free account
hub / github.com/dask/dask / _colorize

Function _colorize

dask/base.py:1028–1044  ·  view source on GitHub ↗

Convert (r, g, b) triple to "#RRGGBB" string For use with ``visualize(color=...)`` Examples -------- >>> _colorize((255, 255, 255)) '#FFFFFF' >>> _colorize((0, 32, 128)) '#002080'

(t)

Source from the content-addressed store, hash-verified

1026
1027
1028def _colorize(t):
1029 """Convert (r, g, b) triple to "#RRGGBB" string
1030
1031 For use with ``visualize(color=...)``
1032
1033 Examples
1034 --------
1035 >>> _colorize((255, 255, 255))
1036 '#FFFFFF'
1037 >>> _colorize((0, 32, 128))
1038 '#002080'
1039 """
1040 t = t[:3]
1041 i = sum(v * 256 ** (len(t) - i - 1) for i, v in enumerate(t))
1042 h = hex(int(i))[2:].upper()
1043 h = "0" * (6 - len(h)) + h
1044 return "#" + h
1045
1046
1047named_schedulers: dict[str, SchedulerGetCallable] = {

Callers 1

visualize_dskFunction · 0.85

Calls 1

sumFunction · 0.50

Tested by

no test coverage detected