Welcome to MkDocs
For full documentation visit mkdocs.org.
Commands
mkdocs new [dir-name] - Create a new project.
mkdocs serve - Start the live-reloading docs server.
mkdocs build - Build the documentation site.
mkdocs -h - Print help message and exit.
Project layout
mkdocs.yml # The configuration file.
docs/
index.md # The documentation homepage.
... # Other markdown pages, images and other files.
Entry point for the codesmith package, defines the IPython magic functions.
codesmith(line='', cell=None, local_ns=None)
Defines line and cell magic functions %codesmith and %%codesmith
(respectively). local_ns should be set by IPython
Source code in codesmith/__init__.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66 | @register_line_cell_magic
@needs_local_scope
def codesmith(line='', cell=None, local_ns=None):
""" Defines line and cell magic functions %codesmith and %%codesmith
(respectively). local_ns *should* be set by IPython """
global_ns = get_ipython().user_ns
if local_ns is None: local_ns = global_ns
verbose = debug = False
p = py.cell # Default language is python (py), and entry point is py.cell
line += ' ' # Need spaces at end for cell magic argument parsing
# Parse the arguments to (%)%codesmith, each starts with '-'
while line[0] == '-':
first_space = line.index(' ')
arg = line[1:first_space]
line = line[first_space+1:]
if arg == 'v': verbose = True
elif arg == 'vd': verbose = debug = True
else:
if verbose: print(f"parser:>>{arg}<<")
import builtins
p = builtins.eval(arg, local_ns)
if verbose: print(p)
if verbose: print(f"line:>>{line}<<")
if not cell: cell = line
readout = p.read(cell, verbose=verbose)
if verbose: print("output of read_", readout, type(readout))
try:
evalout = eval_(readout, global_ns, local_ns, debug)
if verbose: print("output of eval_", evalout, type(evalout))
if evalout: display(evalout)
except Exception as e:
display(e)
return None
|
reload()
For active development: reloads this module and all submodules
Source code in codesmith/__init__.py
| def reload():
"""For active development: reloads this module and all submodules"""
package_name = 'codesmith'
import importlib
for k,v in list(sys.modules.items()):
if k.startswith(package_name): importlib.reload(v)
|