Detection
๐ค AI-Generated Content
This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.
provide.foundation.platform.detection
¶
Classes¶
PlatformError
¶
PlatformError(
message: str,
*,
platform: str | None = None,
operation: str | None = None,
**kwargs: Any,
)
Bases: FoundationError
Raised when platform detection or system operations fail.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Error message describing the platform issue. |
required |
platform
|
str | None
|
Optional platform identifier. |
None
|
operation
|
str | None
|
Optional operation that failed. |
None
|
**kwargs
|
Any
|
Additional context passed to FoundationError. |
{}
|
Examples:
>>> raise PlatformError("Failed to detect OS")
>>> raise PlatformError("Unsupported platform", platform="freebsd")
Source code in provide/foundation/errors/platform.py
Functions¶
get_arch_name
¶
Get normalized architecture name.
Returns:
| Type | Description |
|---|---|
str
|
Normalized architecture (amd64, arm64, x86, i386) |
Source code in provide/foundation/platform/detection.py
get_cpu_type
¶
Get CPU type/family information.
Returns:
| Type | Description |
|---|---|
str | None
|
CPU type string or None if unavailable |
Source code in provide/foundation/platform/detection.py
get_os_name
¶
Get normalized OS name.
Returns:
| Type | Description |
|---|---|
str
|
Normalized OS name (darwin, linux, windows) |
Source code in provide/foundation/platform/detection.py
get_os_version
¶
Get OS version information.
Returns:
| Type | Description |
|---|---|
str | None
|
OS version string or None if unavailable |
Source code in provide/foundation/platform/detection.py
get_platform_string
¶
Get normalized platform string in format 'os_arch'.
Returns:
| Type | Description |
|---|---|
str
|
Platform string like 'darwin_arm64' or 'linux_amd64' |
Source code in provide/foundation/platform/detection.py
normalize_platform_components
¶
Normalize OS and architecture names to standard format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
os_name
|
str
|
Operating system name |
required |
arch_name
|
str
|
Architecture name |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, str]
|
Tuple of (normalized_os, normalized_arch) |