mirror of
https://github.com/arsenetar/dupeguru.git
synced 2024-11-14 03:29:02 +00:00
f1153c85c0
it's a tiny bit faster and saves a bit of memory
17 lines
531 B
Python
17 lines
531 B
Python
# Copyright 2016 Virgil Dupras
|
|
#
|
|
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
|
# which should be included with this package. The terms are also available at
|
|
# http://www.gnu.org/licenses/gpl-3.0.html
|
|
|
|
from core.pe._cache import bytes_to_colors # noqa
|
|
|
|
|
|
def colors_to_bytes(colors):
|
|
"""Transform the 3 sized tuples 'colors' into a bytes string.
|
|
|
|
[(0,100,255)] --> b'\x00d\xff'
|
|
[(1,2,3),(4,5,6)] --> b'\x01\x02\x03\x04\x05\x06'
|
|
"""
|
|
return b"".join(map(bytes, colors))
|