models
Classes:
| Name | Description |
|---|---|
Action |
Action input interface of the inputs section of Control. |
AircraftKwargs |
Represent the keyword arguments expected by the Aircraft class. |
ApacheAllDrawModesKwargs |
Keyword arguments for Apache all draw modes. |
ApacheDrawModeKwargs |
Keyword arguments for Apache draw mode. |
ApacheEufdMode |
Apache EUFD Mode. |
Asset |
Representation of an asset with metadata information. |
BiosValueInt |
Value of BIOS Integer Buffer. |
BiosValueStr |
Value of BIOS String Buffer. |
Color |
A superset of HTML 4.0 color names used in CSS 1. |
Control |
Control section of the BIOS model. |
ControlDepiction |
Represent the depiction of a control. |
ControlKeyData |
Describes input data for cockpit controller. |
CycleButton |
Map BIOS key string with iterator to keep a current value. |
DcsBiosPlaneData |
DcsBios plane data model. |
DeviceRowsNumber |
Represent the number of rows for different types of devices. |
Direction |
Direction of iteration. |
DllSdk |
DLL SDK. |
FixedStep |
FixedStep input interface of the inputs section of Control. |
FontsConfig |
Fonts configuration for LcdInfo. |
Gkey |
Logitech G-Key. |
GuiPlaneInputRequest |
Represents a GUI plane input request. |
GuiTab |
Describe GUI mani window tabs. |
Input |
Input base class of the inputs section of Control. |
IntBuffArgs |
Arguments of BIOS Integer Buffer. |
LcdButton |
LCD Buttons. |
LcdInfo |
LCD info. |
LcdMode |
LCD Mode. |
LcdSize |
LCD dimensions. |
LcdType |
LCD Type. |
LedConstants |
LED constants. |
LogitechDeviceModel |
Logitech Device model. |
MouseButton |
Representation of a mouse button. |
MsgBoxTypes |
Message box types. |
Output |
Output base class of the outputs section of Control. |
OutputInt |
Integer output interface of the outputs section of Control. |
OutputStr |
String output interface of the outputs a section of Control. |
Release |
Representation of a software release. |
RequestModel |
Represent a request model for handling different input button states and their respective BIOS actions. |
RequestType |
Internal request types. |
SetState |
SetState input interface of the inputs section of Control. |
SetString |
SetString input interface of the inputs section of Control. |
StrBuffArgs |
Arguments of BIOS String Buffer. |
SystemData |
Stores system and application-related information. |
VariableStep |
VariableStep input interface of the inputs section of Control. |
ZigZagIterator |
An iterator that moves within a range in an oscillating pattern. |
Action
Bases: Input
Action input interface of the inputs section of Control.
Methods:
| Name | Description |
|---|---|
get |
Access an attribute and get default when is not available. |
validate_interface |
Validate. |
get
Access an attribute and get default when is not available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
|
|
None
|
Returns:
| Type | Description |
|---|---|
Any | None
|
|
Source code in src/dcspy/models.py
102 103 104 105 106 107 108 109 110 | |
validate_interface
Validate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
str
|
|
Source code in src/dcspy/models.py
172 173 174 175 176 177 178 179 180 181 182 | |
AircraftKwargs
ApacheAllDrawModesKwargs
ApacheDrawModeKwargs
ApacheEufdMode
Asset
Bases: BaseModel
Representation of an asset with metadata information.
This class is used to encapsulate details about an asset such as its URL, name, label, content type, size and download location. It also provides functionality to validate the asset's properties against specific criteria.
Methods:
| Name | Description |
|---|---|
get_asset_with_name |
Retrieve the asset if its name matches the specified file extension and contains the given file name. |
get_asset_with_name
Retrieve the asset if its name matches the specified file extension and contains the given file name.
This method checks if the name of the asset ends with the provided file extension and if the given file name is a substring of the asset's name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The file extension to check for. |
''
|
|
str
|
The specific file name to look for within the asset's name. |
''
|
Returns:
| Type | Description |
|---|---|
Asset | None
|
The Asset instance if the name matches, otherwise None. |
Source code in src/dcspy/models.py
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 | |
BiosValueInt
Bases: BaseModel
Value of BIOS Integer Buffer.
BiosValueStr
Bases: BaseModel
Value of BIOS String Buffer.
Color
Control
Bases: BaseModel
Control section of the BIOS model.
Methods:
| Name | Description |
|---|---|
make_empty |
Make an empty Control object with default values assigned to its attributes. |
Attributes:
| Name | Type | Description |
|---|---|---|
input |
ControlKeyData
|
Extract inputs data. |
output |
BiosValueInt | BiosValueStr
|
Extract outputs data. |
input
property
input: ControlKeyData
output
property
output: BiosValueInt | BiosValueStr
Extract outputs data.
Returns:
| Type | Description |
|---|---|
BiosValueInt | BiosValueStr
|
Union[BiosValueInt, BiosValueStr] |
make_empty
classmethod
make_empty() -> Control
Make an empty Control object with default values assigned to its attributes.
Returns:
| Type | Description |
|---|---|
Control
|
Control an object with empty values. |
Source code in src/dcspy/models.py
483 484 485 486 487 488 489 490 | |
ControlDepiction
Bases: BaseModel
Represent the depiction of a control.
ControlKeyData
ControlKeyData(
name: str,
description: str,
max_value: int,
suggested_step: int = 1,
)
Describes input data for cockpit controller.
Define a type of input for a cockpit controller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Name of the input |
required |
|
str
|
Short description |
required |
|
int
|
Max value (zero-based) |
required |
|
int
|
One (1) by default |
1
|
Methods:
| Name | Description |
|---|---|
from_control |
Construct an object based on Control BIOS Model. |
Attributes:
| Name | Type | Description |
|---|---|---|
depiction |
ControlDepiction
|
Return the depiction of the control. |
has_action |
bool
|
Check if an input has an action input. |
has_fixed_step |
bool
|
Check if input has fixed step input. |
has_set_state |
bool
|
Check if input has set state input. |
has_set_string |
bool
|
Check if input has set string input. |
has_variable_step |
bool
|
Check if an input has a variable step input. |
input_len |
int
|
Get a length of input dictionary. |
is_push_button |
bool
|
Check if the controller is a push button type. |
one_input |
bool
|
Check if an input has only one input dict. |
Source code in src/dcspy/models.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
depiction
property
depiction: ControlDepiction
Return the depiction of the control.
Returns:
| Type | Description |
|---|---|
ControlDepiction
|
ControlDepiction object representing the control's name and description. |
has_action
property
has_action: bool
Check if an input has an action input.
Returns:
| Type | Description |
|---|---|
bool
|
True if ControlKeyData has action input, False otherwise |
has_fixed_step
property
has_fixed_step: bool
Check if input has fixed step input.
Returns:
| Type | Description |
|---|---|
bool
|
True if ControlKeyData has fixed step input, False otherwise |
has_set_state
property
has_set_state: bool
Check if input has set state input.
Returns:
| Type | Description |
|---|---|
bool
|
True if ControlKeyData has set state input, False otherwise |
has_set_string
property
has_set_string: bool
Check if input has set string input.
Returns:
| Type | Description |
|---|---|
bool
|
True if ControlKeyData has set string input, False otherwise |
has_variable_step
property
has_variable_step: bool
Check if an input has a variable step input.
Returns:
| Type | Description |
|---|---|
bool
|
True if ControlKeyData has variable step input, False otherwise |
input_len
property
input_len: int
is_push_button
property
is_push_button: bool
Check if the controller is a push button type.
Returns:
| Type | Description |
|---|---|
bool
|
True if a controller is a push button type, False otherwise |
one_input
property
one_input: bool
Check if an input has only one input dict.
Returns:
| Type | Description |
|---|---|
bool
|
True if ControlKeyData has only one input, False otherwise |
from_control
classmethod
from_control(ctrl: Control) -> ControlKeyData
Construct an object based on Control BIOS Model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Control
|
Control BIOS model |
required |
Returns:
| Type | Description |
|---|---|
ControlKeyData
|
ControlKeyData instance |
Source code in src/dcspy/models.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
CycleButton
Bases: BaseModel
Map BIOS key string with iterator to keep a current value.
Methods:
| Name | Description |
|---|---|
from_request |
Convert a request string to a |
from_request
classmethod
from_request(req: str) -> CycleButton
Convert a request string to a CycleButton instance by extracting the necessary details from the request's components.
The request is expected to follow a predefined structure where its components are separated by spaces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
A string a request expected to contain |
required |
Returns:
| Type | Description |
|---|---|
CycleButton
|
Instance of |
Source code in src/dcspy/models.py
544 545 546 547 548 549 550 551 552 553 554 555 556 | |
DcsBiosPlaneData
Bases: RootModel
DcsBios plane data model.
Methods:
| Name | Description |
|---|---|
get_ctrl |
Get Control from DCS-BIOS with name. |
get_inputs |
Get dict with all not empty inputs for plane. |
get_ctrl
Get Control from DCS-BIOS with name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Control name |
required |
Returns:
| Type | Description |
|---|---|
Control
|
Control instance |
Source code in src/dcspy/models.py
501 502 503 504 505 506 507 508 509 510 511 512 | |
get_inputs
get_inputs() -> dict[str, dict[str, ControlKeyData]]
Get dict with all not empty inputs for plane.
Inputs are grouped in original sections.
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, ControlKeyData]]
|
Dict with sections and ControlKeyData models. |
Source code in src/dcspy/models.py
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | |
DeviceRowsNumber
Direction
DllSdk
Bases: BaseModel
DLL SDK.
Methods:
| Name | Description |
|---|---|
get_path |
Return the path of the DLL file based on the provided library type. |
Attributes:
| Name | Type | Description |
|---|---|---|
header |
str
|
Load the header content of the DLL. |
header
property
header: str
get_path
get_path() -> str
Return the path of the DLL file based on the provided library type.
Returns:
| Type | Description |
|---|---|
str
|
The path of the DLL file as a string. |
Source code in src/dcspy/models.py
1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 | |
FixedStep
Bases: Input
FixedStep input interface of the inputs section of Control.
Methods:
| Name | Description |
|---|---|
get |
Access an attribute and get default when is not available. |
validate_interface |
Validate. |
get
Access an attribute and get default when is not available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
|
|
None
|
Returns:
| Type | Description |
|---|---|
Any | None
|
|
Source code in src/dcspy/models.py
102 103 104 105 106 107 108 109 110 | |
validate_interface
Validate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
str
|
|
Source code in src/dcspy/models.py
117 118 119 120 121 122 123 124 125 126 127 | |
FontsConfig
Bases: BaseModel
Fonts configuration for LcdInfo.
Gkey
Bases: BaseModel
Logitech G-Key.
Methods:
| Name | Description |
|---|---|
from_yaml |
Construct Gkey from YAML string. |
generate |
Generate a sequence of G-Keys. |
from_yaml
classmethod
Construct Gkey from YAML string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
G-Key string, example: G2_M1 |
required |
Returns:
| Type | Description |
|---|---|
Gkey
|
Gkey instance |
Source code in src/dcspy/models.py
748 749 750 751 752 753 754 755 756 757 758 759 | |
generate
staticmethod
Generate a sequence of G-Keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
Number of keys |
required |
|
int
|
Number of modes |
required |
Returns:
| Type | Description |
|---|---|
Sequence[Gkey]
|
sequence of Gkey instances |
Source code in src/dcspy/models.py
761 762 763 764 765 766 767 768 769 770 | |
GuiPlaneInputRequest
Bases: BaseModel
Represents a GUI plane input request.
This class is used to construct and manage input requests originating from a graphical interface, such as radio buttons or other control widgets, that interact with plane systems. It allows for structured generation of requests based on provided parameters or configurations and provides utility methods to convert data into request objects.
Methods:
| Name | Description |
|---|---|
from_control_key |
Create an instance of GuiPlaneInputRequest based on provided control key data, a request type and optional custom value. |
from_plane_gkeys |
Create a dictionary mapping unique plane keys to |
make_empty |
Create an empty GuiPlaneInputRequest object with default values assigned to its attributes. |
from_control_key
classmethod
from_control_key(
ctrl_key: ControlKeyData,
rb_iface: str,
custom_value: str = "",
) -> GuiPlaneInputRequest
Create an instance of GuiPlaneInputRequest based on provided control key data, a request type and optional custom value.
The method generates a request string for the GUI widget interface determined by the specified request type (rb_iface) using information from the ControlKeyData object (ctrl_key). If a custom value is provided, it incorporates the value into the generated request for certain request types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ControlKeyData
|
A ControlKeyData is an object used to specify the control key's attributes, such as its name, suggested step, and maximum value. |
required |
|
str
|
A string that represents the requested widget interface type, options include types such as 'rb_action', 'rb_fixed_step_inc', etc. |
required |
|
str
|
An optional string used to provide a custom value for specific request types ('rb_custom' or 'rb_set_state'). |
''
|
Returns:
| Type | Description |
|---|---|
GuiPlaneInputRequest
|
A GuiPlaneInputRequest object initialized with the identifier, generated request string and the specified widget interface type. |
Source code in src/dcspy/models.py
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | |
from_plane_gkeys
classmethod
from_plane_gkeys(
plane_gkeys: dict[str, str],
) -> dict[str, GuiPlaneInputRequest]
Create a dictionary mapping unique plane keys to GuiPlaneInputRequest objects, based on input configuration data.
The method processes each key-value pair where the value contains a request type and determines the appropriate widget interface based on specified keywords. A mapping dictionary is used to identify widget interfaces corresponding to request types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[str, str]
|
A dictionary where each key is a plane identifier (string) and the value is a space-separated string of configuration data that includes a request type. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, GuiPlaneInputRequest]
|
A dictionary mapping each plane identifier (string) to a |
Source code in src/dcspy/models.py
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | |
make_empty
classmethod
make_empty() -> GuiPlaneInputRequest
Create an empty GuiPlaneInputRequest object with default values assigned to its attributes.
Returns:
| Type | Description |
|---|---|
GuiPlaneInputRequest
|
An instance of GuiPlaneInputRequest with default empty values |
Source code in src/dcspy/models.py
639 640 641 642 643 644 645 646 | |
GuiTab
Input
Bases: BaseModel
Input base class of the inputs section of Control.
Methods:
| Name | Description |
|---|---|
get |
Access an attribute and get default when is not available. |
get
Access an attribute and get default when is not available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
|
|
None
|
Returns:
| Type | Description |
|---|---|
Any | None
|
|
Source code in src/dcspy/models.py
102 103 104 105 106 107 108 109 110 | |
IntBuffArgs
Bases: BaseModel
Arguments of BIOS Integer Buffer.
LcdButton
LcdInfo
Bases: BaseModel
LCD info.
Methods:
| Name | Description |
|---|---|
set_fonts |
Set fonts configuration. |
set_fonts
set_fonts(fonts: FontsConfig) -> None
Set fonts configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FontsConfig
|
fonts configuration |
required |
Source code in src/dcspy/models.py
824 825 826 827 828 829 830 831 832 833 834 835 836 | |
LcdMode
LcdSize
LcdType
LedConstants
LogitechDeviceModel
Bases: BaseModel
Logitech Device model.
It describes all capabilities of any Logitech device.
Methods:
| Name | Description |
|---|---|
get_key_at |
Get the keys at the specified row and column in the table layout. |
Attributes:
| Name | Type | Description |
|---|---|---|
cols |
int
|
Get the number of columns required. |
g_keys |
Sequence[Gkey]
|
Generate a sequence of G-Keys. |
lcd_name |
str
|
Get the LCD name in lower case. |
mouse_keys |
Sequence[MouseButton]
|
Generate a sequence of MouseButtons. |
rows |
DeviceRowsNumber
|
Get the number of rows for each key category. |
cols
property
cols: int
g_keys
property
lcd_name
property
lcd_name: str
Get the LCD name in lower case.
Returns:
| Type | Description |
|---|---|
str
|
The name of the LCD as a lowercase string. |
mouse_keys
property
mouse_keys: Sequence[MouseButton]
Generate a sequence of MouseButtons.
Returns:
| Type | Description |
|---|---|
Sequence[MouseButton]
|
A sequence of MouseButtons. |
rows
property
rows: DeviceRowsNumber
Get the number of rows for each key category.
Returns:
| Type | Description |
|---|---|
DeviceRowsNumber
|
A DeviceRowsNumber with the number of rows for each category. |
get_key_at
Get the keys at the specified row and column in the table layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
The row index (zero-based). |
required |
|
int
|
The column index (zero-based). |
required |
Returns:
| Type | Description |
|---|---|
AnyButton | None
|
The key at the specified row and column, if it exists, otherwise None. |
Source code in src/dcspy/models.py
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | |
MouseButton
Bases: BaseModel
Representation of a mouse button.
Provides functionality for working with mouse buttons, including conversion to string, boolean evaluation, hashing and constructing instances from YAML strings. Supports generating sequences of mouse buttons within a specified range.
Methods:
| Name | Description |
|---|---|
from_yaml |
Create a MouseButton object from a YAML string representation. |
generate |
Generate a sequence of MouseButton objects based on the provided range. |
from_yaml
classmethod
from_yaml(yaml_str: str) -> MouseButton
Create a MouseButton object from a YAML string representation.
This method parses a given YAML string to extract the button number
encoded in the format M_<i> (such as M_1, M_2, etc.) and generates
a MouseButton instance for the corresponding button.
If the format does not conform to expectations and parsing fails, a ValueError is raised.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The YAML string representing the mouse button in the format |
required |
Returns:
| Type | Description |
|---|---|
MouseButton
|
A MouseButton instance derived from the specified YAML string. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the provided YAML string does not match the expected format |
Source code in src/dcspy/models.py
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
generate
staticmethod
generate(
button_range: tuple[int, int],
) -> Sequence[MouseButton]
Generate a sequence of MouseButton objects based on the provided range.
This utility creates MouseButton instances for each integer value within
the inclusive range defined by the button_range tuple.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
tuple[int, int]
|
A tuple of two integers, representing the start and end of the range (inclusive) for generating MouseButton objects. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[MouseButton]
|
A tuple containing instantiated MouseButton objects for each value in the specified range. |
Source code in src/dcspy/models.py
717 718 719 720 721 722 723 724 725 726 727 728 | |
MsgBoxTypes
Output
Bases: BaseModel
Output base class of the outputs section of Control.
OutputInt
Bases: Output
Integer output interface of the outputs section of Control.
Methods:
| Name | Description |
|---|---|
validate_interface |
Validate. |
validate_interface
Validate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
str
|
|
Source code in src/dcspy/models.py
237 238 239 240 241 242 243 244 245 246 247 | |
OutputStr
Bases: Output
String output interface of the outputs a section of Control.
Methods:
| Name | Description |
|---|---|
validate_interface |
Validate. |
validate_interface
Validate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
str
|
|
Source code in src/dcspy/models.py
217 218 219 220 221 222 223 224 225 226 227 | |
Release
Bases: BaseModel
Representation of a software release.
The Release class provides detailed information about a specific release of a software project, including metadata such as URLs, tags, names, and dates. It also includes functionality to determine whether a release is the latest and to retrieve downloadable assets.
Methods:
| Name | Description |
|---|---|
download_url |
Download the URL of a specific asset that matches the given file name and extension. |
get_asset |
Retrieve the asset if its name matches the specified file extension and contains the given file name. |
is_latest |
Determine if the provided version is the latest compared to the instance's version. |
verify |
Verify the integrity of a local file by comparing its checksums with the expected checksum. |
Attributes:
| Name | Type | Description |
|---|---|---|
published |
str
|
Convert and format the |
version |
Version
|
The |
published
property
published: str
Convert and format the published_at attribute into a human-readable date string in the format 'DD Month YYYY'.
Returns:
| Type | Description |
|---|---|
str
|
The formatted publication date string. |
version
property
version: Version
The version property retrieves the software version as a version.Version object.
The version data is parsed from the tag_name attribute, which is expected to be in a format compatible with packaging.version.
Returns:
| Type | Description |
|---|---|
Version
|
Parsed |
download_url
Download the URL of a specific asset that matches the given file name and extension.
This method iterates through the list of assets, applying the criteria specified by
the extension and file_name parameters to identify the correct asset.
If no asset matches the provided criteria, an empty string is returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The file extension to search for, defaults to an empty string if not specified. |
''
|
|
str
|
The file name to search for defaults to an empty string if not specified. |
''
|
Returns:
| Type | Description |
|---|---|
str
|
The download URL of the asset if a match is found, otherwise an empty string. |
Source code in src/dcspy/models.py
1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 | |
get_asset
Retrieve the asset if its name matches the specified file extension and contains the given file name.
This method checks if the name of the asset ends with the provided file extension and if the given file name is a substring of the asset's name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The file extension to check for. |
''
|
|
str
|
The specific file name to look for within the asset's name. |
''
|
Returns:
| Type | Description |
|---|---|
Asset | None
|
The Asset instance if the name matches, otherwise None. |
Source code in src/dcspy/models.py
1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | |
is_latest
is_latest(current_ver: str | Version) -> bool
Determine if the provided version is the latest compared to the instance's version.
This method compares the version of the current object with a given version to check if the current version is equal to or earlier than the given version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | Version
|
The version to compare against, it can be provided as a string or as a version.Version object. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Returns True if the current version is less than or equal to the provided version (indicating it is the latest), False otherwise. |
Source code in src/dcspy/models.py
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | |
verify
verify(
local_file: Path,
temp_digest=Path(gettempdir())
/ f"DIGESTS_{strftime('%Y%m%d_%H%M%S')}",
) -> tuple[bool, dict[str, bool]]
Verify the integrity of a local file by comparing its checksums with the expected checksum.
It returns True if the checksums match, indicating that the file is intact and unaltered; otherwise, it returns False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Path
|
The path to the local file whose integrity is to be verified. |
required |
|
Temporary file to store the digest in the local file. |
Path(gettempdir()) / f'DIGESTS_{strftime('%Y%m%d_%H%M%S')}'
|
Returns:
| Type | Description |
|---|---|
tuple[bool, dict[str, bool]]
|
True if the computed checksum matches the expected checksum, False otherwise. |
Source code in src/dcspy/models.py
1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 | |
RequestModel
Bases: BaseModel
Represent a request model for handling different input button states and their respective BIOS actions.
This class is designed to manage various types of input requests, including cycle, custom and push-button requests. It provides functionality to validate input data, generate requests in byte format, and interpret requests based on specific conditions. It also supports creating empty request models and handling interactions with BIOS configuration via designated callable functions.
Methods:
| Name | Description |
|---|---|
bytes_requests |
Generate and returns a list of byte strings based on a specific request input. |
from_request |
Create an instance of the RequestModel class using a specific request string. |
make_empty |
Create an empty instance of RequestModel with default values for its attributes. |
validate_interface |
Validate the provided interface name ensuring it consists only of uppercase letters, digits or underscores. |
Attributes:
| Name | Type | Description |
|---|---|---|
is_custom |
bool
|
Check if the request is of type custom. |
is_cycle |
bool
|
Check if the instance has a valid cycle. |
is_push_button |
bool
|
Identify if the request is a push-button type. |
is_custom
property
is_custom: bool
Check if the request is of type custom.
This property evaluates whether the raw_request attribute of the object contains
a custom request type, based on the predefined RequestType.CUSTOM value.
Returns:
| Type | Description |
|---|---|
bool
|
Boolean indicating if the request is of type custom. |
is_cycle
property
is_cycle: bool
Check if the instance has a valid cycle.
This property checks the internal state of the instance to determine whether a valid cycle exists.
A cycle is represented by the presence of a truthy value in the cycle attribute.
Returns:
| Type | Description |
|---|---|
bool
|
Returns |
is_push_button
property
is_push_button: bool
Identify if the request is a push-button type.
This property checks if the raw_request contains a specific value indicating a push-button request type and returns a boolean result accordingly.
Returns:
| Type | Description |
|---|---|
bool
|
True if the request is of type push-button, else False |
bytes_requests
Generate and returns a list of byte strings based on a specific request input.
The method generates a string request using the provided argument key_down.
It then splits the generated string request using the | delimiter and converts each segment into a byte string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int | None
|
Accepts an integer representing the key value or None for default behavior. |
None
|
Returns:
| Type | Description |
|---|---|
list[bytes]
|
A list containing byte strings derived from the generated request. |
Source code in src/dcspy/models.py
1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 | |
from_request
classmethod
from_request(
key: AnyButton,
request: str,
get_bios_fn: Callable[[str], BiosValue],
) -> RequestModel
Create an instance of the RequestModel class using a specific request string.
This method processes the provided request string to extract necessary information, such as control name and cycle details. It initializes a CycleButton instance using the request information if applicable. The function then returns a RequestModel instance, contains the parsed data and additional state information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
AnyButton
|
The key representing the |
required |
|
str
|
The raw request string providing all request details. |
required |
|
Callable[[str], BiosValue]
|
A callable function that retrieves BIOS values, function takes
a string input (BIOS key) and returns a corresponding |
required |
Returns:
| Type | Description |
|---|---|
RequestModel
|
A new instance of |
Source code in src/dcspy/models.py
1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 | |
make_empty
classmethod
make_empty(key: AnyButton) -> RequestModel
Create an empty instance of RequestModel with default values for its attributes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
AnyButton
|
Represents the key parameter, which will be used as a button object type for the RequestModel instance. |
required |
Returns:
| Type | Description |
|---|---|
RequestModel
|
A new instance of RequestModel initialized with default attribute values and the provided key parameter. |
Source code in src/dcspy/models.py
1312 1313 1314 1315 1316 1317 1318 1319 1320 | |
validate_interface
Validate the provided interface name ensuring it consists only of uppercase letters, digits or underscores.
This validator enforces strict naming conventions for control names, rejecting any value that contains invalid characters or is an empty string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The interface name to validate. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The validated interface name if it passes all checks. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the given value is an empty string or contains characters other than uppercase letters (A-Z), digits (0-9), or underscores (_). |
Source code in src/dcspy/models.py
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 | |
RequestType
SetState
Bases: Input
SetState input interface of the inputs section of Control.
Methods:
| Name | Description |
|---|---|
get |
Access an attribute and get default when is not available. |
validate_interface |
Validate. |
get
Access an attribute and get default when is not available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
|
|
None
|
Returns:
| Type | Description |
|---|---|
Any | None
|
|
Source code in src/dcspy/models.py
102 103 104 105 106 107 108 109 110 | |
validate_interface
Validate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
str
|
|
Source code in src/dcspy/models.py
154 155 156 157 158 159 160 161 162 163 164 | |
SetString
Bases: Input
SetString input interface of the inputs section of Control.
Methods:
| Name | Description |
|---|---|
get |
Access an attribute and get default when is not available. |
validate_interface |
Validate. |
get
Access an attribute and get default when is not available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
|
|
None
|
Returns:
| Type | Description |
|---|---|
Any | None
|
|
Source code in src/dcspy/models.py
102 103 104 105 106 107 108 109 110 | |
validate_interface
Validate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
str
|
|
Source code in src/dcspy/models.py
189 190 191 192 193 194 195 196 197 198 199 | |
StrBuffArgs
Bases: BaseModel
Arguments of BIOS String Buffer.
SystemData
VariableStep
Bases: Input
VariableStep input interface of the inputs section of Control.
Methods:
| Name | Description |
|---|---|
get |
Access an attribute and get default when is not available. |
validate_interface |
Validate. |
get
Access an attribute and get default when is not available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
|
|
None
|
Returns:
| Type | Description |
|---|---|
Any | None
|
|
Source code in src/dcspy/models.py
102 103 104 105 106 107 108 109 110 | |
validate_interface
Validate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
str
|
|
Source code in src/dcspy/models.py
136 137 138 139 140 141 142 143 144 145 146 | |
ZigZagIterator
An iterator that moves within a range in an oscillating pattern.
The iterator starts at a given current value, progresses or retreats based on the defined step size
and changes a direction upon reaching the boundaries of the range (max_val and 0).
This allows for oscillating behavior within the specified limits.
The class also provides access to its current direction of iteration.
Represent a simple iterator with a defined range and step increment.
The iterator maintains a current value, a maximum limit, and adjusts its progression based on the specified step. It also tracks the direction of iteration internally.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
The starting point of the iterator. |
required |
|
int
|
The upper limit of the iterator range. |
required |
|
int
|
The increment value for each iteration, defaults to 1. |
1
|
Attributes:
| Name | Type | Description |
|---|---|---|
direction |
Direction
|
Represent the direction of an iterator or entity within a defined context. |
Source code in src/dcspy/models.py
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | |