Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardcl committed Oct 23, 2021
1 parent a165e8f commit b2972eb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/renfe/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ def main():
print(colorama.Fore.GREEN + f"Searching timetable for date: {get_date(int(options.days))}")
print(colorama.Fore.GREEN + f"From {origin_name} to {destination_name}" + colorama.Fore.RESET)
print(colorama.Fore.GREEN + "Be patient, navigating through renfe site now..." + colorama.Fore.RESET)
times = get_timetable(origin_name, destination_name, int(options.days), options.browser, int(options.search_timeout))
times = get_timetable(
origin_name,
destination_name,
int(options.days),
options.browser,
int(options.search_timeout))
print(colorama.Fore.GREEN + "=======================TIMETABLE======================")
print(colorama.Fore.GREEN + " {:<10} | {:<10} | {:<10} | {:<10} ".format(
'Train', 'Departure', 'Arrival', 'Duration'))
Expand All @@ -42,7 +47,10 @@ def main():
print(colorama.Fore.GREEN + "======================================================" + colorama.Fore.RESET)

if not times:
print(colorama.Fore.YELLOW + "Timetable was empty. Maybe no more trains for today? Also, try increasing search timeout (-e flag, see help). Please, open an issue if problem does persist." + colorama.Fore.RESET)
print(colorama.Fore.YELLOW + "Timetable was empty. \
Maybe no more trains for today? \
Also, try increasing search timeout (-e flag, see help). \
Please, open an issue if problem does persist." + colorama.Fore.RESET)

except (RenfeException, ValueError) as err:
logging.error(err)
Expand Down
7 changes: 6 additions & 1 deletion src/renfe/timetable.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
os.environ['WDM_LOG_LEVEL'] = '0'


def get_timetable(origin: str, destination: str, days_from_today: int = 0, browser: str = "firefox", search_timeout: int = 3) -> List[Set]:
def get_timetable(
origin: str,
destination: str,
days_from_today: int = 0,
browser: str = "firefox",
search_timeout: int = 3) -> List[Set]:
soup = get_soup(browser, origin, destination, days_from_today, search_timeout)
types = get_types(soup)
durations = get_durations(soup)
Expand Down

0 comments on commit b2972eb

Please sign in to comment.