summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2020-05-02 18:46:17 +0700
committerGitHub <noreply@github.com>2020-05-02 18:46:17 +0700
commitd51029d1684d852e690e1a6d96bdc89ed56c56db (patch)
tree8639bc66938657631ca98b050536c5f671802ac8
parent096c77340b2a6a72edbed660fe4fb000aca9275f (diff)
parent51f98e74749acd4b41c642380c7ad4d340e9d3c2 (diff)
downloadvyos-1x-d51029d1684d852e690e1a6d96bdc89ed56c56db.tar.gz
vyos-1x-d51029d1684d852e690e1a6d96bdc89ed56c56db.zip
Merge pull request #385 from c-po/numeric-performance
validators: numeric: T2414: improve runtime performance
-rwxr-xr-xsrc/validators/numeric6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/validators/numeric b/src/validators/numeric
index 0a2d83d14..2cd5178b9 100755
--- a/src/validators/numeric
+++ b/src/validators/numeric
@@ -19,7 +19,6 @@
import sys
import argparse
-import re
parser = argparse.ArgumentParser()
parser.add_argument("-f", "--float", action="store_true", help="Accept floating point values")
@@ -50,8 +49,9 @@ if args.range:
valid = False
for r in args.range:
try:
- lower, upper = re.match(r'(\d+)\s*\-\s*(\d+)', r).groups()
- lower, upper = int(lower), int(upper)
+ list = r.split('-')
+ lower = int(list[0])
+ upper = int(list[1])
except:
print("{0} is not a valid number range",format(args.range), file=sys.stderr)
sys.exit(1)