From c0cef7250d6bc394769b647b32405597cd5ce4e3 Mon Sep 17 00:00:00 2001 From: xmatthias Date: Thu, 31 May 2018 21:22:46 +0200 Subject: [PATCH] typing - avoid variable reuse with differen ttype --- freqtrade/arguments.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/freqtrade/arguments.py b/freqtrade/arguments.py index cf7db5901..2421abc9f 100644 --- a/freqtrade/arguments.py +++ b/freqtrade/arguments.py @@ -19,7 +19,7 @@ class Arguments(object): def __init__(self, args: List[str], description: str) -> None: self.args = args - self.parsed_arg = None + self.parsed_arg: Optional[argparse.Namespace] = None self.parser = argparse.ArgumentParser(description=description) def _load_args(self) -> None: @@ -211,7 +211,7 @@ class Arguments(object): self.hyperopt_options(hyperopt_cmd) @staticmethod - def parse_timerange(text: str) -> Optional[Tuple[List, int, int]]: + def parse_timerange(text: str) -> Optional[Tuple[Tuple, Optional[int], Optional[int]]]: """ Parse the value of the argument --timerange to determine what is the range desired :param text: value from --timerange @@ -231,21 +231,21 @@ class Arguments(object): if match: # Regex has matched rvals = match.groups() index = 0 - start = None - stop = None + start: Optional[int] = None + stop: Optional[int] = None if stype[0]: - start = rvals[index] + starts = rvals[index] if stype[0] == 'date': - start = arrow.get(start, 'YYYYMMDD').timestamp + start = arrow.get(starts, 'YYYYMMDD').timestamp else: - start = int(start) + start = int(starts) index += 1 if stype[1]: - stop = rvals[index] + stops = rvals[index] if stype[1] == 'date': - stop = arrow.get(stop, 'YYYYMMDD').timestamp + stop = arrow.get(stops, 'YYYYMMDD').timestamp else: - stop = int(stop) + stop = int(stops) return stype, start, stop raise Exception('Incorrect syntax for timerange "%s"' % text)