neulab/docprompting-conala huggingface dataset:
class pprint.PrettyPrinter(indent=1, width=80, depth=None, stream=None, *, compact=False, sort_dicts=True)  
Construct a PrettyPrinter instance. This constructor understands several keyword parameters. An output stream may be set using the stream keyword; the only method used on the stream object is the file protocol’s write() method. If not specified, the PrettyPrinter adopts sys.stdout. The amount of indentation added for each recursive level is specified by indent; the default is one. Other values can cause output to look a little odd, but can make nesting easier to spot. The number of levels which may be printed is controlled by depth; if the data structure being printed is too deep, the next contained level is replaced by .... By default, there is no constraint on the depth of the objects being formatted. The desired output width is constrained using the width parameter; the default is 80 characters. If a structure cannot be formatted within the constrained width, a best effort will be made. If compact is false (the default) each item of a long sequence will be formatted on a separate line. If compact is true, as many items as will fit within the width will be formatted on each output line. If sort_dicts is true (the default), dictionaries will be formatted with their keys sorted, otherwise they will display in insertion order.  Changed in version 3.4: Added the compact parameter.   Changed in version 3.8: Added the sort_dicts parameter. >>> import pprint
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
>>> stuff.insert(0, stuff[:])
>>> pp = pprint.PrettyPrinter(indent=4)
>>> pp.pprint(stuff)
[   ['spam', 'eggs', 'lumberjack', 'knights', 'ni'],
    'spam',
    'eggs',
    'lumberjack',
    'knights',
    'ni']
>>> pp = pprint.PrettyPrinter(width=41, compact=True)
>>> pp.pprint(stuff)
[['spam', 'eggs', 'lumberjack',
  'knights', 'ni'],
 'spam', 'eggs', 'lumberjack', 'knights',
 'ni']
>>> tup = ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead',
... ('parrot', ('fresh fruit',))))))))
>>> pp = pprint.PrettyPrinter(depth=6)
>>> pp.pprint(tup)
('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead', (...)))))))
PrettyPrinter.format(object, context, maxlevels, level)  
Returns three values: the formatted version of object as a string, a flag indicating whether the result is readable, and a flag indicating whether recursion was detected. The first argument is the object to be presented. The second is a dictionary which contains the id() of objects that are part of the current presentation context (direct and indirect containers for object that are affecting the presentation) as the keys; if an object needs to be presented which is already represented in context, the third return value should be True. Recursive calls to the format() method should add additional entries for containers to this dictionary. The third argument, maxlevels, gives the requested limit to recursion; this will be 0 if there is no requested limit. This argument should be passed unmodified to recursive calls. The fourth argument, level, gives the current level; recursive calls should be passed a value less than that of the current call.
PrettyPrinter.isreadable(object)  
Determine if the formatted representation of the object is “readable,” or can be used to reconstruct the value using eval(). Note that this returns False for recursive objects. If the depth parameter of the PrettyPrinter is set and the object is deeper than allowed, this returns False.
PrettyPrinter.isrecursive(object)  
Determine if the object requires a recursive representation.
PrettyPrinter.pformat(object)  
Return the formatted representation of object. This takes into account the options passed to the PrettyPrinter constructor.
PrettyPrinter.pprint(object)  
Print the formatted representation of object on the configured stream, followed by a newline.
pprint.saferepr(object)  
Return a string representation of object, protected against recursive data structures. If the representation of object exposes a recursive entry, the recursive reference will be represented as <Recursion on typename with
id=number>. The representation is not otherwise formatted. >>> pprint.saferepr(stuff)
"[<Recursion on list with id=...>, 'spam', 'eggs', 'lumberjack', 'knights', 'ni']"
print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)  
Print objects to the text stream file, separated by sep and followed by end. sep, end, file and flush, if present, must be given as keyword arguments. All non-keyword arguments are converted to strings like str() does and written to the stream, separated by sep and followed by end. Both sep and end must be strings; they can also be None, which means to use the default values. If no objects are given, print() will just write end. The file argument must be an object with a write(string) method; if it is not present or None, sys.stdout will be used. Since printed arguments are converted to text strings, print() cannot be used with binary mode file objects. For these, use file.write(...) instead. Whether output is buffered is usually determined by file, but if the flush keyword argument is true, the stream is forcibly flushed.  Changed in version 3.3: Added the flush keyword argument.
exception ProcessLookupError  
Raised when a given process doesn’t exist. Corresponds to errno ESRCH.
class profile.Profile(timer=None, timeunit=0.0, subcalls=True, builtins=True)  
This class is normally only used if more precise control over profiling is needed than what the cProfile.run() function provides. A custom timer can be supplied for measuring how long code takes to run via the timer argument. This must be a function that returns a single number representing the current time. If the number is an integer, the timeunit specifies a multiplier that specifies the duration of each unit of time. For example, if the timer returns times measured in thousands of seconds, the time unit would be .001. Directly using the Profile class allows formatting profile results without writing the profile data to a file: import cProfile, pstats, io
from pstats import SortKey
pr = cProfile.Profile()
pr.enable()
# ... do something ...
pr.disable()
s = io.StringIO()
sortby = SortKey.CUMULATIVE
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print(s.getvalue())
 The Profile class can also be used as a context manager (supported only in cProfile module. see Context Manager Types): import cProfile

with cProfile.Profile() as pr:
    # ... do something ...

pr.print_stats()
  Changed in version 3.8: Added context manager support.   
enable()  
Start collecting profiling data. Only in cProfile. 
  
disable()  
Stop collecting profiling data. Only in cProfile. 
  
create_stats()  
Stop collecting profiling data and record the results internally as the current profile. 
  
print_stats(sort=-1)  
Create a Stats object based on the current profile and print the results to stdout. 
  
dump_stats(filename)  
Write the results of the current profile to filename. 
  
run(cmd)  
Profile the cmd via exec(). 
  
runctx(cmd, globals, locals)  
Profile the cmd via exec() with the specified global and local environment. 
  
runcall(func, /, *args, **kwargs)  
Profile func(*args, **kwargs)
create_stats()  
Stop collecting profiling data and record the results internally as the current profile.
print_stats(sort=-1)  
Create a Stats object based on the current profile and print the results to stdout.
runcall(func, /, *args, **kwargs)  
Profile func(*args, **kwargs)
runctx(cmd, globals, locals)  
Profile the cmd via exec() with the specified global and local environment.
profile.run(command, filename=None, sort=-1)  
This function takes a single argument that can be passed to the exec() function, and an optional file name. In all cases this routine executes: exec(command, __main__.__dict__, __main__.__dict__)
 and gathers profiling statistics from the execution. If no file name is present, then this function automatically creates a Stats instance and prints a simple profiling report. If the sort value is specified, it is passed to this Stats instance to control how the results are sorted.
profile.runctx(command, globals, locals, filename=None, sort=-1)  
This function is similar to run(), with added arguments to supply the globals and locals dictionaries for the command string. This routine executes: exec(command, globals, locals)
 and gathers profiling statistics as in the run() function above.
class property(fget=None, fset=None, fdel=None, doc=None)  
Return a property attribute. fget is a function for getting an attribute value. fset is a function for setting an attribute value. fdel is a function for deleting an attribute value. And doc creates a docstring for the attribute. A typical use is to define a managed attribute x: class C:
    def __init__(self):
        self._x = None

    def getx(self):
        return self._x

    def setx(self, value):
        self._x = value

    def delx(self):
        del self._x

    x = property(getx, setx, delx, "I'm the 'x' property.")
 If c is an instance of C, c.x will invoke the getter, c.x = value will invoke the setter and del c.x the deleter. If given, doc will be the docstring of the property attribute. Otherwise, the property will copy fget’s docstring (if it exists). This makes it possible to create read-only properties easily using property() as a decorator: class Parrot:
    def __init__(self):
        self._voltage = 100000

    @property
    def voltage(self):
        """Get the current voltage."""
        return self._voltage
 The @property decorator turns the voltage() method into a “getter” for a read-only attribute with the same name, and it sets the docstring for voltage to “Get the current voltage.” A property object has getter, setter, and deleter methods usable as decorators that create a copy of the property with the corresponding accessor function set to the decorated function. This is best explained with an example: class C:
    def __init__(self):
        self._x = None

    @property
    def x(self):
        """I'm the 'x' property."""
        return self._x

    @x.setter
    def x(self, value):
        self._x = value

    @x.deleter
    def x(self):
        del self._x
 This code is exactly equivalent to the first example. Be sure to give the additional functions the same name as the original property (x in this case.) The returned property object also has the attributes fget, fset, and fdel corresponding to the constructor arguments.  Changed in version 3.5: The docstrings of property objects are now writeable.
add(*filenames)  
This method of the Stats class accumulates additional profiling information into the current profiling object. Its arguments should refer to filenames created by the corresponding version of profile.run() or cProfile.run(). Statistics for identically named (re: file, line, name) functions are automatically accumulated into single function statistics.
dump_stats(filename)  
Save the data loaded into the Stats object to a file named filename. The file is created if it does not exist, and is overwritten if it already exists. This is equivalent to the method of the same name on the profile.Profile and cProfile.Profile classes.
get_stats_profile()  
This method returns an instance of StatsProfile, which contains a mapping of function names to instances of FunctionProfile. Each FunctionProfile instance holds information related to the function’s profile such as how long the function took to run, how many times it was called, etc…  New in version 3.9: Added the following dataclasses: StatsProfile, FunctionProfile. Added the following function: get_stats_profile.
print_callees(*restrictions)  
This method for the Stats class prints a list of all function that were called by the indicated function. Aside from this reversal of direction of calls (re: called vs was called by), the arguments and ordering are identical to the print_callers() method.
print_callers(*restrictions)  
This method for the Stats class prints a list of all functions that called each function in the profiled database. The ordering is identical to that provided by print_stats(), and the definition of the restricting argument is also identical. Each caller is reported on its own line. The format differs slightly depending on the profiler that produced the stats:  With profile, a number is shown in parentheses after each caller to show how many times this specific call was made. For convenience, a second non-parenthesized number repeats the cumulative time spent in the function at the right. With cProfile, each caller is preceded by three numbers: the number of times this specific call was made, and the total and cumulative times spent in the current function while it was invoked by this specific caller.
print_stats(*restrictions)  
This method for the Stats class prints out a report as described in the profile.run() definition. The order of the printing is based on the last sort_stats() operation done on the object (subject to caveats in add() and strip_dirs()). The arguments provided (if any) can be used to limit the list down to the significant entries. Initially, the list is taken to be the complete set of profiled functions. Each restriction is either an integer (to select a count of lines), or a decimal fraction between 0.0 and 1.0 inclusive (to select a percentage of lines), or a string that will interpreted as a regular expression (to pattern match the standard name that is printed). If several restrictions are provided, then they are applied sequentially. For example: print_stats(.1, 'foo:')
 would first limit the printing to first 10% of list, and then only print functions that were part of filename .*foo:. In contrast, the command: print_stats('foo:', .1)
 would limit the list to all functions having file names .*foo:, and then proceed to only print the first 10% of them.
reverse_order()  
This method for the Stats class reverses the ordering of the basic list within the object. Note that by default ascending vs descending order is properly selected based on the sort key of choice.
sort_stats(*keys)  
This method modifies the Stats object by sorting it according to the supplied criteria. The argument can be either a string or a SortKey enum identifying the basis of a sort (example: 'time', 'name', SortKey.TIME or SortKey.NAME). The SortKey enums argument have advantage over the string argument in that it is more robust and less error prone. When more than one key is provided, then additional keys are used as secondary criteria when there is equality in all keys selected before them. For example, sort_stats(SortKey.NAME, SortKey.FILE) will sort all the entries according to their function name, and resolve all ties (identical function names) by sorting by file name. For the string argument, abbreviations can be used for any key names, as long as the abbreviation is unambiguous. The following are the valid string and SortKey:   
Valid String Arg Valid enum Arg Meaning   
'calls' SortKey.CALLS call count  
'cumulative' SortKey.CUMULATIVE cumulative time  
'cumtime' N/A cumulative time  
'file' N/A file name  
'filename' SortKey.FILENAME file name  
'module' N/A file name  
'ncalls' N/A call count  
'pcalls' SortKey.PCALLS primitive call count  
'line' SortKey.LINE line number  
'name' SortKey.NAME function name  
'nfl' SortKey.NFL name/file/line  
'stdname' SortKey.STDNAME standard name  
'time' SortKey.TIME internal time  
'tottime' N/A internal time   Note that all sorts on statistics are in descending order (placing most time consuming items first), where as name, file, and line number searches are in ascending order (alphabetical). The subtle distinction between SortKey.NFL and SortKey.STDNAME is that the standard name is a sort of the name as printed, which means that the embedded line numbers get compared in an odd way. For example, lines 3, 20, and 40 would (if the file names were the same) appear in the string order 20, 3 and 40. In contrast, SortKey.NFL does a numeric compare of the line numbers. In fact, sort_stats(SortKey.NFL) is the same as sort_stats(SortKey.NAME, SortKey.FILENAME, SortKey.LINE). For backward-compatibility reasons, the numeric arguments -1, 0, 1, and 2 are permitted. They are interpreted as 'stdname', 'calls', 'time', and 'cumulative' respectively. If this old style format (numeric) is used, only one sort key (the numeric key) will be used, and additional arguments will be silently ignored.  New in version 3.7: Added the SortKey enum.
strip_dirs()  
This method for the Stats class removes all leading path information from file names. It is very useful in reducing the size of the printout to fit within (close to) 80 columns. This method modifies the object, and the stripped information is lost. After performing a strip operation, the object is considered to have its entries in a “random” order, as it was just after object initialization and loading. If strip_dirs() causes two function names to be indistinguishable (they are on the same line of the same filename, and have the same function name), then the statistics for these two entries are accumulated into a single entry.
pty.fork()  
Fork. Connect the child’s controlling terminal to a pseudo-terminal. Return value is (pid, fd). Note that the child gets pid 0, and the fd is invalid. The parent’s return value is the pid of the child, and fd is a file descriptor connected to the child’s controlling terminal (and also to the child’s standard input and output).
pty.openpty()  
Open a new pseudo-terminal pair, using os.openpty() if possible, or emulation code for generic Unix systems. Return a pair of file descriptors (master, slave), for the master and the slave end, respectively.
pty.spawn(argv[, master_read[, stdin_read]])  
Spawn a process, and connect its controlling terminal with the current process’s standard io. This is often used to baffle programs which insist on reading from the controlling terminal. It is expected that the process spawned behind the pty will eventually terminate, and when it does spawn will return. The functions master_read and stdin_read are passed a file descriptor which they should read from, and they should always return a byte string. In order to force spawn to return before the child process exits an OSError should be thrown. The default implementation for both functions will read and return up to 1024 bytes each time the function is called. The master_read callback is passed the pseudoterminal’s master file descriptor to read output from the child process, and stdin_read is passed file descriptor 0, to read from the parent process’s standard input. Returning an empty byte string from either callback is interpreted as an end-of-file (EOF) condition, and that callback will not be called after that. If stdin_read signals EOF the controlling terminal can no longer communicate with the parent process OR the child process. Unless the child process will quit without any input, spawn will then loop forever. If master_read signals EOF the same behavior results (on linux at least). If both callbacks signal EOF then spawn will probably never return, unless select throws an error on your platform when passed three empty lists. This is a bug, documented in issue 26228. Return the exit status value from os.waitpid() on the child process. waitstatus_to_exitcode() can be used to convert the exit status into an exit code. Raises an auditing event pty.spawn with argument argv.  Changed in version 3.4: spawn() now returns the status value from os.waitpid() on the child process.
pwd — The password database This module provides access to the Unix user account and password database. It is available on all Unix versions. Password database entries are reported as a tuple-like object, whose attributes correspond to the members of the passwd structure (Attribute field below, see <pwd.h>):   
Index Attribute Meaning   
0 pw_name Login name  
1 pw_passwd Optional encrypted password  
2 pw_uid Numerical user ID  
3 pw_gid Numerical group ID  
4 pw_gecos User name or comment field  
5 pw_dir User home directory  
6 pw_shell User command interpreter   The uid and gid items are integers, all others are strings. KeyError is raised if the entry asked for cannot be found.  Note In traditional Unix the field pw_passwd usually contains a password encrypted with a DES derived algorithm (see module crypt). However most modern unices use a so-called shadow password system. On those unices the pw_passwd field only contains an asterisk ('*') or the letter 'x' where the encrypted password is stored in a file /etc/shadow which is not world readable. Whether the pw_passwd field contains anything useful is system-dependent. If available, the spwd module should be used where access to the encrypted password is required.  It defines the following items:  
pwd.getpwuid(uid)  
Return the password database entry for the given numeric user ID. 
  
pwd.getpwnam(name)  
Return the password database entry for the given user name. 
  
pwd.getpwall()  
Return a list of all available password database entries, in arbitrary order. 
  See also  
Module grp


An interface to the group database, similar to this.  
Module spwd


An interface to the shadow password database, similar to this.
pwd.getpwall()  
Return a list of all available password database entries, in arbitrary order.
pwd.getpwnam(name)  
Return the password database entry for the given user name.
pwd.getpwuid(uid)  
Return the password database entry for the given numeric user ID.
Class.children  
A dictionary mapping names to descriptors for nested functions and classes.  New in version 3.7.
Class.methods  
A dictionary mapping method names to line numbers. This can be derived from the newer children dictionary, but remains for back-compatibility.
Class.parent  
For top-level classes, None. For nested classes, the parent.  New in version 3.7.
Class.super  
A list of Class objects which describe the immediate base classes of the class being described. Classes which are named as superclasses but which are not discoverable by readmodule_ex() are listed as a string with the class name instead of as Class objects.
Function.children  
A dictionary mapping names to descriptors for nested functions and classes.  New in version 3.7.
Function.parent  
For top-level functions, None. For nested functions, the parent.  New in version 3.7.
pyclbr.readmodule(module, path=None)  
Return a dictionary mapping module-level class names to class descriptors. If possible, descriptors for imported base classes are included. Parameter module is a string with the name of the module to read; it may be the name of a module within a package. If given, path is a sequence of directory paths prepended to sys.path, which is used to locate the module source code. This function is the original interface and is only kept for back compatibility. It returns a filtered version of the following.
pyclbr.readmodule_ex(module, path=None)  
Return a dictionary-based tree containing a function or class descriptors for each function and class defined in the module with a def or class statement. The returned dictionary maps module-level function and class names to their descriptors. Nested objects are entered into the children dictionary of their parent. As with readmodule, module names the module to be read and path is prepended to sys.path. If the module being read is a package, the returned dictionary has a key '__path__' whose value is a list containing the package search path.