Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81b3060

Browse files
committed
en weer twee!
1 parent 51bbdfb commit 81b3060

4 files changed

Lines changed: 208 additions & 0 deletions

File tree

Doc/lib/libtempfile.tex

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
\section{Built-in module \sectcode{tempfile}}
2+
\stmodindex{tempfile}
3+
\indexii{temporary}{file name}
4+
\indexii{temporary}{file}
5+
6+
\renewcommand{\indexsubitem}{(in module tempfile)}
7+
8+
This module generates temporary file names. It is not UNIX specific,
9+
but it may require some help on non-UNIX systems.
10+
11+
Note: the modules does not create temporary files, nor does it
12+
automatically remove them when the current process exits or dies.
13+
14+
The module defines a single user-callable function:
15+
16+
\begin{funcdesc}{mktemp}{}
17+
Return a unique temporary filename. This is an absolute pathname of a
18+
file that does not exist at the time the call is made. No two calls
19+
will return the same filename.
20+
\end{funcdesc}
21+
22+
The module uses two global variables that tell it how to construct a
23+
temporary name. The caller may assign values to them; by default they
24+
are initialized at the first call to \code{mktemp()}.
25+
26+
\begin{datadesc}{tempdir}
27+
When set to a value other than \code{None}, this variable defines the
28+
directory in which filenames returned by \code{mktemp()} reside. The
29+
default is taken from the environment variable \code{TMPDIR}; if this
30+
is not set, either \code{/usr/tmp} is used (on UNIX), or the current
31+
working directory (all other systems). No check is made to see
32+
whether its value is valid.
33+
\end{datadesc}
34+
\ttindex{TMPDIR}
35+
36+
\begin{datadesc}{template}
37+
When set to a value other than \code{None}, this variable defines the
38+
prefix of the final component of the filenames returned by
39+
\code{mktemp()}. A string of decimal digits is added to generate
40+
unique filenames. The default is either ``\code{@\var{pid}.}'' where
41+
\var{pid} is the current process ID (on UNIX), or ``\code{tmp}'' (all
42+
other systems).
43+
\end{datadesc}
44+
45+
Warning: if a UNIX process uses \code{mktemp()}, then calls
46+
\code{fork()} and both parent and child continue to use
47+
\code{mktemp()}, the processes will generate conflicting temporary
48+
names. To resolve this, the child process should assign \code{None}
49+
to \code{template}, to force recomputing the default on the next call
50+
to \code{mktemp()}.

Doc/lib/libtraceback.tex

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
\section{Built-in module \sectcode{traceback}}
2+
\stmodindex{traceback}
3+
4+
\renewcommand{\indexsubitem}{(in module traceback)}
5+
6+
This module provides a standard interface to format and print stack
7+
traces of Python programs. It exactly mimics the behavior of the
8+
Python interpreter when it prints a stack trace. This is useful when
9+
you want to print stack traces under program control, e.g. in a
10+
``wrapper'' around the interpreter.
11+
12+
The module uses traceback objects --- this is the object type
13+
that is stored in the variables \code{sys.exc_traceback} and
14+
\code{sys.last_traceback}.
15+
16+
The module defines the following functions:
17+
18+
\begin{funcdesc}{print_tb}{traceback\optional{\, limit}}
19+
Print up to \var{limit} stack trace entries from \var{traceback}. If
20+
\var{limit} is omitted or \code{None}, all entries are printed.
21+
\end{funcdesc}
22+
23+
\begin{funcdesc}{extract_tb}{traceback\optional{\, limit}}
24+
Return a list of up to \var{limit} ``pre-processed'' stack trace
25+
entries extracted from \var{traceback}. It is useful for alternate
26+
formatting of stack traces. If \var{limit} is omitted or \code{None},
27+
all entries are extracted. A ``pre-processed'' stack trace entry is a
28+
quadruple (\var{filename}, \var{line number}, \var{function name},
29+
\var{line text}) representing the information that is usually printed
30+
for a stack trace. The \var{line text} is a string with leading and
31+
trailing whitespace stripped; if the source is not available it is
32+
\code{None}.
33+
\end{funcdesc}
34+
35+
\begin{funcdesc}{print_exception}{type\, value\, traceback\optional{\, limit}}
36+
Print exception information and up to \var{limit} stack trace entries
37+
from \var{traceback}. This differs from \code{print_tb} in the
38+
following ways: (1) if \var{traceback} is not \code{None}, it prints a
39+
header ``\code{Traceback (innermost last):}''; (2) it prints the
40+
exception \var{type} and \var{value} after the stack trace; (3) if
41+
\var{type} is \code{SyntaxError} and \var{value} has the appropriate
42+
format, it prints the line where the syntax error occurred with a
43+
caret indication the approximate position of the error.
44+
\end{funcdesc}
45+
46+
\begin{funcdesc}{print_exc}{\optional{limit}}
47+
This is a shorthand for \code{print_exception(sys.exc_type,}
48+
\code{sys.exc_value,} \code{sys.exc_traceback,} \code{limit)}.
49+
\end{funcdesc}
50+
51+
\begin{funcdesc}{print_last}{\optional{limit}}
52+
This is a shorthand for \code{print_exception(sys.last_type,}
53+
\code{sys.last_value,} \code{sys.last_traceback,} \code{limit)}.
54+
\end{funcdesc}

Doc/libtempfile.tex

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
\section{Built-in module \sectcode{tempfile}}
2+
\stmodindex{tempfile}
3+
\indexii{temporary}{file name}
4+
\indexii{temporary}{file}
5+
6+
\renewcommand{\indexsubitem}{(in module tempfile)}
7+
8+
This module generates temporary file names. It is not UNIX specific,
9+
but it may require some help on non-UNIX systems.
10+
11+
Note: the modules does not create temporary files, nor does it
12+
automatically remove them when the current process exits or dies.
13+
14+
The module defines a single user-callable function:
15+
16+
\begin{funcdesc}{mktemp}{}
17+
Return a unique temporary filename. This is an absolute pathname of a
18+
file that does not exist at the time the call is made. No two calls
19+
will return the same filename.
20+
\end{funcdesc}
21+
22+
The module uses two global variables that tell it how to construct a
23+
temporary name. The caller may assign values to them; by default they
24+
are initialized at the first call to \code{mktemp()}.
25+
26+
\begin{datadesc}{tempdir}
27+
When set to a value other than \code{None}, this variable defines the
28+
directory in which filenames returned by \code{mktemp()} reside. The
29+
default is taken from the environment variable \code{TMPDIR}; if this
30+
is not set, either \code{/usr/tmp} is used (on UNIX), or the current
31+
working directory (all other systems). No check is made to see
32+
whether its value is valid.
33+
\end{datadesc}
34+
\ttindex{TMPDIR}
35+
36+
\begin{datadesc}{template}
37+
When set to a value other than \code{None}, this variable defines the
38+
prefix of the final component of the filenames returned by
39+
\code{mktemp()}. A string of decimal digits is added to generate
40+
unique filenames. The default is either ``\code{@\var{pid}.}'' where
41+
\var{pid} is the current process ID (on UNIX), or ``\code{tmp}'' (all
42+
other systems).
43+
\end{datadesc}
44+
45+
Warning: if a UNIX process uses \code{mktemp()}, then calls
46+
\code{fork()} and both parent and child continue to use
47+
\code{mktemp()}, the processes will generate conflicting temporary
48+
names. To resolve this, the child process should assign \code{None}
49+
to \code{template}, to force recomputing the default on the next call
50+
to \code{mktemp()}.

Doc/libtraceback.tex

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
\section{Built-in module \sectcode{traceback}}
2+
\stmodindex{traceback}
3+
4+
\renewcommand{\indexsubitem}{(in module traceback)}
5+
6+
This module provides a standard interface to format and print stack
7+
traces of Python programs. It exactly mimics the behavior of the
8+
Python interpreter when it prints a stack trace. This is useful when
9+
you want to print stack traces under program control, e.g. in a
10+
``wrapper'' around the interpreter.
11+
12+
The module uses traceback objects --- this is the object type
13+
that is stored in the variables \code{sys.exc_traceback} and
14+
\code{sys.last_traceback}.
15+
16+
The module defines the following functions:
17+
18+
\begin{funcdesc}{print_tb}{traceback\optional{\, limit}}
19+
Print up to \var{limit} stack trace entries from \var{traceback}. If
20+
\var{limit} is omitted or \code{None}, all entries are printed.
21+
\end{funcdesc}
22+
23+
\begin{funcdesc}{extract_tb}{traceback\optional{\, limit}}
24+
Return a list of up to \var{limit} ``pre-processed'' stack trace
25+
entries extracted from \var{traceback}. It is useful for alternate
26+
formatting of stack traces. If \var{limit} is omitted or \code{None},
27+
all entries are extracted. A ``pre-processed'' stack trace entry is a
28+
quadruple (\var{filename}, \var{line number}, \var{function name},
29+
\var{line text}) representing the information that is usually printed
30+
for a stack trace. The \var{line text} is a string with leading and
31+
trailing whitespace stripped; if the source is not available it is
32+
\code{None}.
33+
\end{funcdesc}
34+
35+
\begin{funcdesc}{print_exception}{type\, value\, traceback\optional{\, limit}}
36+
Print exception information and up to \var{limit} stack trace entries
37+
from \var{traceback}. This differs from \code{print_tb} in the
38+
following ways: (1) if \var{traceback} is not \code{None}, it prints a
39+
header ``\code{Traceback (innermost last):}''; (2) it prints the
40+
exception \var{type} and \var{value} after the stack trace; (3) if
41+
\var{type} is \code{SyntaxError} and \var{value} has the appropriate
42+
format, it prints the line where the syntax error occurred with a
43+
caret indication the approximate position of the error.
44+
\end{funcdesc}
45+
46+
\begin{funcdesc}{print_exc}{\optional{limit}}
47+
This is a shorthand for \code{print_exception(sys.exc_type,}
48+
\code{sys.exc_value,} \code{sys.exc_traceback,} \code{limit)}.
49+
\end{funcdesc}
50+
51+
\begin{funcdesc}{print_last}{\optional{limit}}
52+
This is a shorthand for \code{print_exception(sys.last_type,}
53+
\code{sys.last_value,} \code{sys.last_traceback,} \code{limit)}.
54+
\end{funcdesc}

0 commit comments

Comments
 (0)