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
IOHub
IOHub.AppendTimeStamp()
IOHub.AppendWriteLinePrefixInternal()
IOHub.AppendWriteLinePrefixPrimary()
IOHub.ClearWriteLinePrefix()
IOHub.ColorSetting
IOHub.ErrorStream
IOHub.FormatPrompt
IOHub.GetLinePrefix()
IOHub.Input
IOHub.IsErrorRedirected
IOHub.IsInputRedirected
IOHub.IsOutputRedirected
IOHub.Options
IOHub.Output
IOHub.Peek()
IOHub.Read()
IOHub.ReadLinePrimary()
IOHub.ReadToEnd()
IOHub.ResetError()
IOHub.ResetInput()
IOHub.ResetOutput()
IOHub.SubtractWriteLinePrefix()
IOHub.WriteInternal()
IOHub.WritePrimary()
IOHub4Bit
PureTextIOHub
- 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
Submodules¶
ReFreSH.MobileSuit.Core.ColorSetting module¶
- class ReFreSH.MobileSuit.Core.ColorSetting.ColorSetting(BackgroundColor: Color, DefaultColor: Color, PromptColor: Color, ErrorColor: Color, OkColor: Color, TitleColor: Color, InformationColor: Color, SystemColor: Color, WarningColor: Color)[source]¶
Bases:
IColorSetting
Color settings of a Mobile Suit.
- property BackgroundColor: Color¶
- property DefaultColor: Color¶
Default color. For OutputType.Default
- Equals(other: IColorSetting | None) bool [source]¶
Indicates whether this instance and a specified object are equal.
- Parameters:
other – The object to compare with the current instance.
- property ErrorColor: Color¶
Prompt Color. For OutputType.Error
- property InformationColor: Color¶
Prompt Color. For OutputType.CustomInformation
- property OkColor: Color¶
Prompt Color. For OutputType.AllOK
- property PromptColor: Color¶
Prompt Color. For OutputType.Prompt
- property SystemColor: Color¶
Prompt Color. For OutputType.Information
- property TitleColor: Color¶
Prompt Color. For OutputType.ListTitle
- property WarningColor: Color¶
Warning color. For OutputType.Warning
- class ReFreSH.MobileSuit.Core.ColorSetting.IColorSetting[source]¶
Bases:
ABC
Color settings of a Mobile Suit.
- abstract property BackgroundColor: Color¶
- abstract property DefaultColor: Color¶
Default color. For OutputType.Default
- abstract property ErrorColor: Color¶
Prompt Color. For OutputType.Error
- abstract property InformationColor: Color¶
Prompt Color. For OutputType.Info
- abstract property OkColor: Color¶
Prompt Color. For OutputType.OK
- abstract property PromptColor: Color¶
Prompt Color. For OutputType.Prompt
- static SelectColor(colorSetting, otype: OutputType = OutputType.Default, customColor: Color | None = None) Color [source]¶
select color for the output type from color setting
- Parameters:
colorSetting – color setting
otype – output type
customColor – customized color
- abstract property SystemColor: Color¶
Prompt Color. For OutputType.System
- abstract property TitleColor: Color¶
Prompt Color. For OutputType.Title
- abstract property WarningColor: Color¶
Prompt Color. For OutputType.System
ReFreSH.MobileSuit.Core.ISuitCommandServer module¶
- class ReFreSH.MobileSuit.Core.ISuitCommandServer.ISuitCommandServer[source]¶
Bases:
ABC
Built-In-Command Server’s Model.
- abstract ChDir(path: str) str [source]¶
Set current directory
- Parameters:
path – path to set as current directory
- abstract ExitSuit() RequestStatus [source]¶
Exit MobileSuit
- abstract async Join(index: int, context: SuitContext) str | None [source]¶
Join a Running task
- Parameters:
index – index of the task to join
context – context of the request
- abstract async ListCommands(args: list[str]) None [source]¶
Show Members of the Current SuitObject
- Parameters:
args – command args
- abstract async Stop(index: int) None [source]¶
Stop a Running task
- Parameters:
index – index of the task to stop
ReFreSH.MobileSuit.Core.ISuitMiddleware module¶
- class ReFreSH.MobileSuit.Core.ISuitMiddleware.ISuitMiddleware[source]¶
Bases:
ABC
A middleware of Mobile Suit.
- abstract async InvokeAsync(context: SuitContext, nextStep: Callable[[SuitContext], Awaitable])[source]¶
To invoke the middleware
ReFreSH.MobileSuit.Core.SuitBuildUtils module¶
- ReFreSH.MobileSuit.Core.SuitBuildUtils.CreateConverterFactory(T, parserInfo: SuitArgParserInfo) Callable[[SuitContext], Callable[[str], object | None]] [source]¶
- ReFreSH.MobileSuit.Core.SuitBuildUtils.CreateInstance(otype, s: SuitContext) Any | None [source]¶
- ReFreSH.MobileSuit.Core.SuitBuildUtils.CreateInstanceWithProvider(otype, s: ServiceProvider) Any | None [source]¶
- ReFreSH.MobileSuit.Core.SuitBuildUtils.GetArg(parameter: Parameter, function: Callable, arg: str | None, context: SuitContext) tuple[object, int] [source]¶
- ReFreSH.MobileSuit.Core.SuitBuildUtils.GetArgs(func: Callable, args: List[str], context: SuitContext) List[Any | None] | None [source]¶
- ReFreSH.MobileSuit.Core.SuitBuildUtils.GetArgsInternal(func: Callable, parameterInfo: SuitMethodParameterInfo, args: List[str], context: SuitContext) List[Any | None] | None [source]¶
- ReFreSH.MobileSuit.Core.SuitBuildUtils.GetArrayArg(parameter: Parameter, function: Callable, argArray: list[str], context: SuitContext) object [source]¶
- ReFreSH.MobileSuit.Core.SuitBuildUtils.GetMethodParameterInfo(func: Callable) SuitMethodParameterInfo [source]¶
ReFreSH.MobileSuit.Core.SuitContext module¶
- class ReFreSH.MobileSuit.Core.SuitContext.SuitContext(sp: ServiceProvider)[source]¶
Bases:
object
Context through the lifetime of a SuitRequest(A Command)
- Exception: Exception | None¶
The exception caught in the execution.
- Properties: dict[str, object]¶
Properties of current request.
- Request: list[str]¶
A command from input stream
- RequestStatus: RequestStatus¶
The execution status of current request.
- Response: str | None¶
Output to the output stream
- ServiceProvider¶
The ServiceProvider who provides services through whole request.
ReFreSH.MobileSuit.Core.SuitMethodParameterInfo module¶
- class ReFreSH.MobileSuit.Core.SuitMethodParameterInfo.SuitMethodParameterInfo[source]¶
Bases:
object
Parameter information of a method in MobileSuit
- MaxParameterCount: int¶
Number of the parameters which can be passed at least.
- MinParameterCount: int¶
Number of the parameters which can be passed at most.
- NonArrayParameterCount: int¶
Number of the parameters which are neither array nor DynamicParameter
- TailParameterType: TailParameterType¶
Type of the last parameter
ReFreSH.MobileSuit.Core.SuitMethodShell module¶
- class ReFreSH.MobileSuit.Core.SuitMethodShell.SuitMethodShell(method: Callable, factory: Callable[[SuitContext], Any], absoluteName=None)[source]¶
Bases:
SuitShell
Object’s Member which may be a method.
- async Execute(context: SuitContext)[source]¶
Execute this object.
- Parameters:
context – The arguments for execution.
- Returns:
The result of executing this object
- classmethod FromInstance(method: Callable, factory: Callable[[SuitContext], Any])[source]¶
- MayExecute(request: List[str]) bool [source]¶
Detect whether this IExecutable may execute the command.
- property MemberCount¶
ReFreSH.MobileSuit.Core.SuitObjectShell module¶
- class ReFreSH.MobileSuit.Core.SuitObjectShell.ISuitShellCollection[source]¶
Bases:
ABC
A collection contains ordered suit shell members.
- class ReFreSH.MobileSuit.Core.SuitObjectShell.SuitObjectShell(typedef, factory: Callable[[SuitContext], Any], info, name)[source]¶
Bases:
SuitShell
,ISuitShellCollection
Represents an object in Mobile Suit.
- async Execute(context: SuitContext)[source]¶
Execute this object.
- Parameters:
context – The arguments for execution.
- Returns:
The result of executing this object
- MayExecute(request: List[str]) bool [source]¶
Detect whether this IExecutable may execute the command.
- property MemberCount¶
ReFreSH.MobileSuit.Core.SuitParser module¶
- class ReFreSH.MobileSuit.Core.SuitParser.SuitParser(name: str, parser: Callable[[str], T | None])[source]¶
Bases:
Generic
[T
]A data parser of MobileSuit
- classmethod FromConverter(_T, converter: Callable[[str], T | None], name='')[source]¶
Create a mobile suit parser from a converter
- Parameters:
_T
converter – The converter method
name – Name of the parser, if set empty, the parser will be default.
- classmethod FromName(_T, name)[source]¶
Create a mobile suit parser from a func and given type
- Parameters:
name – Name of the parser, if set empty, the parser will be default.
- Name¶
Name of the Parser
- Parser¶
The parser which convert string argument to certain type.
- property TargetType: Type¶
ReFreSH.MobileSuit.Core.SuitShell module¶
- class ReFreSH.MobileSuit.Core.SuitShell.MemberType(value)[source]¶
Bases:
IntEnum
Type of member
- FieldWithInfo = 1¶
A Field/Property with customized information
- FieldWithoutInfo = -2¶
A Field/Property without customized information
- MethodWithInfo = 0¶
A Method with customized information
- MethodWithoutInfo = -1¶
A Method without customized information
- class ReFreSH.MobileSuit.Core.SuitShell.SuitShell(member, instance_factory: Callable[[SuitContext], Any], absoluteName=None)[source]¶
Bases:
ABC
A SuitObject’s member.
- AbsoluteName¶
Absolute name of this member.
- Aliases¶
Aliases of this member.
- abstract async Execute(context: SuitContext)[source]¶
Execute this object.
- Parameters:
context – The arguments for execution.
- Returns:
The result of executing this object
- FriendlyNames¶
Absolute name, and aliases.
- GetInstance(context: SuitContext) Any [source]¶
Instance which contains this member.
- property Information: str¶
Information of this member, customized or generated by Mobile Suit.
- abstract MayExecute(request: List[str]) bool [source]¶
Detect whether this IExecutable may execute the command.
- Type: MemberType¶
Type of the member