summaryrefslogtreecommitdiffstats
path: root/lib/rdoc/markup/sample
diff options
context:
space:
mode:
authorseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-22 14:10:36 +0000
committerseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-22 14:10:36 +0000
commit8aac7cfba1f7c029c3e334ac7a074f378468416b (patch)
treea93a4e77d4e992325cfa1df309d4fc1cecb7eb78 /lib/rdoc/markup/sample
parent45e99448bfa9d94dc4f39cfa5b2d8159a736aab4 (diff)
(accept) rescue SSLError. [druby-ja:110]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/markup/sample')
0 files changed, 0 insertions, 0 deletions
ef='#n92'>92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
# -*- encoding: utf-8 -*-
# Software Management Providers
#
# Copyright (C) 2012-2013 Red Hat, Inc.  All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
# Authors: Michal Minar <miminar@redhat.com>
"""
Pylint checker for CIM provider modules and classes.
"""

import re
from logilab.astng import node_classes # pylint: disable=W0403
from logilab.astng import scoped_nodes # pylint: disable=W0403
from pylint.interfaces import IASTNGChecker
from pylint.checkers import BaseChecker

_RE_PROVIDER_CLASS_NAME = re.compile(
    r'^(?P<prefix>[A-Z][a-zA-Z0-9]*)_(?P<name>[A-Z][a-zA-Z]*)$')
_RE_PROVIDER_MODULE_NAME = re.compile(
    r'^((?P<parent>.*)\.)?(?P<basename>(?P<prefix>[A-Z][a-zA-Z0-9]*)'
    r'_(?P<name>[A-Z][a-zA-Z]*))$')
_RE_COMMON_MODULE_NAME = re.compile(
    r'^([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)$')

def recursively_clean_cls_values(linter, node):
    """
    Values class under provider defines property values, under
    nested classes that are popular target of pylint messages. Since
    these are generated and known to any developper, we don't want
    to be bothered by these warnings.

    Supress them for any nested class recursively.
    """
    # class has too few public methods
    linter.disable('R0903', scope='module', line=node.fromlineno)
    # class has not docstring
    linter.disable('C0111', scope='module', line=node.fromlineno)
    for child in node.get_children():
        if isinstance(child, scoped_nodes.Class):
            recursively_clean_cls_values(linter, child)

def supress_cim_provider_messages(linter, node):
    """
    Supress some warnings for CIMProvider2 subclass.
    @param node is a subclass of CIMProvider2
    """
    assert isinstance(node, scoped_nodes.Class)
    # class has too many public methods
    linter.disable('R0904', scope='module', line=node.fromlineno)
    if '__init__' in node:
        # __init__ not called for base class
        linter.disable('W0231', scope='module', line=node['__init__'].fromlineno)
    if (  'Values' in node