data.SourceVariable

 1from .SourceType import SourceType
 2
 3
 4class SourceVariable:
 5    """
 6    Data class representing a python variable.
 7    """
 8
 9    def __init__(
10            self,
11            name: str,
12            data_type: SourceType,
13            static: bool = False,
14            default: str | None = None
15    ) -> None:
16        self.static: bool = static
17        self.name: str = name
18        self.type: SourceType = data_type
19        self.default: str | None = default
20
21    def get_dependencies(self) -> set[str]:
22        """
23        Generates a list of dependencies.
24
25        :return: All dependencies of the variable.
26        """
27        return self.type.dependencies
28
29    def __str__(self) -> str:
30        return ('{static}' if self.static else '') + \
31            self.name + \
32            (': <color:MidnightBlue>' + str(self.type) + '</color>' if str(self.type) else '') + \
33            (' = ' + self.default if self.default else '')
class SourceVariable:
 5class SourceVariable:
 6    """
 7    Data class representing a python variable.
 8    """
 9
10    def __init__(
11            self,
12            name: str,
13            data_type: SourceType,
14            static: bool = False,
15            default: str | None = None
16    ) -> None:
17        self.static: bool = static
18        self.name: str = name
19        self.type: SourceType = data_type
20        self.default: str | None = default
21
22    def get_dependencies(self) -> set[str]:
23        """
24        Generates a list of dependencies.
25
26        :return: All dependencies of the variable.
27        """
28        return self.type.dependencies
29
30    def __str__(self) -> str:
31        return ('{static}' if self.static else '') + \
32            self.name + \
33            (': <color:MidnightBlue>' + str(self.type) + '</color>' if str(self.type) else '') + \
34            (' = ' + self.default if self.default else '')

Data class representing a python variable.

SourceVariable( name: str, data_type: data.SourceType.SourceType, static: bool = False, default: str | None = None)
10    def __init__(
11            self,
12            name: str,
13            data_type: SourceType,
14            static: bool = False,
15            default: str | None = None
16    ) -> None:
17        self.static: bool = static
18        self.name: str = name
19        self.type: SourceType = data_type
20        self.default: str | None = default
static: bool
name: str
default: str | None
def get_dependencies(self) -> set[str]:
22    def get_dependencies(self) -> set[str]:
23        """
24        Generates a list of dependencies.
25
26        :return: All dependencies of the variable.
27        """
28        return self.type.dependencies

Generates a list of dependencies.

Returns

All dependencies of the variable.