pylint/config.py
def read_config_file(self, config_file=None, verbose=None):
        """read the configuration file but do not load it (i.e. dispatching
        values to each options provider)
        """
        helplevel = 1
        while helplevel <= self._maxlevel:
            opt = "-".join(["long"] * helplevel) + "-help"
            if opt in self._all_options:
                break  # already processed
            # pylint: disable=unused-argument
            def helpfunc(option, opt, val, p, level=helplevel):
                print(self.help(level))
                sys.exit(0)

            helpmsg = "%s verbose help." % " ".join(["more"] * helplevel)
            optdict = {"action": "callback", "callback": helpfunc, "help": helpmsg}
            provider = self.options_providers[0]
            self.add_optik_option(provider, self.cmdline_parser, opt, optdict)
            provider.options += ((opt, optdict),)
            helplevel += 1
        if config_file is None:
            config_file = self.config_file
        if config_file is not None:
            config_file = os.path.expanduser(config_file)
            if not os.path.exists(config_file):
                raise IOError("The config file {:s} doesn't exist!".format(config_file))

        use_config_file = config_file and os.path.exists(config_file)
        if use_config_file:
            parser = self.cfgfile_parser

            # Use this encoding in order to strip the BOM marker, if any.
            with io.open(config_file, "r", encoding="utf_8_sig") as fp:
                parser.read_file(fp)

            # normalize sections'title
            for sect, values in list(parser._sections.items()):
                if not sect.isupper() and values:
                    parser._sections[sect.upper()] = values

        if not verbose:
            return

        if use_config_file:
            msg = "Using config file {}".format(os.path.abspath(config_file))
        else:
            msg = "No config file found, using default configuration"
        print(msg, file=sys.stderr)
def read_config_file(self, config_file=None, verbose=None):
        """read the configuration file but do not load it (i.e. dispatching
        values to each options provider)
        """
        helplevel = 1
        while helplevel <= self._maxlevel:
            opt = "-".join(["long"] * helplevel) + "-help"
            if opt in self._all_options:
                break  # already processed
            # pylint: disable=unused-argument
            def helpfunc(option, opt, val, p, level=helplevel):
                print(self.help(level))
                sys.exit(0)

            helpmsg = "%s verbose help." % " ".join(["more"] * helplevel)
            optdict = {"action": "callback", "callback": helpfunc, "help": helpmsg}
            provider = self.options_providers[0]
            self.add_optik_option(provider, self.cmdline_parser, opt, optdict)
            provider.options += ((opt, optdict),)
            helplevel += 1
        if config_file is None:
            config_file = self.config_file
        if config_file is not None:
            config_file = os.path.expanduser(config_file)
            if not os.path.exists(config_file):
                raise IOError("The config file {:s} doesn't exist!".format(config_file))

        use_config_file = config_file and os.path.exists(config_file)
        if use_config_file:
            parser = self.cfgfile_parser

            # Use this encoding in order to strip the BOM marker, if any.
            with io.open(config_file, "r", encoding="utf_8_sig") as fp:
                parser.read_file(fp)

            # normalize sections'title
            for sect, values in list(parser._sections.items()):
                if not sect.isupper() and values:
                    parser._sections[sect.upper()] = values

        if not verbose:
            return

        if use_config_file:
            msg = "Using config file {}".format(os.path.abspath(config_file))
        else:
            msg = "No config file found, using default configuration"
        print(msg, file=sys.stderr)
def read_config_file ( self , config_file = None , verbose = None ) : helplevel = 1 while helplevel <= self . _maxlevel : opt = "-" . join ( [ "long" ] * helplevel ) + "-help" if opt in self . _all_options : break # already processed # pylint: disable=unused-argument def helpfunc ( option , opt , val , p , level = helplevel ) : print ( self . help ( level ) ) sys . exit ( 0 ) helpmsg = "%s verbose help." % " " . join ( [ "more" ] * helplevel ) optdict = { "action" : "callback" , "callback" : helpfunc , "help" : helpmsg } provider = self . options_providers [ 0 ] self . add_optik_option ( provider , self . cmdline_parser , opt , optdict ) provider . options += ( ( opt , optdict ) , ) helplevel += 1 if config_file is None : config_file = self . config_file if config_file is not None : config_file = os . path . expanduser ( config_file ) if not os . path . exists ( config_file ) : raise IOError ( "The config file {:s} doesn't exist!" . format ( config_file ) ) use_config_file = config_file and os . path . exists ( config_file ) if use_config_file : parser = self . cfgfile_parser # Use this encoding in order to strip the BOM marker, if any. with io . open ( config_file , "r" , encoding = "utf_8_sig" ) as fp : parser . read_file ( fp ) # normalize sections'title for sect , values in list ( parser . _sections . items ( ) ) : if not sect . isupper ( ) and values : parser . _sections [ sect . upper ( ) ] = values if not verbose : return if use_config_file : msg = "Using config file {}" . format ( os . path . abspath ( config_file ) ) else : msg = "No config file found, using default configuration" print ( msg , file = sys . stderr )
read the configuration file but do not load it (i.e. dispatching
        values to each options provider)
read the configuration file but do not load it ( i . e . dispatching values to each options provider )