Coverage for pyquickhelper/_cst/cst_sphinx.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-03 02:21 +0200

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

2""" 

3@file 

4@brief Default values for the Sphinx configuration. 

5""" 

6import sys 

7 

8 

9def latex_preamble(): 

10 """ 

11 Default latex preamble. 

12 """ 

13 preamble = ''' 

14 %% addition by pyquickhelper(1) %% 

15 \\usepackage{etex} 

16 \\usepackage{fixltx2e} % LaTeX patches, \\textsubscript 

17 \\usepackage{cmap} % fix search and cut-and-paste in Acrobat 

18 \\usepackage[raccourcis]{fast-diagram} 

19 \\usepackage{titlesec} 

20 \\usepackage{amsmath} 

21 \\usepackage{amssymb} 

22 \\usepackage{amsfonts} 

23 \\usepackage{graphics} 

24 \\usepackage{epic} 

25 \\usepackage{eepic} 

26 \\usepackage{media9} 

27 %\\usepackage{pict2e} 

28 %%% Redefined titleformat 

29 \\setlength{\\parindent}{0cm} 

30 \\setlength{\\parskip}{1ex plus 0.5ex minus 0.2ex} 

31 \\newcommand{\\hsp}{\\hspace{20pt}} 

32 \\newcommand{\\acc}[1]{\\left\\{#1\\right\\}} 

33 \\newcommand{\\cro}[1]{\\left[#1\\right]} 

34 \\newcommand{\\pa}[1]{\\left(#1\\right)} 

35 \\newcommand{\\R}{\\mathbb{R}} 

36 \\newcommand{\\HRule}{\\rule{\\linewidth}{0.5mm}} 

37 %\\titleformat{\\chapter}[hang]{\\Huge\\bfseries\\sffamily}{\\thechapter\\hsp}{0pt}{\\Huge\\bfseries\\sffamily} 

38 

39 \\renewcommand{\\Verbatim}[1][1]{% 

40 \\bgroup\\parskip=0pt% 

41 \\smallskip% 

42 \\list{}{% 

43 \\setlength\\parskip{0pt}% 

44 \\setlength\\itemsep{0ex}% 

45 \\setlength\\topsep{0ex}% 

46 \\setlength\\partopsep{0pt}% 

47 \\setlength\\leftmargin{10pt}% 

48 }% 

49 \\item\\MakeFramed{\\FrameRestore}% 

50 \\tiny 

51 \\OriginalVerbatim[#1]% 

52 %% addition by pyquickhelper(1) %% 

53 } 

54 '''.replace(" ", "") 

55 return preamble 

56 

57 

58def get_epkg_dictionary(): 

59 """ 

60 Returns default dictionary for extension @see fn epkg_role. 

61 """ 

62 epkg_dictionary = { 

63 '7z': "https://www.7-zip.org/", 

64 'ASCII': "https://en.wikipedia.org/wiki/ASCII", 

65 'Anaconda': 'https://continuum.io/downloads', 

66 'appveyor': 'https://www.appveyor.com/', 

67 'autopep8': 'https://github.com/hhatto/autopep8', 

68 'azure pipeline': 'https://azure.microsoft.com/en-us/services/devops/pipelines/', 

69 'azure pipelines': 'https://azure.microsoft.com/en-us/services/devops/pipelines/', 

70 'Azure Pipelines': 'https://azure.microsoft.com/en-us/services/devops/pipelines/', 

71 'bokeh': 'https://bokeh.pydata.org/en/latest/', 

72 'builderapi': 'https://www.sphinx-doc.org/en/master/extdev/builderapi.html', 

73 'bz2': 'https://en.wikipedia.org/wiki/Bzip2', 

74 'cairosvg': 'https://github.com/Kozea/CairoSVG', 

75 'chrome': 'https://www.google.com/chrome/', 

76 'class Sphinx': 'https://github.com/sphinx-doc/sphinx/blob/master/sphinx/application.py#L107', 

77 'circleci': 'https://circleci.com/', 

78 'codecov': 'https://codecov.io/', 

79 'conda': 'https://github.com/conda/conda', 

80 'coverage': 'https://pypi.org/project/coverage', 

81 'cryptography': 'https://cryptography.readthedocs.org/', 

82 'cssselect2': 'https://cssselect2.readthedocs.io/en/latest/', 

83 'C++': 'https://en.wikipedia.org/wiki/C%2B%2B', 

84 'Cython': 'https://cython.org/', 

85 'dataframe': 'https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html', 

86 'datetime': 'https://docs.python.org/3/library/datetime.html#datetime-objects', 

87 'docx': 'https://en.wikipedia.org/wiki/Office_Open_XML', 

88 'DOT': 'https://www.graphviz.org/doc/info/lang.html', 

89 'doxygen': 'https://www.doxygen.org/', 

90 'django': 'https://www.djangoproject.com/', 

91 'docutils': 'https://docutils.sourceforge.net/', 

92 'dvipng': 'https://ctan.org/pkg/dvipng?lang=en', 

93 'FastAPI': 'https://fastapi.tiangolo.com/', 

94 'format style': 'https://pyformat.info/>`_', 

95 'FTP': 'https://en.wikipedia.org/wiki/File_Transfer_Protocol', 

96 'getsitepackages': 'https://docs.python.org/3/library/site.html#site.getsitepackages', 

97 'GIT': 'https://git-scm.com/', 

98 'git': 'https://git-scm.com/', 

99 'Git': 'https://git-scm.com/', 

100 'github': 'https://github.com/', 

101 'GitHub': 'https://github.com/', 

102 'graphviz': 'https://www.graphviz.org/', 

103 'GraphViz': 'https://www.graphviz.org/', 

104 'Graphviz': 'https://www.graphviz.org/', 

105 'html': 'https://en.wikipedia.org/wiki/HTML', 

106 'HTML': 'https://en.wikipedia.org/wiki/HTML', 

107 'imgmath': 'https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.imgmath', 

108 'img2pdf': 'https://gitlab.mister-muffin.de/josch/img2pdf', 

109 'Inkscape': 'https://inkscape.org/', 

110 'InkScape': 'https://inkscape.org/', 

111 'IPython': 'https://en.wikipedia.org/wiki/IPython', 

112 'Java': 'https://www.java.com/fr/download/', 

113 'javascript': 'https://en.wikipedia.org/wiki/JavaScript', 

114 'Jenkins': 'https://jenkins-ci.org/', 

115 'Jenkins API': 'https://python-jenkins.readthedocs.org/en/latest/api.html', 

116 'jinja2': 'https://jinja.pocoo.org/docs/', 

117 'js2py': 'https://github.com/PiotrDabkowski/Js2Py', 

118 'json': 'https://docs.python.org/3/library/json.html', 

119 'JSON': 'https://en.wikipedia.org/wiki/JSON', 

120 'Jupyter': 'https://jupyter.org/', 

121 'jupyter': 'https://jupyter.org/', 

122 'JupyterLab': 'https://jupyterlab.readthedocs.io/en/stable/', 

123 'Jupyter Lab': 'https://jupyterlab.readthedocs.io/en/stable/', 

124 'jupyter_sphinx': 'https://jupyter-sphinx.readthedocs.io/en/latest/index.html', 

125 'keyring': 'https://github.com/jaraco/keyring', 

126 'keyrings.cryptfile': 'https://github.com/frispete/keyrings.cryptfile', 

127 'latex': 'https://en.wikipedia.org/wiki/LaTeX', 

128 'LaTeX': 'https://en.wikipedia.org/wiki/LaTeX', 

129 'LaTex': 'https://en.wikipedia.org/wiki/LaTeX', 

130 'Latex': 'https://en.wikipedia.org/wiki/LaTeX', 

131 'Linux': 'https://en.wikipedia.org/wiki/Linux', 

132 'linux': 'https://en.wikipedia.org/wiki/Linux', 

133 'mako': 'https://www.makotemplates.org/', 

134 "matplotlib": "https://matplotlib.org/index.html", 

135 'Markdown': 'https://en.wikipedia.org/wiki/Markdown', 

136 'markdown': 'https://en.wikipedia.org/wiki/Markdown', 

137 'mathjax': 'https://www.mathjax.org/', 

138 'MD': 'https://en.wikipedia.org/wiki/Markdown', 

139 'md': 'https://en.wikipedia.org/wiki/Markdown', 

140 'mistune': 'https://pypi.org/project/mistune', 

141 'MiKTeX': 'https://miktex.org/', 

142 'Miktex': 'https://miktex.org/', 

143 'miktex': 'https://miktex.org/', 

144 'MinGW': 'https://www.mingw.org/', 

145 'MyBinder': 'https://gke.mybinder.org/', 

146 'nbconvert': 'https://nbconvert.readthedocs.io/en/latest/', 

147 'nbpresent': 'https://github.com/Anaconda-Platform/nbpresent', 

148 'node.js': 'https://nodejs.org/en/', 

149 'notebook': 'https://jupyter-notebook.readthedocs.io/', 

150 'nose': 'https://pypi.org/project/nose', 

151 'npm': 'https://www.npmjs.com/', 

152 'numpy': ('https://www.numpy.org/', 

153 ('https://docs.scipy.org/doc/numpy/reference/generated/numpy.{0}.html', 1), 

154 ('https://docs.scipy.org/doc/numpy/reference/generated/numpy.{0}.{1}.html', 2)), 

155 'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', 

156 ('https://pandas.pydata.org/pandas-docs/stable/generated/pandas.{0}.html', 1), 

157 ('https://pandas.pydata.org/pandas-docs/stable/generated/pandas.{0}.{1}.html', 2)), 

158 'pandoc': 'https://johnmacfarlane.net/pandoc/', 

159 'Pandoc': 'https://johnmacfarlane.net/pandoc/', 

160 'paramiko': 'https://www.paramiko.org/', 

161 'pdf': 'https://en.wikipedia.org/wiki/Portable_Document_Format', 

162 'pep8': 'https://www.python.org/dev/peps/pep-0008/', 

163 'PEP8': 'https://www.python.org/dev/peps/pep-0008/', 

164 "PEP8 codes": 'https://pep8.readthedocs.io/en/latest/intro.html#error-codes', 

165 'Pillow': 'https://pillow.readthedocs.io/', 

166 'PIL': 'https://pillow.readthedocs.io/', 

167 'pip': 'https://pip.pypa.io/en/stable/', 

168 'png': 'https://fr.wikipedia.org/wiki/Portable_Network_Graphics', 

169 'PNG': 'https://fr.wikipedia.org/wiki/Portable_Network_Graphics', 

170 'pycodestyle': 'https://pycodestyle.readthedocs.io/', 

171 'pycrypto': 'https://pypi.org/project/pycrypto', 

172 'pycryptodome': 'https://pypi.org/project/pycryptodome/', 

173 'pycryptodomex': 'https://pypi.org/project/pycryptodomex/', 

174 'pyformat.info': 'https://pyformat.info/>`_', 

175 'pygments': 'https://pygments.org/', 

176 'pyinstrument': 'https://github.com/joerick/pyinstrument', 

177 'pylzma': 'https://pypi.org/project/pylzma', 

178 'pylint': 'https://www.pylint.org/', 

179 'pylint error codes': 'https://pylint-messages.wikidot.com/all-codes', 

180 'pypi': 'https://pypi.org/project/', 

181 'PyPI': 'https://pypi.org/project/', 

182 'pysftp': 'https://pysftp.readthedocs.io/', 

183 'pytest': 'https://docs.pytest.org/en/latest/', 

184 'python': 'https://www.python.org/', 

185 'Python': 'https://www.python.org/', 

186 'python-jenkins': 'https://python-jenkins.readthedocs.org/en/latest/', 

187 'pywin32': 'https://sourceforge.net/projects/pywin32/', 

188 'REST': 'https://en.wikipedia.org/wiki/Representational_state_transfer', 

189 'reveal.js': 'https://github.com/hakimel/reveal.js/releases', 

190 'rst': 'https://en.wikipedia.org/wiki/ReStructuredText', 

191 'RST': 'https://en.wikipedia.org/wiki/ReStructuredText', 

192 'scikit-learn': 'https://scikit-learn.org/', 

193 'SciTe': 'https://www.scintilla.org/SciTE.html', 

194 'sklearn': ('https://scikit-learn.org/stable/', 

195 ('https://scikit-learn.org/stable/modules/generated/{0}.html', 1), 

196 ('https://scikit-learn.org/stable/modules/generated/{0}.{1}.html', 2)), 

197 'scipy': ('https://www.scipy.org/', 

198 ('https://docs.scipy.org/doc/scipy/reference/generated/scipy.{0}.html', 1), 

199 ('https://docs.scipy.org/doc/scipy/reference/generated/scipy.{0}.{1}.html', 2)), 

200 'SFTP': 'https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol', 

201 'sphinx': 'https://www.sphinx-doc.org/en/master/', 

202 'Sphinx': 'https://www.sphinx-doc.org/en/master/', 

203 'sphinx.ext.autodoc': 'https://www.sphinx-doc.org/en/master/ext/autodoc.html#module-sphinx.ext.autodoc', 

204 'sphinx.ext.intersphinx': 'https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html', 

205 'sphinx-gallery': 'https://sphinx-gallery.readthedocs.io/en/latest/', 

206 'Sphinx application': 'https://www.sphinx-doc.org/en/master/_modules/sphinx/application.html', 

207 'svg': 'https://fr.wikipedia.org/wiki/Scalable_Vector_Graphics', 

208 'SVG': 'https://fr.wikipedia.org/wiki/Scalable_Vector_Graphics', 

209 'SVN': 'https://subversion.apache.org/', 

210 'svn': 'https://subversion.apache.org/', 

211 'tar.gz': 'https://en.wikipedia.org/wiki/Tar_(computing)', 

212 'toctree': 'https://www.sphinx-doc.org/en/master/markup/toctree.html', 

213 'TexnicCenter': 'https://www.texniccenter.org/', 

214 'tinycss2': 'https://pythonhosted.org/tinycss2/', 

215 'tkinter': 'https://docs.python.org/3/library/tkinter.html', 

216 'tornado': 'https://www.tornadoweb.org/en/stable/', 

217 'TortoiseSVN': 'https://tortoisesvn.net/', 

218 'travis': 'https://travis-ci.com/', 

219 'uvicorn': 'https://www.uvicorn.org/', 

220 'vis.js': 'https://visjs.org/', 

221 'viz.js': 'https://github.com/mdaines/viz.js/', 

222 'Visual Studio Community Edition 2015': 'https://imagine.microsoft.com/en-us/Catalog/Product/101', 

223 'Windows': 'https://en.wikipedia.org/wiki/Microsoft_Windows', 

224 'xml': 'https://docs.python.org/3/library/xml.etree.elementtree.html#module-xml.etree.ElementTree', 

225 'yaml': 'https://en.wikipedia.org/wiki/YAML', 

226 'YAML': 'https://en.wikipedia.org/wiki/YAML', 

227 'yml': 'https://en.wikipedia.org/wiki/YAML', 

228 'zip': 'https://en.wikipedia.org/wiki/Zip_(file_format)', 

229 '*py': ('https://docs.python.org/3/', 

230 ('https://docs.python.org/3/library/{0}.html', 1), 

231 ('https://docs.python.org/3/library/{0}.html#{0}.{1}', 2), 

232 ('https://docs.python.org/3/library/{0}.html#{0}.{1}.{2}', 3)), 

233 '*pyf': (('https://docs.python.org/3/library/functions.html#{0}', 1),), 

234 # Custom. 

235 'jyquickhelper': 'http://www.xavierdupre.fr/app/jyquickhelper/helpsphinx/index.html', 

236 'pymyinstall': 'http://www.xavierdupre.fr/app/pymyinstall/helpsphinx/index.html', 

237 'pyquickhelper': 'http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/index.html', 

238 'pyrsslocal': 'http://www.xavierdupre.fr/app/pyrsslocal/helpsphinx/index.html', 

239 'tkinterquickhelper': 'http://www.xavierdupre.fr/app/tkinterquickhelper/helpsphinx/index.html', 

240 # Specific. 

241 'datetime.datetime.strptime': 'https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior', 

242 } 

243 return epkg_dictionary 

244 

245 

246def get_intersphinx_mapping(): 

247 """ 

248 Returns default dictionary 

249 for extension :epkg:`sphinx.ext.intersphinx`. 

250 """ 

251 return { 

252 'cpyquickhelper': ( 

253 'http://www.xavierdupre.fr/app/cpyquickhelper/helpsphinx/', None), 

254 'joblib': ('https://joblib.readthedocs.io/en/latest/', None), 

255 'jyquickhelper': ( 

256 'http://www.xavierdupre.fr/app/jyquickhelper/helpsphinx/', None), 

257 'matplotlib': ('https://matplotlib.org/', None), 

258 'numpy': ('https://docs.scipy.org/doc/numpy/', None), 

259 'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None), 

260 'pyquickhelper': ( 

261 'http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/', None), 

262 'python': ( 

263 f'https://docs.python.org/{sys.version_info.major}', 

264 None), 

265 'scikit-learn': ('https://scikit-learn.org/stable/', None), 

266 'scipy': ('https://docs.scipy.org/doc/scipy/reference', None), 

267 'sklearn': ('https://scikit-learn.org/stable/', None) 

268 }