<s> import os <EOL> from logging . config import fileConfig <EOL> try : <EOL> import configparser <EOL> except ImportError : <EOL> import ConfigParser as configparser <EOL> def setup_logging ( config_uri , fileConfig = fileConfig , <EOL> configparser = configparser ) : <EOL> """<STR_LIT>""" <EOL> path , _ = _getpathsec ( config_uri , None ) <EOL> parser = configparser . ConfigParser ( ) <EOL> parser . read ( [ path ] ) <EOL> if parser . has_section ( '<STR_LIT>' ) : <EOL> config_file = os . path . abspath ( path ) <EOL> config_options = dict ( <EOL> __file__ = config_file , <EOL> here = os . path . dirname ( config_file ) <EOL> ) <EOL> fileConfig ( config_file , config_options , <EOL> disable_existing_loggers = False ) <EOL> def _getpathsec ( config_uri , name ) : <EOL> if '<STR_LIT:#>' in config_uri : <EOL> path , section = config_uri . split ( '<STR_LIT:#>' , <NUM_LIT:1> ) <EOL> else : <EOL> path , section = config_uri , '<STR_LIT>' <EOL> if name : <EOL> section = name <EOL> return path , section </s>
