mirror of https://github.com/astral-sh/ruff
[ty] document the `"all"` option for `python-platform` (#18548)
Co-authored-by: detachhead <detachhead@users.noreply.github.com>
This commit is contained in:
parent
b01c95d460
commit
07cb84426d
|
|
@ -76,6 +76,7 @@ python = "./.venv"
|
||||||
Specifies the target platform that will be used to analyze the source code.
|
Specifies the target platform that will be used to analyze the source code.
|
||||||
If specified, ty will understand conditions based on comparisons with `sys.platform`, such
|
If specified, ty will understand conditions based on comparisons with `sys.platform`, such
|
||||||
as are commonly found in typeshed to reflect the differing contents of the standard library across platforms.
|
as are commonly found in typeshed to reflect the differing contents of the standard library across platforms.
|
||||||
|
If `all` is specified, ty will assume that the source code can run on any platform.
|
||||||
|
|
||||||
If no platform is specified, ty will use the current platform:
|
If no platform is specified, ty will use the current platform:
|
||||||
- `win32` for Windows
|
- `win32` for Windows
|
||||||
|
|
@ -86,7 +87,7 @@ If no platform is specified, ty will use the current platform:
|
||||||
|
|
||||||
**Default value**: `<current-platform>`
|
**Default value**: `<current-platform>`
|
||||||
|
|
||||||
**Type**: `"win32" | "darwin" | "android" | "ios" | "linux" | str`
|
**Type**: `"win32" | "darwin" | "android" | "ios" | "linux" | "all" | str`
|
||||||
|
|
||||||
**Example usage** (`pyproject.toml`):
|
**Example usage** (`pyproject.toml`):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -333,6 +333,7 @@ pub struct EnvironmentOptions {
|
||||||
/// Specifies the target platform that will be used to analyze the source code.
|
/// Specifies the target platform that will be used to analyze the source code.
|
||||||
/// If specified, ty will understand conditions based on comparisons with `sys.platform`, such
|
/// If specified, ty will understand conditions based on comparisons with `sys.platform`, such
|
||||||
/// as are commonly found in typeshed to reflect the differing contents of the standard library across platforms.
|
/// as are commonly found in typeshed to reflect the differing contents of the standard library across platforms.
|
||||||
|
/// If `all` is specified, ty will assume that the source code can run on any platform.
|
||||||
///
|
///
|
||||||
/// If no platform is specified, ty will use the current platform:
|
/// If no platform is specified, ty will use the current platform:
|
||||||
/// - `win32` for Windows
|
/// - `win32` for Windows
|
||||||
|
|
@ -343,7 +344,7 @@ pub struct EnvironmentOptions {
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[option(
|
#[option(
|
||||||
default = r#"<current-platform>"#,
|
default = r#"<current-platform>"#,
|
||||||
value_type = r#""win32" | "darwin" | "android" | "ios" | "linux" | str"#,
|
value_type = r#""win32" | "darwin" | "android" | "ios" | "linux" | "all" | str"#,
|
||||||
example = r#"
|
example = r#"
|
||||||
# Tailor type stubs and conditionalized type definitions to windows.
|
# Tailor type stubs and conditionalized type definitions to windows.
|
||||||
python-platform = "win32"
|
python-platform = "win32"
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"python-platform": {
|
"python-platform": {
|
||||||
"description": "Specifies the target platform that will be used to analyze the source code. If specified, ty will understand conditions based on comparisons with `sys.platform`, such as are commonly found in typeshed to reflect the differing contents of the standard library across platforms.\n\nIf no platform is specified, ty will use the current platform: - `win32` for Windows - `darwin` for macOS - `android` for Android - `ios` for iOS - `linux` for everything else",
|
"description": "Specifies the target platform that will be used to analyze the source code. If specified, ty will understand conditions based on comparisons with `sys.platform`, such as are commonly found in typeshed to reflect the differing contents of the standard library across platforms. If `all` is specified, ty will assume that the source code can run on any platform.\n\nIf no platform is specified, ty will use the current platform: - `win32` for Windows - `darwin` for macOS - `android` for Android - `ios` for iOS - `linux` for everything else",
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/PythonPlatform"
|
"$ref": "#/definitions/PythonPlatform"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue