Rivescript

Latest version: v1.15.0

Safety actively analyzes 629959 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 4

1.14.4

- Fix the `last_match()` function so that it returns `None` when there was no
match instead of `"undefined"` (PR 63).
- Strip leading and trailing whitespace from user messages, and consolidate
repeated whitespace into a single space character (PR 62).

1.14.3

- Fix sorting algorithm for triggers with `%Previous`, making their sort order
deterministic and correct regardless of the order they appeared in the
source file (PR 60; bug 59).
- Fix a possible crash when interpolating a `<star>` tag when the trigger
had captured no stars. In this cases the `<star>` tag will become the string
`"None"`; it is a user error that this situation arises anyway and this fix
just prevents Python from crashing (bugs 51 and 54).
- Fix a possible crash when calling `random.choice` on an empty list by
wrapping it in a safety function at `rivescript.utils.random_choice`
(bug 36).
- Better error reporting on the JSON Interactive Mode: if there is an
exception raised when decoding the input JSON, the output JSON now contains
an `error` key with the text of the exception to help diagnose what went
wrong.

1.14.2

- Fix numeric tags like `<add>` raising a `TypeError` exception.

1.14.1

- Fix a regression when handling Unicode strings under Python 2 (bug 40).

1.14.0

- Make the session manager pluggable and replaceable. RiveScript still uses
an in-memory store for user variables, but this can be swapped out with a
replacement that puts user variables somewhere else, like Redis or MySQL.
The constructor accepts a `session_manager` parameter to use your own
session manager based on the `rivescript.sessions.SessionManager` class.
- Make the RiveScript Parser module (`rivescript.parser`) more developer
friendly by removing the parent RiveScript module as a dependency. The
parser can be used as a stand-alone module if all you want to do is parse
and validate RiveScript code.
- The `log` parameter to the constructor may now be an already opened file
handle (opened in write or append mode) instead of a string, if you already
have a file handle ready.
- Add two examples to the `eg` directory:
- `eg/sessions` replaces the in-memory session store with one that uses
a Redis cache instead.
- `eg/parser` shows how to use the RiveScript Parser module.
- Fix a bug where atomic triggers that contain a `{weight}` tag were unable
to be matched properly.
- Reorganize the unit tests into many smaller files instead of one large one.

1.13.0

- Restructure the code to keep it on par with the JavaScript and Go versions:
- `rivescript.parser` now contains all the parsing code:
`parse()` and `check_syntax()` are moved here.
- Triggers are stored internally in only one place now, like in the
JavaScript and Go versions. This makes some internal mappings simpler as
they now point to common references and don't duplicate data in memory.
- **Note:** Most of the new `rivescript.*` modules are still
private-use-only, even though many internal functions lost their
underscore prefixes. You should still only use the API functions exposed
by `rivescript.rivescript` or what is exported by the top level package.
The `rivescript.parser` API will be more public-facing in the future to
help with third party integrations (currently it still relies on a Python
object with methods `_say` and `_warn`).
- Refactor the RiveScript interactive mode (`rivescript.interactive`) to use
argparse instead of getopt and add a pretty ASCII logo.
- Add `shell.py` as a possibly easier-to-access (and certainly
easier-to-discover) shortcut to running RiveScript's interactive mode.
It accepts all the same options and works the same as before.

Page 2 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.