code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
# Generated from 'OSA.h'
def FOUR_CHAR_CODE(x): return x
from Carbon.AppleEvents import *
kAEUseStandardDispatch = -1
kOSAComponentType = FOUR_CHAR_CODE('osa ')
kOSAGenericScriptingComponentSubtype = FOUR_CHAR_CODE('scpt')
kOSAFileType = FOUR_CHAR_CODE('osas')
kOSASuite = FOUR_CHAR_CODE('ascr')
kOSARecordedText = FOUR... | Python |
from _Help import *
| Python |
from _Mlte import *
| Python |
try:
from OverrideFrom23._Res import *
except ImportError:
from _Res import *
| Python |
# Generated from 'IBCarbonRuntime.h'
kIBCarbonRuntimeCantFindNibFile = -10960
kIBCarbonRuntimeObjectNotOfRequestedType = -10961
kIBCarbonRuntimeCantFindObject = -10962
| Python |
from _Menu import *
| Python |
"""terminalcommand.py -- A minimal interface to Terminal.app.
To run a shell command in a new Terminal.app window:
import terminalcommand
terminalcommand.run("ls -l")
No result is returned; it is purely meant as a quick way to run a script
with a decent input/output window.
"""
#
# This module is a fairly s... | Python |
"""codefragments.py -- wrapper to modify code fragments."""
# (c) 1998, Just van Rossum, Letterror
__version__ = "0.8b3"
__author__ = "jvr"
import Carbon.File
import struct
from Carbon import Res
import os
import sys
DEBUG = 0
error = "cfm.error"
BUFSIZE = 0x80000
def mergecfmfiles(srclist, dst, architecture = '... | Python |
"""icopen patch
OVERVIEW
icopen patches MacOS Python to use the Internet Config file mappings to select
the type and creator for a file.
Version 1 released to the public domain 3 November 1999
by Oliver Steele (steele@cs.brandeis.edu).
DETAILS
This patch causes files created by Python's open(filename, 'w') command... | Python |
"""Easy to use dialogs.
Message(msg) -- display a message and an OK button.
AskString(prompt, default) -- ask for a string, display OK and Cancel buttons.
AskPassword(prompt, default) -- like AskString(), but shows text as bullets.
AskYesNoCancel(question, default) -- display a question and Yes, No and Cancel buttons.... | Python |
"""Tools for use in AppleEvent clients and servers:
conversion between AE types and python types
pack(x) converts a Python object to an AEDesc object
unpack(desc) does the reverse
coerce(x, wanted_sample) coerces a python object to another python object
"""
#
# This code was originally written by Guido, and modified/... | Python |
"""MiniAEFrame - A minimal AppleEvent Application framework.
There are two classes:
AEServer -- a mixin class offering nice AE handling.
MiniApplication -- a very minimal alternative to FrameWork.py,
only suitable for the simplest of AppleEvent servers.
"""
import sys
import traceback
import MacOS
fro... | Python |
#
# Local customizations for generating the Carbon interface modules.
# Edit this file to reflect where things should be on your system.
# Note that pathnames are unix-style for OSX MachoPython/unix-Python,
# but mac-style for MacPython, whether running on OS9 or OSX.
#
import sys, os
Error = "bgenlocations.Error"
#
... | Python |
#! /usr/bin/env python
"""\
bundlebuilder.py -- Tools to assemble MacOS X (application) bundles.
This module contains two classes to build so called "bundles" for
MacOS X. BundleBuilder is a general tool, AppBuilder is a subclass
specialized in building application bundles.
[Bundle|App]Builder objects are instantiat... | Python |
"A sort of application framework for the Mac"
DEBUG=0
import MacOS
import traceback
from Carbon.AE import *
from Carbon.AppleEvents import *
from Carbon.Ctl import *
from Carbon.Controls import *
from Carbon.Dlg import *
from Carbon.Dialogs import *
from Carbon.Evt import *
from Carbon.Events import *
from Carbon.He... | Python |
"""tools for BuildApplet and BuildApplication"""
import sys
import os
import string
import imp
import marshal
from Carbon import Res
import Carbon.Files
import Carbon.File
import MacOS
import macostools
import macresource
import EasyDialogs
import shutil
BuildError = "BuildError"
# .pyc file (and 'PYC ' resource ma... | Python |
"""IC wrapper module, based on Internet Config 1.3"""
import icglue
import string
import sys
import os
from Carbon import Res
import Carbon.File
import macostools
error=icglue.error
# From ictypes.h:
icPrefNotFoundErr = -666 # preference not found (duh!)
icPermErr = -667 # cannot set preference... | Python |
"""Tools for use in AppleEvent clients and servers.
pack(x) converts a Python object to an AEDesc object
unpack(desc) does the reverse
packevent(event, parameters, attributes) sets params and attrs in an AEAppleEvent record
unpackevent(event) returns the parameters and attributes from an AEAppleEvent record
Plus... ... | Python |
"""PixMapWrapper - defines the PixMapWrapper class, which wraps an opaque
QuickDraw PixMap data structure in a handy Python class. Also provides
methods to convert to/from pixel data (from, e.g., the img module) or a
Python Imaging Library Image object.
J. Strout <joe@strout.net> February 1999"""
from Carbon import... | Python |
# Emulate sys.argv and run __main__.py or __main__.pyc in an environment that
# is as close to "normal" as possible.
#
# This script is put into __rawmain__.pyc for applets that need argv
# emulation, by BuildApplet and friends.
#
import argvemulator
import os
import sys
import marshal
#
# Make sure we have an argv[0]... | Python |
#!/usr/bin/env python
# This file is meant as an executable script for running applets.
# BuildApplet will use it as the main executable in the .app bundle if
# we are not running in a framework build.
import os
import sys
for name in ["__rawmain__.py", "__rawmain__.pyc", "__main__.py", "__main__.pyc"]:
realmain =... | Python |
#! /usr/bin/env python
"""\
bundlebuilder.py -- Tools to assemble MacOS X (application) bundles.
This module contains two classes to build so called "bundles" for
MacOS X. BundleBuilder is a general tool, AppBuilder is a subclass
specialized in building application bundles.
[Bundle|App]Builder objects are instantiat... | Python |
"""
gensuitemodule - Generate an AE suite module from an aete/aeut resource
Based on aete.py.
Reading and understanding this code is left as an exercise to the reader.
"""
import MacOS
import EasyDialogs
import os
import string
import sys
import types
import StringIO
import keyword
import macresource
import aetools
... | Python |
"""Package Install Manager for Python.
This is currently a MacOSX-only strawman implementation.
Despite other rumours the name stands for "Packman IMPlementation".
Tools to allow easy installation of packages. The idea is that there is
an online XML database per (platform, python-version) containing packages
known to... | Python |
"""macfs - Pure Python module designed to be backward compatible with
macfs and MACFS.
"""
import sys
import struct
import Carbon.Res
import Carbon.File
import warnings
warnings.warn("macfs is deprecated, use Carbon.File, Carbon.Folder or EasyDialogs",
DeprecationWarning, stacklevel=2)
# First step: ens... | Python |
"""plistlib.py -- a tool to generate and parse MacOSX .plist files.
The PropertList (.plist) file format is a simple XML pickle supporting
basic object types, like dictionaries, lists, numbers and strings.
Usually the top level object is a dictionary.
To write out a plist file, use the writePlist(rootObject, pathOrFi... | Python |
# Generated from 'WASTE.h'
kPascalStackBased = None # workaround for header parsing
def FOUR_CHAR_CODE(x): return x
weCantUndoErr = -10015
weEmptySelectionErr = -10013
weUnknownObjectTypeErr = -9478
weObjectNotFoundErr = -9477
weReadOnlyErr = -9476
weTextNotFoundErr = -9474
weInvalidTextEncodingErr = -9473
weDuplicate... | Python |
"""macresource - Locate and open the resources needed for a script."""
from Carbon import Res
import os
import sys
import MacOS
import macostools
class ArgumentError(TypeError): pass
class ResourceFileNotFoundError(ImportError): pass
def need(restype, resid, filename=None, modname=None):
"""Open a resource file,... | Python |
# Video file reader, using QuickTime
#
# This module was quickly ripped out of another software package, so there is a good
# chance that it does not work as-is and it needs some hacking.
#
# Jack Jansen, August 2000
#
import sys
from Carbon import Qt
from Carbon import QuickTime
from Carbon import Qd
from Carbon impor... | Python |
"""macostools - Various utility functions for MacOS.
mkalias(src, dst) - Create a finder alias 'dst' pointing to 'src'
copy(src, dst) - Full copy of 'src' to 'dst'
"""
from Carbon import Res
from Carbon import File, Files
import os
import sys
import MacOS
import time
try:
openrf = MacOS.openrf
except AttributeErr... | Python |
QSIZE = 100000
error='Audio_mac.error'
class Play_Audio_mac:
def __init__(self, qsize=QSIZE):
self._chan = None
self._qsize = qsize
self._outrate = 22254
self._sampwidth = 1
self._nchannels = 1
self._gc = []
self._usercallback = None
def __del__(self):
... | Python |
#!/usr/bin/env python
# This file is meant as an executable script for running applets.
# BuildApplet will use it as the main executable in the .app bundle if
# we are not running in a framework build.
import os
import sys
for name in ["__rawmain__.py", "__rawmain__.pyc", "__main__.py", "__main__.pyc"]:
realmain =... | Python |
# Symbols from <gl/get.h>
BCKBUFFER = 0x1
FRNTBUFFER = 0x2
DRAWZBUFFER = 0x4
DMRGB = 0
DMSINGLE = 1
DMDOUBLE = 2
DMRGBDOUBLE = 5
HZ30 = 0
HZ60 = 1
NTSC = 2
HDTV = 3
VGA = 4
IRIS3K = 5
PR60 = 6
PAL = 9
HZ30_SG = 11
A343 = 14
STR_RECT = 15
VOF0 = 16
VOF1 = 17
VOF2 = 18
VOF3 = 19
SGI0 = 20
SGI1 = 21
SGI2 = 22
HZ72 = 23
G... | Python |
# Implement 'jpeg' interface using SGI's compression library
# XXX Options 'smooth' and 'optimize' are ignored.
# XXX It appears that compressing grayscale images doesn't work right;
# XXX the resulting file causes weirdness.
class error(Exception):
pass
options = {'quality': 75, 'optimize': 0, 'smooth': 0, 'fo... | Python |
# This file implements a class which forms an interface to the .cdplayerrc
# file that is maintained by SGI's cdplayer program.
#
# Usage is as follows:
#
# import readcd
# r = readcd.Readcd()
# c = Cdplayer(r.gettrackinfo())
#
# Now you can use c.artist, c.title and c.track[trackno] (where trackno
# starts at 1). Whe... | Python |
#
# flp - Module to load fl forms from fd files
#
# Jack Jansen, December 1991
#
import string
import os
import sys
import FL
SPLITLINE = '--------------------'
FORMLINE = '=============== FORM ==============='
ENDLINE = '=============================='
class error(Exception):
pass
##############################... | Python |
NOERROR = 0
NOCONTEXT = -1
NODISPLAY = -2
NOWINDOW = -3
NOGRAPHICS = -4
NOTTOP = -5
NOVISUAL = -6
BUFSIZE = -7
BADWINDOW = -8
ALREADYBOUND = -100
BINDFAILED = -101
SETFAILED = -102
| Python |
# Convert "arbitrary" image files to rgb files (SGI's image format).
# Input may be compressed.
# The uncompressed file type may be PBM, PGM, PPM, GIF, TIFF, or Sun raster.
# An exception is raised if the file is not of a recognized type.
# Returned filename is either the input filename or a temporary filename;
# in th... | Python |
# Backward compatible module CL.
# All relevant symbols are now defined in the module cl.
try:
from cl import *
except ImportError:
from CL_old import *
else:
del CompressImage
del DecompressImage
del GetAlgorithmName
del OpenCompressor
del OpenDecompressor
del QueryAlgorithms
del Qu... | Python |
# Constants used by the FORMS library (module fl).
# This corresponds to "forms.h".
# Recommended use: import FL; ... FL.NORMAL_BOX ... etc.
# Alternate use: from FL import *; ... NORMAL_BOX ... etc.
_v20 = 1
_v21 = 1
##import fl
##try:
## _v20 = (fl.get_rgbmode is not None)
##except:
## _v20 = 0
##del fl
N... | Python |
ERROR = 0
NODISC = 1
READY = 2
PLAYING = 3
PAUSED = 4
STILL = 5
AUDIO = 0
PNUM = 1
INDEX = 2
PTIME = 3
ATIME = 4
CATALOG = 5
IDENT = 6
CONTROL = 7
CDDA_DATASIZE = 2352
##CDDA_SUBCODE... | Python |
#
# cl.h - Compression Library typedefs and prototypes
#
# 01/07/92 Cleanup by Brian Knittel
# 02/18/92 Original Version by Brian Knittel
#
#
# originalFormat parameter values
#
MAX_NUMBER_OF_ORIGINAL_FORMATS = 32
# Audio
MONO = 0
STEREO_INTERLEAVED = 1
# Video
# YUV is defined to be the same thing as YCrC... | Python |
# This file implements a class which forms an interface to the .cddb
# directory that is maintained by SGI's cdman program.
#
# Usage is as follows:
#
# import readcd
# r = readcd.Readcd()
# c = Cddb(r.gettrackinfo())
#
# Now you can use c.artist, c.title and c.track[trackno] (where trackno
# starts at 1). When the CD... | Python |
NULL = 0
FALSE = 0
TRUE = 1
ATTRIBSTACKDEPTH = 10
VPSTACKDEPTH = 8
MATRIXSTACKDEPTH = 32
NAMESTACKDEPTH = 1025
STARTTAG = -2
ENDTAG = -3
BLACK = 0
RED = 1
GREEN = 2
YELLOW = 3
BLUE = 4
MAGENTA = 5
CYAN = 6
WHITE = 7
PUP_CLEAR = 0
PUP_COLOR = 1
PUP_BLACK = 2
PUP_WHITE = 3
NORMALDRAW = 0x010
PUPDRAW = 0x020
OVERDRAW = 0x... | Python |
NTSC_XMAX = 640
NTSC_YMAX = 480
PAL_XMAX = 768
PAL_YMAX = 576
BLANKING_BUFFER_SIZE = 2
MAX_SOURCES = 2
# mode parameter for Bind calls
IN_OFF = 0 # No Video
IN_OVER = 1 # Video over graphics
IN_UNDER = 2 # Video under graphics
IN_REPL... | Python |
# Class interface to the CD module.
import cd, CD
class Error(Exception):
pass
class _Stop(Exception):
pass
def _doatime(self, cb_type, data):
if ((data[0] * 60) + data[1]) * 75 + data[2] > self.end:
## print 'done with list entry', repr(self.listindex)
raise _Stop
func, arg = se... | Python |
# Module 'panel'
#
# Support for the Panel library.
# Uses built-in module 'pnl'.
# Applications should use 'panel.function' instead of 'pnl.function';
# most 'pnl' functions are transparently exported by 'panel',
# but dopanel() is overridden and you have to use this version
# if you want to use callbacks.
import pn... | Python |
NULLDEV = 0
BUTOFFSET = 1
VALOFFSET = 256
PSEUDOFFSET = 512
BUT2OFFSET = 3840
TIMOFFSET = 515
XKBDOFFSET = 143
BUTCOUNT = 255
VALCOUNT = 256
TIMCOUNT = 4
XKBDCOUNT = 28
USERBUTOFFSET = 4096
USERVALOFFSET = 12288
USERPSEUDOFFSET = 16384
BUT0 = 1
BUT1 = 2
BUT2 = 3
BUT3 = 4
BUT4 = 5
BUT5 = 6
BUT6 = 7
BUT7 = 8
BUT8 = 9
BUT... | Python |
RATE_48000 = 48000
RATE_44100 = 44100
RATE_32000 = 32000
RATE_22050 = 22050
RATE_16000 = 16000
RATE_11025 = 11025
RATE_8000 = 8000
SAMPFMT_TWOSCOMP= 1
SAMPFMT_FLOAT = 32
SAMPFMT_DOUBLE = 64
SAMPLE_8 = 1
SAMPLE_16 = 2
# SAMPLE_24 is the low 24 bits of a long,... | Python |
# Module 'parser'
#
# Parse S-expressions output by the Panel Editor
# (which is written in Scheme so it can't help writing S-expressions).
#
# See notes at end of file.
whitespace = ' \t\n'
operators = '()\''
separators = operators + whitespace + ';' + '"'
# Tokenize a string.
# Return a list of tokens (strings).
... | Python |
"""A dumb and slow but simple dbm clone.
For database spam, spam.dir contains the index (a text file),
spam.bak *may* contain a backup of the index (also a text file),
while spam.dat contains the data (a binary file).
XXX TO DO:
- seems to contain a bug when updating...
- reclaim free space (currently, space once o... | Python |
"""HTML 2.0 parser.
See the HTML 2.0 specification:
http://www.w3.org/hypertext/WWW/MarkUp/html-spec/html-spec_toc.html
"""
import sgmllib
from formatter import AS_IS
__all__ = ["HTMLParser", "HTMLParseError"]
class HTMLParseError(sgmllib.SGMLParseError):
"""Error raised when an HTML document can't be parsed.... | Python |
"""
opcode module - potentially shared between dis and other modules which
operate on bytecodes (e.g. peephole optimizers).
"""
__all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs",
"haslocal", "hascompare", "hasfree", "opname", "opmap",
"HAVE_ARGUMENT", "EXTENDED_ARG"]
cmp_op = ('<... | Python |
# 'grep'
import regex
from regex_syntax import *
opt_show_where = 0
opt_show_filename = 0
opt_show_lineno = 1
def grep(pat, *files):
return ggrep(RE_SYNTAX_GREP, pat, files)
def egrep(pat, *files):
return ggrep(RE_SYNTAX_EGREP, pat, files)
def emgrep(pat, *files):
return ggrep(RE_SYNTAX_EMACS, pat, fil... | Python |
"""Efficiently compare files, boolean outcome only (equal / not equal).
Tricks (used in this order):
- Files with identical type, size & mtime are assumed to be clones
- Files with different type or size cannot be identical
- We keep a cache of outcomes of earlier comparisons
- We don't fork a process ... | Python |
# A subroutine for extracting a function name from a code object
# (with cache)
import sys
from stat import *
import string
import os
import linecache
# XXX The functions getcodename() and getfuncname() are now obsolete
# XXX as code and function objects now have a name attribute --
# XXX co.co_name and f.func_name.
... | Python |
# Module 'dump'
#
# Print python code that reconstructs a variable.
# This only works in certain cases.
#
# It works fine for:
# - ints and floats (except NaNs and other weird things)
# - strings
# - compounds and lists, provided it works for all their elements
# - imported modules, provided their name is the module na... | Python |
# Module 'rand'
# Don't use unless you want compatibility with C's rand()!
import whrandom
def srand(seed):
whrandom.seed(seed%256, seed/256%256, seed/65536%256)
def rand():
return int(whrandom.random() * 32768.0) % 32768
def choice(seq):
return seq[rand() % len(seq)]
| Python |
"""A class to build directory diff tools on."""
import os
import dircache
import cmpcache
import statcache
from stat import *
class dircmp:
"""Directory comparison class."""
def new(self, a, b):
"""Initialize."""
self.a = a
self.b = b
# Properties that caller may change befor... | Python |
# Print tracebacks, with a dump of local variables.
# Also an interactive stack trace browser.
# Note -- this module is obsolete -- use pdb.pm() instead.
import sys
import os
from stat import *
import linecache
def br(): browser(sys.last_traceback)
def tb(): printtb(sys.last_traceback)
def browser(tb):
if not t... | Python |
from sndhdr import *
| Python |
# Module 'packmail' -- create a self-unpacking shell archive.
# This module works on UNIX and on the Mac; the archives can unpack
# themselves only on UNIX.
import os
from stat import ST_MTIME
# Print help
def help():
print 'All fns have a file open for writing as first parameter'
print 'pack(f, fullname, na... | Python |
"""Efficiently compare files, boolean outcome only (equal / not equal).
Tricks (used in this order):
- Use the statcache module to avoid statting files more than once
- Files with identical type, size & mtime are assumed to be clones
- Files with different type or size cannot be identical
- We keep a c... | Python |
# module 'zmod'
# Compute properties of mathematical "fields" formed by taking
# Z/n (the whole numbers modulo some whole number n) and an
# irreducible polynomial (i.e., a polynomial with only complex zeros),
# e.g., Z/5 and X**2 + 2.
#
# The field is formed by taking all possible linear combinations of
# a set of d ... | Python |
import struct, fcntl
def writelock(f):
_lock(f, fcntl.F_WRLCK)
def readlock(f):
_lock(f, fcntl.F_RDLCK)
def unlock(f):
_lock(f, fcntl.F_UNLCK)
def _lock(f, op):
dummy = fcntl.fcntl(f.fileno(), fcntl.F_SETLKW,
struct.pack('2h8l', op,
0, 0, 0... | Python |
# Module 'util' -- some useful functions that don't fit elsewhere
# NB: These are now built-in functions, but this module is provided
# for compatibility. Don't use in new programs unless you need backward
# compatibility (i.e. need to run with old interpreters).
# Remove an item from a list.
# No complaints if it ... | Python |
import fnmatch
import os
_debug = 0
_prune = ['(*)']
def find(pattern, dir = os.curdir):
list = []
names = os.listdir(dir)
names.sort()
for name in names:
if name in (os.curdir, os.pardir):
continue
fullname = os.path.join(dir, name)
if fnmatch.fnmatch(name, patter... | Python |
# Text formatting abstractions
# Note -- this module is obsolete, it's too slow anyway
# Oft-used type object
Int = type(0)
# Represent a paragraph. This is a list of words with associated
# font and size information, plus indents and justification for the
# entire paragraph.
# Once the words have been added to a ... | Python |
"""New import scheme with package support.
Quick Reference
---------------
- To enable package support, execute "import ni" before importing any
packages. Importing this module automatically installs the relevant
import hooks.
- To create a package named spam containing sub-modules ham, bacon and
eggs, create... | Python |
# This module provides standard support for "packages".
#
# The idea is that large groups of related modules can be placed in
# their own subdirectory, which can be added to the Python search path
# in a relatively easy way.
#
# The current version takes a package name and searches the Python
# search path for a direct... | Python |
# New dir() function
# This should be the new dir(), except that it should still list
# the current local name space by default
def listattrs(x):
try:
dictkeys = x.__dict__.keys()
except (AttributeError, TypeError):
dictkeys = []
#
try:
methods = x.__methods__
except (Attr... | Python |
# Text formatting abstractions
# Note -- this module is obsolete, it's too slow anyway
import string
import Para
# A formatter back-end object has one method that is called by the formatter:
# addpara(p), where p is a paragraph object. For example:
# Formatter back-end to do nothing at all with the paragraphs
cl... | Python |
# module 'poly' -- Polynomials
# A polynomial is represented by a list of coefficients, e.g.,
# [1, 10, 5] represents 1*x**0 + 10*x**1 + 5*x**2 (or 1 + 10x + 5x**2).
# There is no way to suppress internal zeros; trailing zeros are
# taken out by normalize().
def normalize(p): # Strip unnecessary zero coefficients
... | Python |
#! /usr/bin/env python
"""A Python debugger."""
# (See pdb.doc for documentation.)
import sys
import linecache
import cmd
import bdb
from repr import Repr
import os
import re
import pprint
import traceback
# Create a custom safe Repr instance and increase its maxstring.
# The default of 30 truncates error messages t... | Python |
#! /usr/bin/env python
"""Conversions to/from quoted-printable transport encoding as per RFC 1521."""
# (Dec 1991 version).
__all__ = ["encode", "decode", "encodestring", "decodestring"]
ESCAPE = '='
MAXLINESIZE = 76
HEX = '0123456789ABCDEF'
EMPTYSTRING = ''
try:
from binascii import a2b_qp, b2a_qp
except Impo... | Python |
"""Load / save to libwww-perl (LWP) format files.
Actually, the format is slightly extended from that used by LWP's
(libwww-perl's) HTTP::Cookies, to avoid losing some RFC 2965 information
not recorded by LWP.
It uses the version string "2.0", though really there isn't an LWP Cookies
2.0 format. This indicates that ... | Python |
"""Strptime-related classes and functions.
CLASSES:
LocaleTime -- Discovers and stores locale-specific time information
TimeRE -- Creates regexes for pattern matching a string of text containing
time information
FUNCTIONS:
_getlang -- Figure out what language is being used for the locale
... | Python |
"""
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.
Many of these classes are empty and are included only as documentation
of the interfaces.
$Id: handler.py,v ... | Python |
"""\
A library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
"""
import os, urlparse, urllib, types
import handler
import xmlreader
try:
_StringTypes = [types.StringType, types.UnicodeType]
except AttributeError:
_StringTypes = [types.StringType]
# See wh... | Python |
"""Different kinds of SAX Exceptions"""
import sys
if sys.platform[:4] == "java":
from java.lang import Exception
del sys
# ===== SAXEXCEPTION =====
class SAXException(Exception):
"""Encapsulate an XML error or warning. This class can contain
basic error or warning information from either the XML parser o... | Python |
"""
SAX driver for the pyexpat C module. This driver works with
pyexpat.__version__ == '2.22'.
"""
version = "0.20"
from xml.sax._exceptions import *
from xml.sax.handler import feature_validation, feature_namespaces
from xml.sax.handler import feature_namespace_prefixes
from xml.sax.handler import feature_external_... | Python |
"""Simple API for XML (SAX) implementation for Python.
This module provides an implementation of the SAX 2 interface;
information about the Java version of the interface can be found at
http://www.megginson.com/SAX/. The Python version of the interface is
documented at <...>.
This package contains the following modu... | Python |
"""An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. """
import handler
from _exceptions import SAXNotSupportedException, SAXNotRecognizedException
# ===== XMLREADER =====
class XMLReader:
"""Interface for reading an XML document using callbacks.
XMLReader is the... | Python |
"""\
minidom.py -- a lightweight DOM implementation.
parse("foo.xml")
parseString("<foo><bar/></foo>")
Todo:
=====
* convenience methods for getting elements and text.
* more testing
* bring some of the writer and linearizer code into conformance with this
interface
* SAX 2 namespaces
"""
import xml.dom... | Python |
# This is the Python mapping for interface NodeFilter from
# DOM2-Traversal-Range. It contains only constants.
class NodeFilter:
"""
This is the DOM2 NodeFilter interface. It contains only constants.
"""
FILTER_ACCEPT = 1
FILTER_REJECT = 2
FILTER_SKIP = 3
SHOW_ALL = 0x... | Python |
"""Registration facilities for DOM. This module should not be used
directly. Instead, the functions getDOMImplementation and
registerDOMImplementation should be imported from xml.dom."""
from xml.dom.minicompat import * # isinstance, StringTypes
# This is a list of well-known implementations. Well-known names
# sho... | Python |
import xml.sax
import xml.sax.handler
import types
try:
_StringTypes = [types.StringType, types.UnicodeType]
except AttributeError:
_StringTypes = [types.StringType]
START_ELEMENT = "START_ELEMENT"
END_ELEMENT = "END_ELEMENT"
COMMENT = "COMMENT"
START_DOCUMENT = "START_DOCUMENT"
END_DOCUMENT = "END_DOCUMENT"
... | Python |
"""Implementation of the DOM Level 3 'LS-Load' feature."""
import copy
import xml.dom
from xml.dom.minicompat import *
from xml.dom.NodeFilter import NodeFilter
__all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"]
class Options:
"""Features object that has variables set for each DOMBuilder feature... | Python |
"""W3C Document Object Model implementation for Python.
The Python mapping of the Document Object Model is documented in the
Python Library Reference in the section on the xml.dom package.
This package contains the following modules:
minidom -- A simple implementation of the Level 1 DOM with namespace
sup... | Python |
"""Facility to use the Expat parser to load a minidom instance
from a string or file.
This avoids all the overhead of SAX and pulldom to gain performance.
"""
# Warning!
#
# This module is tightly bound to the implementation details of the
# minidom DOM and can't be used with other DOM implementations. This
# is due... | Python |
"""Python version compatibility support for minidom."""
# This module should only be imported using "import *".
#
# The following names are defined:
#
# isinstance -- version of the isinstance() function that accepts
# tuples as the second parameter regardless of the
# Python... | Python |
"""Core XML support for Python.
This package contains three sub-packages:
dom -- The W3C Document Object Model. This supports DOM Level 1 +
Namespaces.
parsers -- Python wrappers for XML parsers (currently only supports Expat).
sax -- The Simple API for XML, developed by XML-Dev, led by David
Meggins... | Python |
"""Interface to the Expat non-validating XML parser."""
__version__ = '$Revision: 1.1 $'
from pyexpat import *
| Python |
"""Python interfaces to XML parsers.
This package contains one module:
expat -- Python wrapper for James Clark's Expat parser, with namespace
support.
"""
| Python |
"""IMAP4 client.
Based on RFC 2060.
Public class: IMAP4
Public variable: Debug
Public functions: Internaldate2tuple
Int2AP
ParseFlags
Time2Internaldate
"""
# Author: Piers Lauder <piers@cs.su.oz.au> December 1997.
#
# Auth... | Python |
""" robotparser.py
Copyright (C) 2000 Bastian Kleineidam
You can choose between two licenses when using this package:
1) GNU GPLv2
2) PSF license for Python 2.2
The robots.txt Exclusion Protocol is implemented as specified in
http://info.webcrawler.com/mak/projects/robots/norobots-rfc.html
"... | Python |
# Author: Fred L. Drake, Jr.
# fdrake@acm.org
#
# This is a simple little module I wrote to make life easier. I didn't
# see anything quite like it in the library, though I may have overlooked
# something. I wrote this when I was trying to read some heavily nested
# tuples with fairly non-desc... | Python |
#
# Secret Labs' Regular Expression Engine
#
# re-compatible interface for the sre matching engine
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# This version of the SRE library can be redistributed under CNRI's
# Python 1.6 license. For any other use, please contact Secret Labs
# AB (info@py... | Python |
"""MH interface -- purely object-oriented (well, almost)
Executive summary:
import mhlib
mh = mhlib.MH() # use default mailbox directory and profile
mh = mhlib.MH(mailbox) # override mailbox location (default from profile)
mh = mhlib.MH(mailbox, profile) # override mailbox and profile
mh.error(format, ...)... | Python |
"""A parser for XML, using the derived class as static DTD."""
# Author: Sjoerd Mullender.
import re
import string
import warnings
warnings.warn("The xmllib module is obsolete. Use xml.sax instead.", DeprecationWarning)
del warnings
version = '0.3'
class Error(RuntimeError):
pass
# Regular expressions used f... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.