Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 37505ef

Browse files
refactor(tool): use charset_normalizer instead of chardet
1 parent 2ff9f15 commit 37505ef

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

‎commitizen/cmd.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import subprocess
22
from typing import NamedTuple
33

4-
import chardet
4+
fromcharset_normalizerimport from_bytes
55

66

77
class Command(NamedTuple):
@@ -23,8 +23,8 @@ def run(cmd: str) -> Command:
2323
stdout, stderr = process.communicate()
2424
return_code = process.returncode
2525
return Command(
26-
stdout.decode(chardet.detect(stdout)["encoding"] or"utf-8"),
27-
stderr.decode(chardet.detect(stderr)["encoding"] or"utf-8"),
26+
str(from_bytes(stdout).best()),
27+
str(from_bytes(stderr).best()),
2828
stdout,
2929
stderr,
3030
return_code,

‎pyproject.toml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jinja2 = ">=2.10.3"
5656
pyyaml = ">=3.08"
5757
argcomplete = "^1.12.1"
5858
typing-extensions = "^4.0.1"
59-
chardet = "^5.0.0"
59+
charset-normalizer = "^2.1.0"
6060

6161
[tool.poetry.dev-dependencies]
6262
ipython = "^7.2"
@@ -82,7 +82,6 @@ mkdocs = "^1.0"
8282
mkdocs-material = "^4.1"
8383
pydocstyle = "^5.0.2"
8484
pytest-xdist = "^2.5.0"
85-
types-chardet = "^5.0.2"
8685

8786
[tool.poetry.scripts]
8887
cz = "commitizen.cli:main"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /