Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#261)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.9 → v0.3.5](astral-sh/ruff-pre-commit@v0.1.9...v0.3.5)
- [github.com/psf/black: 23.12.1 → 24.3.0](psf/black@23.12.1...24.3.0)
- [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](pre-commit/mirrors-mypy@v1.8.0...v1.9.0)
- [github.com/shellcheck-py/shellcheck-py: v0.9.0.6 → v0.10.0.1](shellcheck-py/shellcheck-py@v0.9.0.6...v0.10.0.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Apr 2, 2024
1 parent c9786ca commit 92383b3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 32 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.9"
rev: "v0.3.5"
hooks:
- id: ruff
args: [--fix]

- repo: https://github.com/psf/black
rev: "23.12.1"
rev: "24.3.0"
hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.8.0"
rev: "v1.9.0"
hooks:
- id: mypy
additional_dependencies: &mypy-deps
Expand All @@ -38,7 +38,7 @@ repos:
- pytest

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.9.0.6"
rev: "v0.10.0.1"
hooks:
- id: shellcheck

Expand Down
29 changes: 6 additions & 23 deletions SRT/reservation.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,14 @@ def __repr__(self):

def dump(self):
d = (
"[{name}] "
"{month}월 {day}일, "
"{dep}~{arr}"
"({dep_hour}:{dep_min}~{arr_hour}:{arr_min}) "
"{cost}원({seats}석)"
).format(
name=self.train_name,
month=self.dep_date[4:6],
day=self.dep_date[6:8],
dep=self.dep_station_name,
arr=self.arr_station_name,
dep_hour=self.dep_time[0:2],
dep_min=self.dep_time[2:4],
arr_hour=self.arr_time[0:2],
arr_min=self.arr_time[2:4],
cost=self.total_cost,
seats=self.seat_count,
f"[{self.train_name}] "
f"{self.dep_date[4:6]}{self.dep_date[6:8]}일, "
f"{self.dep_station_name}~{self.arr_station_name}"
f"({self.dep_time[0:2]}:{self.dep_time[2:4]}~{self.arr_time[0:2]}:{self.arr_time[2:4]}) "
f"{self.total_cost}원({self.seat_count}석)"
)
if not self.paid:
d += (", 구입기한 {pay_month}월 {pay_day}일 {pay_hour}:{pay_min}").format(
pay_month=self.payment_date[4:6],
pay_day=self.payment_date[6:8],
pay_hour=self.payment_time[0:2],
pay_min=self.payment_time[2:4],
)
d += f", 구입기한 {self.payment_date[4:6]}{self.payment_date[6:8]}{self.payment_time[0:2]}:{self.payment_time[2:4]}"
return d

@property
Expand Down
4 changes: 3 additions & 1 deletion SRT/srt.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,9 @@ def get_reservations(self, paid_only: bool = False) -> list[SRTReservation]:
pay_data = parser.get_all()["payListMap"]
reservations = []
for train, pay in zip(train_data, pay_data):
if paid_only and pay["stlFlg"] == "N": # paid_only가 참이면 결제된 예약내역만 보여줌
if (
paid_only and pay["stlFlg"] == "N"
): # paid_only가 참이면 결제된 예약내역만 보여줌
continue
ticket = self.ticket_info(train["pnrNo"])
reservation = SRTReservation(train, pay, ticket)
Expand Down
8 changes: 6 additions & 2 deletions SRT/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def dump(self):
arr_min=self.arr_time[2:4],
special_state=self.special_seat_state,
general_state=self.general_seat_state,
reserve_standby_state="가능" if self.reserve_standby_available() else "불가능",
reserve_standby_state=(
"가능" if self.reserve_standby_available() else "불가능"
),
)

return d
Expand All @@ -65,7 +67,9 @@ def special_seat_available(self):
return "예약가능" in self.special_seat_state

def reserve_standby_available(self):
return "9" in self.reserve_wait_possible_code # 9인 경우, 예약대기 가능한 상태임
return (
"9" in self.reserve_wait_possible_code
) # 9인 경우, 예약대기 가능한 상태임

def seat_available(self):
return self.general_seat_available() or self.special_seat_available()
6 changes: 4 additions & 2 deletions tests/test_srt_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def test_pay_with_card_fail_card_password(mock_server, httpserver):
srt = SRT("010-1234-1234", "password")

with pytest.raises(
SRTResponseError, match="비밀번호오류<br><br>사용하신 각 신용카드사의 고객센터로 문의 바랍니다."
SRTResponseError,
match="비밀번호오류<br><br>사용하신 각 신용카드사의 고객센터로 문의 바랍니다.",
):
srt.pay_with_card(
mock_reservation,
Expand Down Expand Up @@ -308,7 +309,8 @@ def test_pay_with_card_fail_invalid_reservation(mock_server, httpserver):
srt = SRT("010-1234-1234", "password")

with pytest.raises(
SRTResponseError, match="취소된 여정이므로 발매할 수 없습니다.<br>비회원은 다시 예약하셔야합니다."
SRTResponseError,
match="취소된 여정이므로 발매할 수 없습니다.<br>비회원은 다시 예약하셔야합니다.",
):
srt.pay_with_card(
mock_reservation,
Expand Down

0 comments on commit 92383b3

Please sign in to comment.