BerserkerMother commited on
Commit
5aaa03c
·
1 Parent(s): de34903

Lints the entire project

Browse files
.pylintrc ADDED
@@ -0,0 +1,631 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Clear in-memory caches upon conclusion of linting. Useful if running pylint
9
+ # in a server-like mode.
10
+ clear-cache-post-run=no
11
+
12
+ # Load and enable all available extensions. Use --list-extensions to see a list
13
+ # all available extensions.
14
+ #enable-all-extensions=
15
+
16
+ # In error mode, messages with a category besides ERROR or FATAL are
17
+ # suppressed, and no reports are done by default. Error mode is compatible with
18
+ # disabling specific errors.
19
+ #errors-only=
20
+
21
+ # Always return a 0 (non-error) status code, even if lint errors are found.
22
+ # This is primarily useful in continuous integration scripts.
23
+ #exit-zero=
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.
28
+ extension-pkg-allow-list=
29
+
30
+ # A comma-separated list of package or module names from where C extensions may
31
+ # be loaded. Extensions are loading into the active Python interpreter and may
32
+ # run arbitrary code. (This is an alternative name to extension-pkg-allow-list
33
+ # for backward compatibility.)
34
+ extension-pkg-whitelist=
35
+
36
+ # Return non-zero exit code if any of these messages/categories are detected,
37
+ # even if score is above --fail-under value. Syntax same as enable. Messages
38
+ # specified are enabled, while categories only check already-enabled messages.
39
+ fail-on=
40
+
41
+ # Specify a score threshold under which the program will exit with error.
42
+ fail-under=10
43
+
44
+ # Interpret the stdin as a python script, whose filename needs to be passed as
45
+ # the module_or_package argument.
46
+ #from-stdin=
47
+
48
+ # Files or directories to be skipped. They should be base names, not paths.
49
+ ignore=CVS
50
+
51
+ # Add files or directories matching the regular expressions patterns to the
52
+ # ignore-list. The regex matches against paths and can be in Posix or Windows
53
+ # format. Because '\\' represents the directory delimiter on Windows systems,
54
+ # it can't be used as an escape character.
55
+ ignore-paths=
56
+
57
+ # Files or directories matching the regular expression patterns are skipped.
58
+ # The regex matches against base names, not paths. The default value ignores
59
+ # Emacs file locks
60
+ ignore-patterns=^\.#
61
+
62
+ # List of module names for which member attributes should not be checked
63
+ # (useful for modules/projects where namespaces are manipulated during runtime
64
+ # and thus existing member attributes cannot be deduced by static analysis). It
65
+ # supports qualified module names, as well as Unix pattern matching.
66
+ ignored-modules=
67
+
68
+ # Python code to execute, usually for sys.path manipulation such as
69
+ # pygtk.require().
70
+ init-hook='import sys; sys.path.append("/home/kave/work/Elise/elise/src")'
71
+
72
+ # Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
73
+ # number of processors available to use, and will cap the count on Windows to
74
+ # avoid hangs.
75
+ jobs=1
76
+
77
+ # Control the amount of potential inferred values when inferring a single
78
+ # object. This can help the performance when dealing with large functions or
79
+ # complex, nested conditions.
80
+ limit-inference-results=100
81
+
82
+ # List of plugins (as comma separated values of python module names) to load,
83
+ # usually to register additional checkers.
84
+ load-plugins=
85
+
86
+ # Pickle collected data for later comparisons.
87
+ persistent=yes
88
+
89
+ # Minimum Python version to use for version dependent checks. Will default to
90
+ # the version used to run pylint.
91
+ py-version=3.10
92
+
93
+ # Discover python modules and packages in the file system subtree.
94
+ recursive=no
95
+
96
+ # Add paths to the list of the source roots. Supports globbing patterns. The
97
+ # source root is an absolute path or a path relative to the current working
98
+ # directory used to determine a package namespace for modules located under the
99
+ # source root.
100
+ source-roots=
101
+
102
+ # When enabled, pylint would attempt to guess common misconfiguration and emit
103
+ # user-friendly hints instead of false-positive error messages.
104
+ suggestion-mode=yes
105
+
106
+ # Allow loading of arbitrary C extensions. Extensions are imported into the
107
+ # active Python interpreter and may run arbitrary code.
108
+ unsafe-load-any-extension=no
109
+
110
+ # In verbose mode, extra non-checker-related info will be displayed.
111
+ #verbose=
112
+
113
+
114
+ [BASIC]
115
+
116
+ # Naming style matching correct argument names.
117
+ argument-naming-style=snake_case
118
+
119
+ # Regular expression matching correct argument names. Overrides argument-
120
+ # naming-style. If left empty, argument names will be checked with the set
121
+ # naming style.
122
+ #argument-rgx=
123
+
124
+ # Naming style matching correct attribute names.
125
+ attr-naming-style=snake_case
126
+
127
+ # Regular expression matching correct attribute names. Overrides attr-naming-
128
+ # style. If left empty, attribute names will be checked with the set naming
129
+ # style.
130
+ #attr-rgx=
131
+
132
+ # Bad variable names which should always be refused, separated by a comma.
133
+ bad-names=foo,
134
+ bar,
135
+ baz,
136
+ toto,
137
+ tutu,
138
+ tata
139
+
140
+ # Bad variable names regexes, separated by a comma. If names match any regex,
141
+ # they will always be refused
142
+ bad-names-rgxs=
143
+
144
+ # Naming style matching correct class attribute names.
145
+ class-attribute-naming-style=any
146
+
147
+ # Regular expression matching correct class attribute names. Overrides class-
148
+ # attribute-naming-style. If left empty, class attribute names will be checked
149
+ # with the set naming style.
150
+ #class-attribute-rgx=
151
+
152
+ # Naming style matching correct class constant names.
153
+ class-const-naming-style=UPPER_CASE
154
+
155
+ # Regular expression matching correct class constant names. Overrides class-
156
+ # const-naming-style. If left empty, class constant names will be checked with
157
+ # the set naming style.
158
+ #class-const-rgx=
159
+
160
+ # Naming style matching correct class names.
161
+ class-naming-style=PascalCase
162
+
163
+ # Regular expression matching correct class names. Overrides class-naming-
164
+ # style. If left empty, class names will be checked with the set naming style.
165
+ #class-rgx=
166
+
167
+ # Naming style matching correct constant names.
168
+ const-naming-style=UPPER_CASE
169
+
170
+ # Regular expression matching correct constant names. Overrides const-naming-
171
+ # style. If left empty, constant names will be checked with the set naming
172
+ # style.
173
+ #const-rgx=
174
+
175
+ # Minimum line length for functions/classes that require docstrings, shorter
176
+ # ones are exempt.
177
+ docstring-min-length=-1
178
+
179
+ # Naming style matching correct function names.
180
+ function-naming-style=snake_case
181
+
182
+ # Regular expression matching correct function names. Overrides function-
183
+ # naming-style. If left empty, function names will be checked with the set
184
+ # naming style.
185
+ #function-rgx=
186
+
187
+ # Good variable names which should always be accepted, separated by a comma.
188
+ good-names=i,
189
+ j,
190
+ k,
191
+ ex,
192
+ Run,
193
+ _
194
+
195
+ # Good variable names regexes, separated by a comma. If names match any regex,
196
+ # they will always be accepted
197
+ good-names-rgxs=
198
+
199
+ # Include a hint for the correct naming format with invalid-name.
200
+ include-naming-hint=no
201
+
202
+ # Naming style matching correct inline iteration names.
203
+ inlinevar-naming-style=any
204
+
205
+ # Regular expression matching correct inline iteration names. Overrides
206
+ # inlinevar-naming-style. If left empty, inline iteration names will be checked
207
+ # with the set naming style.
208
+ #inlinevar-rgx=
209
+
210
+ # Naming style matching correct method names.
211
+ method-naming-style=snake_case
212
+
213
+ # Regular expression matching correct method names. Overrides method-naming-
214
+ # style. If left empty, method names will be checked with the set naming style.
215
+ #method-rgx=
216
+
217
+ # Naming style matching correct module names.
218
+ module-naming-style=snake_case
219
+
220
+ # Regular expression matching correct module names. Overrides module-naming-
221
+ # style. If left empty, module names will be checked with the set naming style.
222
+ #module-rgx=
223
+
224
+ # Colon-delimited sets of names that determine each other's naming style when
225
+ # the name regexes allow several styles.
226
+ name-group=
227
+
228
+ # Regular expression which should only match function or class names that do
229
+ # not require a docstring.
230
+ no-docstring-rgx=^_
231
+
232
+ # List of decorators that produce properties, such as abc.abstractproperty. Add
233
+ # to this list to register other decorators that produce valid properties.
234
+ # These decorators are taken in consideration only for invalid-name.
235
+ property-classes=abc.abstractproperty
236
+
237
+ # Regular expression matching correct type alias names. If left empty, type
238
+ # alias names will be checked with the set naming style.
239
+ #typealias-rgx=
240
+
241
+ # Regular expression matching correct type variable names. If left empty, type
242
+ # variable names will be checked with the set naming style.
243
+ #typevar-rgx=
244
+
245
+ # Naming style matching correct variable names.
246
+ variable-naming-style=snake_case
247
+
248
+ # Regular expression matching correct variable names. Overrides variable-
249
+ # naming-style. If left empty, variable names will be checked with the set
250
+ # naming style.
251
+ #variable-rgx=
252
+
253
+
254
+ [CLASSES]
255
+
256
+ # Warn about protected attribute access inside special methods
257
+ check-protected-access-in-special-methods=no
258
+
259
+ # List of method names used to declare (i.e. assign) instance attributes.
260
+ defining-attr-methods=__init__,
261
+ __new__,
262
+ setUp,
263
+ asyncSetUp,
264
+ __post_init__
265
+
266
+ # List of member names, which should be excluded from the protected access
267
+ # warning.
268
+ exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit
269
+
270
+ # List of valid names for the first argument in a class method.
271
+ valid-classmethod-first-arg=cls
272
+
273
+ # List of valid names for the first argument in a metaclass class method.
274
+ valid-metaclass-classmethod-first-arg=mcs
275
+
276
+
277
+ [DESIGN]
278
+
279
+ # List of regular expressions of class ancestor names to ignore when counting
280
+ # public methods (see R0903)
281
+ exclude-too-few-public-methods=
282
+
283
+ # List of qualified class names to ignore when counting class parents (see
284
+ # R0901)
285
+ ignored-parents=
286
+
287
+ # Maximum number of arguments for function / method.
288
+ max-args=5
289
+
290
+ # Maximum number of attributes for a class (see R0902).
291
+ max-attributes=7
292
+
293
+ # Maximum number of boolean expressions in an if statement (see R0916).
294
+ max-bool-expr=5
295
+
296
+ # Maximum number of branch for function / method body.
297
+ max-branches=12
298
+
299
+ # Maximum number of locals for function / method body.
300
+ max-locals=15
301
+
302
+ # Maximum number of parents for a class (see R0901).
303
+ max-parents=7
304
+
305
+ # Maximum number of public methods for a class (see R0904).
306
+ max-public-methods=20
307
+
308
+ # Maximum number of return / yield for function / method body.
309
+ max-returns=6
310
+
311
+ # Maximum number of statements in function / method body.
312
+ max-statements=50
313
+
314
+ # Minimum number of public methods for a class (see R0903).
315
+ min-public-methods=2
316
+
317
+
318
+ [EXCEPTIONS]
319
+
320
+ # Exceptions that will emit a warning when caught.
321
+ overgeneral-exceptions=builtins.BaseException,builtins.Exception
322
+
323
+
324
+ [FORMAT]
325
+
326
+ # Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
327
+ expected-line-ending-format=
328
+
329
+ # Regexp for a line that is allowed to be longer than the limit.
330
+ ignore-long-lines=^\s*(# )?<?https?://\S+>?$
331
+
332
+ # Number of spaces of indent required inside a hanging or continued line.
333
+ indent-after-paren=4
334
+
335
+ # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
336
+ # tab).
337
+ indent-string=' '
338
+
339
+ # Maximum number of characters on a single line.
340
+ max-line-length=100
341
+
342
+ # Maximum number of lines in a module.
343
+ max-module-lines=1000
344
+
345
+ # Allow the body of a class to be on the same line as the declaration if body
346
+ # contains single statement.
347
+ single-line-class-stmt=no
348
+
349
+ # Allow the body of an if to be on the same line as the test if there is no
350
+ # else.
351
+ single-line-if-stmt=no
352
+
353
+
354
+ [IMPORTS]
355
+
356
+ # List of modules that can be imported at any level, not just the top level
357
+ # one.
358
+ allow-any-import-level=
359
+
360
+ # Allow explicit reexports by alias from a package __init__.
361
+ allow-reexport-from-package=no
362
+
363
+ # Allow wildcard imports from modules that define __all__.
364
+ allow-wildcard-with-all=no
365
+
366
+ # Deprecated modules which should not be used, separated by a comma.
367
+ deprecated-modules=
368
+
369
+ # Output a graph (.gv or any supported image format) of external dependencies
370
+ # to the given file (report RP0402 must not be disabled).
371
+ ext-import-graph=
372
+
373
+ # Output a graph (.gv or any supported image format) of all (i.e. internal and
374
+ # external) dependencies to the given file (report RP0402 must not be
375
+ # disabled).
376
+ import-graph=
377
+
378
+ # Output a graph (.gv or any supported image format) of internal dependencies
379
+ # to the given file (report RP0402 must not be disabled).
380
+ int-import-graph=
381
+
382
+ # Force import order to recognize a module as part of the standard
383
+ # compatibility libraries.
384
+ known-standard-library=
385
+
386
+ # Force import order to recognize a module as part of a third party library.
387
+ known-third-party=enchant
388
+
389
+ # Couples of modules and preferred modules, separated by a comma.
390
+ preferred-modules=
391
+
392
+
393
+ [LOGGING]
394
+
395
+ # The type of string formatting that logging methods do. `old` means using %
396
+ # formatting, `new` is for `{}` formatting.
397
+ logging-format-style=old
398
+
399
+ # Logging modules to check that the string format arguments are in logging
400
+ # function parameter format.
401
+ logging-modules=logging
402
+
403
+
404
+ [MESSAGES CONTROL]
405
+
406
+ # Only show warnings with the listed confidence levels. Leave empty to show
407
+ # all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
408
+ # UNDEFINED.
409
+ confidence=HIGH,
410
+ CONTROL_FLOW,
411
+ INFERENCE,
412
+ INFERENCE_FAILURE,
413
+ UNDEFINED
414
+
415
+ # Disable the message, report, category or checker with the given id(s). You
416
+ # can either give multiple identifiers separated by comma (,) or put this
417
+ # option multiple times (only on the command line, not in the configuration
418
+ # file where it should appear only once). You can also use "--disable=all" to
419
+ # disable everything first and then re-enable specific checks. For example, if
420
+ # you want to run only the similarities checker, you can use "--disable=all
421
+ # --enable=similarities". If you want to run only the classes checker, but have
422
+ # no Warning level messages displayed, use "--disable=all --enable=classes
423
+ # --disable=W".
424
+ disable=raw-checker-failed,
425
+ bad-inline-option,
426
+ locally-disabled,
427
+ file-ignored,
428
+ suppressed-message,
429
+ useless-suppression,
430
+ deprecated-pragma,
431
+ use-symbolic-message-instead
432
+
433
+ # Enable the message, report, category or checker with the given id(s). You can
434
+ # either give multiple identifier separated by comma (,) or put this option
435
+ # multiple time (only on the command line, not in the configuration file where
436
+ # it should appear only once). See also the "--disable" option for examples.
437
+ enable=c-extension-no-member
438
+
439
+
440
+ [METHOD_ARGS]
441
+
442
+ # List of qualified names (i.e., library.method) which require a timeout
443
+ # parameter e.g. 'requests.api.get,requests.api.post'
444
+ timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request
445
+
446
+
447
+ [MISCELLANEOUS]
448
+
449
+ # List of note tags to take in consideration, separated by a comma.
450
+ notes=FIXME,
451
+ XXX,
452
+ TODO
453
+
454
+ # Regular expression of note tags to take in consideration.
455
+ notes-rgx=
456
+
457
+
458
+ [REFACTORING]
459
+
460
+ # Maximum number of nested blocks for function / method body
461
+ max-nested-blocks=5
462
+
463
+ # Complete name of functions that never returns. When checking for
464
+ # inconsistent-return-statements if a never returning function is called then
465
+ # it will be considered as an explicit return statement and no message will be
466
+ # printed.
467
+ never-returning-functions=sys.exit,argparse.parse_error
468
+
469
+
470
+ [REPORTS]
471
+
472
+ # Python expression which should return a score less than or equal to 10. You
473
+ # have access to the variables 'fatal', 'error', 'warning', 'refactor',
474
+ # 'convention', and 'info' which contain the number of messages in each
475
+ # category, as well as 'statement' which is the total number of statements
476
+ # analyzed. This score is used by the global evaluation report (RP0004).
477
+ evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
478
+
479
+ # Template used to display messages. This is a python new-style format string
480
+ # used to format the message information. See doc for all details.
481
+ msg-template=
482
+
483
+ # Set the output format. Available formats are text, parseable, colorized, json
484
+ # and msvs (visual studio). You can also give a reporter class, e.g.
485
+ # mypackage.mymodule.MyReporterClass.
486
+ #output-format=
487
+
488
+ # Tells whether to display a full report or only the messages.
489
+ reports=no
490
+
491
+ # Activate the evaluation score.
492
+ score=yes
493
+
494
+
495
+ [SIMILARITIES]
496
+
497
+ # Comments are removed from the similarity computation
498
+ ignore-comments=yes
499
+
500
+ # Docstrings are removed from the similarity computation
501
+ ignore-docstrings=yes
502
+
503
+ # Imports are removed from the similarity computation
504
+ ignore-imports=yes
505
+
506
+ # Signatures are removed from the similarity computation
507
+ ignore-signatures=yes
508
+
509
+ # Minimum lines number of a similarity.
510
+ min-similarity-lines=4
511
+
512
+
513
+ [SPELLING]
514
+
515
+ # Limits count of emitted suggestions for spelling mistakes.
516
+ max-spelling-suggestions=4
517
+
518
+ # Spelling dictionary name. No available dictionaries : You need to install
519
+ # both the python package and the system dependency for enchant to work..
520
+ spelling-dict=
521
+
522
+ # List of comma separated words that should be considered directives if they
523
+ # appear at the beginning of a comment and should not be checked.
524
+ spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
525
+
526
+ # List of comma separated words that should not be checked.
527
+ spelling-ignore-words=
528
+
529
+ # A path to a file that contains the private dictionary; one word per line.
530
+ spelling-private-dict-file=
531
+
532
+ # Tells whether to store unknown words to the private dictionary (see the
533
+ # --spelling-private-dict-file option) instead of raising a message.
534
+ spelling-store-unknown-words=no
535
+
536
+
537
+ [STRING]
538
+
539
+ # This flag controls whether inconsistent-quotes generates a warning when the
540
+ # character used as a quote delimiter is used inconsistently within a module.
541
+ check-quote-consistency=no
542
+
543
+ # This flag controls whether the implicit-str-concat should generate a warning
544
+ # on implicit string concatenation in sequences defined over several lines.
545
+ check-str-concat-over-line-jumps=no
546
+
547
+
548
+ [TYPECHECK]
549
+
550
+ # List of decorators that produce context managers, such as
551
+ # contextlib.contextmanager. Add to this list to register other decorators that
552
+ # produce valid context managers.
553
+ contextmanager-decorators=contextlib.contextmanager
554
+
555
+ # List of members which are set dynamically and missed by pylint inference
556
+ # system, and so shouldn't trigger E1101 when accessed. Python regular
557
+ # expressions are accepted.
558
+ generated-members=
559
+
560
+ # Tells whether to warn about missing members when the owner of the attribute
561
+ # is inferred to be None.
562
+ ignore-none=yes
563
+
564
+ # This flag controls whether pylint should warn about no-member and similar
565
+ # checks whenever an opaque object is returned when inferring. The inference
566
+ # can return multiple potential results while evaluating a Python object, but
567
+ # some branches might not be evaluated, which results in partial inference. In
568
+ # that case, it might be useful to still emit no-member and other checks for
569
+ # the rest of the inferred objects.
570
+ ignore-on-opaque-inference=yes
571
+
572
+ # List of symbolic message names to ignore for Mixin members.
573
+ ignored-checks-for-mixins=no-member,
574
+ not-async-context-manager,
575
+ not-context-manager,
576
+ attribute-defined-outside-init
577
+
578
+ # List of class names for which member attributes should not be checked (useful
579
+ # for classes with dynamically set attributes). This supports the use of
580
+ # qualified names.
581
+ ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace
582
+
583
+ # Show a hint with possible names when a member name was not found. The aspect
584
+ # of finding the hint is based on edit distance.
585
+ missing-member-hint=yes
586
+
587
+ # The minimum edit distance a name should have in order to be considered a
588
+ # similar match for a missing member name.
589
+ missing-member-hint-distance=1
590
+
591
+ # The total number of similar names that should be taken in consideration when
592
+ # showing a hint for a missing member.
593
+ missing-member-max-choices=1
594
+
595
+ # Regex pattern to define which classes are considered mixins.
596
+ mixin-class-rgx=.*[Mm]ixin
597
+
598
+ # List of decorators that change the signature of a decorated function.
599
+ signature-mutators=
600
+
601
+
602
+ [VARIABLES]
603
+
604
+ # List of additional names supposed to be defined in builtins. Remember that
605
+ # you should avoid defining new builtins when possible.
606
+ additional-builtins=
607
+
608
+ # Tells whether unused global variables should be treated as a violation.
609
+ allow-global-unused-variables=yes
610
+
611
+ # List of names allowed to shadow builtins
612
+ allowed-redefined-builtins=
613
+
614
+ # List of strings which can identify a callback function by name. A callback
615
+ # name must start or end with one of those strings.
616
+ callbacks=cb_,
617
+ _cb
618
+
619
+ # A regular expression matching the name of dummy variables (i.e. expected to
620
+ # not be used).
621
+ dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
622
+
623
+ # Argument names that match this expression will be ignored.
624
+ ignored-argument-names=_.*|^ignored_|^unused_
625
+
626
+ # Tells whether we should check for unused import in __init__ files.
627
+ init-import=no
628
+
629
+ # List of qualified module names which can have objects that can redefine
630
+ # builtins.
631
+ redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
elise/src/__init__.py ADDED
File without changes
elise/src/app.py CHANGED
@@ -1,19 +1,29 @@
 
 
 
1
  import gradio as gr
2
  from sentence_transformers import SentenceTransformer
3
 
4
- from parser import SentenceParser
5
  from matcher import Matcher
6
  from utils import df_to_json
7
 
 
8
  # prep models
9
- model_checkpoint = "BerserkerMother/restaurant_ner"
10
- parser = SentenceParser.from_huggingface(model_checkpoint)
11
 
12
  embedder = SentenceTransformer("all-MiniLM-L6-v2")
13
  matcher = Matcher.from_path("data/final_data.csv", embedder)
14
 
15
 
16
  def recommend(query: str):
 
 
 
 
 
 
17
  ner_tags = parser.get_ner(query)
18
  jobs = parser.get_jobs(ner_tags)
19
  recomms = matcher.handle_jobs(jobs)
 
1
+ """
2
+ Gradio app builder
3
+ """
4
  import gradio as gr
5
  from sentence_transformers import SentenceTransformer
6
 
7
+ from nlu import SentenceParser
8
  from matcher import Matcher
9
  from utils import df_to_json
10
 
11
+
12
  # prep models
13
+ MODEL_CHECKPOINT = "BerserkerMother/restaurant_ner"
14
+ parser = SentenceParser.from_huggingface(MODEL_CHECKPOINT)
15
 
16
  embedder = SentenceTransformer("all-MiniLM-L6-v2")
17
  matcher = Matcher.from_path("data/final_data.csv", embedder)
18
 
19
 
20
  def recommend(query: str):
21
+ """
22
+ App logic for gradio fn
23
+
24
+ Parameters:
25
+ query(str): user query
26
+ """
27
  ner_tags = parser.get_ner(query)
28
  jobs = parser.get_jobs(ner_tags)
29
  recomms = matcher.handle_jobs(jobs)
elise/src/matcher/__init__.py CHANGED
@@ -1 +1,8 @@
 
 
 
 
 
 
 
1
  from .matcher import Matcher
 
1
+ """
2
+ Create Matcher to find best matches for prompts.
3
+
4
+ Classes:
5
+
6
+ Mathcer
7
+ """
8
  from .matcher import Matcher
elise/src/matcher/matcher.py CHANGED
@@ -1,4 +1,11 @@
1
- from typing import List
 
 
 
 
 
 
 
2
 
3
  import pandas as pd
4
 
@@ -7,6 +14,21 @@ import sentence_transformers
7
 
8
 
9
  class Matcher:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  mappings = {
11
  "Semantic": [
12
  "Accessibility",
@@ -26,13 +48,26 @@ class Matcher:
26
  "Name": "name",
27
  }
28
 
29
- def __init__(self, df: pd.DataFrame, semantic_encoder):
30
- self.database = df
 
 
 
 
 
 
 
 
 
 
31
  self.semantic_encoder = semantic_encoder
32
  self.semantics = None
33
  self.prep_semantics()
34
 
35
  def prep_semantics(self):
 
 
 
36
  semantics_corpus = self.database[self.mappings["Semantic"]]
37
  print(semantics_corpus)
38
 
@@ -49,6 +84,16 @@ class Matcher:
49
  )
50
 
51
  def handle_jobs(self, jobs):
 
 
 
 
 
 
 
 
 
 
52
  prompts_scores = []
53
  for job in jobs:
54
  flag = True # checks if there where any outputs
@@ -72,6 +117,15 @@ class Matcher:
72
  return prompts_scores
73
 
74
  def match_semantic(self, semantic_prompt: List[str]):
 
 
 
 
 
 
 
 
 
75
  if not isinstance(self.semantics, torch.Tensor):
76
  raise ValueError("Semantics vectors are not initilized!")
77
  semantic_prompt = "and ".join(semantic_prompt)
@@ -85,21 +139,76 @@ class Matcher:
85
  scores = cos_scores[0].tolist()
86
  return scores
87
 
88
- def match_price(self):
89
- pass
 
 
 
 
 
 
 
 
 
90
 
91
- def match_name(self):
92
- pass
 
93
 
94
- def match_menu(self):
95
- pass
96
 
97
- def match_location(self):
98
- pass
 
 
99
 
100
- def match_hours(self):
101
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  @classmethod
104
  def from_path(cls, df_path: str, semantic_encoder):
 
 
 
 
 
 
 
 
 
 
105
  return cls(pd.read_csv(df_path), semantic_encoder)
 
1
+ """
2
+ Create Matcher to find best matches for prompts.
3
+
4
+ Classes:
5
+
6
+ Mathcer
7
+ """
8
+ from typing import List, Union
9
 
10
  import pandas as pd
11
 
 
14
 
15
 
16
  class Matcher:
17
+ """
18
+ Matcher to match user prompts against database.
19
+
20
+ ...
21
+
22
+ Attributes
23
+ ----------
24
+ database : pd.Dataframe
25
+ restaurants database
26
+ semantic_encoder : transformers.pipeline
27
+ text embedder
28
+ semantics : torch.tensor
29
+ embedded representation for semnatic fields in db
30
+ """
31
+
32
  mappings = {
33
  "Semantic": [
34
  "Accessibility",
 
48
  "Name": "name",
49
  }
50
 
51
+ def __init__(self, data_frame: pd.DataFrame, semantic_encoder):
52
+ """
53
+ Constructs a matcher that matches extracted user prompt info against database.
54
+
55
+ Parameters
56
+ ----------
57
+ data_frame :
58
+ restaurants data
59
+ semantic_encoder :
60
+ language model encoder that maps text to meaningful embedding
61
+ """
62
+ self.database = data_frame
63
  self.semantic_encoder = semantic_encoder
64
  self.semantics = None
65
  self.prep_semantics()
66
 
67
  def prep_semantics(self):
68
+ """
69
+ Converts restaurants data to embedding vectors.
70
+ """
71
  semantics_corpus = self.database[self.mappings["Semantic"]]
72
  print(semantics_corpus)
73
 
 
84
  )
85
 
86
  def handle_jobs(self, jobs):
87
+ """
88
+ Returns the score of each prompt against cls.mapping keys
89
+
90
+ Parameters:
91
+ jobs:
92
+ list of dictionaries for each prompt containing job and it's value
93
+
94
+ Returns:
95
+ prompts_scores: dataframes for each prompt representing job scores
96
+ """
97
  prompts_scores = []
98
  for job in jobs:
99
  flag = True # checks if there where any outputs
 
117
  return prompts_scores
118
 
119
  def match_semantic(self, semantic_prompt: List[str]):
120
+ """
121
+ Scores user prompt against Semantic fields in restaurants DB.
122
+
123
+ Parameters:
124
+ semantic_prompt: List of Semantic prompts
125
+
126
+ Returns:
127
+ scores: list of scores for resutrants in DB
128
+ """
129
  if not isinstance(self.semantics, torch.Tensor):
130
  raise ValueError("Semantics vectors are not initilized!")
131
  semantic_prompt = "and ".join(semantic_prompt)
 
139
  scores = cos_scores[0].tolist()
140
  return scores
141
 
142
+ def match_price(self, price):
143
+ """
144
+ Scores user prompt against prices in restaurants DB.
145
+
146
+ Parameters:
147
+ price: wanted price
148
+
149
+ Returns:
150
+ scores: list of scores for resutrants in DB
151
+ """
152
+ raise NotImplementedError
153
 
154
+ def match_name(self, name: str):
155
+ """
156
+ Finds a specific restaurant name in the DB.
157
 
158
+ Parameters:
159
+ semantic_prompt (str): name of the restaurants
160
 
161
+ Returns:
162
+ scores: list of scores for resutrants in DB
163
+ """
164
+ raise NotImplementedError
165
 
166
+ def match_menu(self, foods: Union[List[str], str]):
167
+ """
168
+ Scores user prompt against Semantic fields in restaurants DB.
169
+
170
+ Parameters:
171
+ foods: List of wanted foods
172
+
173
+ Returns:
174
+ scores: list of scores for resutrants in DB
175
+ """
176
+ raise NotImplementedError
177
+
178
+ def match_location(self, location):
179
+ """
180
+ Scores restaurants base on min distance to user intent.
181
+
182
+ Parameters:
183
+ location: location
184
+
185
+ Returns:
186
+ scores: list of scores for resutrants in DB
187
+ """
188
+ raise NotImplementedError
189
+
190
+ def match_hours(self, hours):
191
+ """
192
+ Scores user prompt against working hours in restaurants DB.
193
+
194
+ Parameters:
195
+ hours: restaurant working hours(lunch, dinner, and etc.)
196
+
197
+ Returns:
198
+ scores: list of scores for resutrants in DB
199
+ """
200
+ raise NotImplementedError
201
 
202
  @classmethod
203
  def from_path(cls, df_path: str, semantic_encoder):
204
+ """
205
+ Builds a matcher from csv path
206
+
207
+ Parameters:
208
+ df_path (str): path to database csv file
209
+ semantic_encoder (transformers.pipeline): text embedder
210
+
211
+ Returns:
212
+ matcher object
213
+ """
214
  return cls(pd.read_csv(df_path), semantic_encoder)
elise/src/nlu/__init__.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ """
2
+ Parses user raw user prompts to jobs to run against DB
3
+
4
+ Classes:
5
+ Semantic Parser: object to parse the user prompts
6
+ """
7
+ from .nlu import SentenceParser
elise/src/{parser/parser.py → nlu/nlu.py} RENAMED
@@ -1,9 +1,30 @@
 
 
 
 
 
 
1
  from typing import List, Union
2
 
3
  import transformers
4
 
5
 
6
  class SentenceParser:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  mappings = {
8
  "Amenity": "Semantic",
9
  "Price": "Price",
@@ -15,20 +36,41 @@ class SentenceParser:
15
  }
16
 
17
  def __init__(self, pipe):
 
 
 
 
 
 
 
18
  self.pipe = pipe
19
 
20
  @classmethod
21
- def from_huggingface(cls, model_path: str):
 
 
 
 
 
 
 
 
22
  token_classifier = transformers.pipeline(
23
  "token-classification",
24
- model=model_path,
25
  aggregation_strategy="simple",
26
  )
27
  return cls(token_classifier)
28
 
29
  def get_ner(self, sentences: Union[str, List[str]]):
30
- """Identifies the user intents from prompts
31
- returns: list of dictionaries{category: words}
 
 
 
 
 
 
32
  """
33
  if isinstance(sentences, str):
34
  sentences = [sentences]
@@ -37,7 +79,7 @@ class SentenceParser:
37
  for items in self.pipe(sentences):
38
  sentence_ner = {}
39
  for recognized_token in items:
40
- if recognized_token["entity_group"] in list(sentence_ner.keys()):
41
  sentence_ner[recognized_token["entity_group"]].append(
42
  recognized_token["word"]
43
  )
@@ -49,12 +91,17 @@ class SentenceParser:
49
  return list_out
50
 
51
  def get_jobs(self, ners):
52
- """Maps user's intents to Matcher jobs"""
 
 
 
 
 
53
  list_out = []
54
  for item in ners:
55
  jobs = {}
56
  for ner, value in item.items():
57
- if ner in self.mappings.keys():
58
  jobs[self.mappings[ner]] = value
59
  list_out.append(jobs)
60
  return list_out
 
1
+ """
2
+ Parses user raw user prompts to jobs to run against DB
3
+
4
+ Classes:
5
+ Semantic Parser: object to parse the user prompts
6
+ """
7
  from typing import List, Union
8
 
9
  import transformers
10
 
11
 
12
  class SentenceParser:
13
+ """
14
+ Parses user prompts.
15
+
16
+ Attributes
17
+ ----------
18
+ pipe: pipeline to convert prompts to jobs for matcher
19
+
20
+ Methods
21
+ -------
22
+ from_huggingface(pipe_path)
23
+ get_ners(sentence)
24
+ get_jobs(ner)
25
+
26
+ """
27
+
28
  mappings = {
29
  "Amenity": "Semantic",
30
  "Price": "Price",
 
36
  }
37
 
38
  def __init__(self, pipe):
39
+ """
40
+ Constructs the a nlu
41
+
42
+ Parameters
43
+ ----------
44
+ pipe: pipeline to converts prompts to jobs
45
+ """
46
  self.pipe = pipe
47
 
48
  @classmethod
49
+ def from_huggingface(cls, pipe_path: str):
50
+ """
51
+ builds a nlu from hf pipeline
52
+
53
+ Parameters:
54
+ pipe_path: hf pipe name
55
+ Returns:
56
+ nlu object
57
+ """
58
  token_classifier = transformers.pipeline(
59
  "token-classification",
60
+ model=pipe_path,
61
  aggregation_strategy="simple",
62
  )
63
  return cls(token_classifier)
64
 
65
  def get_ner(self, sentences: Union[str, List[str]]):
66
+ """
67
+ Identifies the user intents from prompts
68
+
69
+ Parameters:
70
+ sentences: user prompt(s)
71
+
72
+ Returns:
73
+ list_out: list of dictionaries{category: words}
74
  """
75
  if isinstance(sentences, str):
76
  sentences = [sentences]
 
79
  for items in self.pipe(sentences):
80
  sentence_ner = {}
81
  for recognized_token in items:
82
+ if recognized_token["entity_group"] in list(sentence_ner):
83
  sentence_ner[recognized_token["entity_group"]].append(
84
  recognized_token["word"]
85
  )
 
91
  return list_out
92
 
93
  def get_jobs(self, ners):
94
+ """
95
+ Maps user's intents to Matcher jobs
96
+
97
+ Parameters:
98
+ ners: list of user intents for each prompts
99
+ """
100
  list_out = []
101
  for item in ners:
102
  jobs = {}
103
  for ner, value in item.items():
104
+ if ner in self.mappings:
105
  jobs[self.mappings[ner]] = value
106
  list_out.append(jobs)
107
  return list_out
elise/src/parser/__init__.py DELETED
@@ -1 +0,0 @@
1
- from .parser import SentenceParser
 
 
elise/src/utils/__init__.py CHANGED
@@ -1,2 +1,9 @@
 
 
 
 
 
 
 
1
  from .gradio import df_to_json
2
- from . import logger
 
1
+ """
2
+ Contains project utility functions
3
+
4
+ Functions
5
+ ---------
6
+ df_to_json(df)
7
+ """
8
  from .gradio import df_to_json
9
+ from . import logger
elise/src/utils/gradio.py CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  from typing import List
2
 
3
  import pandas as pd
 
1
+ """
2
+ Gradio app utility functions
3
+ """
4
  from typing import List
5
 
6
  import pandas as pd
elise/src/utils/logger.py CHANGED
@@ -1,15 +1,19 @@
 
 
 
1
  import logging.config
2
  import yaml
3
 
4
- with open('elise/src/configs/logging_config.yaml', 'r') as f:
5
  config = yaml.safe_load(f.read())
6
  logging.config.dictConfig(config)
7
  logging.captureWarnings(True)
8
 
 
9
  def get_logger(name: str):
10
  """Logs a message
11
- Args:
12
- name(str): name of logger
13
  """
14
  logger = logging.getLogger(name)
15
- return logger
 
1
+ """
2
+ Logging helper module
3
+ """
4
  import logging.config
5
  import yaml
6
 
7
+ with open("elise/src/configs/logging_config.yaml", "r", encoding="utf-8") as f:
8
  config = yaml.safe_load(f.read())
9
  logging.config.dictConfig(config)
10
  logging.captureWarnings(True)
11
 
12
+
13
  def get_logger(name: str):
14
  """Logs a message
15
+ Parameters:
16
+ name(str): name of logger
17
  """
18
  logger = logging.getLogger(name)
19
+ return logger