Loading .github/workflows/badge.yml +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: python-version: [ 3.7 ] python-version: [ 3.8 ] steps: - name: Checkout code uses: actions/checkout@v2 Loading .github/workflows/doc.yml +2 −2 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ jobs: if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} strategy: matrix: python-version: [ 3.7 ] python-version: [ 3.8 ] services: plantuml: Loading Loading @@ -89,7 +89,7 @@ jobs: if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: matrix: python-version: [ 3.7 ] python-version: [ 3.8 ] services: plantuml: Loading .github/workflows/test.yml +5 −1 Original line number Diff line number Diff line #file: noinspection YAMLSchemaValidation name: Code Test on: Loading @@ -7,7 +8,7 @@ jobs: unittest: name: Code test runs-on: ${{ matrix.os }} if: "!contains(github.event.head_commit.message, 'ci skip')" if: ${{ !contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'test skip') }} strategy: fail-fast: false matrix: Loading @@ -21,6 +22,9 @@ jobs: - '3.9' - '3.10' - '3.11' exclude: - os: 'macos-latest' python-version: '3.7' steps: - name: Get system version for Linux Loading MANIFEST.in +1 −1 Original line number Diff line number Diff line Loading @@ -2,4 +2,4 @@ include README.md include MANIFEST.in include requirements.txt include requirements-*.txt recursive-include imgutils *.json *.yml *.yaml recursive-include imgutils *.json *.yml *.yaml *.png docs/source/_libs/plot.py +15 −4 Original line number Diff line number Diff line Loading @@ -5,12 +5,14 @@ from PIL import Image from cli import _wrap_func_as_cli from imgutils.data import load_image, grid_transparent, ImageTyping from imgutils.detect import detect_censors from imgutils.operate.censor_ import censor_areas from imgutils.validate.truncate import _mock_load_truncated_images INCHES_TO_PIXELS = 96 def _image_input_process(img) -> Tuple[Image.Image, str]: def _image_input_process(img, autocensor: bool = True) -> Tuple[Image.Image, str]: if isinstance(img, tuple): img_file, label = img image = load_image(img_file, force_background=None) Loading @@ -20,12 +22,21 @@ def _image_input_process(img) -> Tuple[Image.Image, str]: else: raise TypeError(f'Unknown type of img - {img!r}.') return grid_transparent(image), label image = grid_transparent(image) label = label.rstrip() if autocensor: detection = detect_censors(image) if detection: image = censor_areas(image, method='emoji', areas=[area for area, _, _ in detection]) label = f'{label}\n(Censored)' return image, label @_wrap_func_as_cli @_mock_load_truncated_images(True) def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsize=(6, 6)): def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsize=(6, 6), autocensor: bool = True): plt.cla() plt.tight_layout() Loading @@ -36,7 +47,7 @@ def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsiz plt.subplots_adjust(wspace=0.2, hspace=0.15) for i, img in enumerate(images, start=0): xi, yi = i // columns, i % columns image, label = _image_input_process(img) image, label = _image_input_process(img, autocensor) if rows == 1 and columns == 1: ax = axs elif rows == 1: Loading Loading
.github/workflows/badge.yml +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: python-version: [ 3.7 ] python-version: [ 3.8 ] steps: - name: Checkout code uses: actions/checkout@v2 Loading
.github/workflows/doc.yml +2 −2 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ jobs: if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} strategy: matrix: python-version: [ 3.7 ] python-version: [ 3.8 ] services: plantuml: Loading Loading @@ -89,7 +89,7 @@ jobs: if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: matrix: python-version: [ 3.7 ] python-version: [ 3.8 ] services: plantuml: Loading
.github/workflows/test.yml +5 −1 Original line number Diff line number Diff line #file: noinspection YAMLSchemaValidation name: Code Test on: Loading @@ -7,7 +8,7 @@ jobs: unittest: name: Code test runs-on: ${{ matrix.os }} if: "!contains(github.event.head_commit.message, 'ci skip')" if: ${{ !contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'test skip') }} strategy: fail-fast: false matrix: Loading @@ -21,6 +22,9 @@ jobs: - '3.9' - '3.10' - '3.11' exclude: - os: 'macos-latest' python-version: '3.7' steps: - name: Get system version for Linux Loading
MANIFEST.in +1 −1 Original line number Diff line number Diff line Loading @@ -2,4 +2,4 @@ include README.md include MANIFEST.in include requirements.txt include requirements-*.txt recursive-include imgutils *.json *.yml *.yaml recursive-include imgutils *.json *.yml *.yaml *.png
docs/source/_libs/plot.py +15 −4 Original line number Diff line number Diff line Loading @@ -5,12 +5,14 @@ from PIL import Image from cli import _wrap_func_as_cli from imgutils.data import load_image, grid_transparent, ImageTyping from imgutils.detect import detect_censors from imgutils.operate.censor_ import censor_areas from imgutils.validate.truncate import _mock_load_truncated_images INCHES_TO_PIXELS = 96 def _image_input_process(img) -> Tuple[Image.Image, str]: def _image_input_process(img, autocensor: bool = True) -> Tuple[Image.Image, str]: if isinstance(img, tuple): img_file, label = img image = load_image(img_file, force_background=None) Loading @@ -20,12 +22,21 @@ def _image_input_process(img) -> Tuple[Image.Image, str]: else: raise TypeError(f'Unknown type of img - {img!r}.') return grid_transparent(image), label image = grid_transparent(image) label = label.rstrip() if autocensor: detection = detect_censors(image) if detection: image = censor_areas(image, method='emoji', areas=[area for area, _, _ in detection]) label = f'{label}\n(Censored)' return image, label @_wrap_func_as_cli @_mock_load_truncated_images(True) def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsize=(6, 6)): def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsize=(6, 6), autocensor: bool = True): plt.cla() plt.tight_layout() Loading @@ -36,7 +47,7 @@ def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsiz plt.subplots_adjust(wspace=0.2, hspace=0.15) for i, img in enumerate(images, start=0): xi, yi = i // columns, i % columns image, label = _image_input_process(img) image, label = _image_input_process(img, autocensor) if rows == 1 and columns == 1: ax = axs elif rows == 1: Loading