Module pyspecan.config

Classes

class Mode (*args, **kwds)
Expand source code
class Mode(Enum):
    """Specan modes"""
    NONE = "none"
    SWEPT = "swept"
    RT = "rt"

    @classmethod
    def choices(cls):
        """return mode choices"""
        arr = []
        for inst in cls:
            if inst == cls.NONE:
                continue
            arr.append(inst.name)
        return arr

    @classmethod
    def get(cls, option: str):
        for inst in cls:
            if inst.name == option:
                return inst
        return cls.NONE

Specan modes

Ancestors

  • enum.Enum

Class variables

var NONE
var RT
var SWEPT

Static methods

def choices()

return mode choices

def get(option: str)
class Sink (*args, **kwds)
Expand source code
class Sink(Enum):
    """Sink modes"""
    NONE = "none"
    FILE = "file"
    LIVE = "live"

    @classmethod
    def choices(cls):
        """return mode choices"""
        arr = []
        for inst in cls:
            if inst == cls.NONE:
                continue
            arr.append(inst.name)
        return arr

    @classmethod
    def get(cls, option: str):
        for inst in cls:
            if inst.name == option:
                return inst
        return cls.NONE

Sink modes

Ancestors

  • enum.Enum

Class variables

var FILE
var LIVE
var NONE

Static methods

def choices()

return mode choices

def get(option: str)
class View (*args, **kwds)
Expand source code
class View(Enum):
    """Specan views"""
    NONE = (("none",), None)
    CUI = (("c", "cui"), "cui")
    tkGUI = (("tk", "tkgui"), "tk_gui")

    @property
    def path(self):
        """return view import path name"""
        return self.value[1]

    @classmethod
    def get(cls, option: str):
        """return view instance"""
        for inst in cls:
            if inst.name == option or option in inst.value[0]:
                return inst
        return cls.NONE

    @classmethod
    def choices(cls):
        """return view choices"""
        arr = []
        for inst in cls:
            if inst == cls.NONE:
                continue
            for i in inst.value[0]:
                arr.append(i)
            arr.append(inst.name)
        return arr

Specan views

Ancestors

  • enum.Enum

Class variables

var CUI
var NONE
var tkGUI

Static methods

def choices()

return view choices

def get(option: str)

return view instance

Instance variables

prop path
Expand source code
@property
def path(self):
    """return view import path name"""
    return self.value[1]

return view import path name

class config
Expand source code
class config:
    """Global variables for convenience"""
    __instance = None

    SENTINEL = object()
    SINK: Sink = Sink.NONE
    MODE: Mode = Mode.NONE

    MON_MEM: bool = False
    PROFILE: bool = False
    PROFILE_PATH = [None, "pyspecan.prof"][1]

    def __new__(cls):
        if cls.__instance is None:
            cls.__instance = object.__new__(cls)
            cls.__instance._init()
        return cls.__instance

    def _init(self):
        pass

Global variables for convenience

Class variables

var MODEMode
var MON_MEM : bool
var PROFILE : bool
var PROFILE_PATH
var SENTINEL
var SINKSink