Skip to content

Commit

Permalink
Format with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Sep 25, 2019
1 parent f2c09f5 commit 5d8748e
Show file tree
Hide file tree
Showing 197 changed files with 6,680 additions and 6,748 deletions.
64 changes: 32 additions & 32 deletions docs/html/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import re
import sys

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
on_rtd = os.environ.get("READTHEDOCS", None) == "True"

docs_dir = os.path.dirname(os.path.dirname(__file__))
# If extensions (or modules to document with autodoc) are in another directory,
Expand All @@ -30,54 +30,54 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
# extensions = ['sphinx.ext.autodoc']
extensions = ['sphinx.ext.extlinks', 'pip_sphinxext', 'sphinx.ext.intersphinx']
extensions = ["sphinx.ext.extlinks", "pip_sphinxext", "sphinx.ext.intersphinx"]

# intersphinx
intersphinx_cache_limit = 0
intersphinx_mapping = {
'pypug': ('https://packaging.python.org/', None),
'pypa': ('https://www.pypa.io/en/latest/', None),
"pypug": ("https://packaging.python.org/", None),
"pypa": ("https://www.pypa.io/en/latest/", None),
}


# Add any paths that contain templates here, relative to this directory.
templates_path = []

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
# source_encoding = 'utf-8'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'pip'
copyright = '2008-2017, PyPA'
project = "pip"
copyright = "2008-2017, PyPA"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.

version = release = 'dev'
version = release = "dev"

# Readthedocs seems to install pip as an egg (via setup.py install) which
# is somehow resulting in "import pip" picking up an older copy of pip.
# Rather than trying to force RTD to install pip properly, we'll simply
# read the version direct from the __init__.py file. (Yes, this is
# fragile, but it works...)

pip_init = os.path.join(docs_dir, '..', 'src', 'pip', '__init__.py')
pip_init = os.path.join(docs_dir, "..", "src", "pip", "__init__.py")
with open(pip_init) as f:
for line in f:
m = re.match(r'__version__ = "(.*)"', line)
if m:
__version__ = m.group(1)
# The short X.Y version.
version = '.'.join(__version__.split('.')[:2])
version = ".".join(__version__.split(".")[:2])
# The full version, including alpha/beta/rc tags.
release = __version__
break
Expand All @@ -95,14 +95,14 @@
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%B %d, %Y'
today_fmt = "%B %d, %Y"

# List of documents that shouldn't be included in the build.
# unused_docs = []

# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_patterns = ['build/']
exclude_patterns = ["build/"]

# The reST default role (used for this markup: `text`) to use for all documents
# default_role = None
Expand All @@ -119,15 +119,15 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []

extlinks = {
'issue': ('https://github.com/pypa/pip/issues/%s', '#'),
'pull': ('https://github.com/pypa/pip/pull/%s', 'PR #'),
'pypi': ('https://pypi.org/project/%s', ''),
"issue": ("https://github.com/pypa/pip/issues/%s", "#"),
"pull": ("https://github.com/pypa/pip/pull/%s", "PR #"),
"pypi": ("https://pypi.org/project/%s", ""),
}

# -- Options for HTML output --------------------------------------------------
Expand All @@ -140,10 +140,10 @@
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
'collapsiblesidebar': True,
'externalrefs': True,
'navigation_depth': 3,
'issues_url': 'https://github.com/pypa/pip/issues',
"collapsiblesidebar": True,
"externalrefs": True,
"navigation_depth": 3,
"issues_url": "https://github.com/pypa/pip/issues",
}

# Add any paths that contain custom themes here, relative to this directory.
Expand Down Expand Up @@ -171,7 +171,7 @@

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%b %d, %Y'
html_last_updated_fmt = "%b %d, %Y"

# If true, the Docutils Smart Quotes transform (originally based on
# SmartyPants) will be used to convert characters like quotes and dashes
Expand All @@ -190,7 +190,7 @@
smartquotes_action = "qe"

# Custom sidebar templates, maps document names to template names.
html_sidebars = {'**': ['localtoc.html', 'relations.html'], 'index': ['localtoc.html']}
html_sidebars = {"**": ["localtoc.html", "relations.html"], "index": ["localtoc.html"]}

# Additional templates that should be rendered to pages, maps page names to
# template names.
Expand All @@ -217,7 +217,7 @@
# html_file_suffix = ''

# Output file base name for HTML help builder.
htmlhelp_basename = 'pipdocs'
htmlhelp_basename = "pipdocs"


# -- Options for LaTeX output -------------------------------------------------
Expand All @@ -231,7 +231,7 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual])
latex_documents = [
('index', 'pip.tex', u'pip Documentation', u'pip developers', 'manual')
("index", "pip.tex", u"pip Documentation", u"pip developers", "manual")
]

# The name of an image file (relative to this directory) to place at the top of
Expand All @@ -255,18 +255,18 @@

# List of manual pages generated
man_pages = [
('index', 'pip', u'package manager for Python packages', u'pip developers', 1)
("index", "pip", u"package manager for Python packages", u"pip developers", 1)
]

# Here, we crawl the entire man/commands/ directory and list every file with
# appropriate name and details
man_dir = os.path.join(docs_dir, 'man/')
raw_subcommands = glob.glob(os.path.join(man_dir, 'commands/*.rst'))
man_dir = os.path.join(docs_dir, "man/")
raw_subcommands = glob.glob(os.path.join(man_dir, "commands/*.rst"))
if not raw_subcommands:
raise FileNotFoundError('The individual subcommand manpages could not be found!')
raise FileNotFoundError("The individual subcommand manpages could not be found!")
for fname in raw_subcommands:
fname_base = fname[len(man_dir) : -4]
outname = 'pip-' + fname_base[9:]
description = u'description of {} command'.format(outname.replace('-', ' '))
outname = "pip-" + fname_base[9:]
description = u"description of {} command".format(outname.replace("-", " "))

man_pages.append((fname_base, outname, description, u'pip developers', 1))
man_pages.append((fname_base, outname, description, u"pip developers", 1))
20 changes: 10 additions & 10 deletions docs/pip_sphinxext.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PipCommandUsage(rst.Directive):

def run(self):
cmd = create_command(self.arguments[0])
usage = dedent(cmd.usage.replace('%prog', 'pip {}'.format(cmd.name))).strip()
usage = dedent(cmd.usage.replace("%prog", "pip {}".format(cmd.name))).strip()
node = nodes.literal_block(usage, usage)
return [node]

Expand All @@ -31,7 +31,7 @@ def run(self):
desc = ViewList()
cmd = create_command(self.arguments[0])
description = dedent(cmd.__doc__)
for line in description.split('\n'):
for line in description.split("\n"):
desc.append(line, "")
self.state.nested_parse(desc, 0, node)
return [node]
Expand All @@ -54,7 +54,7 @@ def _format_option(self, option, cmd_name=None):
metavar = option.metavar or option.dest.lower()
line += " <%s>" % metavar.lower()
# fix defaults
opt_help = option.help.replace('%default', str(option.default))
opt_help = option.help.replace("%default", str(option.default))
# fix paths with sys.prefix
opt_help = opt_help.replace(sys.prefix, "<sys.prefix>")
return [bookmark_line, "", line, "", " %s" % opt_help, ""]
Expand All @@ -77,12 +77,12 @@ def run(self):

class PipGeneralOptions(PipOptions):
def process_options(self):
self._format_options([o() for o in cmdoptions.general_group['options']])
self._format_options([o() for o in cmdoptions.general_group["options"]])


class PipIndexOptions(PipOptions):
def process_options(self):
self._format_options([o() for o in cmdoptions.index_group['options']])
self._format_options([o() for o in cmdoptions.index_group["options"]])


class PipCommandOptions(PipOptions):
Expand All @@ -94,8 +94,8 @@ def process_options(self):


def setup(app):
app.add_directive('pip-command-usage', PipCommandUsage)
app.add_directive('pip-command-description', PipCommandDescription)
app.add_directive('pip-command-options', PipCommandOptions)
app.add_directive('pip-general-options', PipGeneralOptions)
app.add_directive('pip-index-options', PipIndexOptions)
app.add_directive("pip-command-usage", PipCommandUsage)
app.add_directive("pip-command-description", PipCommandDescription)
app.add_directive("pip-command-options", PipCommandOptions)
app.add_directive("pip-general-options", PipGeneralOptions)
app.add_directive("pip-index-options", PipIndexOptions)
16 changes: 8 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def read(*parts):
# intentionally *not* adding an encoding option to open, See:
# https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
with codecs.open(os.path.join(here, *parts), 'r') as fp:
with codecs.open(os.path.join(here, *parts), "r") as fp:
return fp.read()


Expand All @@ -24,14 +24,14 @@ def find_version(*file_paths):
raise RuntimeError("Unable to find version string.")


long_description = read('README.rst')
long_description = read("README.rst")

setup(
name="pip",
version=find_version("src", "pip", "__init__.py"),
description="The PyPA recommended tool for installing Python packages.",
long_description=long_description,
license='MIT',
license="MIT",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -47,10 +47,10 @@ def find_version(*file_paths):
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
url='https://pip.pypa.io/',
keywords='distutils easy_install egg setuptools wheel virtualenv',
author='The pip developers',
author_email='pypa-dev@groups.google.com',
url="https://pip.pypa.io/",
keywords="distutils easy_install egg setuptools wheel virtualenv",
author="The pip developers",
author_email="pypa-dev@groups.google.com",
package_dir={"": "src"},
packages=find_packages(where="src", exclude=["contrib", "docs", "tests*", "tasks"]),
package_data={
Expand All @@ -67,5 +67,5 @@ def find_version(*file_paths):
]
},
zip_safe=False,
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*",
)
4 changes: 2 additions & 2 deletions src/pip/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# If we are running from a wheel, add the wheel to sys.path
# This allows the usage python pip-*.whl/pip install pip-*.whl
if __package__ == '':
if __package__ == "":
# __file__ is pip-*.whl/pip/__main__.py
# first dirname call strips of '/__main__.py', second strips off '/pip'
# Resulting path is the name of the wheel itself
Expand All @@ -15,5 +15,5 @@

from pip._internal import main as _main # isort:skip # noqa

if __name__ == '__main__':
if __name__ == "__main__":
sys.exit(_main())
7 changes: 2 additions & 5 deletions src/pip/_internal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@

# We ignore certain warnings from urllib3, since they are not relevant to pip's
# usecases.
from pip._vendor.urllib3.exceptions import (
DependencyWarning,
InsecureRequestWarning,
)
from pip._vendor.urllib3.exceptions import DependencyWarning, InsecureRequestWarning

import pip._internal.utils.inject_securetransport # noqa
from pip._internal.cli.autocompletion import autocomplete
Expand Down Expand Up @@ -50,7 +47,7 @@ def main(args=None):
# Needed for locale.getpreferredencoding(False) to work
# in pip._internal.utils.encoding.auto_decode
try:
locale.setlocale(locale.LC_ALL, '')
locale.setlocale(locale.LC_ALL, "")
except locale.Error as e:
# setlocale can apparently crash if locale are uninitialized
logger.debug("Ignoring error %s when setting locale", e)
Expand Down
Loading

0 comments on commit 5d8748e

Please sign in to comment.