From 284fc5b789e8e8e9a73b434687394eb89cab08de Mon Sep 17 00:00:00 2001
From: Ondrej Nosek <onosek@redhat.com>
Date: Dec 06 2018 12:10:33 +0000
Subject: Imports are sorted


It is just an improvement for better code readdiness.

Signed-off-by: Ondrej Nosek <onosek@redhat.com>

---

diff --git a/doc/generate_commands_docs.py b/doc/generate_commands_docs.py
index 7e0d152..ac28e27 100644
--- a/doc/generate_commands_docs.py
+++ b/doc/generate_commands_docs.py
@@ -17,9 +17,10 @@ import json
 import logging
 import os
 import re
-import six
 import sys
 
+import six
+
 logging.basicConfig(level=logging.CRITICAL)
 logger = logging.getLogger('Generator')
 
diff --git a/git-changelog b/git-changelog
index e53e14f..49cccb5 100755
--- a/git-changelog
+++ b/git-changelog
@@ -23,7 +23,6 @@
 import re
 import subprocess
 import textwrap
-
 from optparse import OptionParser
 
 
diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
index 82b66ec..8985a82 100644
--- a/pyrpkg/__init__.py
+++ b/pyrpkg/__init__.py
@@ -11,42 +11,41 @@
 
 from __future__ import print_function
 
-import cccolutils
 import errno
 import fnmatch
 import getpass
-import git
 import glob
 import io
 import json
-import koji
 import logging
 import os
 import posixpath
 import random
 import re
-import rpm
 import shutil
-import six
 import subprocess
 import sys
 import tempfile
 import time
-
 from multiprocessing.dummy import Pool as ThreadPool
 
-from six.moves import configparser
-from six.moves import urllib
-from six.moves.urllib.parse import urljoin
 import requests
+import rpm
+import six
 import yaml
+from six.moves import configparser, urllib
+from six.moves.urllib.parse import urljoin
 
-from pyrpkg.errors import HashtypeMixingError, rpkgError, rpkgAuthError, \
-    UnknownTargetError
-from .gitignore import GitIgnore
+import cccolutils
+import git
+import koji
+from pyrpkg.errors import (HashtypeMixingError, UnknownTargetError,
+                           rpkgAuthError, rpkgError)
 from pyrpkg.lookaside import CGILookasideCache
 from pyrpkg.sources import SourcesFile
-from pyrpkg.utils import cached_property, log_result, find_me
+from pyrpkg.utils import cached_property, find_me, log_result
+
+from .gitignore import GitIgnore
 
 # libmodulemd might not be available for some platforms
 # currently python27 and older versions are missing
diff --git a/pyrpkg/lookaside.py b/pyrpkg/lookaside.py
index 03dc67e..d28c1d9 100644
--- a/pyrpkg/lookaside.py
+++ b/pyrpkg/lookaside.py
@@ -20,11 +20,12 @@ import logging
 import os
 import sys
 
-import pycurl
 import six
+from six.moves import http_client
+
+import pycurl
 
 from .errors import DownloadError, InvalidHashType, UploadError
-from six.moves import http_client
 
 
 class CGILookasideCache(object):
diff --git a/pyrpkg/man_gen.py b/pyrpkg/man_gen.py
index 1bf4ee8..ba862d2 100644
--- a/pyrpkg/man_gen.py
+++ b/pyrpkg/man_gen.py
@@ -10,10 +10,9 @@
 # the full text of the license.
 
 
-import sys
-import os
 import datetime
-
+import os
+import sys
 
 # We could substitute the "" in .TH with the rpkg version if we knew it
 man_header = """\
diff --git a/pyrpkg/sources.py b/pyrpkg/sources.py
index e9536c4..e021131 100644
--- a/pyrpkg/sources.py
+++ b/pyrpkg/sources.py
@@ -19,8 +19,7 @@ entries, and write these entries to the file in the proper format.
 import os
 import re
 
-from .errors import rpkgError, HashtypeMixingError, MalformedLineError
-
+from .errors import HashtypeMixingError, MalformedLineError, rpkgError
 
 LINE_PATTERN = re.compile(
     r'^(?P<hashtype>[^ ]+?) \((?P<file>[^ )]+?)\) = (?P<hash>[^ ]+?)$')
diff --git a/pyrpkg/utils.py b/pyrpkg/utils.py
index b637911..2268e6f 100644
--- a/pyrpkg/utils.py
+++ b/pyrpkg/utils.py
@@ -15,9 +15,10 @@ This module contains a bunch of utilities used elsewhere in pyrpkg.
 
 import argparse
 import os
-import six
 import sys
 
+import six
+
 if six.PY3:
     def u(s):
         return s
diff --git a/setup.py b/setup.py
index 2233bf1..1421e02 100755
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
 import os
 import sys
 
-from setuptools import setup, find_packages
+from setuptools import find_packages, setup
 
 
 def read_requirements(requirements_file):
diff --git a/tests/commands/test_check_repo.py b/tests/commands/test_check_repo.py
index 9f11d6f..e0018f1 100644
--- a/tests/commands/test_check_repo.py
+++ b/tests/commands/test_check_repo.py
@@ -5,8 +5,9 @@ import subprocess
 import sys
 import tempfile
 
-from mock import patch
 from six.moves import StringIO
+
+from mock import patch
 from pyrpkg.errors import rpkgError
 
 from . import CommandTestCase
diff --git a/tests/commands/test_clone.py b/tests/commands/test_clone.py
index af143bf..4cb744e 100644
--- a/tests/commands/test_clone.py
+++ b/tests/commands/test_clone.py
@@ -3,7 +3,6 @@ import shutil
 import tempfile
 
 import git
-
 import pyrpkg
 
 from . import CommandTestCase
diff --git a/tests/commands/test_push.py b/tests/commands/test_push.py
index bb2d711..e8c92d8 100644
--- a/tests/commands/test_push.py
+++ b/tests/commands/test_push.py
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 
 import os
+
 import git
 
 from . import CommandTestCase
 
-
 SPECFILE_TEMPLATE = """Name:           test
 Version:        1.0
 Release:        1.0
diff --git a/tests/test_cli.py b/tests/test_cli.py
index b02973a..2a90cb9 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1,40 +1,36 @@
 # -*- coding: utf-8 -*-
 
+import errno
+import glob
 import hashlib
 import logging
-import glob
 import os
 import shutil
-import six
 import subprocess
 import sys
 import tempfile
+
+import six
+from six.moves import StringIO, configparser, http_client
+
+import git
 import koji_cli.lib
-import errno
+import pyrpkg.cli
+import utils
+from mock import Mock, PropertyMock, call, mock_open, patch
+from pyrpkg import Commands, Modulemd, rpkgError
+from utils import CommandTestCase, FakeThreadPool
 
 try:
     import unittest2 as unittest
 except ImportError:
     import unittest
 
-from six.moves import configparser
-from six.moves import StringIO
-from six.moves import http_client
-
-import git
-import pyrpkg.cli
-from pyrpkg import Modulemd
-
 try:
     import openidc_client
 except ImportError:
     openidc_client = None
 
-import utils
-from mock import PropertyMock, call, mock_open, patch, Mock
-from pyrpkg import rpkgError, Commands
-from utils import CommandTestCase, FakeThreadPool
-
 
 fixtures_dir = os.path.join(os.path.dirname(__file__), 'fixtures')
 # rpkg.conf for running tests below
@@ -60,6 +56,7 @@ else:
     # The SafeConfigParser class has been renamed to ConfigParser in Python 3.2.
     ConfigParser = configparser.ConfigParser
 
+
 class CliTestCase(CommandTestCase):
 
     def new_cli(self, cfg=None):
diff --git a/tests/test_commands.py b/tests/test_commands.py
index c26301f..53509b2 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -4,21 +4,16 @@ import errno
 import io
 import os
 import shutil
-import six
 import subprocess
 import tempfile
+from datetime import datetime
 
-import git
 import rpm
-from datetime import datetime
-from mock import call
-from mock import patch
-from mock import Mock
-from mock import PropertyMock
-from mock import mock_open
+import six
 
+import git
+from mock import Mock, PropertyMock, call, mock_open, patch
 from pyrpkg import rpkgError
-
 from utils import CommandTestCase
 
 
diff --git a/tests/test_flatpak_build.py b/tests/test_flatpak_build.py
index 0b3d560..f9d365a 100644
--- a/tests/test_flatpak_build.py
+++ b/tests/test_flatpak_build.py
@@ -2,16 +2,17 @@ import os
 import subprocess
 from textwrap import dedent
 
+import requests
+
+from mock import Mock, patch
+from pyrpkg import Modulemd
+from utils import CommandTestCase
+
 try:
     import unittest2 as unittest
 except ImportError:
     import unittest
 
-from mock import Mock, patch
-import requests
-
-from pyrpkg import Modulemd
-from utils import CommandTestCase
 
 EOG_MODULEMD = """
 document: modulemd
diff --git a/tests/test_lookaside.py b/tests/test_lookaside.py
index c10cbef..07d5bb2 100644
--- a/tests/test_lookaside.py
+++ b/tests/test_lookaside.py
@@ -15,10 +15,8 @@ import unittest
 
 import mock
 import pycurl
-
-from pyrpkg.lookaside import CGILookasideCache
 from pyrpkg.errors import DownloadError, InvalidHashType, UploadError
-
+from pyrpkg.lookaside import CGILookasideCache
 
 old_stat = os.stat
 
diff --git a/tests/test_utils.py b/tests/test_utils.py
index e9c67ae..78ca55a 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -2,8 +2,7 @@ import unittest
 import warnings
 
 import mock
-
-from pyrpkg.utils import cached_property, warn_deprecated, log_result
+from pyrpkg.utils import cached_property, log_result, warn_deprecated
 
 
 class CachedPropertyTestCase(unittest.TestCase):
diff --git a/tests/utils.py b/tests/utils.py
index 0af45c0..483a8e7 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -1,11 +1,12 @@
 # -*- coding: utf-8 -*-
 
 import os
+import shutil
 import subprocess
+import sys
 import tempfile
-import shutil
+
 import six
-import sys
 
 from pyrpkg import Commands
 

