Skip to content

Commit

Permalink
RegExp implementation as alternative solution
Browse files Browse the repository at this point in the history
Signed-off-by: ABCbum <kimlong221002@gmail.com>
  • Loading branch information
ABCbum committed Jan 24, 2020
1 parent 412a158 commit 2d434d8
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions whipper/command/cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import cdio
import importlib.util
import os
import re
import glob
import logging
from whipper.command.basecommand import BaseCommand
Expand Down Expand Up @@ -335,17 +336,13 @@ def handle_arguments(self):
logger.critical(msg)
raise ValueError(msg)

try:
if re.fullmatch(r'^[0-9]+', self.options.max_tries):
self.options.max_tries = int(self.options.max_tries)
if(self.options.maxtries < 0):
logger.warning("--max-tries is a negative number, whipper "
"will change it to positive")
self.options.maxtries = 0 - self.options.max_tries
elif(self.options.max_tries == 0):
if self.options.max_tries == 0:
self.options.max_tries = float("inf")
except ValueError as e:
else:
msg = ("Invalid number of max tries specified using the "
"--max-tries argument: %s") % e
"--max-tries argument: %s") % self.options.max_tries
logger.critical(msg)
raise ValueError(msg)

Expand Down

0 comments on commit 2d434d8

Please sign in to comment.