Skip to content

Commit 75db28c

Browse files
committed
fix linting
1 parent 27ea468 commit 75db28c

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

setup.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
# coding: utf-8
33

44
import os
5-
import codecs
6-
import re
5+
76
from setuptools.command.build_ext import build_ext
87

98
try:
@@ -12,13 +11,12 @@
1211
from distutils import sysconfig
1312

1413
try:
15-
from setuptools import setup, Extension
14+
from setuptools import Extension, setup
1615
except ImportError:
17-
from distutils.core import setup, Extension
16+
from distutils.core import Extension, setup
1817

1918
from Cython.Build import cythonize
2019

21-
2220
join = os.path.join
2321

2422
cchardet_dir = join("src", "cchardet") + os.path.sep
@@ -47,13 +45,19 @@
4745
# Remove the "-Wstrict-prototypes" compiler option, which isn't valid for C++.
4846
cfg_vars = sysconfig.get_config_vars()
4947
for key, value in cfg_vars.items():
50-
if type(value) == str:
48+
if isinstance(value, str):
5149
cfg_vars[key] = value.replace("-Wstrict-prototypes", "")
5250
# O3を指定したところで速度が向上するかは疑問である
5351
# cfg_vars[key] = value.replace("-O2", "-O3")
5452

5553

56-
cchardet_module = Extension("cchardet._cchardet", sources, language="c++", extra_compile_args=['-std=c++11'], **ext_args,)
54+
cchardet_module = Extension(
55+
"cchardet._cchardet",
56+
sources,
57+
language="c++",
58+
extra_compile_args=['-std=c++11'],
59+
**ext_args
60+
)
5761

5862

5963
def read(f):

src/tests/cchardet_test.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import glob
22
import os
33
import platform
4+
import sys
45

5-
import cchardet
66
import pytest
7-
import sys
7+
8+
import cchardet
89

910
SKIP_LIST = [
1011
os.path.join("tests", "testdata", "ja", "utf-16le.txt"),
@@ -93,8 +94,6 @@ def test_decode():
9394
if testfile.replace("\\", "/") in SKIP_LIST_02:
9495
continue
9596

96-
base = os.path.basename(testfile)
97-
expected_charset = os.path.splitext(base)[0]
9897
with open(testfile, "rb") as f:
9998
msg = f.read()
10099
detected_encoding = cchardet.detect(msg)

tests/bench.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import time
22

3-
import cchardet
43
import chardet
54

5+
import cchardet
6+
67

78
def main():
89
do_times = 100

0 commit comments

Comments
 (0)