當前位置: 首頁>>代碼示例>>Python>>正文


Python checkers.BaseTokenChecker方法代碼示例

本文整理匯總了Python中pylint.checkers.BaseTokenChecker方法的典型用法代碼示例。如果您正苦於以下問題:Python checkers.BaseTokenChecker方法的具體用法?Python checkers.BaseTokenChecker怎麽用?Python checkers.BaseTokenChecker使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pylint.checkers的用法示例。


在下文中一共展示了checkers.BaseTokenChecker方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: set_option

# 需要導入模塊: from pylint import checkers [as 別名]
# 或者: from pylint.checkers import BaseTokenChecker [as 別名]
def set_option(self, optname, value, action=None, optdict=None):
        """overridden from config.OptionsProviderMixin to handle some
        special options
        """
        if optname in self._options_methods or \
                optname in self._bw_options_methods:
            if value:
                try:
                    meth = self._options_methods[optname]
                except KeyError:
                    meth = self._bw_options_methods[optname]
                    warnings.warn('%s is deprecated, replace it by %s' % (optname,
                                                                          optname.split('-')[0]),
                                  DeprecationWarning)
                value = utils._check_csv(value)
                if isinstance(value, (list, tuple)):
                    for _id in value:
                        meth(_id, ignore_unknown=True)
                else:
                    meth(value)
                return # no need to call set_option, disable/enable methods do it
        elif optname == 'output-format':
            self._reporter_name = value
            # If the reporters are already available, load
            # the reporter class.
            if self._reporters:
                self._load_reporter()

        try:
            checkers.BaseTokenChecker.set_option(self, optname,
                                                 value, action, optdict)
        except config.UnsupportedAction:
            print('option %s can\'t be read from config file' % \
                  optname, file=sys.stderr) 
開發者ID:AtomLinter,項目名稱:linter-pylama,代碼行數:36,代碼來源:lint.py

示例2: __init__

# 需要導入模塊: from pylint import checkers [as 別名]
# 或者: from pylint.checkers import BaseTokenChecker [as 別名]
def __init__(self, linter=None):
        checkers.BaseTokenChecker.__init__(self, linter)
        self._return_nodes = {}
        self._init()
        self._never_returning_functions = None 
開發者ID:AtomLinter,項目名稱:linter-pylama,代碼行數:7,代碼來源:refactoring.py

示例3: set_option

# 需要導入模塊: from pylint import checkers [as 別名]
# 或者: from pylint.checkers import BaseTokenChecker [as 別名]
def set_option(self, optname, value, action=None, optdict=None):
        """overridden from config.OptionsProviderMixin to handle some
        special options
        """
        if optname in self._options_methods or optname in self._bw_options_methods:
            if value:
                try:
                    meth = self._options_methods[optname]
                except KeyError:
                    meth = self._bw_options_methods[optname]
                    warnings.warn(
                        "%s is deprecated, replace it by %s"
                        % (optname, optname.split("-")[0]),
                        DeprecationWarning,
                    )
                value = utils._check_csv(value)
                if isinstance(value, (list, tuple)):
                    for _id in value:
                        meth(_id, ignore_unknown=True)
                else:
                    meth(value)
                return  # no need to call set_option, disable/enable methods do it
        elif optname == "output-format":
            self._reporter_name = value
            # If the reporters are already available, load
            # the reporter class.
            if self._reporters:
                self._load_reporter()

        try:
            checkers.BaseTokenChecker.set_option(self, optname, value, action, optdict)
        except config.UnsupportedAction:
            print("option %s can't be read from config file" % optname, file=sys.stderr) 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:35,代碼來源:lint.py

示例4: __init__

# 需要導入模塊: from pylint import checkers [as 別名]
# 或者: from pylint.checkers import BaseTokenChecker [as 別名]
def __init__(self, options=(), reporter=None, option_groups=(),
                 pylintrc=None):
        # some stuff has to be done before ancestors initialization...
        #
        # messages store / checkers / reporter / astroid manager
        self.msgs_store = utils.MessagesStore()
        self.reporter = None
        self._reporter_name = None
        self._reporters = {}
        self._checkers = collections.defaultdict(list)
        self._pragma_lineno = {}
        self._ignore_file = False
        # visit variables
        self.file_state = utils.FileState()
        self.current_name = None
        self.current_file = None
        self.stats = None
        # init options
        self._external_opts = options
        self.options = options + PyLinter.make_options()
        self.option_groups = option_groups + PyLinter.option_groups
        self._options_methods = {
            'enable': self.enable,
            'disable': self.disable}
        self._bw_options_methods = {'disable-msg': self.disable,
                                    'enable-msg': self.enable}
        full_version = '%%prog %s, \nastroid %s\nPython %s' % (
            version, astroid_version, sys.version)
        utils.MessagesHandlerMixIn.__init__(self)
        utils.ReportsHandlerMixIn.__init__(self)
        super(PyLinter, self).__init__(
            usage=__doc__,
            version=full_version,
            config_file=pylintrc or config.PYLINTRC)
        checkers.BaseTokenChecker.__init__(self)
        # provided reports
        self.reports = (('RP0001', 'Messages by category',
                         report_total_messages_stats),
                        ('RP0002', '% errors / warnings by module',
                         report_messages_by_module_stats),
                        ('RP0003', 'Messages',
                         report_messages_stats),
                       )
        self.register_checker(self)
        self._dynamic_plugins = set()
        self._python3_porting_mode = False
        self._error_mode = False
        self.load_provider_defaults()
        if reporter:
            self.set_reporter(reporter) 
開發者ID:AtomLinter,項目名稱:linter-pylama,代碼行數:52,代碼來源:lint.py

示例5: __init__

# 需要導入模塊: from pylint import checkers [as 別名]
# 或者: from pylint.checkers import BaseTokenChecker [as 別名]
def __init__(self, options=(), reporter=None, option_groups=(), pylintrc=None):
        # some stuff has to be done before ancestors initialization...
        #
        # messages store / checkers / reporter / astroid manager
        self.msgs_store = utils.MessagesStore()
        self.reporter = None
        self._reporter_name = None
        self._reporters = {}
        self._checkers = collections.defaultdict(list)
        self._pragma_lineno = {}
        self._ignore_file = False
        # visit variables
        self.file_state = utils.FileState()
        self.current_name = None
        self.current_file = None
        self.stats = None
        # init options
        self._external_opts = options
        self.options = options + PyLinter.make_options()
        self.option_groups = option_groups + PyLinter.option_groups
        self._options_methods = {"enable": self.enable, "disable": self.disable}
        self._bw_options_methods = {
            "disable-msg": self.disable,
            "enable-msg": self.enable,
        }
        full_version = "%%prog %s\nastroid %s\nPython %s" % (
            version,
            astroid_version,
            sys.version,
        )
        utils.MessagesHandlerMixIn.__init__(self)
        utils.ReportsHandlerMixIn.__init__(self)
        super(PyLinter, self).__init__(
            usage=__doc__, version=full_version, config_file=pylintrc or config.PYLINTRC
        )
        checkers.BaseTokenChecker.__init__(self)
        # provided reports
        self.reports = (
            ("RP0001", "Messages by category", report_total_messages_stats),
            (
                "RP0002",
                "% errors / warnings by module",
                report_messages_by_module_stats,
            ),
            ("RP0003", "Messages", report_messages_stats),
        )
        self.register_checker(self)
        self._dynamic_plugins = set()
        self._python3_porting_mode = False
        self._error_mode = False
        self.load_provider_defaults()
        if reporter:
            self.set_reporter(reporter) 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:55,代碼來源:lint.py


注:本文中的pylint.checkers.BaseTokenChecker方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。