ReFreSH.MobileSuit package¶
Subpackages¶
- ReFreSH.MobileSuit.Core package
- Subpackages
- ReFreSH.MobileSuit.Core.Middlewares package
- Submodules
- ReFreSH.MobileSuit.Core.Middlewares.AppShellMiddleware module
- ReFreSH.MobileSuit.Core.Middlewares.FinalizeMiddleware module
- ReFreSH.MobileSuit.Core.Middlewares.HostShellMiddleware module
- ReFreSH.MobileSuit.Core.Middlewares.PromptMiddleware module
- ReFreSH.MobileSuit.Core.Middlewares.UserInputMiddleware module
- Module contents
- ReFreSH.MobileSuit.Core.Services package
- Submodules
- ReFreSH.MobileSuit.Core.Services.AppInfo module
- ReFreSH.MobileSuit.Core.Services.HistoryService module
- ReFreSH.MobileSuit.Core.Services.IOHub module
- ReFreSH.MobileSuit.Core.Services.ParsingService module
- ReFreSH.MobileSuit.Core.Services.PromptFormatter module
- ReFreSH.MobileSuit.Core.Services.SuitAppShell module
- ReFreSH.MobileSuit.Core.Services.SuitCommandServer module
- ReFreSH.MobileSuit.Core.Services.SuitExceptionHandler module
- ReFreSH.MobileSuit.Core.Services.SuitHostShell module
- ReFreSH.MobileSuit.Core.Services.TaskService module
- Module contents
- ReFreSH.MobileSuit.Core.Middlewares package
- Submodules
- ReFreSH.MobileSuit.Core.ColorSetting module
ColorSetting
IColorSetting
IColorSetting.BackgroundColor
IColorSetting.DefaultColor
IColorSetting.DefaultColorSetting()
IColorSetting.ErrorColor
IColorSetting.InformationColor
IColorSetting.OkColor
IColorSetting.PromptColor
IColorSetting.SelectColor()
IColorSetting.SystemColor
IColorSetting.TitleColor
IColorSetting.WarningColor
- ReFreSH.MobileSuit.Core.ISuitCommandServer module
- ReFreSH.MobileSuit.Core.ISuitMiddleware module
- ReFreSH.MobileSuit.Core.SuitBuildUtils module
- ReFreSH.MobileSuit.Core.SuitContext module
- ReFreSH.MobileSuit.Core.SuitMethodParameterInfo module
- ReFreSH.MobileSuit.Core.SuitMethodShell module
- ReFreSH.MobileSuit.Core.SuitObjectShell module
- ReFreSH.MobileSuit.Core.SuitParser module
- ReFreSH.MobileSuit.Core.SuitShell module
- ReFreSH.MobileSuit.Core.TestSuitMethodShell2 module
- Module contents
- Subpackages
- ReFreSH.MobileSuit.Decorators package
- ReFreSH.MobileSuit.Resources package
- ReFreSH.MobileSuit.UI package
Submodules¶
ReFreSH.MobileSuit.IIOHub module¶
- class ReFreSH.MobileSuit.IIOHub.IIOHub[source]¶
Bases:
ABC
An entity, which serves the input/output of a mobile suit.
- AppendWriteLinePrefix(prefix: str | Iterable = '\t') None [source]¶
Append a str to Prefix, usually used to increase indentation
- Args:
self: IOHub to write to prefix: the output tuple to append
- abstract AppendWriteLinePrefixPrimary(prefix: Iterable) None [source]¶
Append a str to Prefix, usually used to increase indentation
- abstract property ColorSetting: IColorSetting¶
Color settings for this IOServer. (default DefaultColorSetting)
- CreateReadLinePrompt(prompt: str, defaultValue: str | None, customPromptColor: Color | None) Iterable[Iterable] [source]¶
- abstract property ErrorStream: TextIOBase¶
Error stream (default stderr)
- abstract property FormatPrompt: Callable[[Iterable[PrintUnit]], Iterable[PrintUnit]]¶
Prompt server for the io server.
- static GetLabel(otype: OutputType = OutputType.Default) str [source]¶
get label of given output type
- abstract GetLinePrefix(otype: OutputType) List[Iterable] [source]¶
Get the prefix before writing line.
- abstract property Input: TextIOBase¶
Input stream (default stdin)
- abstract property IsErrorRedirected: bool¶
Check if this IOServer’s error stream is redirected (NOT stderr)
- abstract property IsInputRedirected: bool¶
Checks if this IOServer’s input stream is redirected (NOT stdin)
- abstract property IsOutputRedirected: bool¶
Check if this IOServer’s output stream is redirected (NOT stdout)
- abstract property Options: IOOptions¶
Disable Time marks which shows in Output-Redirected Environment.
- abstract property Output: TextIOBase¶
Output stream (default stdout)
- abstract 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.
- abstract 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.
- ReadLine(prompt: str = '', newLine: bool = False, customPromptColor: Color | None = None, defaultValue: str | None = None) str | None [source]¶
Reads a line from input stream, with prompt. Return something default if user input “”.
- Args:
prompt: The prompt display(output to output stream) before user input. newLine: If the prompt will display in a single line customPromptColor: Optional. Prompt’s Color, ColorSetting.PromptColor as default. defaultValue: Default return value if user input “”
- Returns:
Content from input stream, None if EOF, if user input “”, return defaultValue
- abstract ReadLinePrimary() str | None [source]¶
Reads a line from input stream, with prompt.
Returns:
Content from input stream, None if EOF
- abstract 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.
- abstract SubtractWriteLinePrefix() None [source]¶
Subtract a str from Prefix, usually used to decrease indentation
- Write(content: str | Iterable[Iterable], otype: OutputType = OutputType.Default, custom_color: ConsoleColor | Color | None = None) None [source]¶
Writes some content to output stream. With certain color in console.
- Args:
content: Content to output. otype: Optional. Type of this content, this decides how will it be like. custom_color: Optional. Customized color in console
- WriteLine(content: str | Iterable[Iterable] = '', otype: OutputType = OutputType.Default, custom_color: ConsoleColor | Color | None = None) None [source]¶
Writes some content to output stream, with line break. With certain color in console.
Args:
content: Content to output. otype: Optional. Type of this content, this decides how will it be like. custom_color: Optional. Customized color in console
- class ReFreSH.MobileSuit.IIOHub.IOOptions(value)[source]¶
Bases:
Flag
Featured Options of IOHub
- DisableLinePrefix = 4¶
Suggests no Line prefix should be output to the stream
- DisablePrompt = 1¶
Suggests no prompt should be output to the stream
- DisableTag = 2¶
Suggests no type/time tag should be output to the stream
- NoFlag = 0¶
No feature applied.
ReFreSH.MobileSuit.OutputType module¶
- class ReFreSH.MobileSuit.OutputType.OutputType(value)[source]¶
Bases:
Enum
Type of content that writes to the output stream.
- Default = 0¶
Normal content.
- Error = 2¶
Error content.
- Info = 5¶
Normal information.
- Ok = 3¶
All-Ok content.
- Prompt = 1¶
Prompt content.
- System = 6¶
Information provided by MobileSuit.
- Title = 4¶
Title of a list.
- Warning = 7¶
Warning content.
ReFreSH.MobileSuit.PrintUnit module¶
- class ReFreSH.MobileSuit.PrintUnit.PrintUnit(Text: str, Foreground: Color | None = None, Background: Color | None = None)[source]¶
Bases:
object
A basic unit of output print, contains foreground, background and text.
- static ConsoleColorCast(origin: ConsoleColor | None) Color | None [source]¶
Convert ConsoleColor to Color
ReFreSH.MobileSuit.RequestStatus module¶
- class ReFreSH.MobileSuit.RequestStatus.RequestStatus(value)[source]¶
Bases:
IntEnum
An enumeration.
- CommandNotFound = -3¶
Cannot find the member in the object referring to.
- CommandParsingFailure = -5¶
Failed to parse an argument of a command.
- Faulted = -4¶
Error in the application
- Handled = 4¶
Command is Running. Set by the FinalMiddleware.
- Interrupt = -2¶
Cannot find the object referring to.
- NoRequest = 1¶
No Request is input by the user.
- NotHandled = 2¶
No Request is input by the user.
- Ok = 0¶
Everything is OK
- OnExit = -1¶
The Progress is Exiting
- Running = 3¶
Command is Running. Set by the FinalMiddleware.
ReFreSH.MobileSuit.Suit module¶
- ReFreSH.MobileSuit.Suit.CreateBuilder(args: List[str] | None = None) SuitHostBuilder [source]¶
Get a builder to create host
- ReFreSH.MobileSuit.Suit.QuickStart(T, args: List[str] = [])[source]¶
Quick start a mobilesuit on specific client class with default settings.
ReFreSH.MobileSuit.SuitConfig module¶
ReFreSH.MobileSuit.SuitHost module¶
- class ReFreSH.MobileSuit.SuitHost.SuitHost(services: ServiceProvider, middleware: List[ISuitMiddleware], cancellationTasks: TaskRecorder)[source]¶
Bases:
object
A entity, which serves the shell functions of a mobile-suit program.
- static CreateMiddlewareInvocation(m: ISuitMiddleware, nxt: Callable[[SuitContext], Awaitable]) Callable[[SuitContext], Awaitable] [source]¶
- async static EmptyMiddlewareInvocation(c: SuitContext)[source]¶
- async HandleRequest(requestHandler: Callable[[SuitContext], Awaitable])[source]¶
ReFreSH.MobileSuit.SuitHostBuilder module¶
- class ReFreSH.MobileSuit.SuitHostBuilder.ISuitWorkFlow[source]¶
Bases:
ABC
Describes the work flow of mobile suit.
- abstract UseAppShell() ISuitWorkFlow [source]¶
Add AppShell middleware
- abstract UseCustom(middlewareType: Type) ISuitWorkFlow [source]¶
Add a custom middleware
- abstract UseFinalize() ISuitWorkFlow [source]¶
Add Finalize middleware
- abstract UseHostShell() ISuitWorkFlow [source]¶
Add HostShell middleware
- abstract UseInput() ISuitWorkFlow [source]¶
Add input middleware
- abstract UsePrompt() ISuitWorkFlow [source]¶
Add suit prompt middleware
- class ReFreSH.MobileSuit.SuitHostBuilder.SuitHostBuilder(args: List[str] = [])[source]¶
Bases:
object
Builder to build a MobileSuit host.
- HasName(name: str) SuitHostBuilder [source]¶
Use given PromptGenerator for the Host
- MapClass(T, name: str = '') SuitHostBuilder [source]¶
Use given PromptGenerator for the Host
- MapInstance(instance, name: str = '') SuitHostBuilder [source]¶
Use given PromptGenerator for the Host
- MapMethod(name: str, method: Callable) SuitHostBuilder [source]¶
Use given PromptGenerator for the Host
- Use4BitColorIO() SuitHostBuilder [source]¶
Use 4-bit color IO for the Host
- UsePowerLine() SuitHostBuilder [source]¶
Use PowerLine PromptGenerator for the Host
- UsePureTextIO() SuitHostBuilder [source]¶
Use Plain text IO for the Host
- class ReFreSH.MobileSuit.SuitHostBuilder.SuitWorkFlow[source]¶
Bases:
ISuitWorkFlow
- Build(serviceProvider) List[ISuitMiddleware] [source]¶
- UseAppShell() ISuitWorkFlow [source]¶
Add AppShell middleware
- UseCustom(middlewareType: Type) ISuitWorkFlow [source]¶
Add a custom middleware
- UseFinalize() ISuitWorkFlow [source]¶
Add Finalize middleware
- UseHostShell() ISuitWorkFlow [source]¶
Add HostShell middleware
- UseInput() ISuitWorkFlow [source]¶
Add input middleware
- UsePrompt() ISuitWorkFlow [source]¶
Add suit prompt middleware
Module contents¶
- class ReFreSH.MobileSuit.IIOHub[source]¶
Bases:
ABC
An entity, which serves the input/output of a mobile suit.
- AppendWriteLinePrefix(prefix: str | Iterable = '\t') None [source]¶
Append a str to Prefix, usually used to increase indentation
- Args:
self: IOHub to write to prefix: the output tuple to append
- abstract AppendWriteLinePrefixPrimary(prefix: Iterable) None [source]¶
Append a str to Prefix, usually used to increase indentation
- abstract property ColorSetting: IColorSetting¶
Color settings for this IOServer. (default DefaultColorSetting)
- CreateReadLinePrompt(prompt: str, defaultValue: str | None, customPromptColor: Color | None) Iterable[Iterable] [source]¶
- abstract property ErrorStream: TextIOBase¶
Error stream (default stderr)
- abstract property FormatPrompt: Callable[[Iterable[PrintUnit]], Iterable[PrintUnit]]¶
Prompt server for the io server.
- static GetLabel(otype: OutputType = OutputType.Default) str [source]¶
get label of given output type
- abstract GetLinePrefix(otype: OutputType) List[Iterable] [source]¶
Get the prefix before writing line.
- abstract property Input: TextIOBase¶
Input stream (default stdin)
- abstract property IsErrorRedirected: bool¶
Check if this IOServer’s error stream is redirected (NOT stderr)
- abstract property IsInputRedirected: bool¶
Checks if this IOServer’s input stream is redirected (NOT stdin)
- abstract property IsOutputRedirected: bool¶
Check if this IOServer’s output stream is redirected (NOT stdout)
- abstract property Options: IOOptions¶
Disable Time marks which shows in Output-Redirected Environment.
- abstract property Output: TextIOBase¶
Output stream (default stdout)
- abstract 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.
- abstract 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.
- ReadLine(prompt: str = '', newLine: bool = False, customPromptColor: Color | None = None, defaultValue: str | None = None) str | None [source]¶
Reads a line from input stream, with prompt. Return something default if user input “”.
- Args:
prompt: The prompt display(output to output stream) before user input. newLine: If the prompt will display in a single line customPromptColor: Optional. Prompt’s Color, ColorSetting.PromptColor as default. defaultValue: Default return value if user input “”
- Returns:
Content from input stream, None if EOF, if user input “”, return defaultValue
- abstract ReadLinePrimary() str | None [source]¶
Reads a line from input stream, with prompt.
Returns:
Content from input stream, None if EOF
- abstract 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.
- abstract SubtractWriteLinePrefix() None [source]¶
Subtract a str from Prefix, usually used to decrease indentation
- Write(content: str | Iterable[Iterable], otype: OutputType = OutputType.Default, custom_color: ConsoleColor | Color | None = None) None [source]¶
Writes some content to output stream. With certain color in console.
- Args:
content: Content to output. otype: Optional. Type of this content, this decides how will it be like. custom_color: Optional. Customized color in console
- WriteLine(content: str | Iterable[Iterable] = '', otype: OutputType = OutputType.Default, custom_color: ConsoleColor | Color | None = None) None [source]¶
Writes some content to output stream, with line break. With certain color in console.
Args:
content: Content to output. otype: Optional. Type of this content, this decides how will it be like. custom_color: Optional. Customized color in console
- ReFreSH.MobileSuit.SuitAlias(alias: str)[source]¶
Alias for a SuitObject’s member
- Parameters:
alias – Alias for a SuitObject’s member
- ReFreSH.MobileSuit.SuitArgInjected(arg_name: str)[source]¶
Indicate that Mobile Suit should Inject to this argument.
- Parameters:
arg_name – The name of the argument to inject.
- ReFreSH.MobileSuit.SuitArgParser(arg_name: str, parser_name: str = '', TTarget=None, TConverter=None)[source]¶
Select the parser used for the certain argument