stefantaubert commited on
Commit
3899cce
1 Parent(s): f73ca17
Files changed (7) hide show
  1. .gitignore +2 -0
  2. CODE_OF_CONDUCT.md +132 -0
  3. CONTRIBUTING.md +3 -0
  4. LICENSE +21 -0
  5. Pipfile +13 -2
  6. app.py +70 -12
  7. pylintrc +612 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ flagged/
2
+ .vscode/
CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [github@stefantaubert.com](mailto:github@stefantaubert.com).
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
CONTRIBUTING.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Contributing
2
+
3
+ If you notice an error, please don't hesitate to open an issue.
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Stefan Taubert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
Pipfile CHANGED
@@ -1,14 +1,25 @@
1
  [[source]]
2
  url = "https://pypi.org/simple"
3
- verify_ssl = false
4
- name = "pip_conf_index_global"
5
 
6
  [packages]
7
  en-tts = ">=0.0.1"
8
  gradio = {extras = ["oauth"], version = ">=4.26.0"}
9
  uvicorn = ">=0.14.0"
 
10
 
11
  [dev-packages]
 
 
 
 
 
 
 
 
 
 
12
 
13
  [requires]
14
  python_version = "3.11"
 
1
  [[source]]
2
  url = "https://pypi.org/simple"
3
+ verify_ssl = true
4
+ name = "pypi"
5
 
6
  [packages]
7
  en-tts = ">=0.0.1"
8
  gradio = {extras = ["oauth"], version = ">=4.26.0"}
9
  uvicorn = ">=0.14.0"
10
+ numpy = "*"
11
 
12
  [dev-packages]
13
+ autopep8 = "*"
14
+ pylint = "*"
15
+ pycodestyle = "*"
16
+ isort = "*"
17
+ rope = "*"
18
+ pytest = "*"
19
+ autoflake = "*"
20
+ twine = "*"
21
+ tox = "*"
22
+ build = "*"
23
 
24
  [requires]
25
  python_version = "3.11"
app.py CHANGED
@@ -1,23 +1,81 @@
1
- import gradio as gr
2
 
3
- from en_tts import Transcriber
 
 
 
4
 
 
 
 
 
 
 
5
 
6
- def greet(name):
7
- return "Hello " + name + "!!"
8
 
9
  def synt(text: str) -> str:
10
- transcriber = Transcriber()
11
- text_ipa = transcriber.transcribe_to_ipa(text)
12
- return text_ipa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
-
15
  example_text = "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow."
16
 
17
  iface = gr.Interface(
18
- fn=synt,
19
- inputs=[gr.Textbox(example_text)],
20
- #outputs=[gr.Audio(type="numpy")],
21
- outputs=[gr.Textbox()],
22
  )
23
  iface.launch()
 
1
+ from logging import getLogger
2
 
3
+ import gradio as gr
4
+ import numpy as np
5
+ import numpy.typing as npt
6
+ from en_tts import Synthesizer, Transcriber
7
 
8
+ FLOAT32_64_MIN_WAV = -1.0
9
+ FLOAT32_64_MAX_WAV = 1.0
10
+ INT16_MIN = np.iinfo(np.int16).min # -32768 = -(2**15)
11
+ INT16_MAX = np.iinfo(np.int16).max # 32767 = 2**15 - 1
12
+ INT32_MIN = np.iinfo(np.int32).min # -2147483648 = -(2**31)
13
+ INT32_MAX = np.iinfo(np.int32).max # 2147483647 = 2**31 - 1
14
 
 
 
15
 
16
  def synt(text: str) -> str:
17
+ logger = getLogger(__name__)
18
+ logger.info("Initializing transcriber...")
19
+ transcriber = Transcriber()
20
+
21
+ logger.info("Initializing synthesizer...")
22
+ synthesizer = Synthesizer()
23
+
24
+ logger.info("Transcribing...")
25
+ text_ipa = transcriber.transcribe_to_ipa(text)
26
+
27
+ logger.info("Synthesizing...")
28
+ audio = synthesizer.synthesize(text_ipa)
29
+ audio_int = convert_wav(audio, np.int16)
30
+ return 22050, audio_int
31
+
32
+
33
+ def get_max_value(dtype):
34
+ # see wavfile.write() max positive eg. on 16-bit PCM is 32767
35
+ if dtype == np.int16:
36
+ return INT16_MAX
37
+
38
+ if dtype == np.int32:
39
+ return INT32_MAX
40
+
41
+ if dtype in (np.float32, np.float64):
42
+ return FLOAT32_64_MAX_WAV
43
+
44
+ assert False
45
+
46
+
47
+ def get_min_value(dtype):
48
+ if dtype == np.int16:
49
+ return INT16_MIN
50
+
51
+ if dtype == np.int32:
52
+ return INT32_MIN
53
+
54
+ if dtype in (np.float32, np.float64):
55
+ return FLOAT32_64_MIN_WAV
56
+
57
+ assert False
58
+
59
+
60
+ def convert_wav(wav: npt.NDArray[np.float64], to_dtype):
61
+ '''
62
+ if the wav is over-amplified the result will also be over-amplified.
63
+ '''
64
+ if wav.dtype != to_dtype:
65
+ wav = wav / (-1 * get_min_value(wav.dtype)) * get_max_value(to_dtype)
66
+ if to_dtype in (np.int16, np.int32):
67
+ # the default seems to be np.fix instead of np.round on wav.astype()
68
+ wav = np.round(wav, 0)
69
+ wav = wav.astype(to_dtype)
70
+
71
+ return wav
72
+
73
 
 
74
  example_text = "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow."
75
 
76
  iface = gr.Interface(
77
+ fn=synt,
78
+ inputs=[gr.Textbox(example_text)],
79
+ outputs=[gr.Audio(type="numpy")],
 
80
  )
81
  iface.launch()
pylintrc ADDED
@@ -0,0 +1,612 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [MAIN]
2
+
3
+ # Analyse import fallback blocks. This can be used to support both Python 2 and
4
+ # 3 compatible code, which means that the block might have code that exists
5
+ # only in one or another interpreter, leading to false positives when analysed.
6
+ analyse-fallback-blocks=no
7
+
8
+ # Load and enable all available extensions. Use --list-extensions to see a list
9
+ # all available extensions.
10
+ #enable-all-extensions=
11
+
12
+ # In error mode, checkers without error messages are disabled and for others,
13
+ # only the ERROR messages are displayed, and no reports are done by default.
14
+ #errors-only=
15
+
16
+ # Always return a 0 (non-error) status code, even if lint errors are found.
17
+ # This is primarily useful in continuous integration scripts.
18
+ #exit-zero=
19
+
20
+ # A comma-separated list of package or module names from where C extensions may
21
+ # be loaded. Extensions are loading into the active Python interpreter and may
22
+ # run arbitrary code.
23
+ extension-pkg-allow-list=
24
+
25
+ # A comma-separated list of package or module names from where C extensions may
26
+ # be loaded. Extensions are loading into the active Python interpreter and may
27
+ # run arbitrary code. (This is an alternative name to extension-pkg-allow-list
28
+ # for backward compatibility.)
29
+ extension-pkg-whitelist=
30
+
31
+ # Return non-zero exit code if any of these messages/categories are detected,
32
+ # even if score is above --fail-under value. Syntax same as enable. Messages
33
+ # specified are enabled, while categories only check already-enabled messages.
34
+ fail-on=
35
+
36
+ # Specify a score threshold to be exceeded before program exits with error.
37
+ fail-under=10.0
38
+
39
+ # Interpret the stdin as a python script, whose filename needs to be passed as
40
+ # the module_or_package argument.
41
+ #from-stdin=
42
+
43
+ # Files or directories to be skipped. They should be base names, not paths.
44
+ ignore=CVS
45
+
46
+ # Add files or directories matching the regex patterns to the ignore-list. The
47
+ # regex matches against paths and can be in Posix or Windows format.
48
+ ignore-paths=
49
+
50
+ # Files or directories matching the regex patterns are skipped. The regex
51
+ # matches against base names, not paths. The default value ignores Emacs file
52
+ # locks
53
+ ignore-patterns=
54
+
55
+ # List of module names for which member attributes should not be checked
56
+ # (useful for modules/projects where namespaces are manipulated during runtime
57
+ # and thus existing member attributes cannot be deduced by static analysis). It
58
+ # supports qualified module names, as well as Unix pattern matching.
59
+ ignored-modules=
60
+
61
+ # Python code to execute, usually for sys.path manipulation such as
62
+ # pygtk.require().
63
+ #init-hook=
64
+
65
+ # Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
66
+ # number of processors available to use.
67
+ jobs=1
68
+
69
+ # Control the amount of potential inferred values when inferring a single
70
+ # object. This can help the performance when dealing with large functions or
71
+ # complex, nested conditions.
72
+ limit-inference-results=100
73
+
74
+ # List of plugins (as comma separated values of python module names) to load,
75
+ # usually to register additional checkers.
76
+ load-plugins=
77
+
78
+ # Pickle collected data for later comparisons.
79
+ persistent=yes
80
+
81
+ # Minimum Python version to use for version dependent checks. Will default to
82
+ # the version used to run pylint.
83
+ py-version=3.9
84
+
85
+ # Discover python modules and packages in the file system subtree.
86
+ recursive=no
87
+
88
+ # When enabled, pylint would attempt to guess common misconfiguration and emit
89
+ # user-friendly hints instead of false-positive error messages.
90
+ suggestion-mode=yes
91
+
92
+ # Allow loading of arbitrary C extensions. Extensions are imported into the
93
+ # active Python interpreter and may run arbitrary code.
94
+ unsafe-load-any-extension=no
95
+
96
+ # In verbose mode, extra non-checker-related info will be displayed.
97
+ #verbose=
98
+
99
+
100
+ [REPORTS]
101
+
102
+ # Python expression which should return a score less than or equal to 10. You
103
+ # have access to the variables 'fatal', 'error', 'warning', 'refactor',
104
+ # 'convention', and 'info' which contain the number of messages in each
105
+ # category, as well as 'statement' which is the total number of statements
106
+ # analyzed. This score is used by the global evaluation report (RP0004).
107
+ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
108
+
109
+ # Template used to display messages. This is a python new-style format string
110
+ # used to format the message information. See doc for all details.
111
+ msg-template=
112
+
113
+ # Set the output format. Available formats are text, parseable, colorized, json
114
+ # and msvs (visual studio). You can also give a reporter class, e.g.
115
+ # mypackage.mymodule.MyReporterClass.
116
+ #output-format=
117
+
118
+ # Tells whether to display a full report or only the messages.
119
+ reports=no
120
+
121
+ # Activate the evaluation score.
122
+ score=yes
123
+
124
+
125
+ [MESSAGES CONTROL]
126
+
127
+ # Only show warnings with the listed confidence levels. Leave empty to show
128
+ # all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
129
+ # UNDEFINED.
130
+ confidence=HIGH,
131
+ CONTROL_FLOW,
132
+ INFERENCE,
133
+ INFERENCE_FAILURE,
134
+ UNDEFINED
135
+
136
+ # Disable the message, report, category or checker with the given id(s). You
137
+ # can either give multiple identifiers separated by comma (,) or put this
138
+ # option multiple times (only on the command line, not in the configuration
139
+ # file where it should appear only once). You can also use "--disable=all" to
140
+ # disable everything first and then re-enable specific checks. For example, if
141
+ # you want to run only the similarities checker, you can use "--disable=all
142
+ # --enable=similarities". If you want to run only the classes checker, but have
143
+ # no Warning level messages displayed, use "--disable=all --enable=classes
144
+ # --disable=W".
145
+ disable=raw-checker-failed,
146
+ bad-inline-option,
147
+ locally-disabled,
148
+ file-ignored,
149
+ suppressed-message,
150
+ useless-suppression,
151
+ deprecated-pragma,
152
+ use-symbolic-message-instead,
153
+ missing-module-docstring,
154
+ missing-class-docstring,
155
+ missing-function-docstring,
156
+ logging-fstring-interpolation
157
+
158
+ # Enable the message, report, category or checker with the given id(s). You can
159
+ # either give multiple identifier separated by comma (,) or put this option
160
+ # multiple time (only on the command line, not in the configuration file where
161
+ # it should appear only once). See also the "--disable" option for examples.
162
+ enable=c-extension-no-member
163
+
164
+
165
+ [EXCEPTIONS]
166
+
167
+ # Exceptions that will emit a warning when caught.
168
+ overgeneral-exceptions=BaseException,
169
+ Exception
170
+
171
+
172
+ [STRING]
173
+
174
+ # This flag controls whether inconsistent-quotes generates a warning when the
175
+ # character used as a quote delimiter is used inconsistently within a module.
176
+ check-quote-consistency=no
177
+
178
+ # This flag controls whether the implicit-str-concat should generate a warning
179
+ # on implicit string concatenation in sequences defined over several lines.
180
+ check-str-concat-over-line-jumps=no
181
+
182
+
183
+ [SPELLING]
184
+
185
+ # Limits count of emitted suggestions for spelling mistakes.
186
+ max-spelling-suggestions=4
187
+
188
+ # Spelling dictionary name. Available dictionaries: none. To make it work,
189
+ # install the 'python-enchant' package.
190
+ spelling-dict=
191
+
192
+ # List of comma separated words that should be considered directives if they
193
+ # appear at the beginning of a comment and should not be checked.
194
+ spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
195
+
196
+ # List of comma separated words that should not be checked.
197
+ spelling-ignore-words=
198
+
199
+ # A path to a file that contains the private dictionary; one word per line.
200
+ spelling-private-dict-file=
201
+
202
+ # Tells whether to store unknown words to the private dictionary (see the
203
+ # --spelling-private-dict-file option) instead of raising a message.
204
+ spelling-store-unknown-words=no
205
+
206
+
207
+ [IMPORTS]
208
+
209
+ # List of modules that can be imported at any level, not just the top level
210
+ # one.
211
+ allow-any-import-level=
212
+
213
+ # Allow wildcard imports from modules that define __all__.
214
+ allow-wildcard-with-all=no
215
+
216
+ # Deprecated modules which should not be used, separated by a comma.
217
+ deprecated-modules=optparse,tkinter.tix
218
+
219
+ # Output a graph (.gv or any supported image format) of external dependencies
220
+ # to the given file (report RP0402 must not be disabled).
221
+ ext-import-graph=
222
+
223
+ # Output a graph (.gv or any supported image format) of all (i.e. internal and
224
+ # external) dependencies to the given file (report RP0402 must not be
225
+ # disabled).
226
+ import-graph=
227
+
228
+ # Output a graph (.gv or any supported image format) of internal dependencies
229
+ # to the given file (report RP0402 must not be disabled).
230
+ int-import-graph=
231
+
232
+ # Force import order to recognize a module as part of the standard
233
+ # compatibility libraries.
234
+ known-standard-library=
235
+
236
+ # Force import order to recognize a module as part of a third party library.
237
+ known-third-party=enchant
238
+
239
+ # Couples of modules and preferred modules, separated by a comma.
240
+ preferred-modules=
241
+
242
+
243
+ [REFACTORING]
244
+
245
+ # Maximum number of nested blocks for function / method body
246
+ max-nested-blocks=5
247
+
248
+ # Complete name of functions that never returns. When checking for
249
+ # inconsistent-return-statements if a never returning function is called then
250
+ # it will be considered as an explicit return statement and no message will be
251
+ # printed.
252
+ never-returning-functions=sys.exit
253
+
254
+
255
+ [MISCELLANEOUS]
256
+
257
+ # List of note tags to take in consideration, separated by a comma.
258
+ notes=FIXME,
259
+ XXX,
260
+ TODO
261
+
262
+ # Regular expression of note tags to take in consideration.
263
+ notes-rgx=
264
+
265
+
266
+ [DESIGN]
267
+
268
+ # List of regular expressions of class ancestor names to ignore when counting
269
+ # public methods (see R0903)
270
+ exclude-too-few-public-methods=
271
+
272
+ # List of qualified class names to ignore when counting class parents (see
273
+ # R0901)
274
+ ignored-parents=
275
+
276
+ # Maximum number of arguments for function / method.
277
+ max-args=100
278
+
279
+ # Maximum number of attributes for a class (see R0902).
280
+ max-attributes=7
281
+
282
+ # Maximum number of boolean expressions in an if statement (see R0916).
283
+ max-bool-expr=5
284
+
285
+ # Maximum number of branch for function / method body.
286
+ max-branches=12
287
+
288
+ # Maximum number of locals for function / method body.
289
+ max-locals=15
290
+
291
+ # Maximum number of parents for a class (see R0901).
292
+ max-parents=7
293
+
294
+ # Maximum number of public methods for a class (see R0904).
295
+ max-public-methods=100
296
+
297
+ # Maximum number of return / yield for function / method body.
298
+ max-returns=6
299
+
300
+ # Maximum number of statements in function / method body.
301
+ max-statements=50
302
+
303
+ # Minimum number of public methods for a class (see R0903).
304
+ min-public-methods=0
305
+
306
+
307
+ [VARIABLES]
308
+
309
+ # List of additional names supposed to be defined in builtins. Remember that
310
+ # you should avoid defining new builtins when possible.
311
+ additional-builtins=
312
+
313
+ # Tells whether unused global variables should be treated as a violation.
314
+ allow-global-unused-variables=yes
315
+
316
+ # List of names allowed to shadow builtins
317
+ allowed-redefined-builtins=
318
+
319
+ # List of strings which can identify a callback function by name. A callback
320
+ # name must start or end with one of those strings.
321
+ callbacks=cb_,
322
+ _cb
323
+
324
+ # A regular expression matching the name of dummy variables (i.e. expected to
325
+ # not be used).
326
+ dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
327
+
328
+ # Argument names that match this expression will be ignored. Default to name
329
+ # with leading underscore.
330
+ ignored-argument-names=_.*|^ignored_|^unused_
331
+
332
+ # Tells whether we should check for unused import in __init__ files.
333
+ init-import=no
334
+
335
+ # List of qualified module names which can have objects that can redefine
336
+ # builtins.
337
+ redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
338
+
339
+
340
+ [BASIC]
341
+
342
+ # Naming style matching correct argument names.
343
+ argument-naming-style=snake_case
344
+
345
+ # Regular expression matching correct argument names. Overrides argument-
346
+ # naming-style. If left empty, argument names will be checked with the set
347
+ # naming style.
348
+ #argument-rgx=
349
+
350
+ # Naming style matching correct attribute names.
351
+ attr-naming-style=snake_case
352
+
353
+ # Regular expression matching correct attribute names. Overrides attr-naming-
354
+ # style. If left empty, attribute names will be checked with the set naming
355
+ # style.
356
+ #attr-rgx=
357
+
358
+ # Bad variable names which should always be refused, separated by a comma.
359
+ bad-names=foo,
360
+ bar,
361
+ baz,
362
+ toto,
363
+ tutu,
364
+ tata
365
+
366
+ # Bad variable names regexes, separated by a comma. If names match any regex,
367
+ # they will always be refused
368
+ bad-names-rgxs=
369
+
370
+ # Naming style matching correct class attribute names.
371
+ class-attribute-naming-style=any
372
+
373
+ # Regular expression matching correct class attribute names. Overrides class-
374
+ # attribute-naming-style. If left empty, class attribute names will be checked
375
+ # with the set naming style.
376
+ #class-attribute-rgx=
377
+
378
+ # Naming style matching correct class constant names.
379
+ class-const-naming-style=UPPER_CASE
380
+
381
+ # Regular expression matching correct class constant names. Overrides class-
382
+ # const-naming-style. If left empty, class constant names will be checked with
383
+ # the set naming style.
384
+ #class-const-rgx=
385
+
386
+ # Naming style matching correct class names.
387
+ class-naming-style=PascalCase
388
+
389
+ # Regular expression matching correct class names. Overrides class-naming-
390
+ # style. If left empty, class names will be checked with the set naming style.
391
+ #class-rgx=
392
+
393
+ # Naming style matching correct constant names.
394
+ const-naming-style=UPPER_CASE
395
+
396
+ # Regular expression matching correct constant names. Overrides const-naming-
397
+ # style. If left empty, constant names will be checked with the set naming
398
+ # style.
399
+ #const-rgx=
400
+
401
+ # Minimum line length for functions/classes that require docstrings, shorter
402
+ # ones are exempt.
403
+ docstring-min-length=-1
404
+
405
+ # Naming style matching correct function names.
406
+ function-naming-style=snake_case
407
+
408
+ # Regular expression matching correct function names. Overrides function-
409
+ # naming-style. If left empty, function names will be checked with the set
410
+ # naming style.
411
+ #function-rgx=
412
+
413
+ # Good variable names which should always be accepted, separated by a comma.
414
+ good-names=i,
415
+ j,
416
+ k,
417
+ ex,
418
+ Run,
419
+ _
420
+
421
+ # Good variable names regexes, separated by a comma. If names match any regex,
422
+ # they will always be accepted
423
+ good-names-rgxs=
424
+
425
+ # Include a hint for the correct naming format with invalid-name.
426
+ include-naming-hint=no
427
+
428
+ # Naming style matching correct inline iteration names.
429
+ inlinevar-naming-style=any
430
+
431
+ # Regular expression matching correct inline iteration names. Overrides
432
+ # inlinevar-naming-style. If left empty, inline iteration names will be checked
433
+ # with the set naming style.
434
+ #inlinevar-rgx=
435
+
436
+ # Naming style matching correct method names.
437
+ method-naming-style=snake_case
438
+
439
+ # Regular expression matching correct method names. Overrides method-naming-
440
+ # style. If left empty, method names will be checked with the set naming style.
441
+ #method-rgx=
442
+
443
+ # Naming style matching correct module names.
444
+ module-naming-style=snake_case
445
+
446
+ # Regular expression matching correct module names. Overrides module-naming-
447
+ # style. If left empty, module names will be checked with the set naming style.
448
+ #module-rgx=
449
+
450
+ # Colon-delimited sets of names that determine each other's naming style when
451
+ # the name regexes allow several styles.
452
+ name-group=
453
+
454
+ # Regular expression which should only match function or class names that do
455
+ # not require a docstring.
456
+ no-docstring-rgx=^_
457
+
458
+ # List of decorators that produce properties, such as abc.abstractproperty. Add
459
+ # to this list to register other decorators that produce valid properties.
460
+ # These decorators are taken in consideration only for invalid-name.
461
+ property-classes=abc.abstractproperty
462
+
463
+ # Regular expression matching correct type variable names. If left empty, type
464
+ # variable names will be checked with the set naming style.
465
+ #typevar-rgx=
466
+
467
+ # Naming style matching correct variable names.
468
+ variable-naming-style=snake_case
469
+
470
+ # Regular expression matching correct variable names. Overrides variable-
471
+ # naming-style. If left empty, variable names will be checked with the set
472
+ # naming style.
473
+ #variable-rgx=
474
+
475
+
476
+ [CLASSES]
477
+
478
+ # Warn about protected attribute access inside special methods
479
+ check-protected-access-in-special-methods=no
480
+
481
+ # List of method names used to declare (i.e. assign) instance attributes.
482
+ defining-attr-methods=__init__,
483
+ __new__,
484
+ setUp,
485
+ __post_init__
486
+
487
+ # List of member names, which should be excluded from the protected access
488
+ # warning.
489
+ exclude-protected=_asdict,
490
+ _fields,
491
+ _replace,
492
+ _source,
493
+ _make
494
+
495
+ # List of valid names for the first argument in a class method.
496
+ valid-classmethod-first-arg=cls
497
+
498
+ # List of valid names for the first argument in a metaclass class method.
499
+ valid-metaclass-classmethod-first-arg=cls
500
+
501
+
502
+ [FORMAT]
503
+
504
+ # Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
505
+ expected-line-ending-format=
506
+
507
+ # Regexp for a line that is allowed to be longer than the limit.
508
+ ignore-long-lines=^\s*(# )?<?https?://\S+>?$
509
+
510
+ # Number of spaces of indent required inside a hanging or continued line.
511
+ indent-after-paren=2
512
+
513
+ # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
514
+ # tab).
515
+ indent-string=' '
516
+
517
+ # Maximum number of characters on a single line.
518
+ max-line-length=100
519
+
520
+ # Maximum number of lines in a module.
521
+ max-module-lines=1000
522
+
523
+ # Allow the body of a class to be on the same line as the declaration if body
524
+ # contains single statement.
525
+ single-line-class-stmt=no
526
+
527
+ # Allow the body of an if to be on the same line as the test if there is no
528
+ # else.
529
+ single-line-if-stmt=no
530
+
531
+
532
+ [LOGGING]
533
+
534
+ # The type of string formatting that logging methods do. `old` means using %
535
+ # formatting, `new` is for `{}` formatting.
536
+ logging-format-style=old
537
+
538
+ # Logging modules to check that the string format arguments are in logging
539
+ # function parameter format.
540
+ logging-modules=logging
541
+
542
+
543
+ [TYPECHECK]
544
+
545
+ # List of decorators that produce context managers, such as
546
+ # contextlib.contextmanager. Add to this list to register other decorators that
547
+ # produce valid context managers.
548
+ contextmanager-decorators=contextlib.contextmanager
549
+
550
+ # List of members which are set dynamically and missed by pylint inference
551
+ # system, and so shouldn't trigger E1101 when accessed. Python regular
552
+ # expressions are accepted.
553
+ generated-members=numpy.* ,torch.*
554
+
555
+ # Tells whether to warn about missing members when the owner of the attribute
556
+ # is inferred to be None.
557
+ ignore-none=yes
558
+
559
+ # This flag controls whether pylint should warn about no-member and similar
560
+ # checks whenever an opaque object is returned when inferring. The inference
561
+ # can return multiple potential results while evaluating a Python object, but
562
+ # some branches might not be evaluated, which results in partial inference. In
563
+ # that case, it might be useful to still emit no-member and other checks for
564
+ # the rest of the inferred objects.
565
+ ignore-on-opaque-inference=yes
566
+
567
+ # List of symbolic message names to ignore for Mixin members.
568
+ ignored-checks-for-mixins=no-member,
569
+ not-async-context-manager,
570
+ not-context-manager,
571
+ attribute-defined-outside-init
572
+
573
+ # List of class names for which member attributes should not be checked (useful
574
+ # for classes with dynamically set attributes). This supports the use of
575
+ # qualified names.
576
+ ignored-classes=optparse.Values,thread._local,_thread._local
577
+
578
+ # Show a hint with possible names when a member name was not found. The aspect
579
+ # of finding the hint is based on edit distance.
580
+ missing-member-hint=yes
581
+
582
+ # The minimum edit distance a name should have in order to be considered a
583
+ # similar match for a missing member name.
584
+ missing-member-hint-distance=1
585
+
586
+ # The total number of similar names that should be taken in consideration when
587
+ # showing a hint for a missing member.
588
+ missing-member-max-choices=1
589
+
590
+ # Regex pattern to define which classes are considered mixins.
591
+ mixin-class-rgx=.*[Mm]ixin
592
+
593
+ # List of decorators that change the signature of a decorated function.
594
+ signature-mutators=
595
+
596
+
597
+ [SIMILARITIES]
598
+
599
+ # Comments are removed from the similarity computation
600
+ ignore-comments=yes
601
+
602
+ # Docstrings are removed from the similarity computation
603
+ ignore-docstrings=yes
604
+
605
+ # Imports are removed from the similarity computation
606
+ ignore-imports=no
607
+
608
+ # Signatures are removed from the similarity computation
609
+ ignore-signatures=yes
610
+
611
+ # Minimum lines number of a similarity.
612
+ min-similarity-lines=4