Skip to content

Commit

Permalink
Resolve pylint possibly-used-before-assignment
Browse files Browse the repository at this point in the history
************* Module fract4d.fractal
fract4d/fractal.py:174:40: E0606: Possibly using variable 'main_file' before assignment (possibly-used-before-assignment)
************* Module fract4d.gradient
fract4d/gradient.py:223:45: E0606: Possibly using variable 'factor' before assignment (possibly-used-before-assignment)
************* Module fract4d.tests.test_fract4d
fract4d/tests/test_fract4d.py:582:36: E0606: Possibly using variable 'temp' before assignment (possibly-used-before-assignment)
************* Module fract4d_compiler.translate
fract4d_compiler/translate.py:793:15: E0606: Possibly using variable 'r' before assignment (possibly-used-before-assignment)
  • Loading branch information
cjmayo committed May 27, 2024
1 parent 0caa3dc commit 893fcd0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fract4d/fractal.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def save(self, file, update_saved_flag=True, **kwds):

if compress:
file.close()
print(file.getvalue(), file=main_file)
print(file.getvalue(), file=main_file) # pylint: disable=possibly-used-before-assignment

if update_saved_flag:
self.saved = True
Expand Down
1 change: 1 addition & 0 deletions fract4d/gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def get_color_at(self, pos):
mpos = (self.mid - self.left) / len
pos = (pos - self.left) / len

# pylint: disable=possibly-used-before-assignment
if self.bmode == Blend.LINEAR:
factor = self.get_linear_factor(pos, mpos)
elif self.bmode == Blend.CURVED:
Expand Down
1 change: 1 addition & 0 deletions fract4d/tests/test_fract4d.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ def testFDSite(self):
# we use a buffer here like in gtkfractal.py "onData"
nb = 2 * 4
bytes = b""
temp = b""
while True:
# wait up to 1 sec until we can read, otherwise we assume the counterpart is gone (an error ocurred on the C++ layer)
r, w, e = select.select([rfd], [], [], 1)
Expand Down
1 change: 1 addition & 0 deletions fract4d_compiler/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ def declarray(self, node):
atype)

def exp(self, node):
# pylint: disable=possibly-used-before-assignment
if node.type == "const":
r = self.const(node)
elif node.type == "id":
Expand Down

0 comments on commit 893fcd0

Please sign in to comment.