Skip to content

Commit 4d81e95

Browse files
mgautierfrrenaud gaudin
authored andcommitted
Run our lint command.
1 parent 7b76ca0 commit 4d81e95

File tree

7 files changed

+53
-40
lines changed

7 files changed

+53
-40
lines changed

examples/basic_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import uuid
2121

2222
from libzim.reader import Archive
23-
from libzim.writer import Item, StringProvider, Creator
23+
from libzim.writer import Creator, Item, StringProvider
2424

2525

2626
class TestItem(Item):

libzim/libzim.pyx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,27 @@ __path__ = []
3131

3232
cimport zim
3333

34-
import os
34+
import datetime
3535
import enum
36+
import importlib
37+
import os
38+
import pathlib
39+
import sys
40+
import traceback
41+
from types import ModuleType
42+
from typing import Dict, Generator, Iterator, List, Set, Union
3643
from uuid import UUID
37-
from cpython.ref cimport PyObject
44+
3845
from cpython.buffer cimport PyBUF_WRITABLE
46+
from cpython.ref cimport PyObject
3947
from cython.operator import preincrement
4048
from libc.stdint cimport uint64_t
41-
from libcpp.string cimport string
4249
from libcpp cimport bool
43-
from libcpp.memory cimport shared_ptr
4450
from libcpp.map cimport map
51+
from libcpp.memory cimport shared_ptr
52+
from libcpp.string cimport string
4553
from libcpp.utility cimport move
4654

47-
from typing import Dict, Union, Generator, List, Set, Iterator
48-
import datetime
49-
import pathlib
50-
import traceback
51-
from types import ModuleType
52-
import sys
53-
import importlib.abc
54-
5555
pybool = type(True)
5656
pyint = type(1)
5757

libzim/zim.pxd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1919

2020
from cpython.ref cimport PyObject
21-
2221
from libc.stdint cimport uint32_t, uint64_t
2322
from libcpp cimport bool
23+
from libcpp.map cimport map
2424
from libcpp.memory cimport shared_ptr
2525
from libcpp.string cimport string
2626
from libcpp.vector cimport vector
27-
from libcpp.map cimport map
2827

2928

3029
cdef extern from "zim/zim.h" namespace "zim":

setup.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535

3636

3737
import os
38-
import sys
3938
import platform
40-
from pathlib import Path
39+
import sys
4140
from ctypes.util import find_library
41+
from pathlib import Path
4242
from textwrap import dedent
4343

44-
from setuptools import setup, Extension
4544
from Cython.Build import cythonize
4645
from Cython.Distutils.build_ext import new_build_ext as build_ext
46+
from setuptools import Extension, setup
4747

4848
base_dir = Path(__file__).parent
4949

@@ -56,6 +56,7 @@
5656
define_macros = []
5757

5858
if platform.system() == "Darwin":
59+
5960
class fixed_build_ext(build_ext):
6061
"""Workaround for rpath bug in distutils for OSX."""
6162

@@ -68,32 +69,45 @@ def finalize_options(self):
6869
for ext in self.extensions:
6970
ext.extra_link_args.append("-Wl,-rpath," + path)
7071
self.rpath[:] = []
71-
cmdclass={"build_ext": fixed_build_ext}
72+
73+
cmdclass = {"build_ext": fixed_build_ext}
7274
dyn_lib_ext = "dylib"
7375
else:
74-
cmdclass={"build_ext": build_ext}
76+
cmdclass = {"build_ext": build_ext}
7577
dyn_lib_ext = "so"
7678

7779
include_dirs = ["libzim"]
7880
library_dirs = []
7981
# Check for the CPP Libzim library headers in expected directory
80-
if (base_dir / "include" / "zim" / "zim.h").exists() and (base_dir / "lib" / f"libzim.{dyn_lib_ext}").exists():
81-
print(dedent("""\
82+
header_file = base_dir / "include" / "zim" / "zim.h"
83+
lib_file = base_dir / "lib" / f"libzim.{dyn_lib_ext}"
84+
if header_file.exists() and lib_file.exists():
85+
print(
86+
dedent(
87+
"""\
8288
Found lizim library and headers in local directory.
8389
We will use them to compile python-libzim.
8490
Hint : If you don't want to use them (and use "system" installed one), remove them.
85-
"""))
91+
"""
92+
)
93+
)
8694
include_dirs.append("include")
8795
library_dirs = ["lib"]
8896
else:
8997
# Check for library.
9098
if not find_library("zim"):
91-
print(dedent("""\
99+
print(
100+
dedent(
101+
"""\
92102
"[!] The libzim library cannot be found.
93103
"Please verify that the library is correctly installed of and can be found.
94-
"""))
104+
"""
105+
)
106+
)
95107
sys.exit(1)
96-
print("Using system installed library. We are assuming CFLAGS/LDFLAGS are correctly set.")
108+
print(
109+
"Using system installed library. We are assuming CFLAGS/LDFLAGS are correctly set."
110+
)
97111

98112
wrapper_extension = Extension(
99113
name="libzim",

tasks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ def lint(c):
3737

3838

3939
if __name__ == "__main__":
40-
print("""\
40+
print(
41+
"""\
4142
This file is not intended to be directly run.
4243
Install invoke and run the `invoke` command line.
43-
""")
44+
"""
45+
)

tests/test_libzim_creator.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
#!/usr/bin/env python
22

3-
import sys
43
import base64
5-
import pathlib
64
import datetime
75
import itertools
6+
import pathlib
87
import subprocess
8+
import sys
99
from typing import Dict
1010

1111
import pytest
1212

1313
import libzim.writer
14+
from libzim.reader import Archive
1415
from libzim.writer import (
15-
Creator,
16-
Item,
16+
Blob,
1717
ContentProvider,
18+
Creator,
1819
FileProvider,
19-
StringProvider,
20-
Blob,
2120
Hint,
21+
Item,
22+
StringProvider,
2223
)
23-
from libzim.reader import Archive
24-
2524

2625
HOME_PATH = "lorem_ipsum"
2726

tests/test_libzim_reader.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
#!/usr/bin/env python
22

3-
import os
43
import gc
5-
import uuid
4+
import os
65
import pathlib
6+
import uuid
77
from urllib.request import urlretrieve
88

99
import pytest
1010

1111
import libzim.writer
1212
from libzim.reader import Archive
13-
from libzim.search import Searcher, Query
13+
from libzim.search import Query, Searcher
1414
from libzim.suggestion import SuggestionSearcher
1515

16-
1716
# expected data for tests ZIMs (see `all_zims`)
1817
ZIMS_DATA = {
1918
"blank.zim": {

0 commit comments

Comments
 (0)