Skip to content

Commit 53cea15

Browse files
author
preetham.ntp
committed
revert yaml and fix lint errors add yaml dir in flake8.ini update vscode settings.json
1 parent 4cdd54e commit 53cea15

28 files changed

+1785
-2851
lines changed

.vscode/settings.json

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -228,21 +228,8 @@
228228
"中文",
229229
"日本語"
230230
],
231-
"pylint.args": [
232-
"--class-naming-style=PascalCase",
233-
"--function-naming-style=camelCase",
234-
"--method-naming-style=camelCase",
235-
"--attr-naming-style=camelCase",
236-
"--argument-naming-style=camelCase",
237-
"--variable-naming-style=camelCase",
238-
"--inlinevar-naming-style=camelCase",
239-
],
240-
"python.linting.pylintEnabled": true,
241-
"python.linting.enabled": true,
242-
"python.linting.mypyEnabled": false,
243-
"python.linting.flake8Enabled": false,
244-
"python.analysis.diagnosticSeverityOverrides": {
245-
"reportMissingImports": "none"
246-
},
231+
"flake8.args": [
232+
"--max-line-length=130",
233+
],
247234
"git.ignoreLimitWarning": true,
248235
}

Example/test.py

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,57 @@
1-
# MathCAT add-on: generates speech, braille, and allows exploration of
2-
# expressions written in MathML
3-
# The goal of this add-on is to replicate/improve on the functionality of
4-
# MathPlayer which has been discontinued.
1+
# MathCAT add-on: generates speech, braille, and allows exploration of expressions written in MathML
2+
# The goal of this add-on is to replicate/improve on the functionality of MathPlayer which has been discontinued.
53
# Author: Neil Soiffer
6-
# Copyright: this file uses whatever GNU copyright that is
7-
# required for NVDA addons
8-
# The code additionally makes use of the MathCAT library (written in Rust)
9-
# which is covered by the MIT license
4+
# Copyright: this file uses whatever GNU copyright that is required for NVDA addons
5+
# The code additionally makes use of the MathCAT library (written in Rust) which is covered by the MIT license
106
# and also (obviously) requires external speech engines and braille drivers.
117

128

139
import os
10+
import libmathcat
1411

1512
# import shutil
1613
# if os.path.exists("libmathcat_py.pyd"):
1714
# os.remove("libmathcat_py.pyd")
18-
# shutil.copy("..\\target\\i686-pc-windows-msvc\\release\\libmathcat_py.dll",
19-
# "libmathcat.pyd")
20-
21-
import libmathcat
15+
# shutil.copy("..\\target\\i686-pc-windows-msvc\\release\\libmathcat_py.dll", "libmathcat.pyd")
2216

2317

2418
def SetMathCATPreferences():
2519
try:
2620
libmathcat.SetRulesDir(
27-
# this assumes the Rules dir is in the same dir a the library.
28-
# Modify as needed
21+
# this assumes the Rules dir is in the same dir a the library. Modify as needed
2922
os.path.join(os.path.dirname(os.path.abspath(__file__)), "Rules")
3023
)
3124
except Exception as e:
32-
print(e, "problem with finding the MathCAT rules")
25+
print("problem with finding the MathCAT rules", e)
3326

3427
try:
3528
libmathcat.SetPreference("TTS", "none")
3629
libmathcat.SetPreference("Language", "en") # Also "id" and "vi"
37-
libmathcat.SetPreference("SpeechStyle", "SimpleSpeak") # Also "ClearSpeak" # noqa
38-
libmathcat.SetPreference("Verbosity", "Verbose") # also terse "Terse"/"Medium" # noqa
30+
libmathcat.SetPreference("SpeechStyle", "SimpleSpeak") # Also "ClearSpeak"
31+
libmathcat.SetPreference("Verbosity", "Verbose") # also terse "Terse"/"Medium"
3932
libmathcat.SetPreference(
4033
"CapitalLetters_UseWord", "true"
4134
) # if "true", X => "cap x"
4235
except Exception as e:
43-
print(e, "problem with setting a preference")
36+
print("problem with setting a preference", e)
4437

4538

4639
def SetMathMLForMathCAT(mathml: str):
4740
try:
4841
libmathcat.SetMathML(mathml)
4942
except Exception as e:
50-
print(e, "problem with SetMathML")
43+
print("problem with SetMathML", e)
5144

5245

5346
def GetSpeech():
5447
try:
5548
return libmathcat.GetSpokenText()
5649
except Exception as e:
57-
return e, "problem with getting speech for MathML"
50+
return "problem with getting speech for MathML", e
5851

5952

6053
SetMathCATPreferences() # you only need to this once
54+
6155
print("Using MathCAT version '{}'".format(libmathcat.GetVersion()))
6256

6357
mathml = "<math><mfrac> <mn>1</mn> <mi>X</mi> </mfrac> </math>"
@@ -72,16 +66,15 @@ def GetSpeech():
7266
SetMathMLForMathCAT(mathml)
7367
print("MathML: {}\nSpeech: '{}'".format(mathml, GetSpeech()))
7468

75-
mathml = "<math><msup intent='transpose:postfix($x)'> <mi arg='x'>x</mi><mi>T \
76-
</mi> </msup> </math>"
69+
mathml = "<math><msup intent='transpose:postfix($x)'> <mi arg='x'>x</mi> <mi>T</mi> </msup> </math>"
7770
SetMathMLForMathCAT(mathml)
7871
print("MathML: {}\nSpeech: '{}'".format(mathml, GetSpeech()))
7972

8073
mathml = "<math><mrow intent='_(x, $op)'><mo arg='op'>!</mo></mrow></math>"
8174
SetMathMLForMathCAT(mathml)
8275
print("MathML: {}\nSpeech: '{}'".format(mathml, GetSpeech()))
8376

84-
mathml = "<math intent=':structure'><mrow><mo>(</mo><mfrac linethickness='0'> \
85-
<mn arg='n'>7</mn><mn arg='m'>3</mn></mfrac><mo>)</mo></mrow></math>"
77+
mathml = "<math intent=':structure'><mrow><mo>\
78+
(</mo><mfrac linethickness='0'><mn arg='n'>7</mn><mn arg='m'>3</mn></mfrac><mo>)</mo></mrow></math>"
8679
SetMathMLForMathCAT(mathml)
8780
print("MathML: {}\nSpeech (no inference): '{}'".format(mathml, GetSpeech()))

0 commit comments

Comments
 (0)