Example #1
0
    def test_annotating_decorator(self):
        foo = utils.AnnotatingDecorator()

        @foo(3)
        def f():  # pylint: disable=unused-variable
            pass

        self.assertEqual(foo.lookup["f"], 3)
Example #2
0
import os

from pytype import errors
from pytype import imports_map_loader
from pytype import load_pytd
from pytype import utils
from pytype.typegraph import cfg_utils

import six

LOG_LEVELS = [
    logging.CRITICAL, logging.ERROR, logging.WARNING, logging.INFO,
    logging.DEBUG
]

uses = utils.AnnotatingDecorator()  # model relationship between options


class Options(object):
    """Encapsulation of the command-line options."""

    _HAS_DYNAMIC_ATTRIBUTES = True

    def __init__(self, argv):
        """Parse and encapsulate the command-line options.

    Also sets up some basic logger configuration.

    Args:
      argv: sys.argv[1:] (sys.argv[0] is the main script).