diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-07-20 19:21:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-20 19:21:17 -0400 |
commit | cadf172febb5cec35a4faf1d65d5c6d4e6ac76d8 (patch) | |
tree | cb590366fa5786a7062ee8aed75a446b0a171177 /setuptools | |
parent | e6168c607fb4247cbfe410f45a4671bed056a0da (diff) | |
parent | 64335b63f9e03e71d0acd885b8bfd0b4b7a60aa8 (diff) | |
download | external_python_setuptools-cadf172febb5cec35a4faf1d65d5c6d4e6ac76d8.tar.gz external_python_setuptools-cadf172febb5cec35a4faf1d65d5c6d4e6ac76d8.tar.bz2 external_python_setuptools-cadf172febb5cec35a4faf1d65d5c6d4e6ac76d8.zip |
Merge pull request #641 from stepshal/colon
Put colon-separated compound statement on separate lines.
Diffstat (limited to 'setuptools')
-rw-r--r-- | setuptools/depends.py | 3 | ||||
-rw-r--r-- | setuptools/dist.py | 9 | ||||
-rw-r--r-- | setuptools/lib2to3_ex.py | 3 | ||||
-rwxr-xr-x | setuptools/package_index.py | 21 | ||||
-rwxr-xr-x | setuptools/sandbox.py | 12 |
5 files changed, 32 insertions, 16 deletions
diff --git a/setuptools/depends.py b/setuptools/depends.py index 48c20156..75344590 100644 --- a/setuptools/depends.py +++ b/setuptools/depends.py @@ -53,7 +53,8 @@ class Require: if self.attribute is None: try: f, p, i = find_module(self.module, paths) - if f: f.close() + if f: + f.close() return default except ImportError: return None diff --git a/setuptools/dist.py b/setuptools/dist.py index b4ff3861..b8ada9b9 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -155,8 +155,10 @@ def check_package_data(dist, attr, value): """Verify that value is a dictionary of package names to glob lists""" if isinstance(value, dict): for k, v in value.items(): - if not isinstance(k, str): break - try: iter(v) + if not isinstance(k, str): + break + try: + iter(v) except TypeError: break else: @@ -807,7 +809,8 @@ class Feature: r for r in require_features if isinstance(r, str) ] er = [r for r in require_features if not isinstance(r, str)] - if er: extras['require_features'] = er + if er: + extras['require_features'] = er if isinstance(remove, str): remove = remove, diff --git a/setuptools/lib2to3_ex.py b/setuptools/lib2to3_ex.py index c58d8407..467e57d2 100644 --- a/setuptools/lib2to3_ex.py +++ b/setuptools/lib2to3_ex.py @@ -45,7 +45,8 @@ class Mixin2to3(_Mixin2to3): _Mixin2to3.run_2to3(self, files) def __build_fixer_names(self): - if self.fixer_names: return + if self.fixer_names: + return self.fixer_names = [] for p in setuptools.lib2to3_fixer_packages: self.fixer_names.extend(get_fixers_from_package(p)) diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 8764faa6..77f5f96e 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -82,14 +82,16 @@ def egg_info_for_url(url): base = urllib.parse.unquote(path.split('/')[-1]) if server == 'sourceforge.net' and base == 'download': # XXX Yuck base = urllib.parse.unquote(path.split('/')[-2]) - if '#' in base: base, fragment = base.split('#', 1) + if '#' in base: + base, fragment = base.split('#', 1) return base, fragment def distros_for_url(url, metadata=None): """Yield egg or source distribution objects that might be found at a URL""" base, fragment = egg_info_for_url(url) - for dist in distros_for_location(url, base, metadata): yield dist + for dist in distros_for_location(url, base, metadata): + yield dist if fragment: match = EGG_FRAGMENT.match(fragment) if match: @@ -289,7 +291,8 @@ class PackageIndex(Environment): self.to_scan = [] if verify_ssl and ssl_support.is_available and (ca_bundle or ssl_support.find_ca_bundle()): self.opener = ssl_support.opener_for(ca_bundle) - else: self.opener = urllib.request.urlopen + else: + self.opener = urllib.request.urlopen def process_url(self, url, retrieve=False): """Evaluate a URL as a possible download, and maybe retrieve it""" @@ -317,7 +320,8 @@ class PackageIndex(Environment): self.info("Reading %s", url) self.fetched_urls[url] = True # prevent multiple fetch attempts f = self.open_url(url, "Download error on %s: %%s -- Some packages may not be found!" % url) - if f is None: return + if f is None: + return self.fetched_urls[f.url] = True if 'html' not in f.headers.get('content-type', '').lower(): f.close() # not html, we can't process it @@ -442,7 +446,8 @@ class PackageIndex(Environment): def scan_all(self, msg=None, *args): if self.index_url not in self.fetched_urls: - if msg: self.warn(msg, *args) + if msg: + self.warn(msg, *args) self.info( "Scanning index of all packages (this may take a while)" ) @@ -714,7 +719,8 @@ class PackageIndex(Environment): self.check_hash(checker, filename, tfp) return headers finally: - if fp: fp.close() + if fp: + fp.close() def reporthook(self, url, filename, blocknum, blksize, size): pass # no-op @@ -896,7 +902,8 @@ entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub def uchr(c): if not isinstance(c, int): return c - if c > 255: return six.unichr(c) + if c > 255: + return six.unichr(c) return chr(c) diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 5ed45f84..c89593b1 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -291,7 +291,8 @@ class AbstractSandbox: return wrap for name in ["rename", "link", "symlink"]: - if hasattr(_os, name): locals()[name] = _mk_dual_path_wrapper(name) + if hasattr(_os, name): + locals()[name] = _mk_dual_path_wrapper(name) def _mk_single_path_wrapper(name, original=None): original = original or getattr(_os, name) @@ -310,7 +311,8 @@ class AbstractSandbox: "remove", "unlink", "rmdir", "utime", "lchown", "chroot", "lstat", "startfile", "mkfifo", "mknod", "pathconf", "access" ]: - if hasattr(_os, name): locals()[name] = _mk_single_path_wrapper(name) + if hasattr(_os, name): + locals()[name] = _mk_single_path_wrapper(name) def _mk_single_with_return(name): original = getattr(_os, name) @@ -323,7 +325,8 @@ class AbstractSandbox: return wrap for name in ['readlink', 'tempnam']: - if hasattr(_os, name): locals()[name] = _mk_single_with_return(name) + if hasattr(_os, name): + locals()[name] = _mk_single_with_return(name) def _mk_query(name): original = getattr(_os, name) @@ -336,7 +339,8 @@ class AbstractSandbox: return wrap for name in ['getcwd', 'tmpnam']: - if hasattr(_os, name): locals()[name] = _mk_query(name) + if hasattr(_os, name): + locals()[name] = _mk_query(name) def _validate_path(self, path): """Called to remap or validate any path, whether input or output""" |