From f7fadf8d82a9741f7e86ec29f08918e1fafe9b8b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 17:04:26 +0000 Subject: [PATCH 1/2] chore(pre-commit.ci): pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/commitizen-tools/commitizen: v3.20.0 → v3.29.0](https://github.com/commitizen-tools/commitizen/compare/v3.20.0...v3.29.0) - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) - [github.com/python-poetry/poetry: 1.8.2 → 1.8.0](https://github.com/python-poetry/poetry/compare/1.8.2...1.8.0) - [github.com/pre-commit/mirrors-prettier: v3.1.0 → v4.0.0-alpha.8](https://github.com/pre-commit/mirrors-prettier/compare/v3.1.0...v4.0.0-alpha.8) - [github.com/asottile/pyupgrade: v3.15.2 → v3.17.0](https://github.com/asottile/pyupgrade/compare/v3.15.2...v3.17.0) - [github.com/psf/black: 23.12.1 → 24.8.0](https://github.com/psf/black/compare/23.12.1...24.8.0) - [github.com/PyCQA/flake8: 6.1.0 → 7.1.1](https://github.com/PyCQA/flake8/compare/6.1.0...7.1.1) - [github.com/PyCQA/bandit: 1.7.8 → 1.7.9](https://github.com/PyCQA/bandit/compare/1.7.8...1.7.9) - [github.com/srstevenson/nb-clean: 3.2.0 → 3.3.0](https://github.com/srstevenson/nb-clean/compare/3.2.0...3.3.0) --- .pre-commit-config.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7222822..412fa74 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,12 +9,12 @@ ci: repos: - repo: https://github.com/commitizen-tools/commitizen - rev: v3.20.0 + rev: v3.29.0 hooks: - id: commitizen stages: [commit-msg] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: debug-statements - id: check-builtin-literals @@ -28,16 +28,16 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/python-poetry/poetry - rev: 1.8.2 + rev: 1.8.0 hooks: - id: poetry-check - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.1.0 + rev: v4.0.0-alpha.8 hooks: - id: prettier args: ["--tab-width", "2"] - repo: https://github.com/asottile/pyupgrade - rev: v3.15.2 + rev: v3.17.0 hooks: - id: pyupgrade args: [--py38-plus] @@ -50,7 +50,7 @@ repos: hooks: - id: isort - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.8.0 hooks: - id: black # - repo: https://github.com/codespell-project/codespell @@ -58,7 +58,7 @@ repos: # hooks: # - id: codespell - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.1.1 hooks: - id: flake8 # - repo: https://github.com/pre-commit/mirrors-mypy @@ -67,12 +67,12 @@ repos: # - id: mypy # additional_dependencies: ["types-aiofiles"] - repo: https://github.com/PyCQA/bandit - rev: 1.7.8 + rev: 1.7.9 hooks: - id: bandit args: [-x, tests] - repo: https://github.com/srstevenson/nb-clean - rev: "3.2.0" + rev: "3.3.0" hooks: - id: nb-clean args: [--preserve-cell-outputs] From 9b81f6cf961fe76630ad5f36396648ac785ffffd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 17:07:18 +0000 Subject: [PATCH 2/2] chore(pre-commit.ci): auto fixes --- src/ut_course_catalog/analysis.py | 17 +++++++++++++++-- src/ut_course_catalog/common.py | 6 ++++-- src/ut_course_catalog/ja.py | 17 ++++++++++++----- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/ut_course_catalog/analysis.py b/src/ut_course_catalog/analysis.py index 6633526..cb5972e 100644 --- a/src/ut_course_catalog/analysis.py +++ b/src/ut_course_catalog/analysis.py @@ -61,7 +61,16 @@ def parse_scoring_method(text: str | None) -> set[ScoringMethod]: ScoringMethod.課題: ["課題", "assign", "宿題"], ScoringMethod.レポート: ["レポート", "レポ", "report"], ScoringMethod.発表: ["発表", "presenta", "プレゼン"], - ScoringMethod.出席: ["出席", "発表", "参加", "attend", "平常", "出欠", "リアペ", "リアクション"], + ScoringMethod.出席: [ + "出席", + "発表", + "参加", + "attend", + "平常", + "出欠", + "リアペ", + "リアクション", + ], } result: set[ScoringMethod] = set() if text is None: @@ -95,7 +104,11 @@ def encode_common_code(common_codes: pd.Series[CommonCode]) -> pd.DataFrame: def to_perfect_dataframe(df: pd.DataFrame) -> pd.DataFrame: df = df.copy() df = pd.concat( - [df, encode_scoring_method(df["成績評価方法"]), encode_common_code(df["共通科目コード"])], + [ + df, + encode_scoring_method(df["成績評価方法"]), + encode_common_code(df["共通科目コード"]), + ], axis=1, ) return df diff --git a/src/ut_course_catalog/common.py b/src/ut_course_catalog/common.py index 12f0e59..dac9040 100644 --- a/src/ut_course_catalog/common.py +++ b/src/ut_course_catalog/common.py @@ -93,8 +93,10 @@ async def wait(self) -> None: def wraps( self, - func: WrappedFn[WrappedFnParam, WrappedFnResult] - | WrappedAwaitableFn[WrappedFnParam, WrappedFnResult], + func: ( + WrappedFn[WrappedFnParam, WrappedFnResult] + | WrappedAwaitableFn[WrappedFnParam, WrappedFnResult] + ), ) -> WrappedFn[WrappedFnParam, WrappedFnResult]: @wraps(func) async def wrapper( diff --git a/src/ut_course_catalog/ja.py b/src/ut_course_catalog/ja.py index 540797d..f445cfb 100644 --- a/src/ut_course_catalog/ja.py +++ b/src/ut_course_catalog/ja.py @@ -649,7 +649,9 @@ def _parse_weekday_period(period_text: str) -> set[tuple[Weekday, int]]: period_texts = period_text.split("、") def parse_one(period: str) -> tuple[Weekday, int] | None: - w = Weekday([weekday in period for weekday in list("月火水木金土日")].index(True)) + w = Weekday( + [weekday in period for weekday in list("月火水木金土日")].index(True) + ) reres = re.search(r"\d+", period) if not reres: # raise ValueError(f"Invalid period: {period}") @@ -778,7 +780,9 @@ def iterable_or_type_to_iterable( x.value * 100 + 1000 for x in iterable_or_type_to_iterable(params.曜日) ] if params.講義使用言語: - facet["course_language_codes"] = iterable_or_type_to_iterable(params.講義使用言語) + facet["course_language_codes"] = iterable_or_type_to_iterable( + params.講義使用言語 + ) if params.実務経験のある教員による授業科目: facet["operational_experience_flag"] = iterable_or_type_to_iterable( params.実務経験のある教員による授業科目 @@ -1094,8 +1098,9 @@ async def fetch_search_detail_all( *, year: int = current_fiscal_year(), use_tqdm: bool = True, - on_initial_request: None - | (Callable[[SearchResult], Awaitable[None] | None]) = None, + on_initial_request: None | ( + Callable[[SearchResult], Awaitable[None] | None] + ) = None, on_detail_request: Callable[[Details], Awaitable[None] | None] | None = None, ) -> Iterable[Details]: """Fetch all search results by repeatedly calling `fetch_search` and `fetch_detail`. @@ -1144,7 +1149,9 @@ async def on_initial_request_wrapper(search_result: SearchResult): async def inner(item): async with s: try: - details = await self.retry(self.fetch_detail)(item.時間割コード, year) + details = await self.retry(self.fetch_detail)( + item.時間割コード, year + ) except Exception as e: self._logger.error(e) return None