sys.platform documentation
This commit is contained in:
@@ -9,7 +9,11 @@ pub enum PythonPlatform {
|
||||
/// Do not make any assumptions about the target platform.
|
||||
#[default]
|
||||
All,
|
||||
/// Assume a target platform like `linux`, `darwin`, `win32`, etc.
|
||||
/// Assume a specific target platform like `linux`, `darwin` or `win32`.
|
||||
///
|
||||
/// We use a string (instead of individual enum variants), as the set of possible platforms
|
||||
/// may change over time. See <https://docs.python.org/3/library/sys.html#sys.platform> for
|
||||
/// some known platform identifiers.
|
||||
#[cfg_attr(feature = "serde", serde(untagged))]
|
||||
Individual(String),
|
||||
Identifier(String),
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ fn symbol<'db>(db: &'db dyn Db, scope: ScopeId<'db>, name: &str) -> Symbol<'db>
|
||||
&& file_to_module(db, scope.file(db)).is_some_and(|module| module.name() == "sys")
|
||||
{
|
||||
match Program::get(db).python_platform(db) {
|
||||
crate::PythonPlatform::Individual(platform) => {
|
||||
crate::PythonPlatform::Identifier(platform) => {
|
||||
return Symbol::Type(
|
||||
Type::StringLiteral(StringLiteralType::new(db, platform.as_str())),
|
||||
Boundness::Bound,
|
||||
|
||||
Reference in New Issue
Block a user