Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
wbarnha committed Aug 29, 2024
1 parent 27ea468 commit 75db28c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
18 changes: 11 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# coding: utf-8

import os
import codecs
import re

from setuptools.command.build_ext import build_ext

try:
Expand All @@ -12,13 +11,12 @@
from distutils import sysconfig

try:
from setuptools import setup, Extension
from setuptools import Extension, setup
except ImportError:
from distutils.core import setup, Extension
from distutils.core import Extension, setup

from Cython.Build import cythonize


join = os.path.join

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


cchardet_module = Extension("cchardet._cchardet", sources, language="c++", extra_compile_args=['-std=c++11'], **ext_args,)
cchardet_module = Extension(
"cchardet._cchardet",
sources,
language="c++",
extra_compile_args=['-std=c++11'],
**ext_args
)


def read(f):
Expand Down
7 changes: 3 additions & 4 deletions src/tests/cchardet_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import glob
import os
import platform
import sys

import cchardet
import pytest
import sys

import cchardet

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

base = os.path.basename(testfile)
expected_charset = os.path.splitext(base)[0]
with open(testfile, "rb") as f:
msg = f.read()
detected_encoding = cchardet.detect(msg)
Expand Down
3 changes: 2 additions & 1 deletion tests/bench.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import time

import cchardet
import chardet

import cchardet


def main():
do_times = 100
Expand Down

0 comments on commit 75db28c

Please sign in to comment.