Trees | Index | Help |
|
---|
Package logilab :: Package common :: Module modutils |
|
Python modules manipulation utility functions.
Version:
$Revision: 1.2 $
Author:
Logilab
Contact:
http://www.logilab.fr/ -- mailto:python-projects@logilab.org
Copyright:
2003-2005 LOGILAB S.A. (Paris, FRANCE)
Exceptions | |
---|---|
NoSourceFile |
exception raised when we are not able to get a python source file for a precompiled file |
Function Summary | |
---|---|
str or None |
given a mod path (ie splited module / package name), return the corresponding file, giving priority to source file over precompiled file if it exists |
list |
given a package directory return a list of all available python module's files in the package and its subpackages |
str or None |
given a dotted name return the module part of the name : |
list |
given a package directory return a list of all available python modules in the package and its subpackages |
str |
given a python module's file name return the matching source file name (the filename will be returned identically if it's a already an absolute path to a python source file...) |
rtype: bool return: True if the filename is a python source file | |
bool |
return true if the given module name is relative to the given file name |
bool |
try to guess if a module is a standard python module (by default, see std_path parameter's description) |
module |
load a python module from it's splitted name |
module |
load a Python module from it's name |
module |
load a python module from it's splitted name |
list(str) |
given a file path return the corresponding splitted module's name (i.e name of a module or package splitted on '.') |
given a mod path (ie splited module / package name), return the corresponding file | |
if the given directory has a valid __init__ file, return its path, else return None | |
return true if the given filename should be considered as a python file | |
tuple(int, str) |
get a module type / file path |
Variable Summary | |
---|---|
str |
__revision__ = '$Id: modutils.py,v 1.47 2005/04/07 15:42...
|
dict |
BUILTIN_MODULES : dictionary with builtin module names has key |
tuple(str) |
PY_SOURCE_EXTS : list of possible python source file extension |
str |
STD_LIB_DIR : directory where standard modules are located |
Function Details |
---|
file_from_modpath(modpath, path=None, context_file=None)given a mod path (ie splited module / package name), return the corresponding file, giving priority to source file over precompiled file if it exists
|
get_module_files(src_directory, blacklist=('CVS', '.svn', 'debian'))given a package directory return a list of all available python module's files in the package and its subpackages
|
get_module_part(dotted_name, context_file=None)given a dotted name return the module part of the name : >>> get_module_part('logilab.common.modutils.get_module_part') 'logilab.common.modutils'
|
get_modules(package, src_directory, blacklist=('CVS', '.svn', 'debian'))given a package directory return a list of all available python modules in the package and its subpackages
|
get_source_file(filename, include_no_ext=False)given a python module's file name return the matching source file name (the filename will be returned identically if it's a already an absolute path to a python source file...)
|
is_python_source(filename)rtype: bool return: True if the filename is a python source file |
is_relative(modname, from_file)return true if the given module name is relative to the given file name
|
is_standard_module(modname, std_path=('/usr/lib/python2.3',))try to guess if a module is a standard python module (by default,
see
|
load_module_from_modpath(parts, path=None, use_sys=1, _prefix=None)load a python module from it's splitted name
|
load_module_from_name(dotted_name, path=None, use_sys=1)load a Python module from it's name
|
load_module_from_parts(parts, path=None, use_sys=1, _prefix=None)load a python module from it's splitted name
|
modpath_from_file(filename)given a file path return the corresponding splitted module's name (i.e name of a module or package splitted on '.')
|
_file_from_modpath(modpath, path=None, context=None)given a mod path (ie splited module / package name), return the corresponding file this function is used internally, see |
_has_init(directory)if the given directory has a valid __init__ file, return its path, else return None |
_is_python_file(filename)return true if the given filename should be considered as a python file .pyc and .pyo are ignored |
_module_file(modpath, path=None)get a module type / file path
|
Variable Details |
---|
__revision__
|
BUILTIN_MODULESdictionary with builtin module names has key
|
PY_SOURCE_EXTSlist of possible python source file extension
|
STD_LIB_DIRdirectory where standard modules are located
|
Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Thu Apr 14 11:37:32 2005 | http://epydoc.sf.net |