Vega strike Python Modules doc
0.5.1
Documentation of the " Modules " folder of Vega strike
|
Data Structures | |
class | MimeTypes |
Functions | |
def | guess_type |
def | guess_extension |
def | init |
def | read_mime_types |
def | usage |
Variables | |
list | __all__ = ["guess_type","guess_extension","read_mime_types","init"] |
list | knownfiles |
int | inited = 0 |
dictionary | suffix_map |
dictionary | encodings_map |
dictionary | types_map |
dictionary | common_types |
string | USAGE |
int | strict = 1 |
int | extension = 0 |
tuple | guess = guess_extension(gtype, strict) |
Guess the MIME type of a file. This module defines two useful functions: guess_type(url, strict=1) -- guess the MIME type and encoding of a URL. guess_extension(type, strict=1) -- guess the extension for a given MIME type. It also contains the following, for tuning the behavior: Data: knownfiles -- list of files to parse inited -- flag set when init() has been called suffix_map -- dictionary mapping suffixes to suffixes encodings_map -- dictionary mapping suffixes to encodings types_map -- dictionary mapping suffixes to types Functions: init([files]) -- parse a list of files, default knownfiles read_mime_types(file) -- parse one file, return a dictionary or None
def mimetypes.guess_extension | ( | 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 191 of file mimetypes.py.
References init().
def mimetypes.guess_type | ( | 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 169 of file mimetypes.py.
References init().
def mimetypes.init | ( | files = None ) |
def mimetypes.read_mime_types | ( | file) |
def mimetypes.usage | ( | code, | |
msg = '' |
|||
) |
Definition at line 407 of file mimetypes.py.
References getopt.getopt().
list __all__ = ["guess_type","guess_extension","read_mime_types","init"] |
Definition at line 29 of file mimetypes.py.
dictionary common_types |
Definition at line 379 of file mimetypes.py.
dictionary encodings_map |
Definition at line 242 of file mimetypes.py.
int extension = 0 |
Definition at line 419 of file mimetypes.py.
tuple guess = guess_extension(gtype, strict) |
Definition at line 429 of file mimetypes.py.
int inited = 0 |
Definition at line 38 of file mimetypes.py.
list knownfiles |
Definition at line 31 of file mimetypes.py.
int strict = 1 |
Definition at line 418 of file mimetypes.py.
dictionary suffix_map |
Definition at line 236 of file mimetypes.py.
dictionary types_map |
Definition at line 252 of file mimetypes.py.
string USAGE |
Definition at line 395 of file mimetypes.py.