Requirements
- class Requirements
Bases:
CommonBaseModel
Aggregates and categorizes multiple lists of requirements within a project, facilitating structured specification, organization, and tracking.
This class is vital for managing complex sets of requirements in engineering and scientific projects, allowing for clear delineation and efficient access to different types of requirements such as safety, performance, design, and more.
- name
A unique name identifying the set of requirements.
- Type:
str
- description
A brief description of the requirements set, providing context or purpose.
- Type:
str
- requirements
A dictionary mapping requirement categories to lists of Requirement objects, providing flexibility for managing different requirement types.
- Type:
Dict[str, List[Requirement]]
- metadata
Additional metadata providing further context or details about the requirements.
- Type:
Attributes Summary
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Methods Summary
add_requirement
(requirement, category)Dynamically add a new requirement to the specified category, enhancing the project's requirements documentation and tracking.
get_requirements_by_category
(category)Retrieve a list of requirements belonging to the specified category.
remove_requirement
(requirement_name, category)Remove a requirement from the specified category based on its name.
validate_non_empty
(value, field)Validate that the name and description fields are not empty.
Attributes Documentation
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'protected_namespaces': (), 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Methods Documentation
- add_requirement(requirement, category)
Dynamically add a new requirement to the specified category, enhancing the project’s requirements documentation and tracking.
- Parameters:
requirement (Requirement) – The requirement to be added.
category (str) – The category under which to add the requirement.
- Raises:
ValueError – If the specified category does not exist, it will be created.
- Return type:
None
- get_requirements_by_category(category)
Retrieve a list of requirements belonging to the specified category.
- Parameters:
category (str) – The category from which to retrieve the requirements.
- Returns:
The list of requirements in the specified category.
- Raises:
ValueError – If the specified category does not exist in the requirements.
- Return type:
List[Requirement]
- remove_requirement(requirement_name, category)
Remove a requirement from the specified category based on its name.
- Parameters:
requirement_name (str) – The name of the requirement to remove.
category (str) – The category from which to remove the requirement.
- Raises:
ValueError – If the specified category does not exist or if the requirement is not found within the category.
- Return type:
None
- classmethod validate_non_empty(value, field)
Validate that the name and description fields are not empty.
- Parameters:
value (str) – The value of the field being validated.
field (Field) – The metadata of the field being validated.
- Raises:
ValueError – If the field value is empty or just whitespace.
- Returns:
The validated value.
- Return type:
str
Methods:
validate_non_empty
(value, field)Validate that the name and description fields are not empty.
add_requirement
(requirement, category)Dynamically add a new requirement to the specified category, enhancing the project's requirements documentation and tracking.
remove_requirement
(requirement_name, category)Remove a requirement from the specified category based on its name.
get_requirements_by_category
(category)Retrieve a list of requirements belonging to the specified category.
Attributes:
__setattr__ handlers.
- classmethod validate_non_empty(value, field)
Validate that the name and description fields are not empty.
- Parameters:
value (str) – The value of the field being validated.
field (Field) – The metadata of the field being validated.
- Raises:
ValueError – If the field value is empty or just whitespace.
- Returns:
The validated value.
- Return type:
str
- add_requirement(requirement, category)
Dynamically add a new requirement to the specified category, enhancing the project’s requirements documentation and tracking.
- Parameters:
requirement (Requirement) – The requirement to be added.
category (str) – The category under which to add the requirement.
- Raises:
ValueError – If the specified category does not exist, it will be created.
- Return type:
None
- remove_requirement(requirement_name, category)
Remove a requirement from the specified category based on its name.
- Parameters:
requirement_name (str) – The name of the requirement to remove.
category (str) – The category from which to remove the requirement.
- Raises:
ValueError – If the specified category does not exist or if the requirement is not found within the category.
- Return type:
None
- get_requirements_by_category(category)
Retrieve a list of requirements belonging to the specified category.
- Parameters:
category (str) – The category from which to retrieve the requirements.
- Returns:
The list of requirements in the specified category.
- Raises:
ValueError – If the specified category does not exist in the requirements.
- Return type:
List[Requirement]
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__