neulab/docprompting-conala huggingface dataset:
class traceback.StackSummary  
 
classmethod extract(frame_gen, *, limit=None, lookup_lines=True, capture_locals=False)  
Construct a StackSummary object from a frame generator (such as is returned by walk_stack() or walk_tb()). If limit is supplied, only this many frames are taken from frame_gen. If lookup_lines is False, the returned FrameSummary objects will not have read their lines in yet, making the cost of creating the StackSummary cheaper (which may be valuable if it may not actually get formatted). If capture_locals is True the local variables in each FrameSummary are captured as object representations. 
  
classmethod from_list(a_list)  
Construct a StackSummary object from a supplied list of FrameSummary objects or old-style list of tuples. Each tuple should be a 4-tuple with filename, lineno, name, line as the elements. 
  
format()  
Returns a list of strings ready for printing. Each string in the resulting list corresponds to a single frame from the stack. Each string ends in a newline; the strings may contain internal newlines as well, for those items with source text lines. For long sequences of the same frame and line, the first few repetitions are shown, followed by a summary line stating the exact number of further repetitions.  Changed in version 3.6: Long sequences of repeated frames are now abbreviated.
classmethod extract(frame_gen, *, limit=None, lookup_lines=True, capture_locals=False)  
Construct a StackSummary object from a frame generator (such as is returned by walk_stack() or walk_tb()). If limit is supplied, only this many frames are taken from frame_gen. If lookup_lines is False, the returned FrameSummary objects will not have read their lines in yet, making the cost of creating the StackSummary cheaper (which may be valuable if it may not actually get formatted). If capture_locals is True the local variables in each FrameSummary are captured as object representations.
format()  
Returns a list of strings ready for printing. Each string in the resulting list corresponds to a single frame from the stack. Each string ends in a newline; the strings may contain internal newlines as well, for those items with source text lines. For long sequences of the same frame and line, the first few repetitions are shown, followed by a summary line stating the exact number of further repetitions.  Changed in version 3.6: Long sequences of repeated frames are now abbreviated.
classmethod from_list(a_list)  
Construct a StackSummary object from a supplied list of FrameSummary objects or old-style list of tuples. Each tuple should be a 4-tuple with filename, lineno, name, line as the elements.
class traceback.TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False)  
Capture an exception for later rendering. limit, lookup_lines and capture_locals are as for the StackSummary class. Note that when locals are captured, they are also shown in the traceback.  
__cause__  
A TracebackException of the original __cause__. 
  
__context__  
A TracebackException of the original __context__. 
  
__suppress_context__  
The __suppress_context__ value from the original exception. 
  
stack  
A StackSummary representing the traceback. 
  
exc_type  
The class of the original traceback. 
  
filename  
For syntax errors - the file name where the error occurred. 
  
lineno  
For syntax errors - the line number where the error occurred. 
  
text  
For syntax errors - the text where the error occurred. 
  
offset  
For syntax errors - the offset into the text where the error occurred. 
  
msg  
For syntax errors - the compiler error message. 
  
classmethod from_exception(exc, *, limit=None, lookup_lines=True, capture_locals=False)  
Capture an exception for later rendering. limit, lookup_lines and capture_locals are as for the StackSummary class. Note that when locals are captured, they are also shown in the traceback. 
  
format(*, chain=True)  
Format the exception. If chain is not True, __cause__ and __context__ will not be formatted. The return value is a generator of strings, each ending in a newline and some containing internal newlines. print_exception() is a wrapper around this method which just prints the lines to a file. The message indicating which exception occurred is always the last string in the output. 
  
format_exception_only()  
Format the exception part of the traceback. The return value is a generator of strings, each ending in a newline. Normally, the generator emits a single string; however, for SyntaxError exceptions, it emits several lines that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is always the last string in the output.
format(*, chain=True)  
Format the exception. If chain is not True, __cause__ and __context__ will not be formatted. The return value is a generator of strings, each ending in a newline and some containing internal newlines. print_exception() is a wrapper around this method which just prints the lines to a file. The message indicating which exception occurred is always the last string in the output.
format_exception_only()  
Format the exception part of the traceback. The return value is a generator of strings, each ending in a newline. Normally, the generator emits a single string; however, for SyntaxError exceptions, it emits several lines that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is always the last string in the output.
classmethod from_exception(exc, *, limit=None, lookup_lines=True, capture_locals=False)  
Capture an exception for later rendering. limit, lookup_lines and capture_locals are as for the StackSummary class. Note that when locals are captured, they are also shown in the traceback.
traceback.walk_stack(f)  
Walk a stack following f.f_back from the given frame, yielding the frame and line number for each frame. If f is None, the current stack is used. This helper is used with StackSummary.extract().  New in version 3.5.
traceback.walk_tb(tb)  
Walk a traceback following tb_next yielding the frame and line number for each frame. This helper is used with StackSummary.extract().  New in version 3.5.
tracemalloc.clear_traces()  
Clear traces of memory blocks allocated by Python. See also stop().
class tracemalloc.DomainFilter(inclusive: bool, domain: int)  
Filter traces of memory blocks by their address space (domain).  New in version 3.6.   
inclusive  
If inclusive is True (include), match memory blocks allocated in the address space domain. If inclusive is False (exclude), match memory blocks not allocated in the address space domain. 
  
domain  
Address space of a memory block (int). Read-only property.
inclusive  
If inclusive is True (include), match memory blocks allocated in the address space domain. If inclusive is False (exclude), match memory blocks not allocated in the address space domain.
class tracemalloc.Filter(inclusive: bool, filename_pattern: str, lineno: int=None, all_frames: bool=False, domain: int=None)  
Filter on traces of memory blocks. See the fnmatch.fnmatch() function for the syntax of filename_pattern. The '.pyc' file extension is replaced with '.py'. Examples:  
Filter(True, subprocess.__file__) only includes traces of the subprocess module 
Filter(False, tracemalloc.__file__) excludes traces of the tracemalloc module 
Filter(False, "<unknown>") excludes empty tracebacks   Changed in version 3.5: The '.pyo' file extension is no longer replaced with '.py'.   Changed in version 3.6: Added the domain attribute.   
domain  
Address space of a memory block (int or None). tracemalloc uses the domain 0 to trace memory allocations made by Python. C extensions can use other domains to trace other resources. 
  
inclusive  
If inclusive is True (include), only match memory blocks allocated in a file with a name matching filename_pattern at line number lineno. If inclusive is False (exclude), ignore memory blocks allocated in a file with a name matching filename_pattern at line number lineno. 
  
lineno  
Line number (int) of the filter. If lineno is None, the filter matches any line number. 
  
filename_pattern  
Filename pattern of the filter (str). Read-only property. 
  
all_frames  
If all_frames is True, all frames of the traceback are checked. If all_frames is False, only the most recent frame is checked. This attribute has no effect if the traceback limit is 1. See the get_traceback_limit() function and Snapshot.traceback_limit attribute.
all_frames  
If all_frames is True, all frames of the traceback are checked. If all_frames is False, only the most recent frame is checked. This attribute has no effect if the traceback limit is 1. See the get_traceback_limit() function and Snapshot.traceback_limit attribute.
domain  
Address space of a memory block (int or None). tracemalloc uses the domain 0 to trace memory allocations made by Python. C extensions can use other domains to trace other resources.
inclusive  
If inclusive is True (include), only match memory blocks allocated in a file with a name matching filename_pattern at line number lineno. If inclusive is False (exclude), ignore memory blocks allocated in a file with a name matching filename_pattern at line number lineno.
lineno  
Line number (int) of the filter. If lineno is None, the filter matches any line number.
class tracemalloc.Frame  
Frame of a traceback. The Traceback class is a sequence of Frame instances.  
filename  
Filename (str). 
  
lineno  
Line number (int).
tracemalloc.get_object_traceback(obj)  
Get the traceback where the Python object obj was allocated. Return a Traceback instance, or None if the tracemalloc module is not tracing memory allocations or did not trace the allocation of the object. See also gc.get_referrers() and sys.getsizeof() functions.
tracemalloc.get_traceback_limit()  
Get the maximum number of frames stored in the traceback of a trace. The tracemalloc module must be tracing memory allocations to get the limit, otherwise an exception is raised. The limit is set by the start() function.
tracemalloc.get_traced_memory()  
Get the current size and peak size of memory blocks traced by the tracemalloc module as a tuple: (current: int, peak: int).
tracemalloc.get_tracemalloc_memory()  
Get the memory usage in bytes of the tracemalloc module used to store traces of memory blocks. Return an int.
tracemalloc.is_tracing()  
True if the tracemalloc module is tracing Python memory allocations, False otherwise. See also start() and stop() functions.
tracemalloc.reset_peak()  
Set the peak size of memory blocks traced by the tracemalloc module to the current size. Do nothing if the tracemalloc module is not tracing memory allocations. This function only modifies the recorded peak size, and does not modify or clear any traces, unlike clear_traces(). Snapshots taken with take_snapshot() before a call to reset_peak() can be meaningfully compared to snapshots taken after the call. See also get_traced_memory().  New in version 3.9.
class tracemalloc.Snapshot  
Snapshot of traces of memory blocks allocated by Python. The take_snapshot() function creates a snapshot instance.  
compare_to(old_snapshot: Snapshot, key_type: str, cumulative: bool=False)  
Compute the differences with an old snapshot. Get statistics as a sorted list of StatisticDiff instances grouped by key_type. See the Snapshot.statistics() method for key_type and cumulative parameters. The result is sorted from the biggest to the smallest by: absolute value of StatisticDiff.size_diff, StatisticDiff.size, absolute value of StatisticDiff.count_diff, Statistic.count and then by StatisticDiff.traceback. 
  
dump(filename)  
Write the snapshot into a file. Use load() to reload the snapshot. 
  
filter_traces(filters)  
Create a new Snapshot instance with a filtered traces sequence, filters is a list of DomainFilter and Filter instances. If filters is an empty list, return a new Snapshot instance with a copy of the traces. All inclusive filters are applied at once, a trace is ignored if no inclusive filters match it. A trace is ignored if at least one exclusive filter matches it.  Changed in version 3.6: DomainFilter instances are now also accepted in filters.  
  
classmethod load(filename)  
Load a snapshot from a file. See also dump(). 
  
statistics(key_type: str, cumulative: bool=False)  
Get statistics as a sorted list of Statistic instances grouped by key_type:   
key_type description   
'filename' filename  
'lineno' filename and line number  
'traceback' traceback   If cumulative is True, cumulate size and count of memory blocks of all frames of the traceback of a trace, not only the most recent frame. The cumulative mode can only be used with key_type equals to 'filename' and 'lineno'. The result is sorted from the biggest to the smallest by: Statistic.size, Statistic.count and then by Statistic.traceback. 
  
traceback_limit  
Maximum number of frames stored in the traceback of traces: result of the get_traceback_limit() when the snapshot was taken. 
  
traces  
Traces of all memory blocks allocated by Python: sequence of Trace instances. The sequence has an undefined order. Use the Snapshot.statistics() method to get a sorted list of statistics.
compare_to(old_snapshot: Snapshot, key_type: str, cumulative: bool=False)  
Compute the differences with an old snapshot. Get statistics as a sorted list of StatisticDiff instances grouped by key_type. See the Snapshot.statistics() method for key_type and cumulative parameters. The result is sorted from the biggest to the smallest by: absolute value of StatisticDiff.size_diff, StatisticDiff.size, absolute value of StatisticDiff.count_diff, Statistic.count and then by StatisticDiff.traceback.
dump(filename)  
Write the snapshot into a file. Use load() to reload the snapshot.
filter_traces(filters)  
Create a new Snapshot instance with a filtered traces sequence, filters is a list of DomainFilter and Filter instances. If filters is an empty list, return a new Snapshot instance with a copy of the traces. All inclusive filters are applied at once, a trace is ignored if no inclusive filters match it. A trace is ignored if at least one exclusive filter matches it.  Changed in version 3.6: DomainFilter instances are now also accepted in filters.
statistics(key_type: str, cumulative: bool=False)  
Get statistics as a sorted list of Statistic instances grouped by key_type:   
key_type description   
'filename' filename  
'lineno' filename and line number  
'traceback' traceback   If cumulative is True, cumulate size and count of memory blocks of all frames of the traceback of a trace, not only the most recent frame. The cumulative mode can only be used with key_type equals to 'filename' and 'lineno'. The result is sorted from the biggest to the smallest by: Statistic.size, Statistic.count and then by Statistic.traceback.
traceback_limit  
Maximum number of frames stored in the traceback of traces: result of the get_traceback_limit() when the snapshot was taken.
traces  
Traces of all memory blocks allocated by Python: sequence of Trace instances. The sequence has an undefined order. Use the Snapshot.statistics() method to get a sorted list of statistics.
tracemalloc.start(nframe: int=1)  
Start tracing Python memory allocations: install hooks on Python memory allocators. Collected tracebacks of traces will be limited to nframe frames. By default, a trace of a memory block only stores the most recent frame: the limit is 1. nframe must be greater or equal to 1. You can still read the original number of total frames that composed the traceback by looking at the Traceback.total_nframe attribute. Storing more than 1 frame is only useful to compute statistics grouped by 'traceback' or to compute cumulative statistics: see the Snapshot.compare_to() and Snapshot.statistics() methods. Storing more frames increases the memory and CPU overhead of the tracemalloc module. Use the get_tracemalloc_memory() function to measure how much memory is used by the tracemalloc module. The PYTHONTRACEMALLOC environment variable (PYTHONTRACEMALLOC=NFRAME) and the -X tracemalloc=NFRAME command line option can be used to start tracing at startup. See also stop(), is_tracing() and get_traceback_limit() functions.
class tracemalloc.Statistic  
Statistic on memory allocations. Snapshot.statistics() returns a list of Statistic instances. See also the StatisticDiff class.  
count  
Number of memory blocks (int). 
  
size  
Total size of memory blocks in bytes (int). 
  
traceback  
Traceback where the memory block was allocated, Traceback instance.
class tracemalloc.StatisticDiff  
Statistic difference on memory allocations between an old and a new Snapshot instance. Snapshot.compare_to() returns a list of StatisticDiff instances. See also the Statistic class.  
count  
Number of memory blocks in the new snapshot (int): 0 if the memory blocks have been released in the new snapshot. 
  
count_diff  
Difference of number of memory blocks between the old and the new snapshots (int): 0 if the memory blocks have been allocated in the new snapshot. 
  
size  
Total size of memory blocks in bytes in the new snapshot (int): 0 if the memory blocks have been released in the new snapshot. 
  
size_diff  
Difference of total size of memory blocks in bytes between the old and the new snapshots (int): 0 if the memory blocks have been allocated in the new snapshot. 
  
traceback  
Traceback where the memory blocks were allocated, Traceback instance.
count  
Number of memory blocks in the new snapshot (int): 0 if the memory blocks have been released in the new snapshot.
count_diff  
Difference of number of memory blocks between the old and the new snapshots (int): 0 if the memory blocks have been allocated in the new snapshot.
size  
Total size of memory blocks in bytes in the new snapshot (int): 0 if the memory blocks have been released in the new snapshot.
size_diff  
Difference of total size of memory blocks in bytes between the old and the new snapshots (int): 0 if the memory blocks have been allocated in the new snapshot.
tracemalloc.stop()  
Stop tracing Python memory allocations: uninstall hooks on Python memory allocators. Also clears all previously collected traces of memory blocks allocated by Python. Call take_snapshot() function to take a snapshot of traces before clearing them. See also start(), is_tracing() and clear_traces() functions.
tracemalloc.take_snapshot()  
Take a snapshot of traces of memory blocks allocated by Python. Return a new Snapshot instance. The snapshot does not include memory blocks allocated before the tracemalloc module started to trace memory allocations. Tracebacks of traces are limited to get_traceback_limit() frames. Use the nframe parameter of the start() function to store more frames. The tracemalloc module must be tracing memory allocations to take a snapshot, see the start() function. See also the get_object_traceback() function.
class tracemalloc.Trace  
Trace of a memory block. The Snapshot.traces attribute is a sequence of Trace instances.  Changed in version 3.6: Added the domain attribute.   
domain  
Address space of a memory block (int). Read-only property. tracemalloc uses the domain 0 to trace memory allocations made by Python. C extensions can use other domains to trace other resources. 
  
size  
Size of the memory block in bytes (int). 
  
traceback  
Traceback where the memory block was allocated, Traceback instance.
domain  
Address space of a memory block (int). Read-only property. tracemalloc uses the domain 0 to trace memory allocations made by Python. C extensions can use other domains to trace other resources.
class tracemalloc.Traceback  
Sequence of Frame instances sorted from the oldest frame to the most recent frame. A traceback contains at least 1 frame. If the tracemalloc module failed to get a frame, the filename "<unknown>" at line number 0 is used. When a snapshot is taken, tracebacks of traces are limited to get_traceback_limit() frames. See the take_snapshot() function. The original number of frames of the traceback is stored in the Traceback.total_nframe attribute. That allows to know if a traceback has been truncated by the traceback limit. The Trace.traceback attribute is an instance of Traceback instance.  Changed in version 3.7: Frames are now sorted from the oldest to the most recent, instead of most recent to oldest.   
total_nframe  
Total number of frames that composed the traceback before truncation. This attribute can be set to None if the information is not available. 
  Changed in version 3.9: The Traceback.total_nframe attribute was added.   
format(limit=None, most_recent_first=False)  
Format the traceback as a list of lines with newlines. Use the linecache module to retrieve lines from the source code. If limit is set, format the limit most recent frames if limit is positive. Otherwise, format the abs(limit) oldest frames. If most_recent_first is True, the order of the formatted frames is reversed, returning the most recent frame first instead of last. Similar to the traceback.format_tb() function, except that format() does not include newlines. Example: print("Traceback (most recent call first):")
for line in traceback:
    print(line)
 Output: Traceback (most recent call first):
  File "test.py", line 9
    obj = Object()
  File "test.py", line 12
    tb = tracemalloc.get_object_traceback(f())
format(limit=None, most_recent_first=False)  
Format the traceback as a list of lines with newlines. Use the linecache module to retrieve lines from the source code. If limit is set, format the limit most recent frames if limit is positive. Otherwise, format the abs(limit) oldest frames. If most_recent_first is True, the order of the formatted frames is reversed, returning the most recent frame first instead of last. Similar to the traceback.format_tb() function, except that format() does not include newlines. Example: print("Traceback (most recent call first):")
for line in traceback:
    print(line)
 Output: Traceback (most recent call first):
  File "test.py", line 9
    obj = Object()
  File "test.py", line 12
    tb = tracemalloc.get_object_traceback(f())
total_nframe  
Total number of frames that composed the traceback before truncation. This attribute can be set to None if the information is not available.
True  
The true value of the bool type. Assignments to True are illegal and raise a SyntaxError.
tty — Terminal control functions Source code: Lib/tty.py The tty module defines functions for putting the tty into cbreak and raw modes. Because it requires the termios module, it will work only on Unix. The tty module defines the following functions:  
tty.setraw(fd, when=termios.TCSAFLUSH)  
Change the mode of the file descriptor fd to raw. If when is omitted, it defaults to termios.TCSAFLUSH, and is passed to termios.tcsetattr(). 
  
tty.setcbreak(fd, when=termios.TCSAFLUSH)  
Change the mode of file descriptor fd to cbreak. If when is omitted, it defaults to termios.TCSAFLUSH, and is passed to termios.tcsetattr(). 
  See also  
Module termios


Low-level terminal control interface.
tty.setcbreak(fd, when=termios.TCSAFLUSH)  
Change the mode of file descriptor fd to cbreak. If when is omitted, it defaults to termios.TCSAFLUSH, and is passed to termios.tcsetattr().
tty.setraw(fd, when=termios.TCSAFLUSH)  
Change the mode of the file descriptor fd to raw. If when is omitted, it defaults to termios.TCSAFLUSH, and is passed to termios.tcsetattr().