Debian Codegraph @

tests/trb_tamil.py

raw symbols SCIP
1 """Creates a version of traceback_ta.rst to insert in the documentation.
2 """
3
4 # When creating a new translation, you need to:
5 # 1. Make a copy of this file
6 # 2. Change the value of LANG as well as 'intro_text' so that they reflect the
7 # appropriate language
8 # 3. Change the first line of this file so that the name of the rst file
9 # is correct!
10
11
12 import os
13 import sys
14 import platform
15 this_dir = os.path.dirname(__file__)
16 sys.path.append(os.path.join(this_dir, ".."))
17 import friendly_traceback
18
19
20 # Make it possible to find docs and tests source
21 docs_root_dir = os.path.abspath(
22 os.path.join(this_dir, "..", "..", "friendly-docs")
23 )
24 assert os.path.isdir(docs_root_dir), "Separate docs repo need to exist"
25 sys.path.append(os.path.join(this_dir, ".."))
26
27 LANG = "ta"
28 friendly_traceback.install()
29 friendly_traceback.set_lang(LANG)
30 friendly_traceback.set_formatter("docs")
31
32 sys.path.insert(0, this_dir)
33 py_version = f"{sys.version_info.major}.{sys.version_info.minor}"
34
35 import trb_common
36
37 target = os.path.normpath(
38 os.path.join(docs_root_dir, f"source/tracebacks_{LANG}.rst")
39 )
40
41 intro_text = """
42 Friendly tracebacks - in தமிழ் மொழி
43 ==================================================
44
45 Friendly aims to provide friendlier feedback when an exception
46 is raised than what is done by Python.
47
48 Below, we can find some examples. SyntaxError cases, as well as TabError and
49 IndentationError cases, are shown in a separate page.
50 Not all cases handled by friendly are included here.
51
52 .. note::
53
54 The content of this page is generated by running
55 `{name}` located in the ``tests/`` directory.
56 This needs to be done explicitly, independently of updating the
57 documentation using Sphinx.
58
59 Friendly-traceback version: {friendly}
60 Python version: {python}
61
62 """.format(
63 friendly=friendly_traceback.__version__,
64 python=platform.python_version(),
65 name=sys.argv[0],
66 )
67
68 print(f"Python version: {platform.python_version()}; Tamil")
69
70 trb_common.create_tracebacks(target, intro_text)