sasan commited on
Commit
cb47347
1 Parent(s): 961640d

Add .gitignore file and update skills package

Browse files
Files changed (8) hide show
  1. .gitignore +3 -0
  2. .pylintrc +642 -0
  3. car_assistant_text.ipynb +0 -0
  4. kitt.py +10 -4
  5. skills/__init__.py +24 -0
  6. skills/common.py +45 -0
  7. skills/routing.py +68 -1
  8. skills/weather.py +107 -0
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ audio
2
+ .DS_Store
3
+ .env
.pylintrc ADDED
@@ -0,0 +1,642 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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=
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.12
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
+ use-implicit-booleaness-not-comparison-to-string,
433
+ use-implicit-booleaness-not-comparison-to-zero,
434
+ missing-module-docstring,
435
+ missing-class-docstring,
436
+ missing-function-docstring
437
+
438
+ # Enable the message, report, category or checker with the given id(s). You can
439
+ # either give multiple identifier separated by comma (,) or put this option
440
+ # multiple time (only on the command line, not in the configuration file where
441
+ # it should appear only once). See also the "--disable" option for examples.
442
+ enable=
443
+
444
+
445
+ [METHOD_ARGS]
446
+
447
+ # List of qualified names (i.e., library.method) which require a timeout
448
+ # parameter e.g. 'requests.api.get,requests.api.post'
449
+ 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
450
+
451
+
452
+ [MISCELLANEOUS]
453
+
454
+ # List of note tags to take in consideration, separated by a comma.
455
+ notes=FIXME,
456
+ XXX,
457
+ TODO
458
+
459
+ # Regular expression of note tags to take in consideration.
460
+ notes-rgx=
461
+
462
+
463
+ [REFACTORING]
464
+
465
+ # Maximum number of nested blocks for function / method body
466
+ max-nested-blocks=5
467
+
468
+ # Complete name of functions that never returns. When checking for
469
+ # inconsistent-return-statements if a never returning function is called then
470
+ # it will be considered as an explicit return statement and no message will be
471
+ # printed.
472
+ never-returning-functions=sys.exit,argparse.parse_error
473
+
474
+ # Let 'consider-using-join' be raised when the separator to join on would be
475
+ # non-empty (resulting in expected fixes of the type: ``"- " + " -
476
+ # ".join(items)``)
477
+ suggest-join-with-non-empty-separator=yes
478
+
479
+
480
+ [REPORTS]
481
+
482
+ # Python expression which should return a score less than or equal to 10. You
483
+ # have access to the variables 'fatal', 'error', 'warning', 'refactor',
484
+ # 'convention', and 'info' which contain the number of messages in each
485
+ # category, as well as 'statement' which is the total number of statements
486
+ # analyzed. This score is used by the global evaluation report (RP0004).
487
+ evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
488
+
489
+ # Template used to display messages. This is a python new-style format string
490
+ # used to format the message information. See doc for all details.
491
+ msg-template=
492
+
493
+ # Set the output format. Available formats are: text, parseable, colorized,
494
+ # json2 (improved json format), json (old json format) and msvs (visual
495
+ # studio). You can also give a reporter class, e.g.
496
+ # mypackage.mymodule.MyReporterClass.
497
+ #output-format=
498
+
499
+ # Tells whether to display a full report or only the messages.
500
+ reports=no
501
+
502
+ # Activate the evaluation score.
503
+ score=yes
504
+
505
+
506
+ [SIMILARITIES]
507
+
508
+ # Comments are removed from the similarity computation
509
+ ignore-comments=yes
510
+
511
+ # Docstrings are removed from the similarity computation
512
+ ignore-docstrings=yes
513
+
514
+ # Imports are removed from the similarity computation
515
+ ignore-imports=yes
516
+
517
+ # Signatures are removed from the similarity computation
518
+ ignore-signatures=yes
519
+
520
+ # Minimum lines number of a similarity.
521
+ min-similarity-lines=4
522
+
523
+
524
+ [SPELLING]
525
+
526
+ # Limits count of emitted suggestions for spelling mistakes.
527
+ max-spelling-suggestions=4
528
+
529
+ # Spelling dictionary name. No available dictionaries : You need to install
530
+ # both the python package and the system dependency for enchant to work.
531
+ spelling-dict=
532
+
533
+ # List of comma separated words that should be considered directives if they
534
+ # appear at the beginning of a comment and should not be checked.
535
+ spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
536
+
537
+ # List of comma separated words that should not be checked.
538
+ spelling-ignore-words=
539
+
540
+ # A path to a file that contains the private dictionary; one word per line.
541
+ spelling-private-dict-file=
542
+
543
+ # Tells whether to store unknown words to the private dictionary (see the
544
+ # --spelling-private-dict-file option) instead of raising a message.
545
+ spelling-store-unknown-words=no
546
+
547
+
548
+ [STRING]
549
+
550
+ # This flag controls whether inconsistent-quotes generates a warning when the
551
+ # character used as a quote delimiter is used inconsistently within a module.
552
+ check-quote-consistency=no
553
+
554
+ # This flag controls whether the implicit-str-concat should generate a warning
555
+ # on implicit string concatenation in sequences defined over several lines.
556
+ check-str-concat-over-line-jumps=no
557
+
558
+
559
+ [TYPECHECK]
560
+
561
+ # List of decorators that produce context managers, such as
562
+ # contextlib.contextmanager. Add to this list to register other decorators that
563
+ # produce valid context managers.
564
+ contextmanager-decorators=contextlib.contextmanager
565
+
566
+ # List of members which are set dynamically and missed by pylint inference
567
+ # system, and so shouldn't trigger E1101 when accessed. Python regular
568
+ # expressions are accepted.
569
+ generated-members=
570
+
571
+ # Tells whether to warn about missing members when the owner of the attribute
572
+ # is inferred to be None.
573
+ ignore-none=yes
574
+
575
+ # This flag controls whether pylint should warn about no-member and similar
576
+ # checks whenever an opaque object is returned when inferring. The inference
577
+ # can return multiple potential results while evaluating a Python object, but
578
+ # some branches might not be evaluated, which results in partial inference. In
579
+ # that case, it might be useful to still emit no-member and other checks for
580
+ # the rest of the inferred objects.
581
+ ignore-on-opaque-inference=yes
582
+
583
+ # List of symbolic message names to ignore for Mixin members.
584
+ ignored-checks-for-mixins=no-member,
585
+ not-async-context-manager,
586
+ not-context-manager,
587
+ attribute-defined-outside-init
588
+
589
+ # List of class names for which member attributes should not be checked (useful
590
+ # for classes with dynamically set attributes). This supports the use of
591
+ # qualified names.
592
+ ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace
593
+
594
+ # Show a hint with possible names when a member name was not found. The aspect
595
+ # of finding the hint is based on edit distance.
596
+ missing-member-hint=yes
597
+
598
+ # The minimum edit distance a name should have in order to be considered a
599
+ # similar match for a missing member name.
600
+ missing-member-hint-distance=1
601
+
602
+ # The total number of similar names that should be taken in consideration when
603
+ # showing a hint for a missing member.
604
+ missing-member-max-choices=1
605
+
606
+ # Regex pattern to define which classes are considered mixins.
607
+ mixin-class-rgx=.*[Mm]ixin
608
+
609
+ # List of decorators that change the signature of a decorated function.
610
+ signature-mutators=
611
+
612
+
613
+ [VARIABLES]
614
+
615
+ # List of additional names supposed to be defined in builtins. Remember that
616
+ # you should avoid defining new builtins when possible.
617
+ additional-builtins=
618
+
619
+ # Tells whether unused global variables should be treated as a violation.
620
+ allow-global-unused-variables=yes
621
+
622
+ # List of names allowed to shadow builtins
623
+ allowed-redefined-builtins=
624
+
625
+ # List of strings which can identify a callback function by name. A callback
626
+ # name must start or end with one of those strings.
627
+ callbacks=cb_,
628
+ _cb
629
+
630
+ # A regular expression matching the name of dummy variables (i.e. expected to
631
+ # not be used).
632
+ dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
633
+
634
+ # Argument names that match this expression will be ignored.
635
+ ignored-argument-names=_.*|^ignored_|^unused_
636
+
637
+ # Tells whether we should check for unused import in __init__ files.
638
+ init-import=no
639
+
640
+ # List of qualified module names which can have objects that can redefine
641
+ # builtins.
642
+ redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
car_assistant_text.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
kitt.py CHANGED
@@ -5,7 +5,6 @@ import requests
5
  # INTERFACE WITH AUDIO TO AUDIO
6
 
7
 
8
-
9
  def transcript(
10
  general_context, link_to_audio, voice, emotion, place, time, delete_history, state
11
  ):
@@ -132,10 +131,17 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
132
  # value="Kirchberg Campus, Kirchberg",
133
  # show_label=True,
134
  # )
135
- origin = gr.Textbox(value="Luxembourg Gare, Luxembourg", label="Origin", interactive=True)
 
 
136
  destination = gr.Textbox(
137
- value="Kirchberg Campus, Kirchberg", label="Destination", interactive=True)
138
- recorder = gr.Audio(type="filepath", label="input audio", elem_id="recorder")
 
 
 
 
 
139
  with gr.Column(scale=2, min_width=600):
140
  map_plot = gr.Plot()
141
  origin.submit(fn=calculate_route, outputs=map_plot)
 
5
  # INTERFACE WITH AUDIO TO AUDIO
6
 
7
 
 
8
  def transcript(
9
  general_context, link_to_audio, voice, emotion, place, time, delete_history, state
10
  ):
 
131
  # value="Kirchberg Campus, Kirchberg",
132
  # show_label=True,
133
  # )
134
+ origin = gr.Textbox(
135
+ value="Luxembourg Gare, Luxembourg", label="Origin", interactive=True
136
+ )
137
  destination = gr.Textbox(
138
+ value="Kirchberg Campus, Kirchberg",
139
+ label="Destination",
140
+ interactive=True,
141
+ )
142
+ recorder = gr.Audio(
143
+ type="filepath", label="input audio", elem_id="recorder"
144
+ )
145
  with gr.Column(scale=2, min_width=600):
146
  map_plot = gr.Plot()
147
  origin.submit(fn=calculate_route, outputs=map_plot)
skills/__init__.py CHANGED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import inspect
2
+
3
+ from .common import execute_function_call, extract_func_args
4
+ from .weather import get_weather, get_forecast
5
+ from .routing import find_route
6
+
7
+
8
+ def format_functions_for_prompt_raven(*functions):
9
+ """Format functions for use in Prompt Raven.
10
+
11
+ Args:
12
+ *functions (function): One or more functions to format.
13
+ """
14
+ formatted_functions = []
15
+ for func in functions:
16
+ signature = f"{func.__name__}{inspect.signature(func)}"
17
+ docstring = inspect.getdoc(func)
18
+ formatted_functions.append(
19
+ f"OPTION:\n<func_start>{signature}<func_end>\n<docstring_start>\n{docstring}\n<docstring_end>"
20
+ )
21
+ return "\n".join(formatted_functions)
22
+
23
+
24
+ SKILLS_PROMPT = format_functions_for_prompt_raven(get_weather, get_forecast, find_route)
skills/common.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ from typing import Union
3
+
4
+
5
+ from pydantic_settings import BaseSettings, SettingsConfigDict
6
+
7
+ import skills
8
+
9
+ class Settings(BaseSettings):
10
+ WEATHER_API_KEY: str
11
+ TOMTOM_API_KEY: str
12
+
13
+ model_config = SettingsConfigDict(env_file=".env")
14
+
15
+
16
+ def execute_function_call(text: str, dry_run=False) -> str:
17
+ function_name_match = re.search(r"Call: (\w+)", text)
18
+ function_name = function_name_match.group(1) if function_name_match else None
19
+ arguments = eval(f"dict{text.split(function_name)[1].strip()}")
20
+ function = getattr(skills, function_name) if function_name else None
21
+
22
+ if dry_run:
23
+ print(f"{function_name}(**{arguments})")
24
+ return "Dry run successful"
25
+
26
+ if function:
27
+ out = function(**arguments)
28
+ try:
29
+ if function:
30
+ out = function(**arguments)
31
+ except Exception as e:
32
+ out = str(e)
33
+ return out
34
+
35
+
36
+ def extract_func_args(text: str) -> tuple[str, dict]:
37
+ function_name_match = re.search(r"Call: (\w+)", text)
38
+ function_name = function_name_match.group(1) if function_name_match else None
39
+ if not function_name:
40
+ raise ValueError("No function name found in text")
41
+ arguments = eval(f"dict{text.split(function_name)[1].strip()}")
42
+ return function_name, arguments
43
+
44
+
45
+ config = Settings() # type: ignore
skills/routing.py CHANGED
@@ -21,4 +21,71 @@ def calculate_route():
21
  fig.update_layout(mapbox_style="open-street-map", mapbox_zoom=12, mapbox_center_lat=lats[0], mapbox_center_lon=lons[0])
22
  fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
23
 
24
- return fig
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  fig.update_layout(mapbox_style="open-street-map", mapbox_zoom=12, mapbox_center_lat=lats[0], mapbox_center_lon=lons[0])
22
  fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
23
 
24
+ return fig
25
+
26
+
27
+ def find_route(lat_depart="0", lon_depart="0", city_depart="", address_destination="", depart_time ="", **kwargs):
28
+ """
29
+ Return the distance and the estimated time to go to a specific destination from the current place, at a specified depart time.
30
+ :param lat_depart (string): latitude of depart
31
+ :param lon_depart (string): longitude of depart
32
+ :param city_depart (string): Required. city of depart
33
+ :param address_destination (string): Required. The destination
34
+ :param depart_time (string): departure hour, in the format '08:00:20'.
35
+ """
36
+ print(address_destination)
37
+ date = "2025-03-29T"
38
+ departure_time = '2024-02-01T' + depart_time
39
+ lat, lon, city = check_city_coordinates(lat_depart,lon_depart,city_depart)
40
+ lat_dest, lon_dest = find_coordinates(address_destination)
41
+ #print(lat_dest, lon_dest)
42
+
43
+ #print(departure_time)
44
+
45
+ r = requests.get('https://api.tomtom.com/routing/1/calculateRoute/{0},{1}:{2},{3}/json?key={4}&departAt={5}'.format(
46
+ lat_depart,
47
+ lon_depart,
48
+ lat_dest,
49
+ lon_dest,
50
+ TOMTOM_KEY,
51
+ departure_time
52
+ ))
53
+
54
+ # Parse JSON from the response
55
+ data = r.json()
56
+ #print(data)
57
+
58
+ #print(data)
59
+
60
+ result = data['routes'][0]['summary']
61
+
62
+ # Calculate distance in kilometers (1 meter = 0.001 kilometers)
63
+ distance_km = result['lengthInMeters'] * 0.001
64
+
65
+ # Calculate travel time in minutes (1 second = 1/60 minutes)
66
+ time_minutes = result['travelTimeInSeconds'] / 60
67
+ if time_minutes < 60:
68
+ time_display = f"{time_minutes:.0f} minutes"
69
+ else:
70
+ hours = int(time_minutes / 60)
71
+ minutes = int(time_minutes % 60)
72
+ time_display = f"{hours} hours" + (f" and {minutes} minutes" if minutes > 0 else "")
73
+
74
+ # Extract arrival time from the JSON structure
75
+ arrival_time_str = result['arrivalTime']
76
+
77
+ # Convert string to datetime object
78
+ arrival_time = datetime.fromisoformat(arrival_time_str)
79
+
80
+ # Extract and display the arrival hour in HH:MM format
81
+ arrival_hour_display = arrival_time.strftime("%H:%M")
82
+
83
+
84
+ # return the distance and time
85
+ return(f"The route to go to {address_destination} is {distance_km:.2f} km and {time_display}. Leaving now, the arrival time is estimated at {arrival_hour_display} " )
86
+
87
+
88
+ # Sort the results based on distance
89
+ #sorted_results = sorted(results, key=lambda x: x['dist'])
90
+
91
+ #return ". ".join(formatted_results)
skills/weather.py CHANGED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+ from .common import config
4
+
5
+ #current weather API
6
+ def get_weather(location:str= "", **kwargs):
7
+ """
8
+ Returns the CURRENT weather in a specified location.
9
+ Args:
10
+ location (string) : Required. The name of the location, could be a city or lat/longitude in the following format latitude,longitude (example: 37.7749,-122.4194).
11
+ """
12
+ # The endpoint URL provided by WeatherAPI
13
+ url = f"http://api.weatherapi.com/v1/current.json?key={config.WEATHER_API_KEY}&q={location}&aqi=no"
14
+ print(url)
15
+
16
+ # Make the API request
17
+ response = requests.get(url)
18
+
19
+ if response.status_code != 200:
20
+ return f"Failed to get weather data: {response.status_code}, {response.text}"
21
+
22
+ # Parse the JSON response
23
+ weather_data = response.json()
24
+
25
+ # Extracting the necessary pieces of data
26
+ location = weather_data['location']['name']
27
+ region = weather_data['location']['region']
28
+ country = weather_data['location']['country']
29
+ time = weather_data['location']['localtime']
30
+ temperature_c = weather_data['current']['temp_c']
31
+ condition_text = weather_data['current']['condition']['text']
32
+ if 'wind_kph' in weather_data['current']:
33
+ wind_kph = weather_data['current']['wind_kph']
34
+ humidity = weather_data['current']['humidity']
35
+ feelslike_c = weather_data['current']['feelslike_c']
36
+
37
+ # Formulate the sentences
38
+ weather_sentences = (
39
+ f"The current weather in {location}, {region}, {country} is {condition_text} "
40
+ f"with a temperature of {temperature_c}°C that feels like {feelslike_c}°C. "
41
+ f"Humidity is at {humidity}%. "
42
+ f"Wind speed is {wind_kph} kph." if 'wind_kph' in weather_data['current'] else ""
43
+ )
44
+ return weather_sentences, weather_data
45
+
46
+ #weather forecast API
47
+ def get_forecast(city_name:str= "", when = 0, **kwargs):
48
+ """
49
+ Returns the weather forecast in a specified number of days for a specified city .
50
+ Args:
51
+ city_name (string) : Required. The name of the city.
52
+ when (int) : Required. in number of days (until the day for which we want to know the forecast) (example: tomorrow is 1, in two days is 2, etc.)
53
+ """
54
+ #print(when)
55
+ when +=1
56
+ # The endpoint URL provided by WeatherAPI
57
+ url = f"http://api.weatherapi.com/v1/forecast.json?key={WEATHER_API_KEY}&q={city_name}&days={str(when)}&aqi=no"
58
+
59
+
60
+ # Make the API request
61
+ response = requests.get(url)
62
+
63
+ if response.status_code == 200:
64
+ # Parse the JSON response
65
+ data = response.json()
66
+
67
+ # Initialize an empty string to hold our result
68
+ forecast_sentences = ""
69
+
70
+ # Extract city information
71
+ location = data.get('location', {})
72
+ city_name = location.get('name', 'the specified location')
73
+
74
+ #print(data)
75
+
76
+
77
+ # Extract the forecast days
78
+ forecast_days = data.get('forecast', {}).get('forecastday', [])[when-1:]
79
+ #number = 0
80
+
81
+ #print (forecast_days)
82
+
83
+ for day in forecast_days:
84
+ date = day.get('date', 'a specific day')
85
+ conditions = day.get('day', {}).get('condition', {}).get('text', 'weather conditions')
86
+ max_temp_c = day.get('day', {}).get('maxtemp_c', 'N/A')
87
+ min_temp_c = day.get('day', {}).get('mintemp_c', 'N/A')
88
+ chance_of_rain = day.get('day', {}).get('daily_chance_of_rain', 'N/A')
89
+
90
+ if when == 1:
91
+ number_str = 'today'
92
+ elif when == 2:
93
+ number_str = 'tomorrow'
94
+ else:
95
+ number_str = f'in {when-1} days'
96
+
97
+ # Generate a sentence for the day's forecast
98
+ forecast_sentence = f"On {date} ({number_str}) in {city_name}, the weather will be {conditions} with a high of {max_temp_c}°C and a low of {min_temp_c}°C. There's a {chance_of_rain}% chance of rain. "
99
+
100
+ #number = number + 1
101
+ # Add the sentence to the result
102
+ forecast_sentences += forecast_sentence
103
+ return forecast_sentences
104
+ else:
105
+ # Handle errors
106
+ print( f"Failed to get weather data: {response.status_code}, {response.text}")
107
+ return f'error {response.status_code}'