Coverage for src/botadi/__init__.py: 33%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

30 statements  

1# -*- coding: utf-8 -*- 

2""" 

3@file 

4@brief Module *botadi*. 

5Experiments around chatbots. 

6""" 

7 

8__version__ = "0.2.78" 

9__author__ = "Xavier Dupré" 

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

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

12__license__ = "MIT License" 

13__blog__ = """ 

14<?xml version="1.0" encoding="UTF-8"?> 

15<opml version="1.0"> 

16 <head> 

17 <title>blog</title> 

18 </head> 

19 <body> 

20 <outline text="botadi" 

21 title="botadi" 

22 type="rss" 

23 xmlUrl="http://www.xavierdupre.fr/app/botadi/helpsphinx/_downloads/rss.xml" 

24 htmlUrl="http://www.xavierdupre.fr/app/botadi/helpsphinx/blog/main_0000.html" /> 

25 </body> 

26</opml> 

27""" 

28 

29 

30def check(log=False): 

31 """ 

32 Checks the library is working. 

33 It raises an exception. 

34 If you want to disable the logs: 

35 

36 @param log if True, display information, otherwise 

37 @return 0 or exception 

38 """ 

39 return True 

40 

41 

42def _setup_hook(use_print=False): 

43 """ 

44 if this function is added to the module, 

45 the help automation and unit tests call it first before 

46 anything goes on as an initialization step. 

47 """ 

48 # we can check many things, needed module 

49 # any others things before unit tests are started 

50 if use_print: 

51 print("Success: _setup_hook") 

52 

53 

54def launch_gui_mokadi(fLOG=None): 

55 """ 

56 Launches tkinter with Mokadi BOT. 

57 """ 

58 try: 

59 import pyquickhelper 

60 except ImportError: 

61 import os 

62 this = os.path.abspath(os.path.dirname(__file__)) 

63 import sys 

64 for mod in ["pyquickhelper", "pymmails", "jyquickhelper"]: 

65 np = os.path.join(this, "..", "..", "..", mod, "src") 

66 sys.path.append(np) 

67 import pyquickhelper 

68 import ensae_teaching_cs # pylint: disable=W0611 

69 

70 if fLOG is None: 

71 import pyquickhelper.loghelper 

72 fLOG = pyquickhelper.loghelper.fLOG 

73 fLOG(OutputPrint=True) 

74 

75 from .mokadi.gui_mokadi import gui_mokadi 

76 gui_mokadi()