neulab/docprompting-conala huggingface dataset:
class logging.FileHandler(filename, mode='a', encoding=None, delay=False, errors=None)  
Returns a new instance of the FileHandler class. The specified file is opened and used as the stream for logging. If mode is not specified, 'a' is used. If encoding is not None, it is used to open the file with that encoding. If delay is true, then file opening is deferred until the first call to emit(). By default, the file grows indefinitely. If errors is specified, it’s used to determine how encoding errors are handled.  Changed in version 3.6: As well as string values, Path objects are also accepted for the filename argument.   Changed in version 3.9: The errors parameter was added.   
close()  
Closes the file. 
  
emit(record)  
Outputs the record to the file.
class logging.Filter(name='')  
Returns an instance of the Filter class. If name is specified, it names a logger which, together with its children, will have its events allowed through the filter. If name is the empty string, allows every event.  
filter(record)  
Is the specified record to be logged? Returns zero for no, nonzero for yes. If deemed appropriate, the record may be modified in-place by this method.
filter(record)  
Is the specified record to be logged? Returns zero for no, nonzero for yes. If deemed appropriate, the record may be modified in-place by this method.
format(record)  
The record’s attribute dictionary is used as the operand to a string formatting operation. Returns the resulting string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using msg % args. If the formatting string contains '(asctime)', formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message. Note that the formatted exception information is cached in attribute exc_text. This is useful because the exception information can be pickled and sent across the wire, but you should be careful if you have more than one Formatter subclass which customizes the formatting of exception information. In this case, you will have to clear the cached value after a formatter has done its formatting, so that the next formatter to handle the event doesn’t use the cached value but recalculates it afresh. If stack information is available, it’s appended after the exception information, using formatStack() to transform it if necessary.
formatException(exc_info)  
Formats the specified exception information (a standard exception tuple as returned by sys.exc_info()) as a string. This default implementation just uses traceback.print_exception(). The resulting string is returned.
formatStack(stack_info)  
Formats the specified stack information (a string as returned by traceback.print_stack(), but with the last newline removed) as a string. This default implementation just returns the input value.
formatTime(record, datefmt=None)  
This method should be called from format() by a formatter which wants to make use of a formatted time. This method can be overridden in formatters to provide for any specific requirement, but the basic behavior is as follows: if datefmt (a string) is specified, it is used with time.strftime() to format the creation time of the record. Otherwise, the format ‘%Y-%m-%d %H:%M:%S,uuu’ is used, where the uuu part is a millisecond value and the other letters are as per the time.strftime() documentation. An example time in this format is 2003-01-23 00:29:50,411. The resulting string is returned. This function uses a user-configurable function to convert the creation time to a tuple. By default, time.localtime() is used; to change this for a particular formatter instance, set the converter attribute to a function with the same signature as time.localtime() or time.gmtime(). To change it for all formatters, for example if you want all logging times to be shown in GMT, set the converter attribute in the Formatter class.  Changed in version 3.3: Previously, the default format was hard-coded as in this example: 2010-09-06 22:38:15,292 where the part before the comma is handled by a strptime format string ('%Y-%m-%d %H:%M:%S'), and the part after the comma is a millisecond value. Because strptime does not have a format placeholder for milliseconds, the millisecond value is appended using another format string, '%s,%03d' — and both of these format strings have been hardcoded into this method. With the change, these strings are defined as class-level attributes which can be overridden at the instance level when desired. The names of the attributes are default_time_format (for the strptime format string) and default_msec_format (for appending the millisecond value).   Changed in version 3.9: The default_msec_format can be None.
logging.getLevelName(level)  
Returns the textual or numeric representation of logging level level. If level is one of the predefined levels CRITICAL, ERROR, WARNING, INFO or DEBUG then you get the corresponding string. If you have associated levels with names using addLevelName() then the name you have associated with level is returned. If a numeric value corresponding to one of the defined levels is passed in, the corresponding string representation is returned. The level parameter also accepts a string representation of the level such as ‘INFO’. In such cases, this functions returns the corresponding numeric value of the level. If no matching numeric or string value is passed in, the string ‘Level %s’ % level is returned.  Note Levels are internally integers (as they need to be compared in the logging logic). This function is used to convert between an integer level and the level name displayed in the formatted log output by means of the %(levelname)s format specifier (see LogRecord attributes), and vice versa.   Changed in version 3.4: In Python versions earlier than 3.4, this function could also be passed a text level, and would return the corresponding numeric value of the level. This undocumented behaviour was considered a mistake, and was removed in Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility.
logging.getLogger(name=None)  
Return a logger with the specified name or, if name is None, return a logger which is the root logger of the hierarchy. If specified, the name is typically a dot-separated hierarchical name like ‘a’, ‘a.b’ or ‘a.b.c.d’. Choice of these names is entirely up to the developer who is using logging. All calls to this function with a given name return the same logger instance. This means that logger instances never need to be passed between different parts of an application.
logging.getLoggerClass()  
Return either the standard Logger class, or the last class passed to setLoggerClass(). This function may be called from within a new class definition, to ensure that installing a customized Logger class will not undo customizations already applied by other code. For example: class MyLogger(logging.getLoggerClass()):
    # ... override behaviour here
logging.getLogRecordFactory()  
Return a callable which is used to create a LogRecord.  New in version 3.2: This function has been provided, along with setLogRecordFactory(), to allow developers more control over how the LogRecord representing a logging event is constructed.  See setLogRecordFactory() for more information about the how the factory is called.
class logging.Handler  
 
__init__(level=NOTSET)  
Initializes the Handler instance by setting its level, setting the list of filters to the empty list and creating a lock (using createLock()) for serializing access to an I/O mechanism. 
  
createLock()  
Initializes a thread lock which can be used to serialize access to underlying I/O functionality which may not be threadsafe. 
  
acquire()  
Acquires the thread lock created with createLock(). 
  
release()  
Releases the thread lock acquired with acquire(). 
  
setLevel(level)  
Sets the threshold for this handler to level. Logging messages which are less severe than level will be ignored. When a handler is created, the level is set to NOTSET (which causes all messages to be processed). See Logging Levels for a list of levels.  Changed in version 3.2: The level parameter now accepts a string representation of the level such as ‘INFO’ as an alternative to the integer constants such as INFO.  
  
setFormatter(fmt)  
Sets the Formatter for this handler to fmt. 
  
addFilter(filter)  
Adds the specified filter filter to this handler. 
  
removeFilter(filter)  
Removes the specified filter filter from this handler. 
  
filter(record)  
Apply this handler’s filters to the record and return True if the record is to be processed. The filters are consulted in turn, until one of them returns a false value. If none of them return a false value, the record will be emitted. If one returns a false value, the handler will not emit the record. 
  
flush()  
Ensure all logging output has been flushed. This version does nothing and is intended to be implemented by subclasses. 
  
close()  
Tidy up any resources used by the handler. This version does no output but removes the handler from an internal list of handlers which is closed when shutdown() is called. Subclasses should ensure that this gets called from overridden close() methods. 
  
handle(record)  
Conditionally emits the specified logging record, depending on filters which may have been added to the handler. Wraps the actual emission of the record with acquisition/release of the I/O thread lock. 
  
handleError(record)  
This method should be called from handlers when an exception is encountered during an emit() call. If the module-level attribute raiseExceptions is False, exceptions get silently ignored. This is what is mostly wanted for a logging system - most users will not care about errors in the logging system, they are more interested in application errors. You could, however, replace this with a custom handler if you wish. The specified record is the one which was being processed when the exception occurred. (The default value of raiseExceptions is True, as that is more useful during development). 
  
format(record)  
Do formatting for a record - if a formatter is set, use it. Otherwise, use the default formatter for the module. 
  
emit(record)  
Do whatever it takes to actually log the specified logging record. This version is intended to be implemented by subclasses and so raises a NotImplementedError.
close()  
Tidy up any resources used by the handler. This version does no output but removes the handler from an internal list of handlers which is closed when shutdown() is called. Subclasses should ensure that this gets called from overridden close() methods.
createLock()  
Initializes a thread lock which can be used to serialize access to underlying I/O functionality which may not be threadsafe.
emit(record)  
Do whatever it takes to actually log the specified logging record. This version is intended to be implemented by subclasses and so raises a NotImplementedError.
filter(record)  
Apply this handler’s filters to the record and return True if the record is to be processed. The filters are consulted in turn, until one of them returns a false value. If none of them return a false value, the record will be emitted. If one returns a false value, the handler will not emit the record.
flush()  
Ensure all logging output has been flushed. This version does nothing and is intended to be implemented by subclasses.
format(record)  
Do formatting for a record - if a formatter is set, use it. Otherwise, use the default formatter for the module.
handle(record)  
Conditionally emits the specified logging record, depending on filters which may have been added to the handler. Wraps the actual emission of the record with acquisition/release of the I/O thread lock.
handleError(record)  
This method should be called from handlers when an exception is encountered during an emit() call. If the module-level attribute raiseExceptions is False, exceptions get silently ignored. This is what is mostly wanted for a logging system - most users will not care about errors in the logging system, they are more interested in application errors. You could, however, replace this with a custom handler if you wish. The specified record is the one which was being processed when the exception occurred. (The default value of raiseExceptions is True, as that is more useful during development).
setLevel(level)  
Sets the threshold for this handler to level. Logging messages which are less severe than level will be ignored. When a handler is created, the level is set to NOTSET (which causes all messages to be processed). See Logging Levels for a list of levels.  Changed in version 3.2: The level parameter now accepts a string representation of the level such as ‘INFO’ as an alternative to the integer constants such as INFO.
__init__(level=NOTSET)  
Initializes the Handler instance by setting its level, setting the list of filters to the empty list and creating a lock (using createLock()) for serializing access to an I/O mechanism.
class logging.handlers.BaseRotatingHandler(filename, mode, encoding=None, delay=False, errors=None)  
The parameters are as for FileHandler. The attributes are:  
namer  
If this attribute is set to a callable, the rotation_filename() method delegates to this callable. The parameters passed to the callable are those passed to rotation_filename().  Note The namer function is called quite a few times during rollover, so it should be as simple and as fast as possible. It should also return the same output every time for a given input, otherwise the rollover behaviour may not work as expected.   New in version 3.3.  
  
rotator  
If this attribute is set to a callable, the rotate() method delegates to this callable. The parameters passed to the callable are those passed to rotate().  New in version 3.3.  
  
rotation_filename(default_name)  
Modify the filename of a log file when rotating. This is provided so that a custom filename can be provided. The default implementation calls the ‘namer’ attribute of the handler, if it’s callable, passing the default name to it. If the attribute isn’t callable (the default is None), the name is returned unchanged.  Parameters 
default_name – The default name for the log file.    New in version 3.3.  
  
rotate(source, dest)  
When rotating, rotate the current log. The default implementation calls the ‘rotator’ attribute of the handler, if it’s callable, passing the source and dest arguments to it. If the attribute isn’t callable (the default is None), the source is simply renamed to the destination.  Parameters 
 
source – The source filename. This is normally the base filename, e.g. ‘test.log’. 
dest – The destination filename. This is normally what the source is rotated to, e.g. ‘test.log.1’.     New in version 3.3.
namer  
If this attribute is set to a callable, the rotation_filename() method delegates to this callable. The parameters passed to the callable are those passed to rotation_filename().  Note The namer function is called quite a few times during rollover, so it should be as simple and as fast as possible. It should also return the same output every time for a given input, otherwise the rollover behaviour may not work as expected.   New in version 3.3.
rotate(source, dest)  
When rotating, rotate the current log. The default implementation calls the ‘rotator’ attribute of the handler, if it’s callable, passing the source and dest arguments to it. If the attribute isn’t callable (the default is None), the source is simply renamed to the destination.  Parameters 
 
source – The source filename. This is normally the base filename, e.g. ‘test.log’. 
dest – The destination filename. This is normally what the source is rotated to, e.g. ‘test.log.1’.     New in version 3.3.
rotation_filename(default_name)  
Modify the filename of a log file when rotating. This is provided so that a custom filename can be provided. The default implementation calls the ‘namer’ attribute of the handler, if it’s callable, passing the default name to it. If the attribute isn’t callable (the default is None), the name is returned unchanged.  Parameters 
default_name – The default name for the log file.    New in version 3.3.
rotator  
If this attribute is set to a callable, the rotate() method delegates to this callable. The parameters passed to the callable are those passed to rotate().  New in version 3.3.
class logging.handlers.BufferingHandler(capacity)  
Initializes the handler with a buffer of the specified capacity. Here, capacity means the number of logging records buffered.  
emit(record)  
Append the record to the buffer. If shouldFlush() returns true, call flush() to process the buffer. 
  
flush()  
You can override this to implement custom flushing behavior. This version just zaps the buffer to empty. 
  
shouldFlush(record)  
Return True if the buffer is up to capacity. This method can be overridden to implement custom flushing strategies.
emit(record)  
Append the record to the buffer. If shouldFlush() returns true, call flush() to process the buffer.
flush()  
You can override this to implement custom flushing behavior. This version just zaps the buffer to empty.
shouldFlush(record)  
Return True if the buffer is up to capacity. This method can be overridden to implement custom flushing strategies.
class logging.handlers.DatagramHandler(host, port)  
Returns a new instance of the DatagramHandler class intended to communicate with a remote machine whose address is given by host and port.  Changed in version 3.4: If port is specified as None, a Unix domain socket is created using the value in host - otherwise, a UDP socket is created.   
emit()  
Pickles the record’s attribute dictionary and writes it to the socket in binary format. If there is an error with the socket, silently drops the packet. To unpickle the record at the receiving end into a LogRecord, use the makeLogRecord() function. 
  
makeSocket()  
The factory method of SocketHandler is here overridden to create a UDP socket (socket.SOCK_DGRAM). 
  
send(s)  
Send a pickled byte-string to a socket. The format of the sent byte-string is as described in the documentation for SocketHandler.makePickle().
emit()  
Pickles the record’s attribute dictionary and writes it to the socket in binary format. If there is an error with the socket, silently drops the packet. To unpickle the record at the receiving end into a LogRecord, use the makeLogRecord() function.
makeSocket()  
The factory method of SocketHandler is here overridden to create a UDP socket (socket.SOCK_DGRAM).
send(s)  
Send a pickled byte-string to a socket. The format of the sent byte-string is as described in the documentation for SocketHandler.makePickle().
class logging.handlers.HTTPHandler(host, url, method='GET', secure=False, credentials=None, context=None)  
Returns a new instance of the HTTPHandler class. The host can be of the form host:port, should you need to use a specific port number. If no method is specified, GET is used. If secure is true, a HTTPS connection will be used. The context parameter may be set to a ssl.SSLContext instance to configure the SSL settings used for the HTTPS connection. If credentials is specified, it should be a 2-tuple consisting of userid and password, which will be placed in a HTTP ‘Authorization’ header using Basic authentication. If you specify credentials, you should also specify secure=True so that your userid and password are not passed in cleartext across the wire.  Changed in version 3.5: The context parameter was added.   
mapLogRecord(record)  
Provides a dictionary, based on record, which is to be URL-encoded and sent to the web server. The default implementation just returns record.__dict__. This method can be overridden if e.g. only a subset of LogRecord is to be sent to the web server, or if more specific customization of what’s sent to the server is required. 
  
emit(record)  
Sends the record to the Web server as a URL-encoded dictionary. The mapLogRecord() method is used to convert the record to the dictionary to be sent. 
  Note Since preparing a record for sending it to a Web server is not the same as a generic formatting operation, using setFormatter() to specify a Formatter for a HTTPHandler has no effect. Instead of calling format(), this handler calls mapLogRecord() and then urllib.parse.urlencode() to encode the dictionary in a form suitable for sending to a Web server.
emit(record)  
Sends the record to the Web server as a URL-encoded dictionary. The mapLogRecord() method is used to convert the record to the dictionary to be sent.
mapLogRecord(record)  
Provides a dictionary, based on record, which is to be URL-encoded and sent to the web server. The default implementation just returns record.__dict__. This method can be overridden if e.g. only a subset of LogRecord is to be sent to the web server, or if more specific customization of what’s sent to the server is required.
class logging.handlers.MemoryHandler(capacity, flushLevel=ERROR, target=None, flushOnClose=True)  
Returns a new instance of the MemoryHandler class. The instance is initialized with a buffer size of capacity (number of records buffered). If flushLevel is not specified, ERROR is used. If no target is specified, the target will need to be set using setTarget() before this handler does anything useful. If flushOnClose is specified as False, then the buffer is not flushed when the handler is closed. If not specified or specified as True, the previous behaviour of flushing the buffer will occur when the handler is closed.  Changed in version 3.6: The flushOnClose parameter was added.   
close()  
Calls flush(), sets the target to None and clears the buffer. 
  
flush()  
For a MemoryHandler, flushing means just sending the buffered records to the target, if there is one. The buffer is also cleared when this happens. Override if you want different behavior. 
  
setTarget(target)  
Sets the target handler for this handler. 
  
shouldFlush(record)  
Checks for buffer full or a record at the flushLevel or higher.
flush()  
For a MemoryHandler, flushing means just sending the buffered records to the target, if there is one. The buffer is also cleared when this happens. Override if you want different behavior.
shouldFlush(record)  
Checks for buffer full or a record at the flushLevel or higher.