From 42a549833b3f03980fd5e14513f24e397deca39e Mon Sep 17 00:00:00 2001 From: Cristian Date: Thu, 23 Jul 2020 11:47:01 -0500 Subject: [PATCH 1/2] fix: Add missing colors to dict --- archivebox/config/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/archivebox/config/__init__.py b/archivebox/config/__init__.py index 140769db..3daee9fb 100644 --- a/archivebox/config/__init__.py +++ b/archivebox/config/__init__.py @@ -143,12 +143,14 @@ ANSI = {k: '' for k in DEFAULT_CLI_COLORS.keys()} COLOR_DICT = { '00': [(0, 0, 0), (0, 0, 0)], + '30': [(0, 0, 0), (0, 0, 0)], '31': [(255, 0, 0), (128, 0, 0)], '32': [(0, 200, 0), (0, 128, 0)], '33': [(255, 255, 0), (128, 128, 0)], '34': [(0, 0, 255), (0, 0, 128)], '35': [(255, 0, 255), (128, 0, 128)], '36': [(0, 255, 255), (0, 128, 128)], + '37': [(255, 255, 255), (255, 255, 255)], } STATICFILE_EXTENSIONS = { From 030013899ddb742022dd715f3fa47d4aa2ff5e5f Mon Sep 17 00:00:00 2001 From: Cristian Date: Thu, 23 Jul 2020 12:02:17 -0500 Subject: [PATCH 2/2] feat: change COLOR_DICT to a default dict to prevent future issues --- archivebox/config/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/archivebox/config/__init__.py b/archivebox/config/__init__.py index 3daee9fb..87bedbd6 100644 --- a/archivebox/config/__init__.py +++ b/archivebox/config/__init__.py @@ -12,6 +12,7 @@ from hashlib import md5 from typing import Optional, Type, Tuple, Dict from subprocess import run, PIPE, DEVNULL from configparser import ConfigParser +from collections import defaultdict from .stubs import ( SimpleConfigValueDict, @@ -141,7 +142,7 @@ DEFAULT_CLI_COLORS = { } ANSI = {k: '' for k in DEFAULT_CLI_COLORS.keys()} -COLOR_DICT = { +COLOR_DICT = defaultdict(lambda: [(0, 0, 0), (0, 0, 0)], { '00': [(0, 0, 0), (0, 0, 0)], '30': [(0, 0, 0), (0, 0, 0)], '31': [(255, 0, 0), (128, 0, 0)], @@ -151,7 +152,7 @@ COLOR_DICT = { '35': [(255, 0, 255), (128, 0, 128)], '36': [(0, 255, 255), (0, 128, 128)], '37': [(255, 255, 255), (255, 255, 255)], -} +}) STATICFILE_EXTENSIONS = { # 99.999% of the time, URLs ending in these extensions are static files