Remove dependency on re for a trivial task

This commit is contained in:
Pradyun S. Gedam 2017-05-12 12:26:08 +05:30
parent ebead2376a
commit 027911f5e1
1 changed files with 2 additions and 4 deletions

View File

@ -12,7 +12,6 @@ Some terminology:
"""
import os
import re
import logging
from pip._vendor.six import next
@ -25,7 +24,6 @@ from pip.locations import (
)
from pip.utils import ensure_dir
_environ_prefix_re = re.compile(r"^PIP_", re.I)
_need_file_err_msg = "Needed a specific file to be modifying."
@ -253,8 +251,8 @@ class Configuration(object):
def _get_environ_vars(self):
"""Returns a generator with all environmental vars with prefix PIP_"""
for key, val in os.environ.items():
if _environ_prefix_re.search(key):
yield (_environ_prefix_re.sub("", key).lower(), val)
if key.startswith("PIP_"):
yield key[4:].lower(), val
def _get_config_files(self):
"""Yields variant and configuration files associated with it.