pyutils package =============== When I was writing little tools in Python and found myself implementing a generally useful pattern I stuffed it into a local library. That library grew into pyutils: a set of collections, helpers and utilities that I find useful and hope you will too. Code is under `src/pyutils/`. Most code includes documentation and inline doctests. Unit and integration tests are under `tests/*`. To run all tests:: cd tests/ ./run_tests.py --all [--coverage] See the README under `tests/` and the code of `run_tests.py` for more options / information. This package generates Sphinx docs which are available at: https://wannabe.guru.org/pydocs/pyutils/pyutils.html Package code is checked into a local git server and available to clone from git at https://wannabe.guru.org/git/pyutils.git or from a web browser at: https://wannabe.guru.org/gitweb/?p=pyutils.git;a=summary For a long time this was just a local library on my machine that my tools imported but I've now decided to release it on PyPi. Early development happened in a different git repo: https://wannabe.guru.org/gitweb/?p=python_utils.git;a=summary I hope you find this useful. LICENSE and NOTICE describe reusing this code and where everything came from. Drop me a line if you are using this, find a bug, have a question, or have a suggestion: --Scott Gasch (scott.gasch@gmail.com) Subpackages ----------- .. toctree:: :maxdepth: 4 pyutils.collectionz pyutils.compress pyutils.datetimez pyutils.files pyutils.parallelize pyutils.search pyutils.security pyutils.typez Submodules ---------- pyutils.ansi module ------------------- This file mainly contains code for changing the nature of text printed to the console via ANSI escape sequences. e.g. it can be used to emit text that is bolded, underlined, italicised, colorized, etc... It also contains a colorizing context that will apply color patterns based on regular expressions to any data emitted to stdout that may be useful in adding color to other programs' outputs, for instance. Here are the predefined color names it knows: .. raw:: html
abbey=4c4f56
acadia=1b1404
acapulco=7cb0a1
aero blue=c9ffe5
affair=714693
akaroa=d4c4a8
alabaster=fafafa
albescent white=f5e9d3
algae green=93dfb8
alice blue=f0f8ff
alizarin crimson=e32636
allports=0076a3
almond frost=907b71
almond=eed9c4
alpine=af8f2c
alto=dbdbdb
aluminium=a9acb6
amaranth=e52b50
amazon=3b7a57
amber=ffbf00
americano=87756e
amethyst smoke=a397b4
amethyst=9966cc
amour=f9eaf3
amulet=7b9f80
anakiwa=9de5ff
antique brass=c88a65
antique bronze=704a07
antique white=faebd7
anzac=e0b646
apache=dfbe6f
apple blossom=af4d43
apple green=e2f3ec
apple=4fa83d
apricot peach=fbceb1
apricot white=fffeec
apricot=eb9373
aqua deep=014b43
aqua forest=5fa777
aqua haze=edf5f5
aqua island=a1dad7
aqua spring=eaf9f5
aqua squeeze=e8f5f2
aqua=00ffff
aquamarine blue=71d9e2
aquamarine=7fffd4
arapawa=110c6c
armadillo=433e37
arrowtown=948771
ash=c6c3b5
asparagus=7ba05b
asphalt=130a06
astra=faeab9
astral=327da0
astronaut blue=013e62
astronaut=283a77
athens gray=eef0f3
aths special=ecebce
atlantis=97cd2d
atoll=0a6f75
atomic tangerine=ff9966
au chico=97605d
aubergine=3b0910
australian mint=f5ffbe
avocado=888d65
axolotl=4e6649
azalea=f7c8da
aztec=0d1c19
azure radiance=007fff
azure=f0ffff
baby blue=e0ffff
backup.house=af5f00
bahama blue=026395
bahia=a5cb0c
baja white=fff8d1
bali hai=859faf
baltic sea=2a2630
bamboo=da6304
banana mania=fbe7b2
bandicoot=858470
barberry=ded717
barley corn=a68b5b
barley white=fff4ce
barossa=44012d
bastille=292130
battleship gray=828f72
bay leaf=7da98d
bay of many=273a81
bazaar=98777b
bean =3d0c02
beauty bush=eec1be
beaver=926f5b
beeswax=fef2c7
beige=f5f5dc
bermuda gray=6b8ba2
bermuda=7dd8c6
beryl green=dee5c0
bianca=fcfbf3
big stone=162a40
bilbao=327c14
biloba flower=b2a1ea
birch=373021
bird flower=d4cd16
biscay=1b3162
bismark=497183
bison hide=c1b7a4
bisque=ffe4c4
bistre=3d2b1f
bitter lemon=cae00d
bitter=868974
bittersweet=fe6f5e
bizarre=eededa
black bean=081910
black forest=0b1304
black haze=f6f7f7
black marlin=3e2c1c
black olive=242e16
black pearl=041322
black rock=0d0332
black rose=67032d
black russian=0a001c
black squeeze=f2fafa
black white=fffef6
black=000000
blackberry=4d0135
blackcurrant=32293a
blanched almond=ffebcd
blaze orange=ff6600
bleach white=fef3d8
bleached cedar=2c2133
blizzard blue=a3e3ed
blossom=dcb4bc
blue bayoux=496679
blue bell=9999cc
blue chalk=f1e9ff
blue charcoal=010d1a
blue chill=0c8990
blue diamond=380474
blue dianne=204852
blue gem=2c0e8c
blue haze=bfbed8
blue lagoon=017987
blue marguerite=7666c6
blue ribbon=0066ff
blue romance=d2f6de
blue smoke=748881
blue stone=016162
blue violet=8a2be2
blue whale=042e4c
blue zodiac=13264d
blue=0000ff
blumine=18587a
blush pink=ff6fff
blush=b44668
bombay=afb1b8
bon jour=e5e0e1
bondi blue=0095b6
bone=e4d1c0
bordeaux=5c0120
bossanova=4e2a5a
boston blue=3b91b4
botticelli=c7dde5
bottle green=093624
boulder=7a7a7a
bouquet=ae809e
bourbon=ba6f1e
bracken=4a2a04
brandy punch=cd8429
brandy rose=bb8983
brandy=dec196
breaker bay=5da19f
brick red=c62d42
bridal heath=fffaf4
bridesmaid=fef0ec
bright gray=3c4151
bright green=66ff00
bright red=b10000
bright sun=fed33c
bright turquoise=08e8de
brilliant rose=f653a6
brink pink=fb607f
bronco=aba196
bronze olive=4e420c
bronze=3f2109
bronzetone=4d400f
broom=ffec13
brown bramble=592804
brown derby=492615
brown pod=401801
brown rust=af593e
brown tumbleweed=37290e
brown=964b00
bubbles=e7feff
buccaneer=622f30
bud=a8ae9c
buddha gold=c1a004
buff=f0dc82
bulgarian rose=480607
bull shot=864d1e
bunker=0d1117
bunting=151f4c
burgundy=900020
burlywood=deb887
burnham=002e20
burning orange=ff7034
burning sand=d99376
burnt maroon=420303
burnt orange=cc5500
burnt sienna=e97451
burnt umber=8a3324
bush=0d2e1c
buttercup=f3ad16
buttered rum=a1750d
butterfly bush=624e9a
buttermilk=fff1b5
buttery white=fffcea
cab sav=4d0a18
cabaret=d94972
cabbage pont=3f4c3a
cactus=587156
cadet blue=5f9ea0
cadillac=b04c6a
cafe royale=6f440c
calico=e0c095
california=fe9d04
calypso=31728d
camarone=00581a
camelot=893456
cameo=d9b99b
camouflage green=78866b
camouflage=3c3910
can can=d591a4
canary=f3fb62
candlelight=fcd917
candy corn=fbec5d
cannon black=251706
cannon pink=894367
cape cod=3c4443
cape honey=fee5ac
cape palliser=a26645
caper=dcedb4
caramel=ffddaf
cararra=eeeee8
cardin green=01361c
cardinal pink=8c055e
cardinal=c41e3a
careys pink=d29eaa
caribbean green=00cc99
carissma=ea88a8
carla=f3ffd8
carmine=960018
carnaby tan=5c2e01
carnation pink=ffa6c9
carnation=f95a61
carousel pink=f9e0ed
carrot orange=ed9121
casablanca=f8b853
casal=2f6168
cascade=8ba9a5
cashmere=e6bea5
casper=adbed1
castro=52001f
catalina blue=062a78
catskill white=eef6f7
cavern pink=e3bebe
cedar wood finish=711a00
cedar=3e1c14
celadon=ace1af
celery=b8c25d
celeste=d1d2ca
cello=1e385b
celtic=163222
cement=8d7662
ceramic=fcfff9
cerise red=de3163
cerise=da3287
cerulean blue=2a52be
cerulean=02a4d3
chablis=fff4f3
chalet green=516e3d
chalky=eed794
chambray=354e8c
chamois=eddcb1
champagne=faeccc
chantilly=f8c3df
charade=292937
chardon=fff3f1
chardonnay=ffcd8c
charlotte=baeef9
charm=d47494
chartreuse yellow=dfff00
chartreuse=7fff00
chateau green=40a860
chatelle=bdb3c7
chathams blue=175579
cheetah.house=5f0000
chelsea cucumber=83aa5d
chelsea gem=9e5302
chenin=dfcd6f
cherokee=fcda98
cherry pie=2a0359
cherrywood=651a14
cherub=f8d9e9
chestnut rose=cd5c5c
chestnut=b94e48
chetwode blue=8581d9
chicago=5d5c58
chiffon=f1ffc8
chilean fire=f77703
chilean heath=fffde6
china ivory=fcffe7
chino=cec7a7
chinook=a8e3bd
chocolate=370202
christalle=33036b
christi=67a712
christine=e7730a
chrome white=e8f1d4
cinder=0e0e18
cinderella=fde1dc
cinnabar=e34234
cinnamon=7b3f00
cioccolato=55280c
citrine white=faf7d6
citron=9ea91f
citrus=a1c50a
clairvoyant=480656
clam shell=d4b6af
claret=7f1734
classic rose=fbcce7
clay ash=bdc8b3
clay creek=8a8360
clear day=e9fffd
clementine=e96e00
clinker=371d09
cloud burst=202e54
cloud=c7c4bf
cloudy=aca59f
clover=384910
cobalt=0047ab
cocoa bean=481c1c
cocoa brown=301f1e
coconut cream=f8f7dc
cod gray=0b0b0b
coffee bean=2a140e
coffee=706555
cognac=9f381d
cola=3f2500
cold purple=aba0d9
cold turkey=cebaba
colonial white=ffedbc
comet=5c5d75
como=517c66
conch=c9d9d2
concord=7c7b7a
concrete=f2f2f2
confetti=e9d75a
congo brown=593737
congress blue=02478e
conifer=acdd4d
contessa=c6726b
copper canyon=7e3a15
copper rose=996666
copper rust=944747
copper=b87333
copperfield=da8a67
coral red=ff4040
coral reef=c7bca2
coral tree=a86b6b
coral=ff7f50
corduroy=606e68
coriander=c4d0b0
cork=40291d
corn field=f8facd
corn harvest=8b6b0b
corn silk=fff8dc
corn=e7bf05
cornflower blue=6495ed
cornflower lilac=ffb0ac
cornflower=93ccea
corvette=fad3a2
cosmic=76395d
cosmos=ffd8d9
costa del sol=615d30
cotton candy=ffb7d5
cotton seed=c2bdb6
county green=01371a
cowboy=4d282d
crail=b95140
cranberry=db5079
crater brown=462425
cream brulee=ffe5a0
cream can=f5c85c
cream=fffdd0
creole=1e0f04
crete=737829
crimson=dc143c
crocodile=736d58
crown of thorns=771f1f
crowshead=1c1208
cruise=b5ecdf
crusoe=004816
crusta=fd7b33
cumin=924321
cumulus=fdffd5
cupid=fbbeda
curious blue=2596d1
cutty sark=507672
cyan=00ffff
cyprus=003e40
daintree=012731
dairy cream=f9e4bc
daisy bush=4f2398
dallas=6e4b26
dandelion=fed85d
danube=6093d1
dark blue=00008b
dark burgundy=770f05
dark cyan=008b8b
dark ebony=3c2005
dark fern=0a480d
dark goldenrod=b8860b
dark gray=a9a9a9
dark green=182d09
dark magenta=af00af
dark olive green=556b2f
dark orange=ff8c00
dark orchid=9932cc
dark purple=360079
dark red=640000
dark salmon=e9967a
dark sea green=8fbc8f
dark slate gray=2f4f4f
dark tan=661010
dark turquoise=00ced1
dark violet=9400d3
dawn pink=f3e9e5
dawn=a6a29a
de york=7ac488
deco=d2da97
deep blue=220878
deep blush=e47698
deep bronze=4a3004
deep cerulean=007ba7
deep cove=051040
deep fir=002900
deep forest green=182d09
deep koamaru=1b127b
deep oak=412010
deep pink=ff1493
deep sapphire=082567
deep sea green=095859
deep sea=01826b
deep sky blue=00bfff
deep teal=003532
del rio=b09a95
dell=396413
delta=a4a49d
deluge=7563a8
denim=1560bd
derby=ffeed8
desert sand=edc9af
desert storm=f8f8f7
desert=ae6020
dew=eafffe
di serria=db995e
diesel=130000
dim gray=696969
dingley=5d7747
disco=871550
dixie=e29418
dodger blue=1e90ff
dolly=f9ff8b
dolphin=646077
domino=8e775e
don juan=5d4c51
donkey brown=a69279
dorado=6b5755
double colonial white=eee3ad
double pearl lusta=fcf4d0
double spanish white=e6d7b9
dove gray=6d6c6c
downriver=092256
downy=6fd0c5
driftwood=af8751
drover=fdf7ad
dull lavender=a899e6
dune=383533
dust storm=e5ccc9
dusty gray=a8989b
eagle=b6baa4
earls green=c9b93b
early dawn=fff9e6
east bay=414c7d
east side=ac91ce
eastern blue=1e9ab0
ebb=e9e3e3
ebony clay=26283b
ebony=0c0b1d
eclipse=311c17
ecru white=f5f3e5
ecstasy=fa7814
eden=105852
edgewater=c8e3d7
edward=a2aeab
egg sour=fff4dd
egg white=ffefc1
eggplant=614051
el paso=1e1708
el salva=8f3e33
electric lime=ccff00
electric violet=8b00ff
elephant=123447
elf green=1b8a6b
elm=1c7c7d
emerald=50c878
eminence=6c3082
emperor=514649
empress=817377
endeavour=0056a7
energy yellow=f8dd5c
english holly=022d15
english walnut=3e2b23
envy=8ba690
equator=e1bc64
espresso=612718
eternity=211a0e
eucalyptus=278a5b
eunry=cfa39d
evening sea=024e46
everglade=1c402e
faded jade=427977
fair pink=ffefec
falcon=7f626d
fall green=ecebbd
falu red=801818
fantasy=faf3f0
fedora=796a78
feijoa=9fdd8c
fern frond=657220
fern green=4f7942
fern=63b76c
ferra=704f50
festival=fbe96c
feta=f0fcea
fiery orange=b35213
finch=626649
finlandia=556d56
finn=692d54
fiord=405169
fire brick=b22222
fire bush=e89928
fire=aa4203
firefly=0e2a30
flame pea=da5b38
flamenco=ff7d07
flamingo=f2552a
flax smoke=7b8265
flax=eedc82
flesh=ffcba4
flint=6f6a61
flirt=a2006d
floral white=fffaf0
flush mahogany=ca3435
flush orange=ff7f00
foam=d8fcfa
fog=d7d0ff
foggy gray=cbcab6
forest green=228b22
forget me not=fff1ee
fountain blue=56b4be
frangipani=ffdeb3
french gray=bdbdc6
french lilac=ecc7ee
french pass=bdedfd
french rose=f64a8a
fresh eggplant=990066
friar gray=807e79
fringy flower=b1e2c1
froly=f57584
frost=edf5dd
frosted mint=dbfff8
frostee=e4f6e7
fruit salad=4f9d5d
fuchsia blue=7a58c1
fuchsia pink=c154c1
fuchsia=ff00ff
fuego=bede0d
fuel yellow=eca927
fun blue=1959a8
fun green=016d39
fuscous gray=54534d
fuzzy wuzzy brown=c45655
gable green=163531
gainsboro=dcdcdc
gallery=efefef
galliano=dcb20c
gamboge=e49b0f
geebung=d18f1b
genoa=15736b
geraldine=fb8989
geyser=d4dfe2
ghost white=f8f8ff
ghost=c7c9d5
gigas=523c94
gimblet=b8b56a
gin fizz=fff9e2
gin=e8f2eb
givry=f8e4bf
glacier=80b3c4
glade green=61845f
go ben=726d4e
goblin=3d7d52
gold drop=f18200
gold sand=e6be8a
gold tips=deba13
gold=ffd700
golden bell=e28913
golden dream=f0d52d
golden fizz=f5fb3d
golden glow=fde295
golden grass=daa520
golden sand=f0db7d
golden tainoi=ffcc5c
goldenrod=fcd667
gondola=261414
gordons green=0b1107
gorse=fff14f
gossamer=069b81
gossip=d2f8b0
gothic=6d92a1
governor bay=2f3cb3
grain brown=e4d5b7
grandis=ffd38c
granite green=8d8974
granny apple=d5f6e3
granny smith apple=9de093
granny smith=84a0a0
grape=381a51
graphite=251607
gravel=4a444b
gray asparagus=465945
gray chateau=a2aab3
gray nickel=c3c3bd
gray nurse=e7ece6
gray olive=a9a491
gray suit=c1becd
gray=808080
green haze=01a368
green house=24500f
green kelp=25311c
green leaf=436a0d
green mist=cbd3b0
green pea=1d6142
green smoke=a4af6e
green spring=b8c1b1
green vogue=032b52
green waterloo=101405
green white=e8ebe0
green yellow=adff2f
green=00ff00
grenadier=d54600
guardsman red=ba0101
gulf blue=051657
gulf stream=80b3ae
gull gray=9dacb7
gum leaf=b6d3bf
gumbo=7ca1a6
gun powder=414257
gunsmoke=828685
gurkha=9a9577
hacienda=98811b
hairy heath=6b2a14
haiti=1b1035
half and half=fffee1
half baked=85c4cc
half colonial white=fdf6d3
half dutch white=fef7de
half spanish white=fef4db
hampton=e5d8af
harlequin=3fff00
harp=e6f2ea
harvest gold=e0b974
havelock blue=5590d9
hawaiian tan=9d5616
hawkes blue=d4e2fc
heath=541012
heather=b7c3d0
heathered gray=b6b095
heavy metal=2b3228
heliotrope=df73ff
hemlock=5e5d3b
hemp=907874
hibiscus=b6316c
highland=6f8e63
hillary=aca586
himalaya=6a5d1b
hint of green=e6ffe9
hint of red=fbf9f9
hint of yellow=fafde4
hippie blue=589aaf
hippie green=53824b
hippie pink=ae4560
hit gray=a1adb5
hit pink=ffab81
hokey pokey=c8a528
hoki=65869f
holly=011d13
hollywood cerise=f400a1
honey flower=4f1c70
honeydew=f0fff0
honeysuckle=edfc84
hopbush=d06da1
horizon=5a87a0
horses neck=604913
hot cinnamon=d2691e
hot pink=ff69b4
hot toddy=b38007
humming bird=cff9f3
hunter green=161d10
hurricane=877c7b
husk=b7a458
ice cold=b1f4e7
iceberg=daf4f0
illusion=f6a4c9
inch worm=b0e313
indian khaki=c3b091
indian red=cd5c5c
indian tan=4d1e01
indigo=4f69c6
indochine=c26b03
international orange=ff4f00
irish coffee=5f3d26
iroko=433120
iron=d4d7d9
ironside gray=676662
ironstone=86483c
island spice=fffcee
ivory=fffff0
jacaranda=2e0329
jacarta=3a2a6a
jacko bean=2e1905
jacksons purple=20208d
jade=00a86b
jaffa=ef863f
jagged ice=c2e8e5
jagger=350e57
jaguar=080110
jambalaya=5b3013
janna=f4ebd3
japanese laurel=0a6906
japanese maple=780109
japonica=d87c63
java=1fc2c2
jazzberry jam=a50b5e
jelly bean=297b9a
jet stream=b5d2ce
jewel=126b40
jon=3b1f1f
jonquil=eeff9a
jordy blue=8ab9f1
judge gray=544333
jumbo=7c7b82
jungle green=29ab87
jungle mist=b4cfd3
juniper=6d9292
just right=eccdb9
kabul=5e483e
kaitoke green=004620
kangaroo=c6c8bd
karaka=1e1609
karry=ffead4
kashmir blue=507096
kelp=454936
kenyan copper=7c1c05
keppel=3ab09e
key lime pie=bfc921
khaki=f0e68c
kidnapper=e1ead4
kilamanjaro=240c02
killarney=3a6a47
kimberly=736c9f
kingfisher daisy=3e0480
kiosk.house=5a5f00
klein blue=002fa7
kobi=e79fc4
kokoda=6e6d57
korma=8f4b0e
koromiko=ffbd5f
kournikova=ffe772
kumera=886221
la palma=368716
la rioja=b3c110
las palmas=c6e610
laser lemon=ffff66
laser=c8b568
laurel=749378
lavender blush=fff0f5
lavender gray=bdbbd7
lavender magenta=ee82ee
lavender pink=fbaed2
lavender purple=967bb6
lavender rose=fba0e3
lavender=b57edc
lawn green=7cfc00
leather=967059
lemon chiffon=fffacd
lemon ginger=ac9e22
lemon grass=9b9e8f
lemon=fde910
light apricot=fdd5b1
light blue=add8e6
light coral=f08080
light cyan=e0ffff
light goldenrod=fafad2
light gray=262335
light green=90ee90
light orchid=e29cd2
light pink=ddb6c1
light salmon=dda07a
light sea green=20b2aa
light slate gray=778899
light steel blue=b0c4de
light wisteria=c9a0dc
light yellow=ffffe0
lightning yellow=fcc01e
lilac bush=9874d3
lilac=c8a2c8
lily white=e7f8ff
lily=c8aabf
lima=76bd17
lime=bfff00
limeade=6f9d02
limed ash=747d63
limed oak=ac8a56
limed spruce=394851
linen=faf0e6
link water=d9e4f5
lipstick=ab0563
lisbon brown=423921
livid brown=4d282e
loafer=eef4de
loblolly=bdc9ce
lochinvar=2c8c84
lochmara=007ec7
locust=a8af8e
log cabin=242a1d
logan=aaa9cd
lola=dfcfdb
london hue=bea6c3
lonestar=6d0101
lotus=863c3c
loulou=460b41
lucky point=1a1a68
lucky=af9f1c
lunar green=3c493a
luxor gold=a7882c
lynch=697e9a
mabel=d9f7ff
macaroni and cheese=ffb97b
madang=b7f0be
madison=09255d
madras=3f3002
magenta=ff00ff
magic mint=aaf0d1
magnolia=f8f4ff
mahogany=4e0606
mai tai=b06608
maize=f5d5a0
makara=897d6d
mako=444954
malachite=0bda51
malibu=7dc8f7
mallard=233418
malta=bdb2a1
mamba=8e8190
manatee=8d90a1
mandalay=ad781b
mandy=e25465
mandys pink=f2c3b2
mango tango=e77200
manhattan=f5c999
mantis=74c365
mantle=8b9c90
manz=eeef78
mardi gras=350036
marigold yellow=fbe870
marigold=b98d28
mariner=286acd
maroon flush=c32148
maroon oak=520c17
maroon=800000
marshland=0b0f08
martini=afa09e
martinique=363050
marzipan=f8db9d
masala=403b38
matisse=1b659d
matrix=b05d54
matterhorn=4e3b41
mauve=e0b0ff
mauvelous=f091a9
maverick=d8c2d5
medium aquamarine=66cdaa
medium blue=0000cd
medium carmine=af4035
medium orchid=ba55d3
medium purple=9370db
medium red violet=bb3385
medium sea green=3cb371
medium slate blue=7b68ee
medium spring green=00fa9a
medium turquoise=48d1cc
medium violet red=c71585
meerkat.cabin=5f005f
melanie=e4c2d5
melanzane=300529
melon=febaad
melrose=c7c1ff
mercury=e5e5e5
merino=f6f0e6
merlin=413c37
merlot=831923
metallic bronze=49371b
metallic copper=71291d
meteor=d07d12
meteorite=3c1f76
mexican red=a72525
mid gray=5f5f6e
midnight blue=003366
midnight moss=041004
midnight=011635
mikado=2d2510
milan=faffa4
milano red=b81104
milk punch=fff6d4
millbrook=594433
mimosa=f8fdd3
mindaro=e3f988
mine shaft=323232
mineral green=3f5d53
ming=36747d
minsk=3f307f
mint cream=f5fff1
mint green=98ff98
mint julep=f1eec1
mint tulip=c4f4eb
mirage=161928
mischka=d1d2dd
mist gray=c4c4bc
misty rose=ffe4e1
mobster=7f7589
moccaccino=6e1d14
moccasin=ffe4b5
mocha=782d19
mojo=c04737
mona lisa=ffa194
monarch=8b0723
mondo=4a3c30
mongoose=b5a27f
monsoon=8a8389
monte carlo=83d0c6
monza=c7031e
moody blue=7f76d3
moon glow=fcfeda
moon mist=dcddcc
moon raker=d6cef6
morning glory=9edee0
morocco brown=441d00
mortar=504351
mosque=036a6e
moss green=addfad
mountain meadow=1ab385
mountain mist=959396
mountbatten pink=997a8d
muddy waters=b78e5c
muesli=aa8b5b
mulberry wood=5c0536
mulberry=c54b8c
mule fawn=8c472f
mulled wine=4e4562
mustard=ffdb58
my pink=d69188
my sin=ffb31f
mystic=e2ebed
nandor=4b5d52
napa=aca494
narvik=edf9f1
natural gray=8b8680
navajo white=ffdead
navy blue=000080
navy=000080
nebula=cbdbd6
negroni=ffe2c5
neon carrot=ff9933
nepal=8eabc1
neptune=7cb7bb
nero=140600
nevada=646e75
new orleans=f3d69d
new york pink=d7837f
niagara=06a189
night rider=1f120f
night shadz=aa375a
nile blue=193751
nobel=b7b1b1
nomad=bab1a2
norway=a8bd9f
nugget=c59922
nutmeg wood finish=683600
nutmeg=81422c
oasis=feefce
observatory=02866f
ocean green=41aa78
ochre=cc7722
off green=e6f8f3
off yellow=fef9e3
oil=281e15
old brick=901e1e
old copper=724a2f
old gold=cfb53b
old lace=fdf5e6
old lavender=796878
old rose=c08081
olive drab=6b8e23
olive green=b5b35c
olive haze=8b8470
olive=808000
olivetone=716e10
olivine=9ab973
onahau=cdf4ff
onion=2f270e
opal=a9c6c2
opium=8e6f70
oracle=377475
orange peel=ffa000
orange red=ff4500
orange roughy=c45719
orange white=fefced
orange=ff681f
orchid white=fffdf3
orchid=da70d6
oregon=9b4703
orient=015e85
oriental pink=c69191
orinoco=f3fbd4
oslo gray=878d91
ottoman=e9f8ed
outer space=2d383a
outrageous orange=ff6037
oxford blue=384555
oxley=779e86
oyster bay=dafaff
oyster pink=e9cecd
paarl=a65529
pablo=776f61
pacific blue=009dc4
pacifika=778120
paco=411f10
padua=ade6c4
pale canary=ffff99
pale goldenrod=eee8aa
pale green=98fb98
pale leaf=c0d3b9
pale oyster=988d77
pale prim=fdfeb8
pale rose=ffe1f2
pale sky=6e7783
pale slate=c3bfc1
pale turquoise=afeeee
pale violet red=db7093
palm green=09230f
palm leaf=19330e
pampas=f4f2ee
panache=eaf6ee
pancho=edcdab
papaya whip=ffefd5
paprika=8d0226
paradiso=317d82
parchment=f1e9d2
paris daisy=fff46e
paris m=26056a
paris white=cadcd4
parsley=134f19
pastel green=77dd77
pastel pink=ffd1dc
patina=639a8f
pattens blue=def5ff
paua=260368
pavlova=d7c498
peach cream=fff0db
peach orange=ffcc99
peach puff=ffdab9
peach schnapps=ffdcd6
peach yellow=fadfad
peach=ffe5b4
peanut=782f16
pear=d1e231
pearl bush=e8e0d5
pearl lusta=fcf4dc
peat=716b56
pelorous=3eabbf
peppermint=e3f5e1
perano=a9bef2
perfume=d0bef8
periglacial blue=e1e6d6
periwinkle gray=c3cde6
periwinkle=ccccff
persian blue=1c39bb
persian green=00a693
persian indigo=32127a
persian pink=f77fbe
persian plum=701c1c
persian red=cc3333
persian rose=fe28a2
persimmon=ff6b53
peru tan=7f3a02
peru=cd853f
pesto=7c7631
petite orchid=db9690
pewter=96a8a1
pharlap=a3807b
picasso=fff39d
pickled bean=6e4826
pickled bluewood=314459
picton blue=45b1e8
pig pink=fdd7e4
pigeon post=afbdd9
pigment indigo=4b0082
pine cone=6d5e54
pine glade=c7cd90
pine green=01796f
pine tree=171f04
pink flamingo=ff66ff
pink flare=e1c0c8
pink lace=ffddf4
pink lady=fff1d8
pink salmon=ff91a4
pink swan=beb5b7
pink=ffc0cb
piper=c96323
pipi=fef4cc
pippin=ffe1df
pirate gold=ba7f03
pistachio=9dc209
pixie green=c0d8b6
pizazz=ff9000
pizza=c99415
plantation=27504b
plum=843179
pohutukawa=8f021c
polar=e5f9f6
polo blue=8da8cc
pomegranate=f34723
pompadour=660045
porcelain=eff2f3
porsche=eaae69
port gore=251f4f
portafino=ffffb4
portage=8b9fee
portica=f9e663
pot pourri=f5e7e2
potters clay=8c5738
powder ash=bcc9c2
powder blue=b0e0e6
prairie sand=9a3820
prelude=d0c0e5
prim=f0e2ec
primrose=edea99
provincial pink=fef5f1
prussian blue=003153
puce=cc8899
pueblo=7d2c14
puerto rico=3fc1aa
pumice=c2cac4
pumpkin skin=b1610b
pumpkin=ff7518
punch=dc4333
punga=4d3d14
purple heart=652dc1
purple mountain's majesty=9678b6
purple pizzazz=ff00cc
purple=660099
putty=e7cd8c
quarter pearl lusta=fffdf4
quarter spanish white=f7f2e1
quicksand=bd978e
quill gray=d6d6d1
quincy=623f2d
racing green=0c1911
radical red=ff355e
raffia=eadab8
rainee=b9c8ac
rajah=f7b668
rangitoto=2e3222
rangoon green=1c1e13
raven=727b89
raw sienna=d27d46
raw umber=734a12
razzle dazzle rose=ff33cc
razzmatazz=e30b5c
rebecca purple=663399
rebel=3c1206
red beech=7b3801
red berry=8e0000
red damask=da6a41
red devil=860111
red orange=ff3f34
red oxide=6e0902
red ribbon=ed0a3f
red robin=80341f
red stage=d05f04
red violet=c71585
red=ff0000
redwood=5d1e0f
reef gold=9f821c
reef=c9ffa2
regal blue=013f6a
regent gray=86949f
regent st blue=aad6e6
remy=feebf3
reno sand=a86515
resolution blue=002387
revolver=2c1632
rhino=2e3f62
rice cake=fffef0
rice flower=eeffe2
rich gold=a85307
rio grande=bbd009
ripe lemon=f4d81c
ripe plum=410056
riptide=8be6d8
river bed=434c59
rob roy=eac674
robin's egg blue=00cccc
rock blue=9eb1cd
rock spray=ba450c
rock=4d3833
rodeo dust=c9b29b
rolling stone=747d83
roman coffee=795d4c
roman=de6360
romance=fffefd
romantic=ffd2b7
ronchi=ecc54e
roof terracotta=a62f20
rope=8e4d1e
rose bud cherry=800b47
rose bud=fbb2a3
rose fog=e7bcb4
rose of sharon=bf5500
rose white=fff6f5
rose=ff007f
rosewood=65000b
rosy blue=bc8f8f
roti=c6a84b
rouge=a23b6c
royal blue=4169e1
royal heath=ab3472
royal purple=6b3fa0
rpi=d05f00
rum swizzle=f9f8e4
rum=796989
russet=80461b
russett=755a57
rust=b7410e
rustic red=480404
rusty nail=86560a
saddle brown=583401
saddle=4c3024
saffron mango=f9bf58
saffron=f4c430
sage=9ea587
sahara sand=f1e788
sahara=b7a214
sail=b8e0f9
salem=097f4b
salmon=ff8c69
salomie=fedb8d
salt box=685e6e
saltpan=f1f7f2
sambuca=3a2010
san felix=0b6207
san juan=304b6a
san marino=456cac
sand dune=826f65
sandal=aa8d6f
sandrift=ab917a
sandstone=796d62
sandwisp=f5e7a2
sandy beach=ffeac8
sandy brown=f4a460
sangria=92000a
sanguine brown=8d3d38
santa fe=b16d52
santas gray=9fa0b1
sapling=ded4a4
sapphire=2f519e
saratoga=555b10
satin linen=e6e4d4
sauvignon=fff5f3
sazerac=fff4e0
scampi=675fa6
scandal=cffaf4
scarlet gum=431560
scarlet=ff2400
scarlett=950015
scarpa flow=585562
schist=a9b497
school bus yellow=ffd800
schooner=8b847e
science blue=0066cc
scooter=2ebfd4
scorpion=695f62
scotch mist=fffbdc
screamin' green=66ff66
screamin green=66ff66
screaming green=66ff66
sea buckthorn=fba129
sea green=2e8b57
sea mist=c5dbca
sea nymph=78a39c
sea pink=ed989e
seagull=80ccea
seance=731e8f
seashell peach=fff5ee
seashell=f1f1f1
seaweed=1b2f11
selago=f0eefd
selective yellow=ffba00
sepia black=2b0202
sepia skin=9e5b40
sepia=704214
serenade=fff4e8
shadow green=9ac2b8
shadow=837050
shady lady=aaa5a9
shakespeare=4eabd1
shalimar=fbffba
shamrock=33cc99
shark=25272c
sherpa blue=004950
sherwood green=02402c
shilo=e8b9b3
shingle fawn=6b4e31
ship cove=788bba
ship gray=3e3a44
shiraz=b20931
shocking pink=fc0fc0
shocking=e292c0
shuttle gray=5f6672
siam=646a54
sidecar=f3e7bb
sienna=a0522d
silk=bdb1a8
silver chalice=acacac
silver rust=c9c0bb
silver sand=bfc1c2
silver tree=66b58f
silver=c0c0c0
sinbad=9fd7d3
siren=7a013a
sirocco=718080
sisal=d3cbba
skeptic=cae6da
sky blue=76d7ea
slate blue=6a5acd
slate gray=708090
smalt blue=51808f
smalt=003399
smoky=605b73
snow drift=f7faf7
snow flurry=e4ffd1
snow=fffafa
snowy mint=d6ffdb
snuff=e2d8ed
soapstone=fffbf9
soft amber=d1c6b4
soft peach=f5edef
solid pink=893843
solitaire=fef8e2
solitude=eaf6ff
sorbus=fd7c07
sorrell brown=ceb98f
soya bean=6a6051
spanish green=819885
spectra=2f5a57
spice=6a442e
spicy mix=885342
spicy mustard=74640d
spicy pink=816e71
spindle=b6d1ea
spray=79deec
spring green=00ff7f
spring leaves=578363
spring rain=accbb1
spring sun=f6ffdc
spring wood=f8f6f1
sprout=c1d7b0
spun pearl=aaabb7
squirrel=8f8176
st tropaz=2d569b
stack=8a8f8a
star dust=9f9f9c
stark white=e5d7bd
starship=ecf245
steel blue=4682b4
steel gray=262335
stiletto=9c3336
stonewall=928573
storm dust=646463
storm gray=717486
stratos=000741
straw=d4bf8d
strikemaster=956387
stromboli=325d52
studio=714ab2
submarine=bac7c9
sugar cane=f9fff6
sulu=c1f07c
summer green=96bbab
sun=fbac13
sundance=c9b35b
sundown=ffb1b3
sunflower=e4d422
sunglo=e16865
sunglow=ffcc33
sunset orange=fe4c40
sunshade=ff9e2c
supernova=ffc901
surf crest=cfe5d2
surf=bbd7c1
surfie green=0c7a79
sushi=87ab39
suva gray=888387
swamp green=acb78e
swamp=001b1c
swans down=dcf0ea
sweet corn=fbea8c
sweet pink=fd9fa2
swirl=d3cdc5
swiss coffee=ddd6d5
sycamore=908d39
tabasco=a02712
tacao=edb381
tacha=d6c562
tahiti gold=e97c07
tahuna sands=eef0c8
tall poppy=b32d29
tallow=a8a589
tamarillo=991613
tamarind=341515
tan hide=fa9d5a
tan=d2b48c
tana=d9dcc1
tangaroa=03163c
tangerine=f28500
tango=ed7a1c
tapa=7b7874
tapestry=b05e81
tara=e1f6e8
tarawera=073a50
tasman=cfdccf
taupe gray=b3af95
taupe=483c32
tawny port=692545
te papa green=1e433c
tea green=d0f0c0
tea=c1bab0
teak=b19461
teal blue=044259
teal=008080
temptress=3b000b
tenn=cd5700
tequila=ffe6c7
terracotta=e2725b
texas rose=ffb555
texas=f8f99c
thatch green=403d19
thatch=b69d98
thistle green=cccaa8
thistle=d8bfd8
thunder=33292f
thunderbird=c02b18
tia maria=c1440e
tiara=c3d1d1
tiber=063537
tickle me pink=fc80a5
tidal=f1ffad
tide=bfb8b0
timber green=16322c
timberwolf=d9d6cf
titan white=f0eeff
toast=9a6e61
tobacco brown=715d47
toledo=3a0020
tolopea=1b0245
tom thumb=3f583b
tomato=ff6347
tonys pink=e79f8c
topaz=7c778a
torch red=fd0e35
torea bay=0f2d9e
tory blue=1450aa
tosca=8d3f3f
totem pole=991b07
tower gray=a9bdbf
tradewind=5fb3ac
tranquil=e6ffff
travertine=fffde8
tree poppy=fc9c1d
treehouse=3b2820
trendy green=7c881a
trendy pink=8c6495
trinidad=e64e03
tropical blue=c3ddf9
tropical rain forest=00755e
trout=4a4e5a
true v=8a73d6
tuatara=363534
tuft bush=ffddcd
tulip tree=eab33b
tumbleweed=dea681
tuna=353542
tundora=4a4244
turbo=fae600
turkish rose=b57281
turmeric=cabb48
turquoise blue=6cdae7
turquoise=30d5c8
turtle green=2a380b
tuscany=bd5e2e
tusk=eef3c3
tussock=c5994b
tutu=fff1f9
twilight blue=eefdff
twilight=e4cfde
twine=c2955d
tyrian purple=66023c
ultramarine=120a8f
valencia=d84437
valentino=350e42
valhalla=2b194f
van cleef=49170c
vanilla ice=f3d9df
vanilla=d1bea8
varden=fff6df
venetian red=72010f
venice blue=055989
venus=928590
verdigris=5d5e37
verdun green=495400
vermilion=ff4d00
vesuvius=b14a0b
victoria=534491
vida loca=549019
viking=64ccdb
vin rouge=983d61
viola=cb8fa9
violent violet=290c5e
violet eggplant=991199
violet red=f7468a
violet=240a40
viridian green=678975
viridian=40826d
vis vis=ffefa1
vista blue=8fd6b4
vista white=fcf8f7
vivid tangerine=ff9980
vivid violet=803790
voodoo=533455
vulcan=10121d
wafer=decbc6
waikawa gray=5a6e9c
waiouru=363c0d
walnut=773f1a
wannabe.house=00005f
wasabi=788a25
water leaf=a1e9de
watercourse=056f57
waterloo =7b7c94
wattle=dcd747
watusi=ffddcf
wax flower=ffc0a8
we peep=f7dbe6
web orange=ffa500
wedgewood=4e7f9e
well read=b43332
west coast=625119
west side=ff910f
westar=dcd9d2
wewak=f19bab
wheat=f5deb3
wheatfield=f3edcf
whiskey=d59a6f
whisper=f7f5fa
white ice=ddf9f1
white lilac=f8f7fc
white linen=f8f0e8
white pointer=fef8ff
white rock=eae8d4
white smoke=f5f5f5
white=ffffff
wild blue yonder=7a89b8
wild rice=ece090
wild sand=f4f4f4
wild strawberry=ff3399
wild watermelon=fd5b78
wild willow=b9c46a
william=3a686c
willow brook=dfecda
willow grove=65745d
windsor=3c0878
wine berry=591d35
winter hazel=d5d195
wisp pink=fef4f8
wisteria=9771b5
wistful=a4a6d3
witch haze=fffc99
wood bark=261105
woodland=4d5328
woodrush=302a0f
woodsmoke=0c0d0f
woody brown=483131
xanadu=738678
yellow green=c5e17a
yellow metal=716338
yellow orange=ffae42
yellow sea=fea904
yellow=ffff00
your pink=ffc3c0
yukon gold=7b6608
yuma=cec291
zambezi=685558
zanah=daecd6
zest=e5841b
zeus=292319
ziggurat=bfdbe2
zinnwaldite=ebc2af
zircon=f4f8ff
zombie=e4d69b
zorba=a59b91
zuccini=044022
zumthor=edf6ff


.. note:: You can also use raw RGB values with this module so you do not have to use the predefined color names. .. automodule:: pyutils.ansi :members: :undoc-members: :show-inheritance: pyutils.argparse\_utils module ------------------------------ I use the Python internal :py:mod:`argparse` module for commandline argument parsing but found it lacking in some ways. This module contains code to fill those gaps. It include stuff like: - An :class:`argparse.Action` to create pairs of flags such as `--feature` and `--no_feature`. - A helper to parse and validate bools, IP addresses, MAC addresses, filenames, percentages, dates, datetimes, and durations passed as flags. .. automodule:: pyutils.argparse_utils :members: :undoc-members: :show-inheritance: pyutils.bootstrap module ------------------------ Bootstrap module defines a decorator meant to wrap your main function. This decorator will do several things for you: - If your code uses the :file:`config.py` module (see below), it invokes :py:meth:`parse` automatically to initialize `config.config` from commandline flags, environment variables, or other sources. - It will optionally break into pdb in response to an unhandled Exception at the top level of your code. - It initializes logging for your program (see :file:`logging.py`). - It can optionally run a code and/or memory profiler on your code. .. automodule:: pyutils.bootstrap :members: :undoc-members: :show-inheritance: pyutils.config module --------------------- This module reads the program's configuration parameters from: the commandline (using :py:mod:`argparse`), environment variables and/or a shared zookeeper-based configuration. It stores this configuration state in a dict-like structure that can be queried by your code at runtime. It handles creating a nice `--help` message for your code. It can optionally react to dynamic config changes and change state at runtime (if and only if you name your flag with the *dynamic_* prefix and are using zookeeper-based configs). It can optionally save and retrieve sets of arguments from files on the local disk or on Zookeeper. All of my examples use this as does the pyutils library itself. .. automodule:: pyutils.config :members: :undoc-members: :show-inheritance: pyutils.decorator\_utils module ------------------------------- This is a grab bag of decorators. .. automodule:: pyutils.decorator_utils :members: :undoc-members: :show-inheritance: pyutils.dict\_utils module -------------------------- A bunch of helpers for dealing with Python dicts. .. automodule:: pyutils.dict_utils :members: :undoc-members: :show-inheritance: pyutils.exec\_utils module -------------------------- Helper code for dealing with subprocesses. .. automodule:: pyutils.exec_utils :members: :undoc-members: :show-inheritance: pyutils.function\_utils module ------------------------------ Helper util for dealing with functions. .. automodule:: pyutils.function_utils :members: :undoc-members: :show-inheritance: pyutils.id\_generator module ---------------------------- Generate unique identifiers. .. automodule:: pyutils.id_generator :members: :undoc-members: :show-inheritance: pyutils.iter\_utils module -------------------------- Iterator utilities including a :py:class:`PeekingIterator`, :py:class:`PushbackIterator`, and :py:class:`SamplingIterator`. .. automodule:: pyutils.iter_utils :members: :undoc-members: :show-inheritance: pyutils.list\_utils module -------------------------- Utilities for dealing with Python lists. .. automodule:: pyutils.list_utils :members: :undoc-members: :show-inheritance: pyutils.logging\_utils module ----------------------------- This is a module that offers an opinionated take on how whole program logging should be initialized and controlled. It uses standard Python :py:mod:`logging` but gives you control, via commandline config, to: - Set the logging level of the program including overriding the logging level for individual modules, - Define the logging message format including easily adding a PID/TID marker on all messages to help with multithreaded debugging, - Control the destination (file, `sys.stderr`, syslog) of messages, - Control the facility and logging level used with syslog, - Squelch repeated messages, - Log probalistically, - Clear rogue logging handlers added by other imports. .. automodule:: pyutils.logging_utils :members: :undoc-members: :show-inheritance: pyutils.math\_utils module -------------------------- Helper utilities that are "mathy" such as a :py:class:`NumericPopulation` that makes population summary statistics available to your code quickly, GCD computation, literate float truncation, percentage <-> multiplier, prime number determination, etc... .. automodule:: pyutils.math_utils :members: :undoc-members: :show-inheritance: pyutils.misc\_utils module -------------------------- Miscellaneous utilities: are we running as root, and is a debugger attached? .. automodule:: pyutils.misc_utils :members: :undoc-members: :show-inheritance: pyutils.persistent module ------------------------- Persistent defines a class hierarchy and decorator for creating singleton classes that (optionally / conditionally) load their state from some external location and (optionally / conditionally) save their state to an external location at shutdown. .. automodule:: pyutils.persistent :members: :undoc-members: :show-inheritance: pyutils.remote\_worker module ----------------------------- This module defines a helper that is invoked by the remote executor to run pickled code on a remote machine. It is used by code marked with `@parallelize(method=Method.REMOTE)` in the parallelize framework. .. automodule:: pyutils.remote_worker :members: :undoc-members: :show-inheritance: pyutils.state\_tracker module ----------------------------- This module defines several classes (:py:class:`StateTracker`, :py:class:`AutomaticStateTracker`, and :py:class:`WaitableAutomaticStateTracker`) that can be used as base classes. These class patterns are meant to encapsulate and represent state that dynamically changes. These classes update their state (either automatically or when invoked to poll) and allow their callers to wait on state changes. .. automodule:: pyutils.state_tracker :members: :undoc-members: :show-inheritance: pyutils.stopwatch module ------------------------ This is a stopwatch context that just times how long something took to execute. .. automodule:: pyutils.stopwatch :members: :undoc-members: :show-inheritance: pyutils.string\_utils module ---------------------------- A bunch of utilities for dealing with strings. Based on a really great starting library from Davide Zanotti, I've added a pile of other string functions so hopefully it will handle all of your string-needs. .. automodule:: pyutils.string_utils :members: :undoc-members: :show-inheritance: pyutils.text\_utils module -------------------------- Utilities for dealing with and creating text chunks. For example: - Make a bar graph, - make a spark line, - left, right, center, justify text, - word wrap text, - indent text, - create a header line, - draw a box around some text. .. automodule:: pyutils.text_utils :members: :undoc-members: :show-inheritance: pyutils.unittest\_utils module ------------------------------ Utilities to support smarter unit tests. .. automodule:: pyutils.unittest_utils :members: :undoc-members: :show-inheritance: pyutils.unscrambler module -------------------------- Unscramble scrambled English words quickly. .. automodule:: pyutils.unscrambler :members: :undoc-members: :show-inheritance: pyutils.zookeeper module ------------------------ A helper module for dealing with Zookeeper that adds some functionality. .. automodule:: pyutils.zookeeper :members: :undoc-members: :show-inheritance: Module contents --------------- .. automodule:: pyutils :members: :undoc-members: :show-inheritance: