Skip to content
This repository was archived by the owner on Nov 22, 2019. It is now read-only.

Commit 7d8c2d2

Browse files
committed
Peanuts: lint session
1 parent 86ab9a1 commit 7d8c2d2

26 files changed

+237
-242
lines changed

lutLab/curve_to_lut.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def curve_to_lut(colorspace, gamma, outlutfile, out_type=None, out_format=None,
106106
# colorspace mode
107107
try:
108108
colorspace_obj = dict(COLORSPACES.items() +
109-
PRIVATE_COLORSPACES.items())[colorspace]
109+
PRIVATE_COLORSPACES.items())[colorspace]
110110
except KeyError:
111111
raise CurveToLUTException(("Unsupported {0} "
112112
"Colorspace!").format(colorspace))
@@ -141,7 +141,7 @@ def curve_to_lut(colorspace, gamma, outlutfile, out_type=None, out_format=None,
141141
# process file output
142142
if os.path.isdir(outlutfile):
143143
filename = "{0}{1}".format(title,
144-
preset[presets.EXT])
144+
preset[presets.EXT])
145145
outlutfile = os.path.join(outlutfile, filename)
146146
else:
147147
try:
@@ -215,11 +215,11 @@ def __get_options():
215215
if __name__ == '__main__':
216216
ARGS = __get_options()
217217
try:
218-
if not ARGS.input_range is None:
218+
if ARGS.input_range is not None:
219219
ARGS.input_range = presets.convert_string_range(ARGS.input_range)
220-
if not ARGS.output_range is None:
220+
if ARGS.output_range is not None:
221221
ARGS.output_range = presets.convert_string_range(ARGS.output_range)
222-
if not ARGS.preset is None:
222+
if ARGS.preset is not None:
223223
ARGS.preset = presets.get_presets_from_env()[ARGS.preset]
224224
curve_to_lut(ARGS.colorspace,
225225
ARGS.gamma,

lutLab/lut_to_lut.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ def __get_options():
162162

163163
if __name__ == '__main__':
164164
ARGS = __get_options()
165-
if not ARGS.input_range is None:
165+
if ARGS.input_range is not None:
166166
ARGS.input_range = presets.convert_string_range(ARGS.input_range)
167-
if not ARGS.output_range is None:
167+
if ARGS.output_range is not None:
168168
ARGS.output_range = presets.convert_string_range(ARGS.output_range)
169-
if not ARGS.preset is None:
169+
if ARGS.preset is not None:
170170
ARGS.preset = presets.get_presets_from_env()[ARGS.preset]
171171
try:
172172
lut_to_lut(ARGS.inlutfiles,

lutLab/plot_that_chroma.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __get_options():
7171
help=("RGB Colorspace."),
7272
type=str, action='append', dest='colorspaces',
7373
choices=sorted(COLORSPACES.keys() +
74-
PRIVATE_COLORSPACES.keys()))
74+
PRIVATE_COLORSPACES.keys()))
7575
# Points
7676
parser.add_argument("-p", "--point", type=float, nargs=2,
7777
metavar=('x', 'y'), action='append',

lutLab/rgb_to_xyz_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def __get_options():
9999
help=("Input RGB Colorspace."),
100100
type=str,
101101
choices=sorted(COLORSPACES.keys() +
102-
PRIVATE_COLORSPACES.keys()),
102+
PRIVATE_COLORSPACES.keys()),
103103
default='Rec709')
104104
# Output format
105105
parser.add_argument("-f", "--format",

plotThatLut/plot_that_lut.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def plot_cube(lutfile, cube_size, processor):
200200
title(filename)
201201
# plot 3D values
202202
axis.scatter(red_values, green_values, blue_values, c=input_colors,
203-
marker="o")
203+
marker="o")
204204
return show_plot(fig, filename)
205205

206206

plotThatLut/ptlut.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __get_options():
4444
# type
4545
parser.add_argument("-t", "--plot-type",
4646
help=("Plot type. By default, a curve for a 1D/2D LUT "
47-
"and a cube for a 3D LUT."),
47+
"and a cube for a 3D LUT."),
4848
type=str,
4949
choices=['auto', 'curve', 'red_curve', 'blue_curve',
5050
'green_curve', 'cube'],
@@ -53,7 +53,7 @@ def __get_options():
5353
parser.add_argument("-s", "--samples-count", help=(
5454
"Samples count. Ex : {0} for a curve or {1} for a cube."
5555
).format(plot_that_lut.DEFAULT_SAMPLE, plot_that_lut.DEFAULT_CUBE_SIZE),
56-
default=None, type=int)
56+
default=None, type=int)
5757
# version
5858
parser.add_argument('-v', "--version", action='version',
5959
version='{0} - version {1}'.format(description,

test/abstract_lut_test.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ def setUp(self):
3636
lut1d = os.path.join(test_dir, 'CineonToLin_1D.csp')
3737
lut3d = os.path.join(test_dir, 'saturation.3dl')
3838
self.processor_1d = create_ocio_processor(lut1d,
39-
interpolation=INTERP_LINEAR)
39+
interpolation=INTERP_LINEAR)
4040
self.processor_3d = create_ocio_processor(lut3d,
41-
interpolation=INTERP_TETRAHEDRAL)
41+
interpolation=INTERP_TETRAHEDRAL)
4242
self.helpers_1d_to_test = [
43-
(CUBE_HELPER, '.cube'),
44-
[SPI_HELPER, '.spi1d'],
45-
(CSP_HELPER, '.csp'),
46-
]
43+
(CUBE_HELPER, '.cube'),
44+
[SPI_HELPER, '.spi1d'],
45+
(CSP_HELPER, '.csp'),
46+
]
4747
self.helpers_3d_to_test = [
48-
(CUBE_HELPER, '.cube', True),
49-
[SPI_HELPER, '.spi3d', True],
50-
(CSP_HELPER, '.csp', True),
51-
(THREEDL_HELPER, '.3dl', True),
52-
(CLCC_HELPER, '.cc', False),
53-
(JSON_HELPER, '.json', False)
54-
]
48+
(CUBE_HELPER, '.cube', True),
49+
[SPI_HELPER, '.spi3d', True],
50+
(CSP_HELPER, '.csp', True),
51+
(THREEDL_HELPER, '.3dl', True),
52+
(CLCC_HELPER, '.cc', False),
53+
(JSON_HELPER, '.json', False)
54+
]
5555

5656
def test_default_1d_lut(self):
5757
""" Test a default 1d LUT export
@@ -129,11 +129,11 @@ def test_check_attributes(self):
129129
CUBE_HELPER.check_preset(cust_preset)
130130
# try to write a 1D LUT with a 3D preset
131131
self.failUnlessRaises(alh.AbstractLUTException,
132-
CUBE_HELPER.write_1d_lut,
133-
self.processor_1d,
134-
outlutfile,
135-
cust_preset)
136-
## test value type
132+
CUBE_HELPER.write_1d_lut,
133+
self.processor_1d,
134+
outlutfile,
135+
cust_preset)
136+
# # test value type
137137
# cube size
138138
cust_preset[presets.CUBE_SIZE] = presets.CUBE_SIZE_MAX_VALUE + 1
139139
self.failUnlessRaises(presets.PresetException,
@@ -177,15 +177,15 @@ def test_float_luts(self):
177177
10)
178178
# write encode LUT
179179
helper.write_2d_lut(colorspace.encode_gradation,
180-
encode_filepath,
181-
args_1d)
180+
encode_filepath,
181+
args_1d)
182182
# write decode LUT
183183
args_1d[presets.IN_RANGE] = get_input_range(colorspace,
184184
"decode",
185185
10)
186186
helper.write_2d_lut(colorspace.decode_gradation,
187-
decode_filepath,
188-
args_1d)
187+
decode_filepath,
188+
args_1d)
189189
# test transparency
190190
proc = create_ocio_processor(encode_filepath,
191191
postlutfile=decode_filepath,
@@ -201,8 +201,8 @@ def test_float_luts(self):
201201
self.assert_(abs_value < delta,
202202
"{0} transparency test failed : {1:8f} >"
203203
" acceptable delta ({2:8f})".format(name,
204-
abs_value,
205-
delta)
204+
abs_value,
205+
delta)
206206
)
207207

208208
def test_3dl_preset(self):
@@ -247,14 +247,14 @@ def test_ascii_lut(self):
247247
outlutfile = os.path.join(self.tmp_dir, "default_2D.lut")
248248
preset = ASCII_HELPER.get_default_preset()
249249
ASCII_HELPER.write_2d_lut(colorspace.decode_gradation,
250-
outlutfile,
251-
preset)
250+
outlutfile,
251+
preset)
252252
# 1D LUT
253253
outlutfile = os.path.join(self.tmp_dir, "default_1D.lut")
254254
preset = ASCII_HELPER.get_default_preset()
255255
ASCII_HELPER.write_1d_lut(colorspace.decode_gradation,
256-
outlutfile,
257-
preset)
256+
outlutfile,
257+
preset)
258258
# test out bit depth inadequate with output range
259259
preset[OUT_BITDEPTH] = 12
260260
self.failUnlessRaises(AsciiHelperException, ASCII_HELPER.write_1d_lut,
@@ -278,17 +278,17 @@ def test_complete_attributes(self):
278278
# try to write a float ascii lut without forcing float mode
279279
cust_preset[presets.IN_RANGE] = [0, 1.0]
280280
self.failUnlessRaises(PresetException, ASCII_HELPER.write_1d_lut,
281-
colorspace.decode_gradation,
282-
outlutfile,
283-
cust_preset)
281+
colorspace.decode_gradation,
282+
outlutfile,
283+
cust_preset)
284284
# force float mode
285285
cust_preset[presets.IS_FLOAT] = True
286286
ASCII_HELPER.write_1d_lut(colorspace.decode_gradation,
287287
outlutfile,
288288
cust_preset)
289289

290290
def tearDown(self):
291-
#Remove test directory
291+
# Remove test directory
292292
shutil.rmtree(self.tmp_dir)
293293

294294

test/chroma_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_chroma_plot(self):
2626
mplh.plot_colorspace_gamut(colorspaces.ACES, lines_color="c",
2727
upvp_conversion=True)
2828
mplh.plot_colorspace_gamut(colorspaces.REC709, lines_color="m",
29-
upvp_conversion=True)
29+
upvp_conversion=True)
3030
plt.legend(loc=4)
3131
if DISPLAY:
3232
plt.show()

test/colorspaces_test.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ def test_gradation(self):
1717
1818
"""
1919
colorspace_to_test = [REC709,
20-
ALEXALOGCV3,
21-
WIDEGAMUT,
22-
REC2020_12B,
23-
ACESLOG_32f,
24-
sRGB,
25-
SGAMUTSLOG,
26-
SGAMUTSLOG2,
27-
SGAMUTSLOG3,
28-
]
20+
ALEXALOGCV3,
21+
WIDEGAMUT,
22+
REC2020_12B,
23+
ACESLOG_32f,
24+
sRGB,
25+
SGAMUTSLOG,
26+
SGAMUTSLOG2,
27+
SGAMUTSLOG3,
28+
]
2929
delta = 0.000000000000001
3030
for space in colorspace_to_test:
3131
name = space.__class__.__name__
@@ -34,8 +34,8 @@ def test_gradation(self):
3434
diff = abs(res - value)
3535
message = ("{0} gradations not transparent ! "
3636
"in: {1:8f} out: {2:8f}").format(name,
37-
value,
38-
res)
37+
value,
38+
res)
3939
self.assert_(diff < delta, message)
4040

4141

test/curve_to_lut_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_curve(self):
3434
process_input_range=True)
3535

3636
def tearDown(self):
37-
#Remove test directory
37+
# Remove test directory
3838
shutil.rmtree(self.tmp_dir)
3939

4040
if __name__ == '__main__':

0 commit comments

Comments
 (0)