Skip to content

Commit

Permalink
style: Fix FURB156: Use of hardcoded string charset
Browse files Browse the repository at this point in the history
  • Loading branch information
echoix committed Oct 17, 2024
1 parent e6fee0f commit f0932e8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion gui/wxpython/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import re
import inspect
import operator
from string import digits

from grass.script import core as grass
from grass.script import task as gtask
Expand Down Expand Up @@ -936,7 +937,7 @@ def SetAddOnPath(addonPath=None, key="PATH"):


def color_resolve(color):
if len(color) > 0 and color[0] in "0123456789":
if len(color) > 0 and color[0] in digits:
rgb = tuple(map(int, color.split(":")))
label = color
else:
Expand Down
3 changes: 2 additions & 1 deletion gui/wxpython/gui_core/goutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""

import textwrap
from string import digits

import wx
from wx import stc
Expand Down Expand Up @@ -624,7 +625,7 @@ def AddStyledMessage(self, message, style=None):
self.linePos = self.GetCurrentPos()
if c != " ":
last_c = c
if last_c not in ("0123456789"):
if last_c not in (digits):
self.AddTextWrapped("\n", wrap=None)
self.linePos = -1
else:
Expand Down
3 changes: 2 additions & 1 deletion python/grass/imaging/images2ims.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import os
from operator import itemgetter
from string import digits

try:
import numpy as np
Expand Down Expand Up @@ -117,7 +118,7 @@ def _getSequenceNumber(filename, part1, part2):
# Get all numeric chars
seq2 = ""
for c in seq:
if c in "0123456789":
if c in digits:
seq2 += c
else:
break
Expand Down
4 changes: 3 additions & 1 deletion scripts/d.rast.edit/d.rast.edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
import sys
import math
import atexit
from string import digits

import grass.script as gs

from grass.script.setup import set_gui_path
Expand Down Expand Up @@ -448,7 +450,7 @@ def OnClose(self, ev):

def OnReturn(self, ev):
self.app.brush = self.newval.GetValue()
if self.app.brush != "*" and self.app.brush.strip("0123456789") != "":
if self.app.brush != "*" and self.app.brush.strip(digits) != "":
self.app.brush = "*"
self.brush_update()

Expand Down

0 comments on commit f0932e8

Please sign in to comment.