Hide keyboard shortcuts

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 *pyensae*. 

5Recurrent needs for teachings 

6turned into functions. 

7""" 

8__version__ = "1.3.934" 

9__author__ = "Xavier Dupré" 

10__github__ = "https://github.com/sdpython/pyensae" 

11__url__ = "http://www.xavierdupre.fr/app/pyensae/helpsphinx/index.html" 

12__license__ = "MIT License" 

13 

14 

15def _setup_hook(add_print=False, unit_test=False): 

16 """ 

17 if this function is added to the module, 

18 the help automation and unit tests call it first before 

19 anything goes on as an initialization step. 

20 It should be run in a separate process. 

21 

22 @param add_print print *Success: _setup_hook* 

23 @param unit_test used only for unit testing purpose 

24 """ 

25 # we can check many things, needed module 

26 # any others things before unit tests are started 

27 if add_print: # pragma: no cover 

28 print("Success: _setup_hook") 

29 

30 

31def check(log=False): 

32 """ 

33 Checks the library is working. 

34 It raises an exception. 

35 

36 @param log if True, display information, otherwise 

37 @return 0 or exception 

38 

39 .. faqref:: 

40 :title: Installation issue 

41 

42 If the installation fails because of a *SyntaxError* 

43 

44 :: 

45 

46 Collecting pyensae 

47 Using cached pyensae-1.1.302.tar.gz 

48 Complete output from command python setup.py egg_info: 

49 Traceback (most recent call last): 

50 File "<string>", line 20, in <module> 

51 File "/private/var/folders/qv/something/T/pip-build-xxxx/pyensae/setup.py", line 98 

52 raise ImportError(message) from e 

53 ^ 

54 SyntaxError: invalid syntax 

55 

56 It probably means you are trying to install *pyensae* on Python 2.7 

57 instead of using Python 3. 

58 """ 

59 return True 

60 

61 

62def load_ipython_extension(ip): # pragma: no cover 

63 """ 

64 to allow the call ``%load_ext pyensae`` 

65 

66 @param ip from ``get_ipython()`` 

67 """ 

68 from .sql.magic_sql import register_sql_magics 

69 from .filehelper.magic_file import register_file_magics 

70 from .graphhelper.magic_graph import register_graph_magics 

71 from .notebookhelper.magic_notebook import register_notebook_magics 

72 

73 register_sql_magics(ip) 

74 register_file_magics(ip) 

75 register_graph_magics(ip) 

76 register_notebook_magics(ip)