Fixed up docs

This commit is contained in:
Sandy Walsh 2014-05-28 03:42:44 +00:00
parent 9172a03a3e
commit 1b705badd2
2 changed files with 14 additions and 6 deletions

View File

@ -14,10 +14,14 @@ Using Simport
# For modules already in the Python Path
function = simport.load('mymodule.myfunction')
class_method = simport.load('mymodule:MyClass.mymethod')
klass = simport.load('mymodule:MyClass') # uninstanstiated.
# For modules not in the Python Path
function = simport.load('/path/to/file|module_name:myfunction')
class_method = simport.load('/path/to/module|module_name:MyClass.mymethod')
function = simport.load('/path/to/dir|module_name:myfunction')
class_method = simport.load('/path/to/dir|module_name:MyClass.mymethod')
Look at the tests for some interesting naming conventions for
specifying relative modules, etc.
Running Tests
=============

View File

@ -44,15 +44,19 @@ def _get_module(target):
Accepts these formats:
".../file/path|module_name:Class.method"
".../file/path|module_name:Class"
".../file/path|module_name:function"
"module_name:Class"
"module_name:function"
"module_name:Class.function"
If a fully qualified file is specified, it implies the
file is not already on the Python Path, in which case
If a fully qualified directory is specified, it implies the
directory is not already on the Python Path, in which case
it will be added.
For example, if I import /home/foo/my_code.py (and
For example, if I import /home/foo (and
/home/foo is not in the python path) as
"/home/foo/my_code.py|mycode:MyClass.mymethod"
"/home/foo|mycode:MyClass.mymethod"
then /home/foo will be added to the python path and
the module loaded as normal.
"""