Skip to content

Commit 95035fc

Browse files
committed
Turn on everything in flake8
flake8 ignores some errors by default, these ignored by defaults change sometimes. This will make things stabler by selecting everything.
1 parent c8d9368 commit 95035fc

36 files changed

+271
-247
lines changed

pip/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def create_main_parser():
109109

110110
pip_pkg_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
111111
parser.version = 'pip %s from %s (python %s)' % (
112-
__version__, pip_pkg_dir, sys.version[:3])
112+
__version__, pip_pkg_dir, sys.version[:3])
113113

114114
# add the general options
115115
gen_opts = cmdoptions.make_option_group(cmdoptions.general_group, parser)
@@ -247,8 +247,10 @@ def from_dist(cls, dist, dependency_links, find_tags=False):
247247
if ver_match or date_match:
248248
svn_backend = vcs.get_backend('svn')
249249
if svn_backend:
250-
svn_location = svn_backend(
251-
).get_location(dist, dependency_links)
250+
svn_location = svn_backend().get_location(
251+
dist,
252+
dependency_links,
253+
)
252254
if not svn_location:
253255
logger.warn(
254256
'Warning: cannot find svn location for %s' % req)

pip/cmdoptions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ def make(self):
357357
skip_requirements_regex,
358358
exists_action,
359359
cert,
360-
]
361-
}
360+
]
361+
}
362362

363363
index_group = {
364364
'name': 'Package Index Options',
@@ -375,5 +375,5 @@ def make(self):
375375
allow_unsafe,
376376
no_allow_unsafe,
377377
process_dependency_links,
378-
]
379-
}
378+
]
379+
}

pip/commands/install.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def run(self, options, args):
357357
for item in os.listdir(lib_dir):
358358
shutil.move(
359359
os.path.join(lib_dir, item),
360-
os.path.join(options.target_dir, item)
361-
)
360+
os.path.join(options.target_dir, item),
361+
)
362362
shutil.rmtree(temp_target_dir)
363363
return requirement_set

pip/download.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def unpack_http_url(link, location, download_cache, download_dir=None,
521521
already_cached = (
522522
os.path.exists(cache_file) and
523523
os.path.exists(cache_content_type_file)
524-
)
524+
)
525525
if not os.path.isdir(download_cache):
526526
create_download_cache_folder(download_cache)
527527

@@ -545,7 +545,7 @@ def unpack_http_url(link, location, download_cache, download_dir=None,
545545
logger.warn(
546546
'Previously-downloaded file %s has bad hash, '
547547
're-downloading.' % temp_location
548-
)
548+
)
549549
temp_location = None
550550
os.unlink(already_downloaded)
551551
already_downloaded = None
@@ -564,7 +564,7 @@ def unpack_http_url(link, location, download_cache, download_dir=None,
564564
logger.warn(
565565
'Cached file %s has bad hash, '
566566
're-downloading.' % temp_location
567-
)
567+
)
568568
temp_location = None
569569
os.unlink(cache_file)
570570
os.unlink(cache_content_type_file)
@@ -654,7 +654,7 @@ def unpack_file_url(link, location, download_dir=None):
654654
logger.warn(
655655
'Previously-downloaded file %s has bad hash, '
656656
're-downloading.' % link_path
657-
)
657+
)
658658
os.unlink(download_path)
659659
else:
660660
already_downloaded = True

pip/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ def set_is_archive(self, url, value=True):
720720
self._archives[url] = value
721721

722722
def add_page_failure(self, url, level):
723-
self._failures[url] = self._failures.get(url, 0)+level
723+
self._failures[url] = self._failures.get(url, 0) + level
724724

725725
def add_page(self, urls, page):
726726
for url in urls:

pip/locations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def distutils_scheme(dist_name, user=False, home=None, root=None):
177177
i.root = root or i.root
178178
i.finalize_options()
179179
for key in SCHEME_KEYS:
180-
scheme[key] = getattr(i, 'install_'+key)
180+
scheme[key] = getattr(i, 'install_' + key)
181181

182182
if running_under_virtualenv():
183183
scheme['headers'] = os.path.join(

pip/req/req_install.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def egg_info_path(self, filename):
391391
if (
392392
os.path.exists(
393393
os.path.join(root, dir, 'bin', 'python')
394-
)
394+
)
395395
or os.path.exists(
396396
os.path.join(
397397
root, dir, 'Scripts', 'Python.exe'
@@ -703,9 +703,10 @@ def archive(self, build_dir):
703703
logger.notify('Saved %s' % display_path(archive_path))
704704

705705
def _clean_zip_name(self, name, prefix):
706-
assert name.startswith(prefix+os.path.sep), (
707-
"name %r doesn't start with prefix %r" % (name, prefix))
708-
name = name[len(prefix)+1:]
706+
assert name.startswith(prefix + os.path.sep), (
707+
"name %r doesn't start with prefix %r" % (name, prefix)
708+
)
709+
name = name[len(prefix) + 1:]
709710
name = name.replace(os.path.sep, '/')
710711
return name
711712

@@ -805,7 +806,7 @@ def prepend_root(path):
805806
)
806807
f.close()
807808
f = open(os.path.join(egg_info_dir, 'installed-files.txt'), 'w')
808-
f.write('\n'.join(new_lines)+'\n')
809+
f.write('\n'.join(new_lines) + '\n')
809810
f.close()
810811
finally:
811812
if os.path.exists(record_filename):

pip/req/req_set.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def prepare_files(self, finder, force_root_egg_info=False, bundle=False):
350350
self.unpack_url(
351351
url, location, download_dir,
352352
do_download,
353-
)
353+
)
354354
except HTTPError as exc:
355355
logger.fatal(
356356
'Could not install requirement %s because '
@@ -728,8 +728,9 @@ def bundle_requirements(self):
728728
return ''.join(parts)
729729

730730
def _clean_zip_name(self, name, prefix):
731-
assert name.startswith(prefix+os.path.sep), (
732-
"name %r doesn't start with prefix %r" % (name, prefix))
733-
name = name[len(prefix)+1:]
731+
assert name.startswith(prefix + os.path.sep), (
732+
"name %r doesn't start with prefix %r" % (name, prefix)
733+
)
734+
name = name[len(prefix) + 1:]
734735
name = name.replace(os.path.sep, '/')
735736
return name

pip/util.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@ def normalize_name(name):
188188

189189

190190
def format_size(bytes):
191-
if bytes > 1000*1000:
192-
return '%.1fMB' % (bytes/1000.0/1000)
193-
elif bytes > 10*1000:
194-
return '%ikB' % (bytes/1000)
191+
if bytes > 1000 * 1000:
192+
return '%.1fMB' % (bytes / 1000.0 / 1000)
193+
elif bytes > 10 * 1000:
194+
return '%ikB' % (bytes / 1000)
195195
elif bytes > 1000:
196-
return '%.1fkB' % (bytes/1000.0)
196+
return '%.1fkB' % (bytes / 1000.0)
197197
else:
198198
return '%ibytes' % bytes
199199

@@ -274,7 +274,7 @@ def make_path_relative(path, rel_to):
274274
while path_parts and rel_to_parts and path_parts[0] == rel_to_parts[0]:
275275
path_parts.pop(0)
276276
rel_to_parts.pop(0)
277-
full_parts = ['..']*len(rel_to_parts) + path_parts + [path_filename]
277+
full_parts = ['..'] * len(rel_to_parts) + path_parts + [path_filename]
278278
if full_parts == ['']:
279279
return '.' + os.path.sep
280280
return os.path.sep.join(full_parts)
@@ -540,7 +540,7 @@ def unzip_file(filename, location, flatten=True):
540540
if mode and stat.S_ISREG(mode) and mode & 0o111:
541541
# make dest file have execute for user/group/world
542542
# (chmod +x) no-op on windows per python docs
543-
os.chmod(fn, (0o777-current_umask() | 0o111))
543+
os.chmod(fn, (0o777 - current_umask() | 0o111))
544544
finally:
545545
zipfp.close()
546546

@@ -615,7 +615,7 @@ def untar_file(filename, location):
615615
if member.mode & 0o111:
616616
# make dest file have execute for user/group/world
617617
# no-op on windows per python docs
618-
os.chmod(path, (0o777-current_umask() | 0o111))
618+
os.chmod(path, (0o777 - current_umask() | 0o111))
619619
finally:
620620
tar.close()
621621

@@ -632,7 +632,7 @@ def cache_download(target_file, temp_location, content_type):
632632
'Storing download in cache at %s' % display_path(target_file)
633633
)
634634
shutil.copyfile(temp_location, target_file)
635-
fp = open(target_file+'.content-type', 'w')
635+
fp = open(target_file + '.content-type', 'w')
636636
fp.write(content_type)
637637
fp.close()
638638

pip/wheel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def uninstallation_paths(dist):
393393
if path.endswith('.py'):
394394
dn, fn = os.path.split(path)
395395
base = fn[:-3]
396-
path = os.path.join(dn, base+'.pyc')
396+
path = os.path.join(dn, base + '.pyc')
397397
yield path
398398

399399

0 commit comments

Comments
 (0)