Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix color enum and lookup #64

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion status-light/utility/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Color(enum.Enum):
YELLOW = 'ffff00'
ORANGE = 'ff9000'
GREEN = '00ff00'
BLUE = '0000f'
BLUE = '0000ff'

def _missing_(self, value): # pylint: disable=arguments-differ
return self.UNKNOWN
Expand Down
2 changes: 1 addition & 1 deletion status-light/utility/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,6 @@ def get_sleep(self):
def get_log_level(self):
# _parse_enum returns a list, so grab the first, and, hopefully
# only, element
self.log_level = util.parse_enum(os.environ.get('LOGLEVEL'),
self.log_level = util.parse_enum(os.environ.get('LOGLEVEL', None),
enum.LogLevel, 'LOGLEVEL', self.log_level)[0]
return self.log_level is not None
6 changes: 3 additions & 3 deletions status-light/utility/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ def parse_color(color_string, default):
if not re.match('^[0-9A-Fa-f]{6}$', color_string) is None:
temp_color = color_string
else:
# _parse_enum returns a list, so grab the first, and, hopefully
# only, element
temp_color = parse_enum(color_string, enum.Color, "parse_color", default)[0]
# _parse_enum returns a list of enums, so grab the first, and, hopefully
# only, element and then get the value (the actual hex color value)
temp_color = parse_enum(color_string, enum.Color, "parse_color", default)[0].value
except BaseException as ex: # pylint: disable=broad-except
logger.warning('Exception encountered during _parseColor: %s, using default: %s',
ex, default)
Expand Down