From 4d3eacea87f2477fe7c54940d6a403e4ec767f75 Mon Sep 17 00:00:00 2001 From: Konstantin Chernyshev Date: Fri, 17 Nov 2023 16:44:46 +0100 Subject: [PATCH] chore: enable mypy and small style fixes --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 6 ++---- evaluate_app/tests.py | 20 ++++---------------- setup.py | 3 +-- 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 19ca3c8..a313d56 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -87,6 +87,6 @@ jobs: cp -r evaluate_app/* hf_evaluate_codebleu cd hf_evaluate_codebleu git add . - git commit --allow-empty -m "Auto files update [${{ github.ref_name }}]" + git commit --allow-empty -m "chore(auto): update changelog and version [${{ github.ref_name }}]" ls -lah git push https://k4black:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/k4black/codebleu main diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d36d1e2..c5d8c53 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,8 +7,6 @@ on: branches: [ main ] -# TODO: add windows-latest build - jobs: lint-python: runs-on: ubuntu-latest @@ -27,8 +25,8 @@ jobs: run: python -m black codebleu --check - name: Run ruff check run: python -m ruff codebleu -# - name: Run mypy check -# run: python -m mypy codebleu + - name: Run mypy check + run: python -m mypy codebleu # First run tests to fail fast, then testing on all python versions and os fast-tests-python: diff --git a/evaluate_app/tests.py b/evaluate_app/tests.py index 601ed75..2869754 100644 --- a/evaluate_app/tests.py +++ b/evaluate_app/tests.py @@ -1,17 +1,5 @@ test_cases = [ - { - "predictions": [0, 0], - "references": [1, 1], - "result": {"metric_score": 0} - }, - { - "predictions": [1, 1], - "references": [1, 1], - "result": {"metric_score": 1} - }, - { - "predictions": [1, 0], - "references": [1, 1], - "result": {"metric_score": 0.5} - } -] \ No newline at end of file + {"predictions": [0, 0], "references": [1, 1], "result": {"metric_score": 0}}, + {"predictions": [1, 1], "references": [1, 1], "result": {"metric_score": 1}}, + {"predictions": [1, 0], "references": [1, 1], "result": {"metric_score": 0.5}}, +] diff --git a/setup.py b/setup.py index b30620c..8908df8 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,6 @@ import requests from setuptools import setup from setuptools.dist import Distribution - from tree_sitter import Language ROOT = Path(__file__).parent @@ -59,7 +58,7 @@ def build_tree_sitter_languages(languages: dict[str, str], languages_folder: Pat build_tree_sitter_languages( tree_sitter_languages, - ROOT / "tree_sitter", + ROOT / "tree_sitter_languages", ROOT / "codebleu" / "my-languages.so", )