Vega strike Python Modules doc
0.5.1
Documentation of the " Modules " folder of Vega strike
|
Public Member Functions | |
def | __init__ |
def | guess_type |
def | guess_extension |
def | read |
def | readfp |
Data Fields | |
encodings_map | |
suffix_map | |
types_map | |
common_types | |
MIME-types datastore. This datastore can handle information from mime.types-style files and supports basic determination of MIME type from a filename or URL, and can guess a reasonable extension given a MIME type.
Definition at line 41 of file mimetypes.py.
def __init__ | ( | self, | |
filenames = () |
|||
) |
def guess_extension | ( | self, | |
type, | |||
strict = 1 |
|||
) |
Guess the extension for a file based on its MIME type. Return value is a string giving a filename extension, including the leading dot ('.'). The extension is not guaranteed to have been associated with any particular data stream, but would be mapped to the MIME type `type' by guess_type(). If no extension can be guessed for `type', None is returned. Optional `strict' argument when false adds a bunch of commonly found, but non-standard types.
Definition at line 121 of file mimetypes.py.
def guess_type | ( | self, | |
url, | |||
strict = 1 |
|||
) |
Guess the type of a file based on its URL. Return value is a tuple (type, encoding) where type is None if the type can't be guessed (no or unknown suffix) or a string of the form type/subtype, usable for a MIME Content-type header; and encoding is None for no encoding or the name of the program used to encode (e.g. compress or gzip). The mappings are table driven. Encoding suffixes are case sensitive; type suffixes are first tried case sensitive, then case insensitive. The suffixes .tgz, .taz and .tz (case sensitive!) are all mapped to '.tar.gz'. (This is table-driven too, using the dictionary suffix_map.) Optional `strict' argument when false adds a bunch of commonly found, but non-standard types.
Definition at line 59 of file mimetypes.py.
References MimeTypes.common_types, MimeTypes.encodings_map, posixpath.splitext(), urllib.splittype(), MimeTypes.suffix_map, and MimeTypes.types_map.
def read | ( | self, | |
filename | |||
) |
Read a single mime.types-format file, specified by pathname.
Definition at line 144 of file mimetypes.py.
References aifc.open(), MimeTypes.readfp(), and ConfigParser.readfp().
def readfp | ( | self, | |
fp | |||
) |
Read a single mime.types-format file.
Definition at line 150 of file mimetypes.py.
References MimeTypes.types_map.
common_types |
Definition at line 55 of file mimetypes.py.
encodings_map |
Definition at line 52 of file mimetypes.py.
suffix_map |
Definition at line 53 of file mimetypes.py.
types_map |
Definition at line 54 of file mimetypes.py.