Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b742a42b
Kaydet (Commit)
b742a42b
authored
Haz 23, 1999
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Two more from Moshe!
üst
cab94763
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
219 additions
and
0 deletions
+219
-0
libcodeop.tex
Doc/lib/libcodeop.tex
+45
-0
libsunau.tex
Doc/lib/libsunau.tex
+174
-0
No files found.
Doc/lib/libcodeop.tex
0 → 100644
Dosyayı görüntüle @
b742a42b
% LaTeXed from excellent doc-string.
\section
{
\module
{
codeop
}
---
Compile Python code
}
\declaremodule
{
standard
}{
codeop
}
\sectionauthor
{
Moshe Zadka
}{
mzadka@geocities.com
}
\modulesynopsis
{
Compile (possibly incomplete) Python code.
}
The
\module
{
codeop
}
module provides a function to compile Python code
with hints on whether it certainly complete, possible complete or
definitely incomplete. This is used by the
\refmodule
{
code
}
module
and should not normally be used directly.
The
\module
{
codeop
}
module defines the following function:
\begin{funcdesc}
{
compile
_
command
}
{
source
\optional
{
, filename
\optional
{
, symbol
}}}
Try to compile
\var
{
source
}
, which should be a string of Python
code. Return a code object if
\var
{
source
}
is valid
Python code. In that case, the filename attribute of the code object
will be
\var
{
filename
}
, which defaults to
\code
{
'<input>'
}
.
Return
\code
{
None
}
if
\var
{
source
}
is
\emph
{
not
}
valid Python
code, but is a prefix of valid Python code.
Raise an exception if there is a problem with
\var
{
source
}
:
\begin{itemize}
\item
\exception
{
SyntaxError
}
if there is invalid Python syntax.
\item
\exception
{
OverflowError
}
if there is an invalid numeric constant.
\end{itemize}
The
\var
{
symbol
}
argument means whether to compile it as a statement
(
\code
{
'single'
}
, the default) or as an expression (
\code
{
'eval'
}
).
\strong
{
Caveat:
}
It is possible (but not likely) that the parser stops parsing
with a successful outcome before reaching the end of the source;
in this case, trailing symbols may be ignored instead of causing an
error. For example, a backslash followed by two newlines may be
followed by arbitrary garbage. This will be fixed once the API
for the parser is better.
\end{funcdesc}
Doc/lib/libsunau.tex
0 → 100644
Dosyayı görüntüle @
b742a42b
\section
{
\module
{
sunau
}
---
Read and write Sun AU files
}
\declaremodule
{
standard
}{
sunau
}
\sectionauthor
{
Moshe Zadka
}{
mzadka@geocities.com
}
\modulesynopsis
{
Provide an interface to the Sun AU sound format.
}
The
\module
{
sunau
}
module provides a convenient interface to the Sun AU sound
format. Note that this module is interface-compatible with the modules
\refmodule
{
aifc
}
and
\refmodule
{
wave
}
.
The
\module
{
sunau
}
module defines the following functions:
\begin{funcdesc}
{
open
}{
file, mode
}
If
\var
{
file
}
is a string, open the file by that name, otherwise treat it
as a seekable file-like object.
\var
{
mode
}
can be any of
\begin{description}
\item
[\code{'r'}]
Read only mode.
\item
[\code{'w'}]
Write only mode.
\end{description}
Note that it does not allow read/write files.
A
\var
{
mode
}
of
\code
{
'r'
}
returns a
\class
{
AU
_
read
}
object, while a
\var
{
mode
}
of
\code
{
'w'
}
or
\code
{
'wb'
}
returns
a
\class
{
AU
_
write
}
object.
\end{funcdesc}
\begin{funcdesc}
{
openfp
}{
file, mode
}
A synonym for
\function
{
open
}
, maintained for backwards compatibility.
\end{funcdesc}
The
\module
{
sunau
}
module defines the following exception:
\begin{excdesc}
{
Error
}
An error raised when something is impossible because of Sun AU specs or
implementation deficiency.
\end{excdesc}
The
\module
{
sunau
}
module defines the following data item:
\begin{datadesc}
{
AUDIO
_
FILE
_
MAGIC
}
An integer every valid Sun AU file begins with a big-endian encoding of.
\end{datadesc}
\subsection
{
AU
_
read Objects
\label
{
au-read-objects
}}
AU
_
read objects, as returned by
\function
{
open()
}
above, have the
following methods:
\begin{methoddesc}
[AU
_
read]
{
close
}{}
Close the stream, and make the instance unusable. (This is
called automatically on deletion.)
\end{methoddesc}
\begin{methoddesc}
[AU
_
read]
{
getnchannels
}{}
Returns number of audio channels (1 for mone, 2 for stereo).
\end{methoddesc}
\begin{methoddesc}
[AU
_
read]
{
getsampwidth
}{}
Returns sample width in bytes.
\end{methoddesc}
\begin{methoddesc}
[AU
_
read]
{
getframerate
}{}
Returns sampling frequency.
\end{methoddesc}
\begin{methoddesc}
[AU
_
read]
{
getnframes
}{}
Returns number of audio frames.
\end{methoddesc}
\begin{methoddesc}
[AU
_
read]
{
getcomptype
}{}
Returns compression type.
Supported compression types are
\code
{
'ULAW'
}
,
\code
{
'ALAW'
}
and
\code
{
'NONE'
}
.
\end{methoddesc}
\begin{methoddesc}
[AU
_
read]
{
getcompname
}{}
Human-readable version of
\method
{
getcomptype()
}
.
The supported types have the respective names
\code
{
'CCITT G.711
u-law'
}
,
\code
{
'CCITT G.711 A-law'
}
and
\code
{
'not compressed'
}
.
\end{methoddesc}
\begin{methoddesc}
[AU
_
read]
{
getparams
}{}
Returns a tuple
\code
{
(
\var
{
nchannels
}
,
\var
{
sampwidth
}
,
\var
{
framerate
}
,
\var
{
nframes
}
,
\var
{
comptype
}
,
\var
{
compname
}
)
}
,
equivalent to output of the
\method
{
get*()
}
methods.
\end{methoddesc}
\begin{methoddesc}
[AU
_
read]
{
readframes
}{
n
}
Reads and returns at most
\var
{
n
}
frames of audio, as a string of bytes.
\end{methoddesc}
\begin{methoddesc}
[AU
_
read]
{
rewind
}{}
Rewind the file pointer to the beginning of the audio stream.
\end{methoddesc}
The following two methods define a term ``position'' which is compatible
between them, and is otherwise implementation dependant.
\begin{methoddesc}
[AU
_
read]
{
setpos
}{
pos
}
Set the file pointer to the specified position.
\end{methoddesc}
\begin{methoddesc}
[AU
_
read]
{
tell
}{}
Return current file pointer position.
\end{methoddesc}
The following two functions are defined for compatibility with the
\refmodule
{
aifc
}
, and don't do anything interesting.
\begin{methoddesc}
[AU
_
read]
{
getmarkers
}{}
Returns
\code
{
None
}
.
\end{methoddesc}
\begin{methoddesc}
[AU
_
read]
{
getmark
}{
id
}
Raise an error.
\end{methoddesc}
\subsection
{
AU
_
write Objects
\label
{
au-write-objects
}}
AU
_
write objects, as returned by
\function
{
open()
}
above, have the
following methods:
\begin{methoddesc}
[AU
_
write]
{
setnchannels
}{
n
}
Set the number of channels.
\end{methoddesc}
\begin{methoddesc}
[AU
_
write]
{
setsampwidth
}{
n
}
Set the sample width (in bytes.)
\end{methoddesc}
\begin{methoddesc}
[AU
_
write]
{
setframerate
}{
n
}
Set the frame rate.
\end{methoddesc}
\begin{methoddesc}
[AU
_
write]
{
setnframes
}{
n
}
Set the number of frames. This can be later changed, when and if more
frames are written.
\end{methoddesc}
\begin{methoddesc}
[AU
_
write]
{
setcomptype
}{
type, name
}
Set the compression type and description.
Only
\code
{
'NONE'
}
and
\code
{
'ULAW'
}
are supported on output.
\end{methoddesc}
\begin{methoddesc}
[AU
_
write]
{
setparams
}{
tuple
}
The
\var
{
tuple
}
should be
\code
{
(
\var
{
nchannels
}
,
\var
{
sampwidth
}
,
\var
{
framerate
}
,
\var
{
nframes
}
,
\var
{
comptype
}
,
\var
{
compname
}
)
}
, with
values valid for the
\method
{
set*()
}
methods. Set all parameters.
\end{methoddesc}
\begin{methoddesc}
[AU
_
write]
{
tell
}{}
Return current position in the file, with the same disclaimer for
the
\method
{
AU
_
read.tell()
}
and
\method
{
AU
_
read.setpos()
}
methods.
\end{methoddesc}
\begin{methoddesc}
[AU
_
write]
{
writeframesraw
}{
data
}
Write audio frames, without correcting
\var
{
nframes
}
.
\end{methoddesc}
\begin{methoddesc}
[AU
_
write]
{
writeframes
}{
data
}
Write audio frames and make sure
\var
{
nframes
}
is correct.
\end{methoddesc}
\begin{methoddesc}
[AU
_
write]
{
close
}{}
Make sure
\var
{
nframes
}
is correct, and close the file.
This method is called upon deletion.
\end{methoddesc}
Note that it is invalid to set any parameters after calling
\method
{
writeframes()
}
or
\method
{
writeframesraw()
}
.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment