Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# -*- coding: utf-8 -*-
2"""
3@file
4@brief Module *pyquickhelper*.
5Helpers to produce documentation, test notebooks, walk through files,
6sphinx extension, jenkins helpers...
7"""
9__version__ = "1.10.3658"
10__author__ = "Xavier Dupré"
11__github__ = "https://github.com/sdpython/pyquickhelper"
12__url__ = "http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/index.html"
13__license__ = "MIT License"
14__blog__ = """
15<?xml version="1.0" encoding="UTF-8"?>
16<opml version="1.0">
17 <head>
18 <title>blog</title>
19 </head>
20 <body>
21 <outline text="pyquickhelper"
22 title="pyquickhelper"
23 type="rss"
24 xmlUrl="http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/_downloads/rss.xml"
25 htmlUrl="http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/blog/main_0000.html" />
26 </body>
27</opml>
28"""
31def check():
32 """
33 Checks the library is working.
34 It raises an exception if it does not.
36 @return boolean
37 """
38 from .loghelper import check_log
39 check_log()
40 return True
43def _setup_hook(add_print=False, unit_test=False):
44 """
45 if this function is added to the module,
46 the help automation and unit tests call it first before
47 anything goes on as an initialization step.
48 It should be run in a separate process.
50 @param add_print print *Success: _setup_hook*
51 @param unit_test used only for unit testing purpose
52 """
53 # it can check many things, needed module
54 # any others things before unit tests are started
55 if add_print:
56 print("Success: _setup_hook") # pragma: no cover
59def load_ipython_extension(ip): # pragma: no cover
60 """
61 to allow the call ``%load_ext pyquickhelper``
63 @param ip from ``get_ipython()``
64 """
65 from .ipythonhelper.magic_class_example import register_file_magics as freg
66 freg(ip)
67 from .ipythonhelper.magic_class_compress import register_file_magics as creg
68 creg(ip)
69 from .ipythonhelper.magic_class_diff import register_file_magics as dreg
70 dreg(ip)
71 from .ipythonhelper.magic_class_crypt import register_file_magics as ereg
72 ereg(ip)
75def get_fLOG(log=True):
76 """
77 return a logging function
79 @param log True, return @see fn fLOG, otherwise @see fn noLOG
80 @return function
81 """
82 if log:
83 from .loghelper import fLOG
84 return fLOG
85 else:
86 from .loghelper import noLOG
87 return noLOG
90def get_insetup_functions():
91 """
92 Returns function used when a module includes C++ parts.
94 @return tuple of functions
95 """
96 from .pycode.insetup_helper import must_build, run_build_ext
97 return must_build, run_build_ext