Skip to content

Commit 15b0245

Browse files
committed
Fix possible use of str methods with Unicode strings.
Use instance methods instead. They are same for str and unicode.
1 parent 8598999 commit 15b0245

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

diffpy/pdfgui/gui/wxExtensions/validators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ def Validate(self, win):
5656
val = tc.GetValue()
5757

5858
if self.flag == ALPHA_ONLY:
59-
return str.isalpha(val)
59+
return val.isalpha()
6060

6161
elif self.flag == DIGIT_ONLY:
6262
if self.allowNeg:
6363
val1 = val[:1].lstrip('-') + val[1:]
6464
else:
6565
val1 = val
66-
return str.isdigit(val1)
66+
return val1.isdigit()
6767

6868
elif self.flag == FLOAT_ONLY:
6969
try:
@@ -100,7 +100,7 @@ def OnChar(self, event):
100100
newval1 = newval
101101
if self.allowNeg:
102102
newval1 = newval[:1].lstrip('-') + newval[1:]
103-
if str.isdigit(newval1):
103+
if newval1.isdigit():
104104
event.Skip()
105105
return
106106

0 commit comments

Comments
 (0)