File: shell_variable.py

package info (click to toggle)
freeorion 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 194,940 kB
  • sloc: cpp: 186,508; python: 40,969; ansic: 1,164; xml: 719; makefile: 32; sh: 7
file content (14 lines) | stat: -rw-r--r-- 459 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class ShellVariable:
    """
    Variable initialization and description for an interpreter.
    """

    def __init__(self, *, variable: str, expression: str, description: str, imports=tuple()):
        self.name = variable
        self.expression = expression
        self.description = description
        self.imports = imports

    def get_evaluation_command(self) -> str:
        yield from self.imports
        yield f"{self.name} = {self.expression}"