Skip to content

Commit

Permalink
rpl_regex: remove args from functions
Browse files Browse the repository at this point in the history
as this was rightfully marked by updated bugbear, that in before
we were mixing named and positioned arguments.
Remove *args, as it also not supported by regex functions

Signed-off-by: Konrad Weihmann <[email protected]>
  • Loading branch information
priv-kweihmann committed Dec 2, 2023
1 parent 4fe21b0 commit ff0a14b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions oelint_parser/rpl_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class RegexRpl():
"""

@staticmethod
def search(pattern, string, timeout=5, default=None, *args, **kwargs):
def search(pattern, string, timeout=5, default=None, **kwargs):
"""replacement for re.search
Args:
Expand All @@ -19,12 +19,12 @@ def search(pattern, string, timeout=5, default=None, *args, **kwargs):
Match: Match object or None
"""
try:
return regex.search(pattern, string, timeout=timeout, *args, **kwargs)
return regex.search(pattern, string, timeout=timeout, **kwargs)
except TimeoutError:
return default

@staticmethod
def split(pattern, string, timeout=5, default=None, *args, **kwargs):
def split(pattern, string, timeout=5, default=None, **kwargs):
"""replacement for re.split
Args:
Expand All @@ -37,12 +37,12 @@ def split(pattern, string, timeout=5, default=None, *args, **kwargs):
list: list object or None
"""
try:
return regex.split(pattern, string, timeout=timeout, *args, **kwargs)
return regex.split(pattern, string, timeout=timeout, **kwargs)
except TimeoutError:
return default

@staticmethod
def match(pattern, string, timeout=5, default=None, *args, **kwargs):
def match(pattern, string, timeout=5, default=None, **kwargs):
"""replacement for re.match
Args:
Expand All @@ -55,12 +55,12 @@ def match(pattern, string, timeout=5, default=None, *args, **kwargs):
Match: Match object or None
"""
try:
return regex.match(pattern, string, timeout=timeout, *args, **kwargs)
return regex.match(pattern, string, timeout=timeout, **kwargs)
except TimeoutError:
return default

@staticmethod
def sub(pattern, repl, string, timeout=5, default='', *args, **kwargs):
def sub(pattern, repl, string, timeout=5, default='', **kwargs):
"""replacement for re.sub
Args:
Expand All @@ -74,12 +74,12 @@ def sub(pattern, repl, string, timeout=5, default='', *args, **kwargs):
str: string
"""
try:
return regex.sub(pattern, repl, string, timeout=timeout, *args, **kwargs)
return regex.sub(pattern, repl, string, timeout=timeout, **kwargs)
except TimeoutError:
return default

@staticmethod
def finditer(pattern, string, timeout=5, default=None, *args, **kwargs):
def finditer(pattern, string, timeout=5, default=None, **kwargs):
"""replacement for re.finditer
Args:
Expand All @@ -92,6 +92,6 @@ def finditer(pattern, string, timeout=5, default=None, *args, **kwargs):
Scanner: Scanner object or None
"""
try:
return regex.finditer(pattern, string, timeout=timeout, *args, **kwargs)
return regex.finditer(pattern, string, timeout=timeout, **kwargs)
except TimeoutError:
return default

0 comments on commit ff0a14b

Please sign in to comment.