Skip to content

Commit 4aa96d3

Browse files
committed
Resolved pylint redefined-variable-type warnings
1 parent 69196ff commit 4aa96d3

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/bitmessageqt/__init__.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,7 @@ def click_pushButtonSend(self):
20472047
# attempt register
20482048
if email[-14:] != "@mailchuck.com":
20492049
# 12 character random email address
2050-
email = ''.join(
2050+
email = u''.join(
20512051
random.SystemRandom().choice(
20522052
string.ascii_lowercase
20532053
) for _ in range(12)
@@ -2063,78 +2063,77 @@ def click_pushButtonSend(self):
20632063
" an email gateway. Sending registration"
20642064
" now as {0}, please wait for the registration"
20652065
" to be processed before retrying sending."
2066-
).format(email)
2067-
)
2066+
).format(email))
20682067
return
20692068
status, addressVersionNumber, streamNumber, ripe = \
20702069
decodeAddress(toAddress)
20712070
if status != 'success':
20722071
try:
2073-
toAddress = unicode(toAddress, 'utf-8', 'ignore')
2072+
toAddress_value = unicode(
2073+
toAddress, 'utf-8', 'ignore')
20742074
except:
20752075
logger.warning(
2076-
"Failed unicode(toAddress ):",
2077-
exc_info=True)
2076+
"Failed unicode(toAddress ):", exc_info=True)
20782077
logger.error(
20792078
'Error: Could not decode recipient address %s: %s',
2080-
toAddress, status)
2079+
toAddress_value, status)
20812080

20822081
if status == 'missingbm':
20832082
self.updateStatusBar(_translate(
20842083
"MainWindow",
20852084
"Error: Bitmessage addresses start with"
20862085
" BM- Please check the recipient address {0}"
2087-
).format(toAddress))
2086+
).format(toAddress_value))
20882087
elif status == 'checksumfailed':
20892088
self.updateStatusBar(_translate(
20902089
"MainWindow",
20912090
"Error: The recipient address {0} is not"
20922091
" typed or copied correctly. Please check it."
2093-
).format(toAddress))
2092+
).format(toAddress_value))
20942093
elif status == 'invalidcharacters':
20952094
self.updateStatusBar(_translate(
20962095
"MainWindow",
20972096
"Error: The recipient address {0} contains"
20982097
" invalid characters. Please check it."
2099-
).format(toAddress))
2098+
).format(toAddress_value))
21002099
elif status == 'versiontoohigh':
21012100
self.updateStatusBar(_translate(
21022101
"MainWindow",
21032102
"Error: The version of the recipient address"
21042103
" {0} is too high. Either you need to upgrade"
21052104
" your Bitmessage software or your"
21062105
" acquaintance is being clever."
2107-
).format(toAddress))
2106+
).format(toAddress_value))
21082107
elif status == 'ripetooshort':
21092108
self.updateStatusBar(_translate(
21102109
"MainWindow",
21112110
"Error: Some data encoded in the recipient"
21122111
" address {0} is too short. There might be"
21132112
" something wrong with the software of"
21142113
" your acquaintance."
2115-
).format(toAddress))
2114+
).format(toAddress_value))
21162115
elif status == 'ripetoolong':
21172116
self.updateStatusBar(_translate(
21182117
"MainWindow",
21192118
"Error: Some data encoded in the recipient"
21202119
" address {0} is too long. There might be"
21212120
" something wrong with the software of"
21222121
" your acquaintance."
2123-
).format(toAddress))
2122+
).format(toAddress_value))
21242123
elif status == 'varintmalformed':
21252124
self.updateStatusBar(_translate(
21262125
"MainWindow",
21272126
"Error: Some data encoded in the recipient"
21282127
" address {0} is malformed. There might be"
21292128
" something wrong with the software of"
21302129
" your acquaintance."
2131-
).format(toAddress))
2130+
).format(toAddress_value))
21322131
else:
21332132
self.updateStatusBar(_translate(
21342133
"MainWindow",
21352134
"Error: Something is wrong with the"
21362135
" recipient address {0}."
2137-
).format(toAddress))
2136+
).format(toAddress_value))
21382137
elif fromAddress == '':
21392138
self.updateStatusBar(_translate(
21402139
"MainWindow",
@@ -4343,6 +4342,8 @@ def tableWidgetInboxItemClicked(self):
43434342
except NameError:
43444343
message = u""
43454344
except IndexError:
4345+
# _translate() often returns unicode, no redefinition here!
4346+
# pylint: disable=redefined-variable-type
43464347
message = _translate(
43474348
"MainWindow",
43484349
"Error occurred: could not load message from disk."

0 commit comments

Comments
 (0)