How to use the pipupgrade.log.get_logger function in pipupgrade

To help you get started, we’ve selected a few pipupgrade examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github achillesrasquinha / pipupgrade / src / pipupgrade / model / registry.py View on Github external
from __future__ import absolute_import

# imports - standard imports
import re
from   functools import partial, cmp_to_key

# imports - module imports
from pipupgrade.model.package   import Package, _get_pip_info
from pipupgrade                 import _pip, parallel
from pipupgrade.util.array      import compact, flatten
from pipupgrade.util.string     import kebab_case
from pipupgrade._compat		    import iteritems, iterkeys, itervalues
from pipupgrade.tree            import Node as TreeNode
from pipupgrade.log             import get_logger

logger = get_logger()

# cache package information
_INFO_DICT = dict()
# cache dependency trees
_TREE_DICT = dict()

def _build_packages_info_dict(packages, pip_exec = None):
    details         = _get_pip_info(*packages, pip_exec = pip_exec)

    requirements    = [ ]

    for name, detail in iteritems(details):
        if not name in _INFO_DICT:
            _INFO_DICT[name] = dict({
                     "version": detail["version"], 
                "dependencies": compact(detail["requires"].split(", "))
github achillesrasquinha / pipupgrade / src / pipupgrade / request / __init__.py View on Github external
urlopen,
    Request,
    urlencode,
    HTTPError,
    ModuleNotFoundError
)

# imports - standard imports
import json

# imports - module imports
from pipupgrade.request.response import Response
from pipupgrade.util.string      import safe_encode
from pipupgrade.log              import get_logger

logger = get_logger()

# YAGNI: This patched "requests" works only for pipupgrade's use-cases.

def get(*args, **kwargs):
    logger.info("Dispatching GET request with arguments %s and parameters %s." % (
        args, kwargs
    ))

    try:
        import requests as req
        return req.get(*args, **kwargs)
    except (ImportError, ModuleNotFoundError):
        url      = args[0]
        response = Response()

        try:
github achillesrasquinha / pipupgrade / src / pipupgrade / util / system.py View on Github external
# imports - standard imports
import os, os.path as osp
import errno
import platform
import subprocess  as sp
import shutil
from   distutils.spawn import find_executable

# imports - module imports
from pipupgrade.exception   import PopenError
from pipupgrade.util.string import strip, safe_decode
from pipupgrade._compat     import iteritems
from pipupgrade.log         import get_logger

logger = get_logger()

def read(fname):
    with open(fname) as f:
        data = f.read()
    return data

def write(fname, data = None, force = False, append = False):
    if not osp.exists(fname) or append or force:
        with open(fname, mode = "a" if append else "w") as f:
            if data:
                f.write(data)

def which(executable, raise_err = False):
    exec_ = None

    try: