parameters: (function)
return_statement: return wrapper
docstring: Decorator for command entry methods.
  
      The decorator initialize/shutdown logging and guard on programming
      errors (catch exceptions).
  
      The decorated method can have arbitrary parameters, the return value will
      be the exit code of the process.
docstring_summary: Decorator for command entry methods.
docstring_tokens: Decorator for command entry methods .
function: def command_entry_point(function):
      """ Decorator for command entry methods.
  
      The decorator initialize/shutdown logging and guard on programming
      errors (catch exceptions).
  
      The decorated method can have arbitrary parameters, the return value will
      be the exit code of the process. """
  
      @functools.wraps(function)
      def wrapper(*args, **kwargs):
          """ Do housekeeping tasks and execute the wrapped method. """
  
          try:
              logging.basicConfig(format='%(name)s: %(message)s',
                                  level=logging.WARNING,
                                  stream=sys.stdout)
              # This hack to get the executable name as %(name).
              logging.getLogger().name = os.path.basename(sys.argv[0])
              return function(*args, **kwargs)
          except KeyboardInterrupt:
              logging.warning('Keyboard interrupt')
              return 130  # Signal received exit code for bash.
          except Exception:
              logging.exception('Internal error.')
              if logging.getLogger().isEnabledFor(logging.DEBUG):
                  logging.error("Please report this bug and attach the output "
                                "to the bug report")
              else:
                  logging.error("Please run this command again and turn on "
                                "verbose mode (add '-vvvv' as argument).")
              return 64  # Some non used exit code for internal errors.
          finally:
              logging.shutdown()
  
      return wrapper
function_tokens: def command_entry_point ( function ) : @ functools . wraps ( function ) def wrapper ( * args , * * kwargs ) : """ Do housekeeping tasks and execute the wrapped method. """ try : logging . basicConfig ( format = '%(name)s: %(message)s' , level = logging . WARNING , stream = sys . stdout ) # This hack to get the executable name as %(name). logging . getLogger ( ) . name = os . path . basename ( sys . argv [ 0 ] ) return function ( * args , * * kwargs ) except KeyboardInterrupt : logging . warning ( 'Keyboard interrupt' ) return 130 # Signal received exit code for bash. except Exception : logging . exception ( 'Internal error.' ) if logging . getLogger ( ) . isEnabledFor ( logging . DEBUG ) : logging . error ( "Please report this bug and attach the output " "to the bug report" ) else : logging . error ( "Please run this command again and turn on " "verbose mode (add '-vvvv' as argument)." ) return 64 # Some non used exit code for internal errors. finally : logging . shutdown ( ) return wrapper