当前位置: 首页>>代码示例>>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;未经允许,请勿转载。