Project inform11/20/2023 ![]() The exception provides the report and terminate methods that processes theĮxception as an error or fatal error if you find that you can do nothing else This allows you to catch the exception and handle it if you like. ExceptionĪn exception, Error, is provided that takes the same arguments as an InformantFactory when creating the informants. This case Inform simply saves the value and makes it available as an attribute,Īnd it is this attribute that is queried by the lambda function passed to the The argument verbosity is not an explicitly supported argument to Inform. verbose2 ( 'Second level of verbosity.' ) First level of verbosity. ![]() verbose1 ( 'First level of verbosity.' ). verbose2 ( 'Second level of verbosity.' ) > with Inform ( verbosity = 1 ). verbosity >= 2 ) > with Inform ( verbosity = 0 ). verbosity >= 1 ) > verbose2 = InformantFactory ( output = lambda m : m. You can create your own informants: > from inform import Inform, InformantFactory > verbose1 = InformantFactory ( output = lambda m : m. > from inform import Inform, error > informer = Inform ( prog_name = "prog" ) > error ( 'file not found.', culprit = 'data.in' ) prog error : data. Program, or return a count of the number of errors that have occurred. Instantiated, you can use the informer to change various settings, terminate the With the print functions, which are referred to as informants). Īn object of the Inform class is referred to as an informer (not to be confused Specify options: > from inform import Inform, display, error > Inform ( logfile = False, prog_name = False ) > display ( 'hello' ) hello > error ( 'file not found.', culprit = 'data.in' ) error : data. With the simplest use of the program, you simply import the informants you needĪnd call them (they take the same arguments as Python’s built-in printįunction): > from inform import display > display ( 'ice', 9 ) ice 9įor more control of the informants, you can import and instantiate the InformĬlass yourself along with the desired informants. Narrate, display, output, notify, debug, warn, error, fatal and They include include log, comment, codicil, These functions are referred to as informants and are described below This package defines a collection of print functions that have different Supported in Python2.7, Python3.5, Python3.6, Python3.7 and Python3.8. You can find the latest development version of the source code on Stable version of the code from PyPI using: pip3 install -user -upgrade inform You can find the documentation on ReadTheDocs. Inform exceptions are unique in that they keepĪll of the named and unnamed arguments so they can be used when reporting ![]() In addition, Inform provides a powerful generic exception that can be usedĭirectly as a general purpose exception, or can be subclassed to produce Inform also provides logging and output control. > error ( 'errors get a header that is printed in red.' ) error : errors get a header that is printed in red. > warn ( 'warnings get a header that is printed in yellow.' ) warning : warnings get a header that is printed in yellow. sep = ', ' ) Display is like print, except that it supports logging and can be disabled. 'except that it supports logging and can be disabled.'. For example: > from inform import display, warn, error > display (. ![]() Informative, and consistent error messages. It allows you to easily print attractive, A package that provides specialized print functions that are used whenĬommunicating with the user.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |