4b921803cb
* fbt: split sdk management code * scripts: fixed import handling * fbt: sdk: reformatted paths * scrips: dist: bundling libs as a build artifact * fbt: sdk: better path management * typo fix * fbt: sdk: minor path handling fixes * toolchain: fixed windows toolchain download Co-authored-by: あく <alleteam@gmail.com>
45 lines
1.0 KiB
Python
45 lines
1.0 KiB
Python
from typing import Set, ClassVar
|
|
from dataclasses import dataclass, field
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ApiEntryFunction:
|
|
name: str
|
|
returns: str
|
|
params: str
|
|
|
|
csv_type: ClassVar[str] = "Function"
|
|
|
|
def dictify(self):
|
|
return dict(name=self.name, type=self.returns, params=self.params)
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ApiEntryVariable:
|
|
name: str
|
|
var_type: str
|
|
|
|
csv_type: ClassVar[str] = "Variable"
|
|
|
|
def dictify(self):
|
|
return dict(name=self.name, type=self.var_type, params=None)
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ApiHeader:
|
|
name: str
|
|
|
|
csv_type: ClassVar[str] = "Header"
|
|
|
|
def dictify(self):
|
|
return dict(name=self.name, type=None, params=None)
|
|
|
|
|
|
@dataclass
|
|
class ApiEntries:
|
|
# These are sets, to avoid creating duplicates when we have multiple
|
|
# declarations with same signature
|
|
functions: Set[ApiEntryFunction] = field(default_factory=set)
|
|
variables: Set[ApiEntryVariable] = field(default_factory=set)
|
|
headers: Set[ApiHeader] = field(default_factory=set)
|