summaryrefslogtreecommitdiff
path: root/pip
diff options
context:
space:
mode:
authorPradyun S. Gedam <pradyunsg@gmail.com>2017-06-01 11:38:20 +0530
committerPradyun S. Gedam <pradyunsg@gmail.com>2017-06-01 11:38:20 +0530
commit3bb4ddc3323b30719144ce0aaa0300194e44a6d5 (patch)
tree3ab2e270105d14195175568ab47cd951e8b133db /pip
parent341766c162437a8dfced6d19ce5923b9446b5595 (diff)
downloadpip-3bb4ddc3323b30719144ce0aaa0300194e44a6d5.tar.gz
Change file_ to fname
Diffstat (limited to 'pip')
-rw-r--r--pip/commands/configuration.py6
-rw-r--r--pip/configuration.py40
-rw-r--r--pip/req/req_uninstall.py6
3 files changed, 26 insertions, 26 deletions
diff --git a/pip/commands/configuration.py b/pip/commands/configuration.py
index cbdc45063..d4655c91f 100644
--- a/pip/commands/configuration.py
+++ b/pip/commands/configuration.py
@@ -177,12 +177,12 @@ class ConfigurationCommand(Command):
def open_in_editor(self, options, args):
editor = self._determine_editor(options)
- file_ = self.configuration.get_file_to_edit()
- if file_ is None:
+ fname = self.configuration.get_file_to_edit()
+ if fname is None:
raise PipError("Could not determine appropriate file.")
try:
- subprocess.check_call([editor, file_])
+ subprocess.check_call([editor, fname])
except subprocess.CalledProcessError as e:
raise PipError(
"Editor Subprocess exited with exit code {}"
diff --git a/pip/configuration.py b/pip/configuration.py
index 9e3d56940..95e455048 100644
--- a/pip/configuration.py
+++ b/pip/configuration.py
@@ -123,7 +123,7 @@ class Configuration(object):
"""
self._ensure_have_load_only()
- file_, parser = self._get_parser_to_modify()
+ fname, parser = self._get_parser_to_modify()
if parser is not None:
section, name = _disassemble_key(key)
@@ -134,7 +134,7 @@ class Configuration(object):
parser.set(section, name, value)
self._config[self.load_only][key] = value
- self._mark_as_modified(file_, parser)
+ self._mark_as_modified(fname, parser)
def unset_value(self, key):
"""Unset a value in the configuration.
@@ -144,7 +144,7 @@ class Configuration(object):
if key not in self._config[self.load_only]:
raise ConfigurationError("No such key - {}".format(key))
- file_, parser = self._get_parser_to_modify()
+ fname, parser = self._get_parser_to_modify()
if parser is not None:
section, name = _disassemble_key(key)
@@ -160,7 +160,7 @@ class Configuration(object):
if next(iter(parser.items(section)), None) is None:
parser.remove_section(section)
- self._mark_as_modified(file_, parser)
+ self._mark_as_modified(fname, parser)
else:
raise ConfigurationError(
"Fatal Internal error [id=1]. Please report as a bug."
@@ -173,13 +173,13 @@ class Configuration(object):
"""
self._ensure_have_load_only()
- for file_, parser in self._modified_parsers:
- logger.info("Writing to %s", file_)
+ for fname, parser in self._modified_parsers:
+ logger.info("Writing to %s", fname)
# Ensure directory exists.
- ensure_dir(os.path.dirname(file_))
+ ensure_dir(os.path.dirname(fname))
- with open(file_, "w") as f:
+ with open(fname, "w") as f:
parser.write(f)
#
@@ -216,23 +216,23 @@ class Configuration(object):
return
for variant, files in config_files.items():
- for file_ in files:
+ for fname in files:
# If there's specific variant set in `load_only`, load only
# that variant, not the others.
if self.load_only is not None and variant != self.load_only:
logger.debug(
- "Skipping file '%s' (variant: %s)", file_, variant
+ "Skipping file '%s' (variant: %s)", fname, variant
)
continue
- parser = self._load_file(variant, file_)
+ parser = self._load_file(variant, fname)
# Keeping track of the parsers used
- self._parsers[variant].append((file_, parser))
+ self._parsers[variant].append((fname, parser))
- def _load_file(self, variant, file_):
- logger.debug("For variant '%s', will try loading '%s'", variant, file_)
- parser = self._construct_parser(file_)
+ def _load_file(self, variant, fname):
+ logger.debug("For variant '%s', will try loading '%s'", variant, fname)
+ parser = self._construct_parser(fname)
for section in parser.sections():
items = parser.items(section)
@@ -240,14 +240,14 @@ class Configuration(object):
return parser
- def _construct_parser(self, file_):
+ def _construct_parser(self, fname):
parser = configparser.RawConfigParser()
# If there is no such file, don't bother reading it but create the
# parser anyway, to hold the data.
# Doing this is useful when modifying and saving files, where we don't
# need to construct a parser.
- if os.path.exists(file_):
- parser.read(file_)
+ if os.path.exists(fname):
+ parser.read(fname)
return parser
@@ -319,7 +319,7 @@ class Configuration(object):
return parsers[-1]
# XXX: This is patched in the tests.
- def _mark_as_modified(self, file_, parser):
- file_parser_tuple = (file_, parser)
+ def _mark_as_modified(self, fname, parser):
+ file_parser_tuple = (fname, parser)
if file_parser_tuple not in self._modified_parsers:
self._modified_parsers.append(file_parser_tuple)
diff --git a/pip/req/req_uninstall.py b/pip/req/req_uninstall.py
index 1e21a7961..0261b5a8d 100644
--- a/pip/req/req_uninstall.py
+++ b/pip/req/req_uninstall.py
@@ -218,10 +218,10 @@ class UninstallPathSet(object):
if fname.endswith(".pyc"):
continue
- file_ = os.path.join(dirpath, fname)
- if os.path.isfile(file_) and file_ not in files:
+ fname = os.path.join(dirpath, fname)
+ if os.path.isfile(fname) and fname not in files:
# We are skipping this file. Add it to the set.
- will_skip.add(file_)
+ will_skip.add(fname)
will_remove = files | {
os.path.join(folder, "*") for folder in folders