Skip to content

armgit / rembg

Public Imported from GitHub
0

Rembg is a tool to remove images background

fix lint

Daniel Gatisc914e77a7f7b
diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml
index a6d9712..62ddd4d 100644
--- a/.github/workflows/lint_python.yml
+++ b/.github/workflows/lint_python.yml
@@ -8,8 +8,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- with:
- python-version: '3.9'
- run: pip install --upgrade pip wheel
- run: pip install bandit black flake8 flake8-bugbear flake8-comprehensions isort safety mypy
- run: mypy --install-types --non-interactive --ignore-missing-imports ./rembg
diff --git a/rembg/bg.py b/rembg/bg.py
index 0223265..e745ca8 100644
--- a/rembg/bg.py
+++ b/rembg/bg.py
@@ -1,4 +1,5 @@
import io
+from enum import Enum
from typing import Optional, Union
import numpy as np
diff --git a/rembg/detect.py b/rembg/detect.py
index 1b50113..c7d5e7d 100644
--- a/rembg/detect.py
+++ b/rembg/detect.py
@@ -27,8 +27,9 @@ def ort_session(model_name: str) -> ort.InferenceSession:
home = os.getenv("U2NET_HOME", os.path.join("~", ".u2net"))
path = Path(home).expanduser() / f"{model_name}.onnx"
path.parents[0].mkdir(parents=True, exist_ok=True)
+ hashing = hashlib.new("md5", path.read_bytes(), usedforsecurity=False)
- if not (path.exists() and hashlib.md5(path.read_bytes()).hexdigest() == md5):
+ if not (path.exists() and hashing.hexdigest() == md5):
with redirect_stdout(sys.stderr):
gdown.download(url, str(path), use_cookies=False)