Rule Categories
Rule categories model the hatto (法度) — the set of scoped policy rules attached to a Scope. Each Category groups Commandment and Suggestion instances that apply under a stated condition. Categories form a tree through their subcategories field.
See Domain Model — Rule Categories for a conceptual overview and Merging — Rule category merging for merge semantics.
Category
Category
Bases: MergeableModel
A named rule category grouping commandments and suggestions under an applicability condition.
Categories form a tree through their subcategories. A category's effective rules include its own rules and all subcategories' rules, computed recursively at query time.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Identifier following programming variable naming conventions. |
applicability |
str
|
Mandatory description of when this category's rules apply. |
tags |
frozenset[str]
|
Short label strings for grouping and filtering. Defaults to empty frozenset. |
additive |
bool
|
When True, suggestions from this category are added to the parent scope's suggestions on merge rather than replacing them. Defaults to False. |
ruleset |
Ruleset
|
The commandments and suggestions belonging to this category. Defaults to an empty Ruleset. |
subcategories |
frozenset[Category]
|
Nested child categories. Names must be unique within this set. Defaults to empty frozenset. |
effective_commandments
property
All commandments from this category and its subcategories, recursively.
effective_suggestions
property
All suggestions from this category and its subcategories, recursively.
Ruleset
Ruleset
Bases: BaseModel
A grouped set of commandments and suggestions belonging to a rule category.
Attributes:
| Name | Type | Description |
|---|---|---|
commandments |
frozenset[Commandment]
|
Mandatory rules. Defaults to an empty frozenset. |
suggestions |
frozenset[Suggestion]
|
Recommended rules. Defaults to an empty frozenset. |
Commandment
Commandment
Bases: Rule
A mandatory rule that must be honored without exception.
Suggestion
Suggestion
Bases: Rule
A recommended rule that should be honored but may be waived under justified conditions.