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

5Recurrent needs for teachings 

6turned into functions. 

7""" 

8import sys 

9 

10 

11__version__ = "1.3.78" 

12__author__ = "Xavier Dupré" 

13__github__ = "https://github.com/sdpython/pyenbc" 

14__url__ = "http://www.xavierdupre.fr/app/pyenbc/helpsphinx/index.html" 

15__license__ = "MIT License" 

16 

17 

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

19 """ 

20 if this function is added to the module, 

21 the help automation and unit tests call it first before 

22 anything goes on as an initialization step. 

23 It should be run in a separate process. 

24 

25 @param add_print print *Success: _setup_hook* 

26 @param unit_test used only for unit testing purpose 

27 """ 

28 # we can check many things, needed module 

29 # any others things before unit tests are started 

30 if add_print: 

31 print("Success: _setup_hook") 

32 

33 

34def check(log=False): 

35 """ 

36 Checks the library is working. 

37 It raises an exception. 

38 

39 @param log if True, display information, otherwise 

40 @return 0 or exception 

41 """ 

42 return True 

43 

44 

45def load_ipython_extension(ip): 

46 """ 

47 to allow the call ``%load_ext pyenbc`` 

48 

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

50 """ 

51 from .remote.magic_remote_ssh import register_magics_ssh 

52 try: 

53 from .remote.magic_azure import register_azure_magics 

54 az = True 

55 except ImportError as e: 

56 if "azure" in str(e): 

57 az = False 

58 else: 

59 raise e 

60 

61 register_magics_ssh(ip) 

62 if az: 

63 register_azure_magics(ip)