Skip to content

Commit

Permalink
Add flake8-import-order and zimports
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Feb 11, 2020
1 parent 9eeda1c commit 2f044e1
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 41 deletions.
4 changes: 4 additions & 0 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ set -x
pip_install -U black
black --check .

# flake8
pip install -U flake8 zimports
flake8 .

# mypy
if [ "$PYTHON_VERSION32" = "3" ]; then
pip_install -U mypy
Expand Down
4 changes: 2 additions & 2 deletions examples/io_examples/pyglet_threaded_image_viewer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python

import imgviz

from pyglet_imshow import get_images

import imgviz


def main():
viewer = imgviz.io.PygletThreadedImageViewer(play=True)
Expand Down
26 changes: 12 additions & 14 deletions imgviz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,32 @@

# -----------------------------------------------------------------------------

from . import _io as io
from . import data

from . import draw

from . import _io as io

# -----------------------------------------------------------------------------

# visualization targets
from .centerize import centerize
from .color import asgray
from .color import gray2rgb
from .color import hsv2rgb
from .color import rgb2gray
from .color import rgb2rgba
from .color import rgb2hsv
from .color import rgb2rgba
from .color import rgba2rgb
from .color import hsv2rgb
from .depth import Depth2RGB
from .depth import depth2rgb
from .flow import flow2rgb
from .instances import instances2rgb
from .label import label_colormap
from .label import label2rgb
from .label import label_colormap
from .nchannel import Nchannel2RGB
from .nchannel import nchannel2rgb
from .trajectory import plot_trajectory

# visualization operations
from .centerize import centerize
from .normalize import normalize
from .resize import resize
from .tile import tile
from .trajectory import plot_trajectory

# -----------------------------------------------------------------------------

# visualization targets

# visualization operations
9 changes: 3 additions & 6 deletions imgviz/_io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# flake8: noqa

from ._pyglet import pyglet_imshow
from ._pyglet import pyglet_run
from ._pyglet import PygletThreadedImageViewer
from .base import imread
from .base import imsave

from .opencv import cv_imshow
from .opencv import cv_waitkey

from .pyplot import pyplot_to_numpy

from ._pyglet import pyglet_imshow
from ._pyglet import pyglet_run
from ._pyglet import PygletThreadedImageViewer
2 changes: 0 additions & 2 deletions imgviz/_io/_pyglet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# flake8: noqa

from .base import check_pyglet_available

from .pyglet_imshow import pyglet_imshow

from .pyglet_run import pyglet_run

try:
Expand Down
2 changes: 1 addition & 1 deletion imgviz/_io/opencv.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import cv2
except ImportError:
cv2 = None
import numpy as np # NOQA
import numpy as np


def check_cv2_available():
Expand Down
6 changes: 1 addition & 5 deletions imgviz/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# flake8: noqa

from .arc2017 import arc2017

from .kitti import kitti_odometry
from .lena import lena

from .middlebury import middlebury

from .kitti import kitti_odometry

from .voc import voc
3 changes: 2 additions & 1 deletion imgviz/external/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@
"""

from __future__ import division, print_function
from __future__ import division
from __future__ import print_function

import math

Expand Down
4 changes: 2 additions & 2 deletions imgviz/nchannel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from . import normalize

import numpy as np

from . import normalize


class Nchannel2RGB(object):

Expand Down
6 changes: 3 additions & 3 deletions imgviz/resize.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import numpy as np
import PIL.Image

try:
import cv2
except ImportError:
cv2 = None

import numpy as np
import PIL.Image


def _resize_pillow(src, height, width, interpolation):
if interpolation == "linear":
Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
license_file = LICENSE

[flake8]
exclude = .eggs,*.egg,build,.anaconda*,src,imgviz/external
exclude = .eggs, *.egg, build/ , .anaconda*/, src/, docs/, imgviz/external/
ignore = E203, W503, W504
import-order-style: google
application-import-names = imgviz
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from __future__ import print_function

import distutils.spawn
import os
import os.path as osp
import re

import distutils.spawn
from setuptools import find_packages
from setuptools import setup
import shlex
import subprocess
import sys

from setuptools import find_packages
from setuptools import setup


def get_version():
filename = "imgviz/__init__.py"
Expand Down

0 comments on commit 2f044e1

Please sign in to comment.