<s> import sys <EOL> import imp <EOL> import errno <EOL> import os <EOL> from u2fval import default_settings <EOL> import logging <EOL> import logging . config <EOL> __all__ = [ <EOL> '<STR_LIT>' <EOL> ] <EOL> SETTINGS_FILE = os . getenv ( '<STR_LIT>' , os . path . join ( <EOL> '<STR_LIT>' ) ) <EOL> LOG_CONFIG_FILE = os . path . join ( os . path . dirname ( os . path . abspath ( SETTINGS_FILE ) ) , <EOL> '<STR_LIT>' ) <EOL> VALUES = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> def parse ( conf , settings = { } ) : <EOL> for confkey , settingskey in VALUES . items ( ) : <EOL> try : <EOL> settings [ settingskey ] = conf . __getattribute__ ( confkey ) <EOL> except AttributeError : <EOL> pass <EOL> return settings <EOL> settings = parse ( default_settings ) <EOL> dont_write_bytecode = sys . dont_write_bytecode <EOL> try : <EOL> sys . dont_write_bytecode = True <EOL> user_settings = imp . load_source ( '<STR_LIT>' , SETTINGS_FILE ) <EOL> settings = parse ( user_settings , settings ) <EOL> except IOError as e : <EOL> if e . errno not in [ errno . ENOENT , errno . EACCES ] : <EOL> raise e <EOL> finally : <EOL> sys . dont_write_bytecode = dont_write_bytecode <EOL> try : <EOL> logging . config . fileConfig ( LOG_CONFIG_FILE ) <EOL> except : <EOL> logging . basicConfig ( level = logging . INFO ) <EOL> log = logging . getLogger ( __name__ ) <EOL> log . warning ( "<STR_LIT>" ) </s>
