Skip to content

Commit

Permalink
Apply isort.
Browse files Browse the repository at this point in the history
  • Loading branch information
wickman committed Jul 25, 2014
1 parent c926e40 commit 61ecc15
Show file tree
Hide file tree
Showing 37 changed files with 124 additions and 143 deletions.
5 changes: 5 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[settings]
line_length=100
known_first_party=pex
multi_line_output=3
default_section=THIRDPARTY
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include *.py
include docs/*.md
include CHANGES
1 change: 0 additions & 1 deletion pex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==================================================================================================

4 changes: 1 addition & 3 deletions pex/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@

from collections import Iterable

from .compatibility import string as compatibility_string

from pkg_resources import Requirement


from .compatibility import string as compatibility_string

REQUIRED_ATTRIBUTES = (
'extras',
Expand Down
20 changes: 5 additions & 15 deletions pex/bin/pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,22 @@

from __future__ import print_function

from optparse import OptionParser
import os
import sys
from optparse import OptionParser

from pex.common import safe_delete, safe_mkdtemp
from pex.fetcher import Fetcher, PyPIFetcher
from pex.installer import EggInstaller, WheelInstaller
from pex.interpreter import PythonInterpreter
from pex.obtainer import CachingObtainer
from pex.package import (
EggPackage,
SourcePackage,
WheelPackage,
)
from pex.package import EggPackage, SourcePackage, WheelPackage
from pex.pex import PEX
from pex.pex_builder import PEXBuilder
from pex.platforms import Platform
from pex.resolver import resolve as requirement_resolver
from pex.pex_builder import PEXBuilder
from pex.pex import PEX
from pex.tracer import Tracer
from pex.translator import (
ChainedTranslator,
EggTranslator,
SourceTranslator,
WheelTranslator,
)

from pex.translator import ChainedTranslator, EggTranslator, SourceTranslator, WheelTranslator

CANNOT_PARSE_REQUIREMENT = 100
CANNOT_DISTILL = 101
Expand Down
4 changes: 2 additions & 2 deletions pex/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

import atexit
from collections import defaultdict
import contextlib
import errno
import os
import shutil
import sys
import stat
import sys
import tempfile
import threading
import zipfile
from collections import defaultdict


# See http://stackoverflow.com/questions/2572172/referencing-other-modules-in-atexit
Expand Down
17 changes: 8 additions & 9 deletions pex/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@
import sys
import uuid

from .common import open_zip, safe_mkdir, safe_rmtree
from .interpreter import PythonInterpreter
from .package import distribution_compatible
from .pex_builder import PEXBuilder
from .pex_info import PexInfo
from .tracer import Tracer
from .util import CacheHelper, DistributionHelper

from pkg_resources import (
DistributionNotFound,
Environment,
find_distributions,
Requirement,
WorkingSet,
WorkingSet
)

from .common import open_zip, safe_mkdir, safe_rmtree
from .interpreter import PythonInterpreter
from .package import distribution_compatible
from .pex_builder import PEXBuilder
from .pex_info import PexInfo
from .tracer import Tracer
from .util import CacheHelper, DistributionHelper

TRACER = Tracer(predicate=Tracer.env_filter('PEX_VERBOSE'), prefix='pex.environment: ')

Expand Down
2 changes: 1 addition & 1 deletion pex/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

from __future__ import absolute_import

from abc import abstractmethod
import random
import warnings
from abc import abstractmethod

from .base import maybe_requirement
from .compatibility import AbstractClass, PY3
Expand Down
1 change: 0 additions & 1 deletion pex/finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import pkg_resources


if sys.version_info >= (3, 3) and sys.implementation.name == "cpython":
import importlib._bootstrap as importlib_bootstrap
else:
Expand Down
4 changes: 2 additions & 2 deletions pex/http/crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

import contextlib
from functools import partial
import os
import re
import threading
from functools import partial

from ..compatibility import PY3
from .http import CachedWeb, Web, FetchError
from .http import CachedWeb, FetchError, Web
from .tracer import TRACER

if PY3:
Expand Down
8 changes: 4 additions & 4 deletions pex/installer.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import print_function, absolute_import
from __future__ import absolute_import, print_function

import os
import subprocess
import sys
import tempfile

from pkg_resources import Distribution, PathMetadata

from .common import safe_mkdtemp, safe_rmtree
from .interpreter import PythonInterpreter, PythonCapability
from .interpreter import PythonCapability, PythonInterpreter
from .tracer import TRACER

from pkg_resources import Distribution, PathMetadata

__all__ = (
'Installer',
'Packager'
Expand Down
21 changes: 10 additions & 11 deletions pex/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@

from __future__ import absolute_import

try:
from numbers import Integral
except ImportError:
Integral = (int, long)

from collections import defaultdict
import os
import re
import subprocess
import sys
from collections import defaultdict

from pkg_resources import Distribution, find_distributions, Requirement

from .base import maybe_requirement, maybe_requirement_list
from .compatibility import string
from .tracer import Tracer

from pkg_resources import (
find_distributions,
Distribution,
Requirement,
)
try:
from numbers import Integral
except ImportError:
Integral = (int, long)




TRACER = Tracer(predicate=Tracer.env_filter('PEX_VERBOSE'), prefix='pex.interpreter: ')

Expand Down
6 changes: 4 additions & 2 deletions pex/marshaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
except ImportError:
HAS_MAGIC = False

import marshal
import struct
import time

from .compatibility import BytesIO, bytes as compatibility_bytes
import marshal

from .compatibility import bytes as compatibility_bytes
from .compatibility import BytesIO


class CodeTimestamp(object):
Expand Down
9 changes: 2 additions & 7 deletions pex/obtainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@

from .base import requirement_is_exact
from .common import safe_mkdtemp
from .fetcher import PyPIFetcher, Fetcher
from .fetcher import Fetcher, PyPIFetcher
from .http import Crawler
from .package import (
EggPackage,
Package,
SourcePackage,
WheelPackage,
)
from .package import EggPackage, Package, SourcePackage, WheelPackage
from .platforms import Platform
from .tracer import TRACER
from .translator import ChainedTranslator, Translator
Expand Down
8 changes: 2 additions & 6 deletions pex/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@
import tarfile
import zipfile

from pkg_resources import EGG_NAME, parse_version, safe_name

from .base import maybe_requirement
from .common import safe_mkdtemp
from .http.link import Link
from .interpreter import PythonInterpreter
from .pep425 import PEP425, PEP425Extras
from .platforms import Platform

from pkg_resources import (
EGG_NAME,
parse_version,
safe_name,
)


class Package(Link):
"""Base class for named Python binary packages (e.g. source, egg, wheel)."""
Expand Down
4 changes: 2 additions & 2 deletions pex/pep425.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
tagging system used to describe platform compatibility for wheel files.
"""

from .platforms import Platform

from pkg_resources import get_supported_platform

from .platforms import Platform


class PEP425Extras(object):
"""Extensions to platform handling beyond PEP425."""
Expand Down
13 changes: 6 additions & 7 deletions pex/pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@

from __future__ import absolute_import, print_function

from contextlib import contextmanager
from distutils import sysconfig
import os
from site import USER_SITE
import sys
import traceback
from contextlib import contextmanager
from distutils import sysconfig
from site import USER_SITE

import pkg_resources
from pkg_resources import EntryPoint, find_distributions

from .common import safe_mkdir
from .compatibility import exec_function
Expand All @@ -18,10 +21,6 @@
from .pex_info import PexInfo
from .tracer import Tracer

import pkg_resources
from pkg_resources import EntryPoint, find_distributions


TRACER = Tracer(predicate=Tracer.env_filter('PEX_VERBOSE'), prefix='pex: ')


Expand Down
10 changes: 3 additions & 7 deletions pex/pex_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@
import os
import tempfile

from pkg_resources import DefaultProvider, get_provider, ZipProvider

from .common import chmod_plus_x, Chroot, open_zip, safe_mkdir
from .compatibility import to_bytes
from .common import chmod_plus_x, open_zip, safe_mkdir, Chroot
from .interpreter import PythonInterpreter
from .marshaller import CodeMarshaller
from .pex_info import PexInfo
from .tracer import TRACER
from .util import CacheHelper, DistributionHelper

from pkg_resources import (
DefaultProvider,
ZipProvider,
get_provider,
)


BOOTSTRAP_ENVIRONMENT = b"""
import os
Expand Down
2 changes: 1 addition & 1 deletion pex/pex_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

from __future__ import absolute_import, print_function

from collections import namedtuple
import json
import os
import sys
from collections import namedtuple

from .common import open_zip
from .orderedset import OrderedSet
Expand Down
6 changes: 3 additions & 3 deletions pex/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

from collections import defaultdict

from pkg_resources import Distribution

from .base import maybe_requirement_list
from .interpreter import PythonInterpreter
from .obtainer import Obtainer
from .orderedset import OrderedSet
from .package import Package, distribution_compatible
from .package import distribution_compatible, Package
from .platforms import Platform

from pkg_resources import Distribution


class Untranslateable(Exception):
pass
Expand Down
2 changes: 1 addition & 1 deletion pex/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import os
import random
import tempfile
from textwrap import dedent
import zipfile
from textwrap import dedent

from .common import safe_mkdir, safe_mkdtemp, safe_rmtree
from .installer import EggInstaller
Expand Down
2 changes: 1 addition & 1 deletion pex/tracer.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from contextlib import contextmanager
import os
import sys
import threading
import time
from contextlib import contextmanager

__all__ = ('Tracer',)

Expand Down
Loading

0 comments on commit 61ecc15

Please sign in to comment.