TTY OV  1
A cross platform python terminal
Loading...
Searching...
No Matches
polyguard.src.constants Namespace Reference

Data Structures

class  LangConfig
 
class  Langs
 

Variables

 MODULE_ROOT = Path(__file__).resolve().parent.parent
 
str DEFAULT_DB_PATH = MODULE_ROOT / "data" / "polyguard.sqlite"
 
str DEFAULT_SOURCE_WORDS = MODULE_ROOT.parent / "wordlists"
 
int DEFAULT_CACHE_MAX_LANGS = 8
 
tuple POLY_BOOT_MSG
 
tuple POLY_HELP_TEXT
 
tuple POLY_MAN_TEXT
 
str POLY_PROMPT = "polyguard> "
 
str STATUS_BLOCKED = "BLOCKED"
 
str STATUS_OK = "OK"
 
str DB_PATH_FMT = "DB path: {path}"
 
 TOKENISER_TABLE = str.maketrans('', '', '\n\r\t\f')
 

Detailed Description

# +==== BEGIN polyguard =================+
# LOGO:
#       input
# 
#    @#$%!  hello
#      |     |
#      +--+--+
#         |
#         v
#   +------------+
#   | POLY GUARD |
#   +------------+
#     |        |
#     v        v
#  BLOCKED  PASSED
#    KO       OK
# /STOP
# PROJECT: polyguard
# FILE: constants.py
# CREATION DATE: 20-03-2026
# LAST Modified: 3:53:29 22-03-2026
# DESCRIPTION:
# A module that provides a set of swearwords to listen to when filtering while allowing to toggle on and off different languages.
# /STOP
# COPYRIGHT: (c) Henry Letellier
# PURPOSE: This is the file containing the constants of the class.
# // AR
# +==== END polyguard =================+

Variable Documentation

◆ DB_PATH_FMT

str polyguard.src.constants.DB_PATH_FMT = "DB path: {path}"

Definition at line 299 of file constants.py.

◆ DEFAULT_CACHE_MAX_LANGS

int polyguard.src.constants.DEFAULT_CACHE_MAX_LANGS = 8

Definition at line 49 of file constants.py.

◆ DEFAULT_DB_PATH

str polyguard.src.constants.DEFAULT_DB_PATH = MODULE_ROOT / "data" / "polyguard.sqlite"

Definition at line 43 of file constants.py.

◆ DEFAULT_SOURCE_WORDS

str polyguard.src.constants.DEFAULT_SOURCE_WORDS = MODULE_ROOT.parent / "wordlists"

Definition at line 45 of file constants.py.

◆ MODULE_ROOT

polyguard.src.constants.MODULE_ROOT = Path(__file__).resolve().parent.parent

Definition at line 39 of file constants.py.

◆ POLY_BOOT_MSG

tuple polyguard.src.constants.POLY_BOOT_MSG
Initial value:
1= (
2 "polyguard — interactive mode\n"
3 f"Type '{COMMAND_TOKEN}help' for a short list of commands, '{COMMAND_TOKEN}man' for more details.\n"
4 f"Enter a word to test it; '{COMMAND_TOKEN}exit' or '{COMMAND_TOKEN}quit' to leave."
5)

Definition at line 258 of file constants.py.

◆ POLY_HELP_TEXT

tuple polyguard.src.constants.POLY_HELP_TEXT
Initial value:
1= (
2 f"Commands (prefix with '{COMMAND_TOKEN}' e.g. '{COMMAND_TOKEN}help'):\n"
3 f" {COMMAND_TOKEN}help Short help text (this message)\n"
4 f" {COMMAND_TOKEN}man Longer manual describing usage and options\n"
5 f" {COMMAND_TOKEN}exit, {COMMAND_TOKEN}quit Leave the REPL\n"
6 f" {COMMAND_TOKEN}db Show configured DB path\n"
7 " <word> Type a word to check it (no prefix required)\n"
8 f" {COMMAND_TOKEN}log <on/off> Toggle logging output\n"
9 f" {COMMAND_TOKEN}langopt <lang> <on/off> Enable/disable a language in your config\n"
10 f" {COMMAND_TOKEN}langs List languages available in the DB (with counts)\n"
11 f" {COMMAND_TOKEN}langstatus Show which languages are enabled in your config\n"
12 f" {COMMAND_TOKEN}word <w> [<lang>] Check a word optionally for a specific language\n"
13)

Definition at line 264 of file constants.py.

◆ POLY_MAN_TEXT

tuple polyguard.src.constants.POLY_MAN_TEXT
Initial value:
1= (
2 "polyguard manual\n\n"
3 "This REPL accepts single-word queries and returns whether the word\n"
4 "is considered a swearword according to the configured language lists.\n\n"
5 "If started with --db-path, that DB will be used; otherwise the package\n"
6 "default DB is used. You can also pipe words via stdin for batch checks.\n\n"
7 "Command prefixing:\n"
8 " To avoid conflicts with words that match command names, commands must be\n"
9 f" prefixed with '{COMMAND_TOKEN}' (for example '{COMMAND_TOKEN}langs' or '{COMMAND_TOKEN}langopt en_uk off'). Any input\n"
10 f" that does not start with '{COMMAND_TOKEN}' is treated as a word to check.\n\n"
11 "Additional commands:\n"
12 f" {COMMAND_TOKEN}log <on/off> Turn logging on or off for the running session.\n"
13 f" {COMMAND_TOKEN}langopt <lang> <on/off> Temporarily enable or disable a language in your session.\n"
14 f" {COMMAND_TOKEN}langs Show languages present in the DB and word counts.\n"
15 f" {COMMAND_TOKEN}langstatus Show which languages are currently enabled in your config.\n"
16 f" {COMMAND_TOKEN}word <w> [<lang>] Check <w> in either your current config or a specific language.\n"
17)

Definition at line 278 of file constants.py.

◆ POLY_PROMPT

str polyguard.src.constants.POLY_PROMPT = "polyguard> "

Definition at line 296 of file constants.py.

◆ STATUS_BLOCKED

str polyguard.src.constants.STATUS_BLOCKED = "BLOCKED"

Definition at line 297 of file constants.py.

◆ STATUS_OK

str polyguard.src.constants.STATUS_OK = "OK"

Definition at line 298 of file constants.py.

◆ TOKENISER_TABLE

polyguard.src.constants.TOKENISER_TABLE = str.maketrans('', '', '\n\r\t\f')

Definition at line 301 of file constants.py.