diff --git a/gallery/utils/metadata/__init__.py b/gallery/utils/metadata/__init__.py index 18157c7..c7a8bcb 100644 --- a/gallery/utils/metadata/__init__.py +++ b/gallery/utils/metadata/__init__.py @@ -77,10 +77,9 @@ class Metadata: "raw": value, "formatted": ( getattr( - helpers, mapping_val[key][1] # pylint: disable=E0602 - )( - value - ) + helpers, + mapping_val[key][1], # pylint: disable=E0602 + )(value) ), } else: diff --git a/gallery/utils/metadata/helpers.py b/gallery/utils/metadata/helpers.py index 266961b..c3a5f61 100644 --- a/gallery/utils/metadata/helpers.py +++ b/gallery/utils/metadata/helpers.py @@ -53,7 +53,7 @@ def focal_length(value): calculated = value[0] / value[1] except TypeError: calculated = value - + return str(round(calculated, 1)) + " mm" @@ -68,11 +68,7 @@ def color_space(value): """ Maps the value of the color space to a human readable format """ - value_map = { - 0: "Reserved", - 1: "sRGB", - 65535: "Uncalibrated" - } + value_map = {0: "Reserved", 1: "sRGB", 65535: "Uncalibrated"} try: return value_map[int(value)] except KeyError: @@ -158,11 +154,7 @@ def resolution_unit(value): """ Maps the value of the resolution unit to a human readable format """ - value_map = { - 1: "No absolute unit of measurement", - 2: "Inch", - 3: "Centimeter" - } + value_map = {1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter"} try: return value_map[int(value)] except KeyError: @@ -398,18 +390,21 @@ def pixel_dimension(value): """ return str(value) + " px" + def title(value): """ Maps the value of the title to a human readable format """ return str(value.title()) + def subject_distance(value): """ Maps the value of the subject distance to a human readable format """ return str(value) + " m" + def subject_distance_range(value): """ Maps the value of the subject distance range to a human readable format @@ -423,4 +418,4 @@ def subject_distance_range(value): try: return value_map[int(value)] except KeyError: - return None \ No newline at end of file + return None