Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from poetry.utils.inspector import Inspector
from poetry.utils.patterns import wheel_file_re
from poetry.version.markers import InvalidMarker
from poetry.version.markers import parse_marker
from .exceptions import PackageNotFound
from .repository import Repository
try:
import urllib.parse as urlparse
except ImportError:
import urlparse
cache_control_logger.setLevel(logging.ERROR)
logger = logging.getLogger(__name__)
class PyPiRepository(Repository):
CACHE_VERSION = parse_constraint("1.0.0")
def __init__(self, url="https://pypi.org/", disable_cache=False, fallback=True):
self._url = url
self._disable_cache = disable_cache
self._fallback = fallback
release_cache_dir = Path(CACHE_DIR) / "cache" / "repositories" / "pypi"
self._cache = CacheManager(
{
def cachecontrol_logging_hook(app):
"""
Reroute cachecontrol logger to use cement log handlers.
"""
from cachecontrol.controller import logger
formatter = logging.Formatter(LOG_FORMAT)
for handler in app.log.backend.handlers:
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
def setup_logging():
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
logger.addHandler(handler)
def cachecontrol_logging_hook(app):
"""
Reroute cachecontrol logger to use cement log handlers.
"""
from cachecontrol.controller import logger
formatter = logging.Formatter(LOG_FORMAT)
for handler in app.log.backend.handlers:
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
def setup_logging():
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
logger.addHandler(handler)