Skip to content

Commit

Permalink
Merge pull request #7 from fedebotu/actions/black
Browse files Browse the repository at this point in the history
Format Python code with psf/black push
  • Loading branch information
fedebotu authored Sep 18, 2023
2 parents 04f0b9a + 4fbd9d9 commit 981e98d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions reserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,21 @@ def get_trains(
for train in trains:
was_available = train_availability[train.train_number]
seat = None
ReserveOption = ReserveOptionKorail if mode == "korail" else ReserveOptionSRT
if seat_type=="R" and train.general_seat_available() :
ReserveOption = (
ReserveOptionKorail if mode == "korail" else ReserveOptionSRT
)
if seat_type == "R" and train.general_seat_available():
seat = ReserveOption.GENERAL_ONLY
elif seat_type=="S" and train.special_seat_available():
elif seat_type == "S" and train.special_seat_available():
seat = ReserveOption.SPECIAL_ONLY
elif seat_type=="B" and train.seat_available():
elif seat_type == "B" and train.seat_available():
seat = ReserveOption.GENERAL_FIRST
else:
seat = None
if not was_available and seat!=None:
if not was_available and seat != None:
if reserve:
if mode == "korail":
ktrains.reserve(train,option=seat)
ktrains.reserve(train, option=seat)
elif mode == "srt":
ktrains.reserve(train, special_seat=seat)
manage_reservation(
Expand Down

0 comments on commit 981e98d

Please sign in to comment.