Skip to content

Commit

Permalink
use ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
kha-white committed Jun 29, 2024
1 parent f965f39 commit 8ba2a0a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/black.yml

This file was deleted.

5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: manga_ocr

- name: Set up Python
uses: actions/setup-python@v3
Expand All @@ -27,8 +25,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e manga_ocr
pip install -e ".[dev]"
- name: Test
run: |
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Ruff
on: [ push, pull_request ]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
4 changes: 2 additions & 2 deletions manga_ocr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from ._version import __version__
from manga_ocr.ocr import MangaOcr
from ._version import __version__ as __version__
from manga_ocr.ocr import MangaOcr as MangaOcr
1 change: 0 additions & 1 deletion manga_ocr_dev/synthetic_data_generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def add_random_furigana(self, line, word_prob=1.0, vocab=None):
kanji_group = ""
ascii_group = ""
for i, c in enumerate(line):

if is_kanji(c):
c_type = "kanji"
kanji_group += c
Expand Down
2 changes: 1 addition & 1 deletion manga_ocr_dev/synthetic_data_generator/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def get_css(
# stroke is simulated by shadow overlaid multiple times
styles.extend(
[
f"text-shadow: "
"text-shadow: "
+ ",".join([f"0 0 {stroke_size}px {stroke_color}"] * 10 * stroke_size)
+ ";",
"-webkit-font-smoothing: antialiased;",
Expand Down
2 changes: 1 addition & 1 deletion manga_ocr_dev/synthetic_data_generator/run_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def f(args):
ret = source, id_, text_gt, params["vertical"], str(font_path)
return ret

except Exception as e:
except Exception:
print(traceback.format_exc())


Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ dependencies = [
"unidic_lite",
]

[project.optional-dependencies]
dev = [
"pytest",
"ruff",
]

[project.urls]
Homepage = "https://github.com/kha-white/manga-ocr"

Expand Down

0 comments on commit 8ba2a0a

Please sign in to comment.