/snap/core22/2411/usr/lib/python3.10/__pycache__
NameSizeModeActions
abc.cpython-310.pyc67510644editdlrm
aifc.cpython-310.pyc246850644editdlrm
antigravity.cpython-310.pyc8220644editdlrm
argparse.cpython-310.pyc635390644editdlrm
ast.cpython-310.pyc557390644editdlrm
asynchat.cpython-310.pyc70250644editdlrm
asyncore.cpython-310.pyc160020644editdlrm
base64.cpython-310.pyc171620644editdlrm
bdb.cpython-310.pyc258320644editdlrm
binhex.cpython-310.pyc128700644editdlrm
bisect.cpython-310.pyc25880644editdlrm
bz2.cpython-310.pyc108700644editdlrm
calendar.cpython-310.pyc263030644editdlrm
cgi.cpython-310.pyc267230644editdlrm
cgitb.cpython-310.pyc99980644editdlrm
chunk.cpython-310.pyc48600644editdlrm
cmd.cpython-310.pyc127070644editdlrm
code.cpython-310.pyc99570644editdlrm
codecs.cpython-310.pyc332190644editdlrm
codeop.cpython-310.pyc55950644editdlrm
colorsys.cpython-310.pyc32650644editdlrm
compileall.cpython-310.pyc127330644editdlrm
configparser.cpython-310.pyc454580644editdlrm
contextlib.cpython-310.pyc208950644editdlrm
contextvars.cpython-310.pyc2460644editdlrm
copy.cpython-310.pyc69960644editdlrm
copyreg.cpython-310.pyc46830644editdlrm
cProfile.cpython-310.pyc51130644editdlrm
crypt.cpython-310.pyc35500644editdlrm
csv.cpython-310.pyc117980644editdlrm
dataclasses.cpython-310.pyc265780644editdlrm
datetime.cpython-310.pyc565330644editdlrm
decimal.cpython-310.pyc3620644editdlrm
difflib.cpython-310.pyc589050644editdlrm
dis.cpython-310.pyc156560644editdlrm
doctest.cpython-310.pyc761750644editdlrm
enum.cpython-310.pyc260630644editdlrm
filecmp.cpython-310.pyc87490644editdlrm
fileinput.cpython-310.pyc140720644editdlrm
fnmatch.cpython-310.pyc42440644editdlrm
fractions.cpython-310.pyc186000644editdlrm
ftplib.cpython-310.pyc289770644editdlrm
functools.cpython-310.pyc283350644editdlrm
genericpath.cpython-310.pyc39070644editdlrm
getopt.cpython-310.pyc63390644editdlrm
getpass.cpython-310.pyc42100644editdlrm
gettext.cpython-310.pyc182210644editdlrm
glob.cpython-310.pyc58520644editdlrm
graphlib.cpython-310.pyc76160644editdlrm
gzip.cpython-310.pyc185460644editdlrm
hashlib.cpython-310.pyc68450644editdlrm
heapq.cpython-310.pyc138650644editdlrm
hmac.cpython-310.pyc69730644editdlrm
imaplib.cpython-310.pyc424320644editdlrm
imghdr.cpython-310.pyc39050644editdlrm
imp.cpython-310.pyc97860644editdlrm
inspect.cpython-310.pyc851530644editdlrm
io.cpython-310.pyc36630644editdlrm
ipaddress.cpython-310.pyc626700644editdlrm
keyword.cpython-310.pyc9270644editdlrm
linecache.cpython-310.pyc41420644editdlrm
locale.cpython-310.pyc461540644editdlrm
lzma.cpython-310.pyc121000644editdlrm
mailbox.cpython-310.pyc600910644editdlrm
mailcap.cpython-310.pyc73200644editdlrm
mimetypes.cpython-310.pyc176190644editdlrm
modulefinder.cpython-310.pyc161660644editdlrm
netrc.cpython-310.pyc39330644editdlrm
nntplib.cpython-310.pyc316230644editdlrm
ntpath.cpython-310.pyc147040644editdlrm
nturl2path.cpython-310.pyc17470644editdlrm
numbers.cpython-310.pyc118660644editdlrm
opcode.cpython-310.pyc54470644editdlrm
operator.cpython-310.pyc135080644editdlrm
optparse.cpython-310.pyc477540644editdlrm
os.cpython-310.pyc315990644editdlrm
pathlib.cpython-310.pyc420520644editdlrm
pdb.cpython-310.pyc474400644editdlrm
pickle.cpython-310.pyc468820644editdlrm
pickletools.cpython-310.pyc677600644editdlrm
pipes.cpython-310.pyc77690644editdlrm
pkgutil.cpython-310.pyc183610644editdlrm
platform.cpython-310.pyc274290644editdlrm
plistlib.cpython-310.pyc237650644editdlrm
poplib.cpython-310.pyc136700644editdlrm
posixpath.cpython-310.pyc105600644editdlrm
pprint.cpython-310.pyc178750644editdlrm
profile.cpython-310.pyc143910644editdlrm
pstats.cpython-310.pyc236210644editdlrm
pty.cpython-310.pyc41430644editdlrm
pyclbr.cpython-310.pyc97750644editdlrm
pydoc.cpython-310.pyc856450644editdlrm
py_compile.cpython-310.pyc73390644editdlrm
queue.cpython-310.pyc107920644editdlrm
quopri.cpython-310.pyc57940644editdlrm
random.cpython-310.pyc227480644editdlrm
re.cpython-310.pyc142270644editdlrm
reprlib.cpython-310.pyc52500644editdlrm
rlcompleter.cpython-310.pyc59540644editdlrm
runpy.cpython-310.pyc94110644editdlrm
sched.cpython-310.pyc61150644editdlrm
secrets.cpython-310.pyc21750644editdlrm
selectors.cpython-310.pyc171050644editdlrm
shelve.cpython-310.pyc94920644editdlrm
shlex.cpython-310.pyc77820644editdlrm
shutil.cpython-310.pyc385360644editdlrm
signal.cpython-310.pyc29350644editdlrm
site.cpython-310.pyc179220644editdlrm
sitecustomize.cpython-310.pyc2250644editdlrm
smtpd.cpython-310.pyc261470644editdlrm
smtplib.cpython-310.pyc357660644editdlrm
sndhdr.cpython-310.pyc69620644editdlrm
socket.cpython-310.pyc289630644editdlrm
socketserver.cpython-310.pyc253470644editdlrm
sre_compile.cpython-310.pyc151940644editdlrm
sre_constants.cpython-310.pyc63570644editdlrm
sre_parse.cpython-310.pyc217550644editdlrm
ssl.cpython-310.pyc452710644editdlrm
stat.cpython-310.pyc42730644editdlrm
statistics.cpython-310.pyc370510644editdlrm
string.cpython-310.pyc71020644editdlrm
stringprep.cpython-310.pyc170750644editdlrm
struct.cpython-310.pyc3070644editdlrm
subprocess.cpython-310.pyc447410644editdlrm
sunau.cpython-310.pyc164820644editdlrm
symtable.cpython-310.pyc128350644editdlrm
sysconfig.cpython-310.pyc181510644editdlrm
tabnanny.cpython-310.pyc69500644editdlrm
tarfile.cpython-310.pyc706740644editdlrm
telnetlib.cpython-310.pyc185060644editdlrm
tempfile.cpython-310.pyc273390644editdlrm
textwrap.cpython-310.pyc138120644editdlrm
this.cpython-310.pyc12640644editdlrm
threading.cpython-310.pyc449690644editdlrm
timeit.cpython-310.pyc117690644editdlrm
token.cpython-310.pyc27380644editdlrm
tokenize.cpython-310.pyc171940644editdlrm
trace.cpython-310.pyc198700644editdlrm
traceback.cpython-310.pyc217120644editdlrm
tracemalloc.cpython-310.pyc175250644editdlrm
tty.cpython-310.pyc10790644editdlrm
turtle.cpython-310.pyc1288570644editdlrm
types.cpython-310.pyc95250644editdlrm
typing.cpython-310.pyc852770644editdlrm
uu.cpython-310.pyc38670644editdlrm
uuid.cpython-310.pyc224980644editdlrm
warnings.cpython-310.pyc136460644editdlrm
wave.cpython-310.pyc175940644editdlrm
weakref.cpython-310.pyc203430644editdlrm
webbrowser.cpython-310.pyc170000644editdlrm
xdrlib.cpython-310.pyc78800644editdlrm
zipapp.cpython-310.pyc60130644editdlrm
zipfile.cpython-310.pyc618450644editdlrm
zipimport.cpython-310.pyc170330644editdlrm
_aix_support.cpython-310.pyc28790644editdlrm
_bootsubprocess.cpython-310.pyc22940644editdlrm
_collections_abc.cpython-310.pyc329250644editdlrm
_compat_pickle.cpython-310.pyc58720644editdlrm
_compression.cpython-310.pyc45120644editdlrm
_distutils_system_mod.cpython-310.pyc54220644editdlrm
_markupbase.cpython-310.pyc75720644editdlrm
_osx_support.cpython-310.pyc115350644editdlrm
_pydecimal.cpython-310.pyc1577360644editdlrm
_pyio.cpython-310.pyc736540644editdlrm
_py_abc.cpython-310.pyc46830644editdlrm
_sitebuiltins.cpython-310.pyc35470644editdlrm
_strptime.cpython-310.pyc159450644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-310.pyc353850644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-310.pyc353790644editdlrm
_threading_local.cpython-310.pyc65390644editdlrm
_weakrefset.cpython-310.pyc76080644editdlrm
__future__.cpython-310.pyc41310644editdlrm
__phello__.foo.cpython-310.pyc1300644editdlrm
Edit: /snap/core22/2411/usr/lib/python3.10/__pycache__/sunau.cpython-310.pyc (16482B)
o `wiF@sdZddlmZeddZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZeeeee egZGdddeZddZddZGdddZGdddZd ddZdS)!aStuff to parse Sun and NeXT audio files. An audio file consists of a header followed by the data. The structure of the header is as follows. +---------------+ | magic word | +---------------+ | header size | +---------------+ | data size | +---------------+ | encoding | +---------------+ | sample rate | +---------------+ | # of channels | +---------------+ | info | | | +---------------+ The magic word consists of the 4 characters '.snd'. Apart from the info field, all header fields are 4 bytes in size. They are all 32-bit unsigned integers encoded in big-endian byte order. The header size really gives the start of the data. The data size is the physical size of the data. From the other parameters the number of frames can be calculated. The encoding gives the way in which audio samples are encoded. Possible values are listed below. The info field currently consists of an ASCII string giving a human-readable description of the audio file. The info field is padded with NUL bytes to the header size. Usage. Reading audio files: f = sunau.open(file, 'r') where file is either the name of a file or an open file pointer. The open file pointer must have methods read(), seek(), and close(). When the setpos() and rewind() methods are not used, the seek() method is not necessary. This returns an instance of a class with the following public methods: getnchannels() -- returns number of audio channels (1 for mono, 2 for stereo) getsampwidth() -- returns sample width in bytes getframerate() -- returns sampling frequency getnframes() -- returns number of audio frames getcomptype() -- returns compression type ('NONE' or 'ULAW') getcompname() -- returns human-readable version of compression type ('not compressed' matches 'NONE') getparams() -- returns a namedtuple consisting of all of the above in the above order getmarkers() -- returns None (for compatibility with the aifc module) getmark(id) -- raises an error since the mark does not exist (for compatibility with the aifc module) readframes(n) -- returns at most n frames of audio rewind() -- rewind to the beginning of the audio stream setpos(pos) -- seek to the specified position tell() -- return the current position close() -- close the instance (make it unusable) The position returned by tell() and the position given to setpos() are compatible and have nothing to do with the actual position in the file. The close() method is called automatically when the class instance is destroyed. Writing audio files: f = sunau.open(file, 'w') where file is either the name of a file or an open file pointer. The open file pointer must have methods write(), tell(), seek(), and close(). This returns an instance of a class with the following public methods: setnchannels(n) -- set the number of channels setsampwidth(n) -- set the sample width setframerate(n) -- set the frame rate setnframes(n) -- set the number of frames setcomptype(type, name) -- set the compression type and the human-readable compression type setparams(tuple)-- set all parameters at once tell() -- return current position in output file writeframesraw(data) -- write audio frames without pathing up the file header writeframes(data) -- write audio frames and patch up the file header close() -- patch up the file header and close the output file You should set the parameters before the first writeframesraw or writeframes. The total number of frames does not need to be set, but when it is set to the correct value, the header does not have to be patched up. It is best to first set all parameters, perhaps possibly the compression type, and then write audio frames using writeframesraw. When all frames have been written, either call writeframes(b'') or close() to patch up the sizes in the header. The close() method is called automatically when the class instance is destroyed. ) namedtuple _sunau_paramsz7nchannels sampwidth framerate nframes comptype compnameidns.lc@s eZdZdS)ErrorN)__name__ __module__ __qualname__rr/usr/lib/python3.10/sunau.pyrsrcCs8d}tdD]}|d}|st|dt|}q|S)Nrrr)rangereadEOFErrorord)filexibyterrr _read_u32s  rcCsFg}tdD]}t|d\}}|dt||}q|t|dS)Nrrr)rdivmodinsertintwritebytes)rrdatardmrrr _write_u32s  r(c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)S)*Au_readcC@t|tdkrddl}||d}d|_nd|_||dS)NrrbTFtypebuiltinsopen_openedinitfpselffr/rrr__init__  zAu_read.__init__cCs|jr |dSdSN_filecloser4rrr__del__s zAu_read.__del__cC|Sr8rr<rrr __enter__zAu_read.__enter__cG |dSr8r;r4argsrrr__exit__ zAu_read.__exit__c Cs||_d|_tt|}|tkrtdtt||_|jdkr$td|jdkr-tdt||_|jtkr=t|j|_tt||_ |j t vrMtd|j t t fvr[d|_ d |_n4|j tkrgd |_|_ n(|j tkrsd|_|_ n|j tkrd |_|_ n|j tkrd |_|_ ntd tt||_tt||_|jstd |j|j|_|jdkr||jd|_|jd\|_}}nd|_z||_WdSttfyd|_YdSw)Nrzbad magic numberr zheader size too smalldzheader size ridiculously largezencoding not (yet) supportedrrrrzunknown encodingzbad # of channels)r: _soundposr"rAUDIO_FILE_MAGICr _hdr_size _data_sizeAUDIO_UNKNOWN_SIZE _encoding_simple_encodingsAUDIO_FILE_ENCODING_MULAW_8AUDIO_FILE_ENCODING_ALAW_8 _sampwidth _framesizeAUDIO_FILE_ENCODING_LINEAR_8AUDIO_FILE_ENCODING_LINEAR_16AUDIO_FILE_ENCODING_LINEAR_24AUDIO_FILE_ENCODING_LINEAR_32 _framerate _nchannelsr_info partitiontell _data_posAttributeErrorOSError)r4rmagic_rrrr2sX             zAu_read.initfpcC|jSr8)r:r<rrrgetfpz Au_read.getfpcCrcr8)rZr<rrr getnchannelsrezAu_read.getnchannelscCrcr8)rSr<rrr getsampwidthrezAu_read.getsampwidthcCrcr8)rYr<rrr getframeraterezAu_read.getframeratecCs(|jtkrtS|jtvr|j|jSdSNr)rMrNrOrPrTr<rrr getnframess   zAu_read.getnframescC |jtkrdS|jtkrdSdS)NULAWALAWNONErOrQrRr<rrr getcomptype  zAu_read.getcomptypecCrk)NCCITT G.711 u-lawCCITT G.711 A-lawnot compressedror<rrr getcompnamerqzAu_read.getcompnamecC*t||||||Sr8rrfrgrhrjrprur<rrr getparams  zAu_read.getparamscCsdSr8rr<rrr getmarkersr@zAu_read.getmarkerscCstd)Nzno marks)r)r4idrrrgetmark szAu_read.getmarkcCsp|jtvr6|tkr|j}n |j||j}|jt||j7_|jtkr4ddl }| ||j }|SdSri) rOrPrNr:rrTrJlenrQaudioopulaw2linrS)r4nframesr%r~rrr readframess   zAu_read.readframescCs*|jdur td|j|jd|_dS)N cannot seekr)r^r`r:seekrJr<rrrrewinds  zAu_read.rewindcCrcr8)rJr<rrrr]!rez Au_read.tellcCsP|dks ||krtd|jdurtd|j|j||j||_dS)Nrzposition not in ranger)rjrr^r`r:rrTrJ)r4posrrrsetpos$s   zAu_read.setposcCs*|j}|rd|_|jr|dSdSdSr8)r:r1r;r4rrrrr;,s z Au_read.closeN)rrrr6r=r?rEr2rdrfrgrhrjrprurxrzr|rrr]rr;rrrrr)s* .  r)c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3S)4Au_writecCr*)Nr+rwbTFr-r3rrrr65r7zAu_write.__init__cCs|jr|d|_dSr8r9r<rrrr=> zAu_write.__del__cCr>r8rr<rrrr?Cr@zAu_write.__enter__cGrAr8rBrCrrrrEFrFzAu_write.__exit__cCsF||_d|_d|_d|_d|_t|_d|_d|_d|_ d|_ d|_ dS)NrrIrl) r:rYrZrSrTrN_nframes_nframeswritten _datawritten _datalengthr[ _comptyperrrrr2Is zAu_write.initfpcC(|jrtd|dvrtd||_dS)N0cannot change parameters after starting to write)rrrz"only 1, 2, or 4 channels supported)rrrZ)r4 nchannelsrrr setnchannelsV  zAu_write.setnchannelscC|jstd|jS)Nznumber of channels not set)rZrr<rrrrf]zAu_write.getnchannelscCr)Nr)rrrrzbad sample width)rrrS)r4 sampwidthrrr setsampwidthbrzAu_write.setsampwidthcCs|jstd|jS)Nsample width not specified)rYrrSr<rrrrgirzAu_write.getsampwidthcCs|jrtd||_dS)Nr)rrrY)r4 frameraterrr setframeratenrzAu_write.setframeratecCr)Nzframe rate not set)rYrr<rrrrhsrzAu_write.getframeratecCs(|jrtd|dkrtd||_dS)Nrrz# of frames cannot be negative)rrr)r4rrrr setnframesxrzAu_write.setnframescCrcr8rr<rrrrjrezAu_write.getnframescCs|dvr ||_dStd)N)rnrlzunknown compression type)rr)r4r.namerrr setcomptypes zAu_write.setcomptypecCrcr8rr<rrrrprezAu_write.getcomptypecCs |jdkrdS|jdkrdSdS)Nrlrrrmrsrtrr<rrrrurqzAu_write.getcompnamecCsH|\}}}}}}|||||||||||dSr8)rrrrr)r4paramsrrrrcomptypecompnamerrr setparamss     zAu_write.setparamscCrvr8rwr<rrrrxryzAu_write.getparamscCrcr8rr<rrrr]rez Au_write.tellcCs~t|ttfst|d}||jdkr"ddl}|||j }t ||j }|j ||j||_|jt ||_dS)NBrlr) isinstancer$ bytearray memoryviewcast_ensure_header_writtenrr~lin2ulawrSr}rTr:r#rr)r4r%r~rrrrwriteframesraws   zAu_write.writeframesrawcCs2|||j|jks|j|jkr|dSdSr8)rrrrr _patchheader)r4r%rrr writeframess    zAu_write.writeframescCs|jr>z+||j|jks|j|jkr||jW|j}d|_|jr-| dSdS|j}d|_|jr=| wwdSr8) r:rrrrrrflushr1r;rrrrr;s$     zAu_write.closecCs@|js|js td|jstd|jstd|dSdS)Nz# of channels not specifiedrzframe rate not specified)rrZrrSrY _write_headerr<rrrrs zAu_write._ensure_header_writtenc Cs||jdkr5|jdkrt}d|_n4|jdkrt}d|_n)|jdkr&t}d|_n|jdkr1t}d|_ntd|jdkr@t}d|_ntd|j|j |_t |j t dt |j}|d d @}t |j ||jtkrlt}n|j|j}z|j |_Wnttfyd|_Ynwt |j |||_t |j |t |j |jt |j |j |j |j|j d |t |jd dS) Nrnrrrrzinternal errorrlr r irHr )rrSrUrTrVrWrXrrQrZr(r:rKr}r[rrNr]_form_length_posr_r`rrYr#)r4encoding header_sizelengthrrrrsL              "zAu_write._write_headercCsH|jdur td|j|jt|j|j|j|_|jdddS)Nrrr)rr`r:rr(rrr<rrrrs zAu_write._patchheaderN)rrrr6r=r?rEr2rrfrrgrrhrrjrrprurrxr]rrr;rrrrrrrr3s4    *rNcCsF|durt|dr |j}nd}|dvrt|S|dvrt|Std)Nmoder,)rr,)wrz$mode must be 'r', 'rb', 'w', or 'wb')hasattrrr)rr)r5rrrrr0s r0r8)__doc__ collectionsrrrKrQrUrVrWrXAUDIO_FILE_ENCODING_FLOATAUDIO_FILE_ENCODING_DOUBLEAUDIO_FILE_ENCODING_ADPCM_G721AUDIO_FILE_ENCODING_ADPCM_G722 AUDIO_FILE_ENCODING_ADPCM_G723_3 AUDIO_FILE_ENCODING_ADPCM_G723_5rRrNrP Exceptionrrr(r)rr0rrrrsD i Q