ReFreSH.MobileSuit.Core.Services package¶
Submodules¶
ReFreSH.MobileSuit.Core.Services.AppInfo module¶
- class ReFreSH.MobileSuit.Core.Services.AppInfo.ISuitAppInfo[source]¶
Bases:
ABC
provides basic info of App.
- abstract property AppName: str¶
Name of application.
- abstract property StartArgs: list[str]¶
Arguments for startup.
- class ReFreSH.MobileSuit.Core.Services.AppInfo.SuitAppInfo[source]¶
Bases:
ISuitAppInfo
provides basic info of App.
- property AppName: str¶
Name of application.
- property StartArgs: list[str]¶
Arguments for startup.
ReFreSH.MobileSuit.Core.Services.HistoryService module¶
- class ReFreSH.MobileSuit.Core.Services.HistoryService.HistoryService[source]¶
Bases:
IHistoryService
- property Response: str | None¶
Response of last Request.
- property Status: RequestStatus¶
Status of last Request.
- class ReFreSH.MobileSuit.Core.Services.HistoryService.IHistoryService[source]¶
Bases:
ABC
Provides request history.
- abstract property Response: str | None¶
Response of last Request.
- abstract property Status: RequestStatus¶
Status of last Request.
ReFreSH.MobileSuit.Core.Services.IOHub module¶
- class ReFreSH.MobileSuit.Core.Services.IOHub.IOHub(promptFormatter: Callable[[Iterable[PrintUnit]], Iterable[PrintUnit]], configurator: Callable[[IIOHub], None])[source]¶
Bases:
IIOHub
,ABC
An entity, which serves the input/output of a mobile suit.
- AppendWriteLinePrefixPrimary(prefix: Iterable) None [source]¶
Append a str to Prefix, usually used to increase indentation
- property ColorSetting: IColorSetting¶
Color settings for this IOServer. (default DefaultColorSetting)
- property ErrorStream: TextIO¶
Error stream (default stderr)
- property FormatPrompt: Callable[[Iterable[PrintUnit]], Iterable[PrintUnit]]¶
Prompt server for the io server.
- GetLinePrefix(otype: OutputType) List[PrintUnit] [source]¶
Get the prefix before writing line.
- property Input: TextIO¶
Input stream (default stdin)
- property IsErrorRedirected: bool¶
Check if this IOServer’s error stream is redirected (NOT stderr)
- property IsInputRedirected: bool¶
Checks if this IOServer’s input stream is redirected (NOT stdin)
- property IsOutputRedirected: bool¶
Check if this IOServer’s output stream is redirected (NOT stdout)
- property Output: TextIO¶
Output stream (default stdout)
- Peek() <module 'pyasn1.type.char' from '/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/pyasn1/type/char.py'> [source]¶
Reads the next character from input stream without changing the state of the reader or the character source.
Returns:
The next available character.
- Read() <module 'pyasn1.type.char' from '/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/pyasn1/type/char.py'> [source]¶
Reads the next character from input stream.
Returns:
The next available character.
- ReadLinePrimary() str [source]¶
Reads a line from input stream, with prompt.
Returns:
Content from input stream, None if EOF
- ReadToEnd() str [source]¶
Reads all characters from the current position to the end of the input stream and returns them as one string.
Returns:
All characters from the current position to the end.
- class ReFreSH.MobileSuit.Core.Services.IOHub.IOHub4Bit(promptFormatter: Callable[[Iterable[PrintUnit]], Iterable[PrintUnit]], configurator: Callable[[IIOHub], None])[source]¶
Bases:
IOHub
IO hub using 4-bit color output.
- static ConsoleColorOf(color: Color) ConsoleColor [source]¶
ReFreSH.MobileSuit.Core.Services.ParsingService module¶
- class ReFreSH.MobileSuit.Core.Services.ParsingService.IParsingService[source]¶
Bases:
ABC
Get parsers for certain type.
- abstract Add(_T, converter: Callable[[str], T], name: str = '') None [source]¶
Add a parser with certain name to parsing service.
- Parameters:
_T
converter
name
- abstract AddParser(parser: SuitParser[T]) None [source]¶
Add a parser.
- Parameters:
parser
- class ReFreSH.MobileSuit.Core.Services.ParsingService.ParsingService[source]¶
Bases:
IParsingService
- Add(_T: Type, converter: Callable[[str], T], name: str = '') None [source]¶
Add a parser with certain name to parsing service.
- Parameters:
_T
converter
name
- AddParser(parser: SuitParser[T]) None [source]¶
Add a parser.
- Parameters:
parser
ReFreSH.MobileSuit.Core.Services.PromptFormatter module¶
- ReFreSH.MobileSuit.Core.Services.PromptFormatter.PromptFormatter¶
represents a generator provides prompt output.
alias of
Callable
[[Iterable
[PrintUnit
]],Iterable
[PrintUnit
]]
- class ReFreSH.MobileSuit.Core.Services.PromptFormatter.PromptFormatters[source]¶
Bases:
object
Default prompt formatters.
- static BasicPromptFormatter(origin: Iterable[PrintUnit]) Iterable[PrintUnit] [source]¶
A basic prompt formatter for Mobile Suit.
- Cross = '⨯'¶
a cross ⨯ char
- Lightning = '⚡'¶
a lightning ⚡ char
- static PowerLineFormatter(origin: Iterable[PrintUnit]) Iterable[PrintUnit] [source]¶
A PowerLine themed prompt generator
- RightArrow = '\ue0b1'¶
a right arrow char
- RightTriangle = '\ue0b0'¶
a right triangle char
ReFreSH.MobileSuit.Core.Services.SuitAppShell module¶
- class ReFreSH.MobileSuit.Core.Services.SuitAppShell.SuitAppShell[source]¶
Bases:
SuitShell
,ISuitShellCollection
SuitShell for Client App.
- async Execute(context: SuitContext) None [source]¶
Inherited from base class.
- classmethod FromClients(clients: Iterable[SuitShell]) SuitAppShell [source]¶
- property MemberCount: int¶
Inherited from base class.
ReFreSH.MobileSuit.Core.Services.SuitCommandServer module¶
- class ReFreSH.MobileSuit.Core.Services.SuitCommandServer.SuitCommandServer(io: IIOHub, app: SuitAppShell, host: SuitHostShell, taskService: ITaskService)[source]¶
Bases:
ISuitCommandServer
Built-In-Command Server. May be Override if necessary.
- ExitSuit() RequestStatus [source]¶
Inherited from base class.
- async Join(index: int, context: SuitContext) str | None [source]¶
Inherited from base class.
- async ListMembersAsync(suitObject: ISuitShellCollection) None [source]¶
List members of a SuitObject
ReFreSH.MobileSuit.Core.Services.SuitExceptionHandler module¶
- class ReFreSH.MobileSuit.Core.Services.SuitExceptionHandler.ISuitExceptionHandler[source]¶
Bases:
ABC
The handler
- abstract async InvokeAsync(context: SuitContext)[source]¶
To invoke the middleware
- Args:
context: Context of the request.
- class ReFreSH.MobileSuit.Core.Services.SuitExceptionHandler.SuitExceptionHandler(history: IHistoryService, io: IIOHub)[source]¶
Bases:
ISuitExceptionHandler
- async InvokeAsync(context: SuitContext)[source]¶
To invoke the middleware
- Args:
context: Context of the request.
ReFreSH.MobileSuit.Core.Services.SuitHostShell module¶
- class ReFreSH.MobileSuit.Core.Services.SuitHostShell.SuitHostShell(otype: Type, factory: Callable[[SuitContext], Any], info: str)[source]¶
Bases:
SuitObjectShell
A SuitShell over SuitServer
- classmethod FromCommandServer(serverType: Type) SuitHostShell [source]¶
Create a Host shell from command server.
ReFreSH.MobileSuit.Core.Services.TaskService module¶
- class ReFreSH.MobileSuit.Core.Services.TaskService.ITaskService[source]¶
Bases:
ABC
Provides task system.
- AddTask(task: Task, context: SuitContext) None [source]¶
Add a task to Task Collection
- async Join(index: int, newContext: SuitContext) None [source]¶
Join the task with certain index.
- property RunningCount: int¶
Number of Tasks that are running.
- class ReFreSH.MobileSuit.Core.Services.TaskService.TaskInfo[source]¶
Bases:
object
Information of Suit Task
- class ReFreSH.MobileSuit.Core.Services.TaskService.TaskService(cancelTasks: TaskRecorder)[source]¶
Bases:
ITaskService
- AddTask(task: Task, context: SuitContext) None [source]¶
Add a task to Task Collection
- async Join(index: int, newContext: SuitContext) None [source]¶
Join the task with certain index.
- property RunningCount: int¶
Number of Tasks that are running.