API Reference¶
Mod Fix¶
RemapService¶
- def_fix
- def_printModsToFix
- def_setupDefaultModType
- def_setupDownloadMode
- def_setupForcedModType
- def_setupLogPath
- def_setupModPath
- def_setupModTypes
- def_setupRemappedTypes
- def_setupToFixModTypes
- def_setupVersion
- defaddTips
- defclear
- defcreateLog
- defcreateMod
- deffix
- deffixIni
- deffixMod
- defreportSkippedAsset
- defreportSkippedMods
- defwarnSkippedIniResource
- class RemapService(path: str | None = None, keepBackups: bool = True, fixOnly: bool = False, undoOnly: bool = False, hideOrig: bool = False, readAllInis: bool = False, types: List[str] | None = None, defaultType: str | None = None, forcedType: str | None = None, log: str | None = None, verbose: bool = True, handleExceptions: bool = False, version: str | None = None, remappedTypes: List[str] | None = None, proxy: str | None = None, downloadMode: str | None = None)¶
The overall class for remapping mods
- Parameters:
path (Optional[
str]) –The file location of where to run the fix.
If this attribute is set to
None, then will run the fix from wherever this class is called
Default:
NonekeepBackups (
bool) –Whether to keep backup versions of any .ini files that the script fixes
Default:
TruefixOnly (
bool) –Whether to only fix the mods without removing any previous changes this fix script may have made
Warning
if this is set to
TrueandundoOnlyis also set toTrue, then the fix will not run and will throw aConflictingOptionsexceptionDefault:
FalseundoOnly (
bool) –Whether to only undo the fixes previously made by the fix
Warning
if this is set to
TrueandfixOnlyis also set toTrue, then the fix will not run and will throw aConflictingOptionsexceptionDefault:
TruehideOrig (
bool) –Whether to not show the mod on the original character
Default:
FalsereadAllInis (
bool) –Whether to read all the .ini files that the fix encounters
Default:
Falsetypes (Optional[List[
str]]) –The names for all the types of mods to fix.
If this argument is an empty list or this argument is
None, then will fix all the types of mods supported by this fix
Default:
NoneNote
For more information about the available mod names/aliases to reference, see Mod Types
remappedTypes (Optional[List[
str]]) –The names for the types of mods to be remapped based from the types of mods specified at
RemapService.types.
For a mod specified at
RemapService.types, if none of its corresponding mods to remap are specified in this attribute, then will remap the mod specified atRemapService.typesto all its corresponding mods to remap.If this argument is an empty list or this argument is
None, then will fix the mods specified attypesto all of their corresponding remapped mods
eg. if
RemapService.typesis["Kequeen", "jean"]and this attribute is["jeanSea"], then this class will perform the following remaps:Keqing –> KeqingOpulent
Jean –> JeanSea
**Note: ** Jean –> JeanCN will not be remapped for the above example
Note
For more information about the available mod names/aliases to reference, see Mod Types
Default:
NonedefaultType (Optional[
str]) –The name for the type to use if a mod has an unidentified type
If this value is
None, then mods with unidentified types will be skippedNote
For more information about the available mod names/aliases to reference, see Mod Types
Default:
NoneforcedType (Optional[
str]) –The mod type to forcibly assume for the parsed .ini files
Note
For more information about the available mod names/aliases to reference, see Mod Types
Default:
Nonelog (Optional[
str]) –The folder location to log the run of the fix into a seperate text file
If this value is
None, then will not log the fix
Default:
Noneverbose (
bool) –Whether to print the progress for fixing mods
Default:
TruehandleExceptions (
bool) –When an exception is caught, whether to silently stop running the fix
Default:
Falseversion (Optional[
str]) –The game version we want the fix to be compatible with
If This value is
None, then will retrieve the hashes/indices of the latest version.
Default:
Noneproxy (Optional[
str]) –The link to the proxy server used for any internet network requests made
If this value is
None, then will assume all internet network requests do not require the need to go through a proxy server.downloadMode (Optional[
str]) –The download mode to handle file downloads
If this value is
None, then the software will default to useDownloadMode.HardTexDrivenas the download modeNote
For more information about the available download modes to specify, see Download Modes
Default:
None
- _loggerBasePrefix¶
The prefix string for the logger used when the fix returns back to the original directory that it started to run
- Type:
- fixOnly¶
Whether to only fix the mods without removing any previous changes this fix script may have made
- Type:
- types¶
All the types of mods that will be fixed.
Note
For more information about the available mod names/aliases to reference, see Mod Types
- Type:
Set[
ModType]
- remappedTypes¶
The names for the types of mods to be remapped based from the types of mods specified at
RemapService.types.
For a mod specified at
RemapService.types, if none of its corresponding mods to remap are specified in this attribute, then will remap the mod specified atRemapService.typesto all its corresponding mods to remap.If this argument is an empty list or this argument is
None, then will fix the mods specified atRemapService.typesto all of their corresponding remapped mods
eg. if
RemapService.typesis["Kequeen", "jean"]and this attribute is["jeanSea"], then this class will perform the following remaps:Keqing –> KeqingOpulent
Jean –> JeanSea
**Note: ** Jean –> JeanCN will not be remapped for the above example
Note
For more information about the available mod names/aliases to reference, see Mod Types
- Type:
Set[
str]
- defaultType¶
The type to use if a mod has an unidentified type
Note
For more information about the available mod names/aliases to reference, see Mod Types
- Type:
Optional[
ModType]
- forcedType¶
The mod type to forcibly assume for the parsed .ini files
Note
For more information about the available mod names/aliases to reference, see Mod Types
- Type:
Optional[
ModType]
- version¶
The game version we want the fix to be compatible with
If This value is
None, then will retrieve the hashes/indices of the latest version.- Type:
Optional[packaging.version.Version]
- downloadMode¶
The download mode to handle file downloads
Note
For more information about the available download modes to specify, see Download Modes
- Type:
- _pathIsCWD¶
Whether the filepath that the program runs from is the current directory where this module is loaded
- Type:
- stats¶
The statistics gathered about the fix process
- Type:
- _fix()¶
The overall logic for fixing a bunch of mods
- For finding out which folders may contain mods, this function:
recursively searches all folders from where the
RemapService.pathis locatedfor every .ini file in a valid mod and every Blend.buf file encountered that is encountered, recursively search all the folders from where the .ini file or Blend.buf file is located
Tip
For more info about how we define a ‘mod’, go to
Mod
- _printModsToFix()¶
Prints out the types of mods that will be fixed
- _setupDefaultModType()¶
Sets the default mod type to be used for an unidentified mod
- _setupDownloadMode()¶
Sets the download mode the software will use for file downloads
- _setupForcedModType()¶
Sets the forced mod type to assume for the .ini files
- _setupLogPath()¶
Sets the folder path for where the log file will be stored
- _setupModPath()¶
Sets the filepath of where the fix will run from
- _setupModTypes(attr: str)¶
Sets the types of mods that will be fixed / fix to
- Parameters:
attr (
str) – The name of the attribute within this class set the mods for
- _setupRemappedTypes()¶
Sets the names for the types of mods that will be fixed to
- _setupToFixModTypes()¶
Sets the names for the type of mods that will be fixed
- _setupVersion()¶
Sets the game version to fix to
- addTips()¶
Prints out any useful tips for the user to know
- clear(clearLog: bool = True)¶
Clears up all the saved data
Paramters¶
- clearLog:
bool Whether to also clear out any saved data in the logger
- clearLog:
- createLog()¶
Creates a log text file that contains all the text printed on the command line
- createMod(path: str | None = None, files: List[str] | None = None) Mod¶
Creates a mod
Tip
For more info about how we define a ‘mod’, go to
Mod- Parameters:
path (Optional[
str]) –The absolute path to the mod folder.
If this argument is set to
None, then will use the current directory of where this module is loadedfiles (Optional[List[
str]]) –The direct children files to the mod folder (does not include files located in a folder within the mod folder).
If this parameter is set to
None, then the module will search the folders for you
- Returns:
The mod that has been created
- Return type:
- fixIni(ini: IniFile, mod: Mod, flushIfTemplates: bool = True) bool¶
Fixes an individual .ini file for a particular mod
Tip
For more info about how we define a ‘mod’, go to
Mod- Parameters:
- Returns:
Whether the particular .ini file has just been fixed
- Return type:
- fixMod(mod: Mod, flushIfTemplates: bool = True) bool¶
Fixes a particular mod
Tip
For more info about how we define a ‘mod’, go to
Mod
- property log: str¶
The folder location to log the run of the fix into a seperate text file
- Getter:
Returns the file path to the log
- Setter:
Sets the path for the log
- Type:
- property path: str¶
The filepath of where the fix is running from
- Getter:
Returns the path of where the fix is running
- Setter:
Sets the path for where the fix runs
- Type:
- property pathIsCwd¶
Whether the filepath that the program runs from is the current directory where this module is loaded
- Getter:
Returns whether the filepath that the program runs from is the current directory of where the module is loaded
- Type:
- property proxy: str | None¶
The link to the proxy server used for any internet network requests made
If this value is
None, then will assume all internet network requests do not require the need to go through a proxy server.- Getter:
Retrieves the proxy link
- Setter:
Sets the new proxy link
- Type:
Optional[
str]
- reportSkippedAsset(assetName: str, assetDict: Dict[str, Exception], warnStrFunc: Callable[[str], str])¶
Prints out the exception message for why a particular .ini file or Blend.buf file has been skipped
- Parameters:
assetName (
str) – The name for the type of asset (files, folders, mods, etc…) that was skippedassetDict (Dict[
str,Exception]) –Locations of where exceptions have occured for the particular asset
The keys are the absolute folder paths to where the exception occured
wantStrFunc (Callable[[
str],str]) –Function for how we want to print out the warning for each exception
Takes in the folder location of where the exception occured as a parameter
- reportSkippedMods()¶
Prints out all of the mods that were skipped due to exceptions
Tip
For more info about how we define a ‘mod’, go to
Mod
Mod¶
- clsMod.blendCorrection
- clsMod.isBackupIni
- clsMod.isBlend
- clsMod.isIni
- clsMod.isRemapBlend
- clsMod.isRemapCopyIni
- clsMod.isRemapTexture
- clsMod.isSrcIni
- clsMod.positionCorrection
- clsMod.texCorrection
- def_removeIniResources
- def_setupFiles
- defcorrectBlend
- defcorrectPosition
- defcorrectResource
- defcorrectTex
- defcreateIniFile
- defdownloadFiles
- defgetOptionalFiles
- defgetOrigIniPath
- defhandleSrcFiles
- defprint
- defremoveBackupInis
- defremoveFix
- class Mod(path: str | None = None, files: List[str] | None = None, logger: Logger | None = None, types: Set[ModType] | None = None, forcedType: ModType | None = None, defaultType: ModType | None = None, version: str | float | Version | None = None, remappedTypes: Set[str] | None = None, downloadMode: DownloadMode = DownloadMode.HardTexDriven)¶
This Class inherits from
ModelUsed for handling a mod
Note
We define a mod based off the following criteria:
A folder that contains at least 1 .ini file
At least 1 of the .ini files in the folder contains:
a section with the regex
[TextureOverride.*Blend]ifRemapService.readAllInisis set toTrueor the script is ran with the--allflag
OR
a section that meets the criteria of one of the mod types defined
Mod._typesby running the mod types’ModType.isType()function
SeeModTypesfor some predefined types of mods- Parameters:
path (Optional[
str]) –The file location to the mod folder.
If this value is set to
None, then will use the current directory of where this module is loaded.
Default:
Nonefiles (Optional[List[
str]]) –The direct children files to the mod folder (does not include files located in a folder within the mod folder).
If this parameter is set to
None, then the class will search the files for you when the class initializes
Default:
Nonelogger (Optional[
Logger]) –The logger used to pretty print messages
Default:
Nonetypes (Optional[Set[
ModType]]) –The types of mods this mod should be.
If this argument is empty or isNone, then all the .ini files in this mod will be parsed
Default:
NoneremappedTypes (Optional[Set[
ModType]]) –The types of mods to the mods specified at
Mod._typeswill be fixed to.Note
For more details, see
RemapService.remappedTypesDefault:
NonedefaultType (Optional[
ModType]) –The type of mod to use if a mod has an unidentified type
If this argument isNone, then will skip the mod with an identified type
Default:
NoneforcedType (Optional[
ModType]) –The type of mod to forcibly assume for some .ini file
Default:
Noneversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version we want the fixed mod
If This value is
None, then will fix the mod to using the latest hashes/indices.downloadMode (
DownloadMode) –The download mode to handle file downloads
Note
For more information about the available download modes to specify, see Download Modes
Default:
DownloadMode.Normal
- version¶
The game version we want the fixed mod
- Type:
Optional[packaging.version.Version]
- downloadMode¶
The download mode to handle file downloads
Note
For more information about the available download modes to specify, see Download Modes
Default:
DownloadMode.SoftTexDriven- Type:
- _files¶
The direct children files to the mod folder (does not include files located in a folder within the mod folder).
- Type:
List[
str]
- _remappedType¶
The types of mods to the mods specified at
Mod.typeswill be fixed to.Note
For more details, see
RemapService.remappedTypes- Type:
Set[
str]
- inis¶
The .ini files found for the mod
The keys are the file paths to the .ini file
- remapCopies¶
The remapFix.ini files found for the mod
The keys are the file paths to the .ini file
- _removeIniResources(ini: IniFile, result: Set[str], resourceName: str, resourceStats: FileStats, getPathsToRemove: Callable[[IniFile], List[str]]) bool¶
Removes a particular type of resource from a .ini file
- Parameters:
ini (
IniFile) – The particular .ini file to be processedresult (Set[
str]) – The resultant paths to the resources that got removedresourceName (
str) – The name of the type of resourceresourceStats (
FileStats) – The associated statistical data for the resource typegetPathsToRemove (Callable[[
IniFile], List[str]]) – The function to file paths to remove for a particular type of resource
- Returns:
Whether there was a file that was attempted to be removed
- Return type:
- classmethod blendCorrection(blendFile: str | bytes, modType: ModType, modToFix: str, fixedBlendFile: str | None = None, version: str | float | Version | None = None, remapMissingIndices: bool = True) str | None | bytearray¶
Fixes a Blend.buf file
See
BlendFile.remap()for more info- Parameters:
blendFile (Union[
str,bytes]) – The file path to the Blend.buf file to fixmodType (
ModType) – The type of mod to fix frommodToFix (
str) – The name of the mod to fix tofixedBlendFile (Optional[
str]) –The file path for the fixed Blend.buf file
Default:
Noneversion (Optional[Union[
str,float,VersionType]]) –The game version to fix to
If this value is
None, then will fix to the latest game version
Default:
NoneremapMissingIndices (
bool) –Whether to deactivate any missing blend indices that cannot be identified
Default:
True
- Raises:
BufFileNotRecognized – If the original Blend.buf file provided by the parameter
blendFilecannot be readBadBufData – If the bytes passed into this function do not correspond to the format defined for a Blend.buf file
- Returns:
If the argument
fixedBlendFileisNone, then will return an array of bytes for the fixed Blend.buf file
Otherwise will return the filename to the fixed RemapBlend.buf file if the provided Blend.buf file got corrected- Return type:
- correctBlend(blendStats: FileStats, iniPaths: List[str] | None = None, fixOnly: bool = False) List[Set[str] | Dict[str, Exception]]¶
Fixes all the Blend.buf files reference by the mod
Requires all the .ini files in the mod to have ran their
IniFile.parse()function- Parameters:
blendStats (
FileStats) – The stats to keep track of whether the particular the blend.buf files have been fixed or skippediniPaths (Optional[List[
str]]) –The file paths to the .ini file to have their blend.buf files corrected. If this value is
None, then will correct all the .ini file in the mod
Default:
NonefixOnly (
bool) –Whether to not correct some Blend.buf file if its corresponding RemapBlend.buf already exists
Default:
True
- Returns:
The absolute file paths of the RemapBlend.buf files that were fixed
The exceptions encountered when trying to fix some RemapBlend.buf files
The keys are absolute filepath to the RemapBlend.buf file and the values are the exception encountered
- Return type:
- correctPosition(positionStats: FileStats, iniPaths: List[str] | None = None, fixOnly: bool = False) List[Set[str] | Dict[str, Exception]]¶
Fixes all the Position.buf files reference by the mod
Requires all the .ini files in the mod to have ran their
IniFile.parse()function- Parameters:
positionStats (
FileStats) – The stats to keep track of whether the particular the Position.buf files have been fixed or skippediniPaths (Optional[List[
str]]) –The file paths to the .ini file to have their Position.buf files corrected. If this value is
None, then will correct all the .ini file in the mod
Default:
NonefixOnly (
bool) –Whether to not correct some Position.buf file if its corresponding RemapPosition.buf already exists
Default:
True
- Returns:
The absolute file paths of the RemapPosition.buf files that were fixed
The exceptions encountered when trying to fix some RemapPosition.buf files
The keys are absolute filepath to the RemapPosition.buf file and the values are the exception encountered
- Return type:
- correctResource(resourceStats: FileStats, getResourceModels: Callable[[IniFile], List[IniFixResourceModel]], correctFile: Callable[[str, str, ModType, str, int, int, int, IniFixResourceModel, FileStats], str], iniPaths: List[str] | None = None, fileTypeName: str = '', needsSrcFile: bool = True, fixOnly: bool = False, newTranslations: Dict[str, Callable[[List[str]], Any]] | None = None) List[Set[str] | Dict[str, Exception]]¶
Fixes all the files for a particular type of resource referenced by the mod
Requires all the .ini files in the mod to have ran their
IniFile.parse()function- Parameters:
resourceStats (
FileStats) – The stats to keep track of whether the particular resource has been fixed or skippedgetResourceModels (Callable[[
IniFile], List[IniFixResourceModel]]) – Function to retrieve all of the neededIniFixResourceModelfrom some .ini filecorrectFile (Callable[[
str,str,ModType,str,int,int,int,IniFixResourceModel,FileStats],str]) –Function to fix up the resource file
The parameters for the function are as follows:
The full file path to the original resource
The fixed file path to the resource
The type of mod being fixed within the .ini file
The name of the mod to fix to
The index of the part within the
IfTemplateThe index of the path within the particular part of the
IfTemplateThe version of the game to fix to
The current
IniFixResourceModelbeing processedThe stats for the particular resource
The function returns a
strwith the fixed file path to the resourceiniPaths (Optional[List[
str]]) –The file paths to the .ini file to have their resources corrected. If this value is
None, then will correct all the .ini file in the mod
Default:
NonefileTypeName (
str) – The name of the file resourcefixOnly (
bool) –Whether to not correct some resource file if its corresponding fixed resource file already exists
Default:
FalsenewTranslations (Optional[Dict[
str, Callable[[…], Any]]]) –Event handlers to print output based on some event.
The keys are the names of the events and the values are the handlers.
The argument supports the following event handlers:
Event Name
Parameters
Description
missingOrig
origFullPath:strThe full path to the source file to fixWhen the source file to fix is not found
origAlreadyError
origFullPath:strThe full path to the source file to fixWhen the source file to fix had already encountered an error
fixedAlreadyFixed
fixedFullPath:strThe full path to the fixed fileWhen the file to fix has already been fixed
fixedAlreadyExists
fixedFullPath:strThe full path to the fixed fileWhen the file to fix has already encountered an error
noCorrectionNeeded
origFullPath:strThe full path to the source file to fixWhen no correction is needed to be done
correctionDone
fixedFullPath:strThe full path to the fixed fileWhen the correction has been done to the fixed file
onIniFirstCorrection
fixedFullPath:strThe full path to the fixed fileWhen handling the first file for a particular .ini file
handleError
error:ExceptionThe error that occured when trying to fix some resourceWhen an error occurs during the correction of a file
iniSpace
iniPath:strThe path to the .ini fileWhen printing out a seperator between .ini files
- Returns:
The absolute file paths of the fixed resource files that were fixed
The exceptions encountered when trying to fix some fixed resource files
The keys are absolute filepath to the fixed resource file and the values are the exception encountered
- Return type:
- correctTex(texAddStats: FileStats, texEditStats: FileStats, iniPaths: List[str] | None = None, fixOnly: bool = False) List[Set[str] | Dict[str, Exception]]¶
Fixes all the texture .dds files reference by the mods
Requires all the .ini files in the mod to have ran their
IniFile.fix()function- Parameters:
texAddStats (
FileStats) – The stats to keep track of whether the particular .dds file have been newly created or skippedtexEditStats (
FileStats) – The stats to keep track of whether the particular .dds file has been editted or skippediniPaths (Optional[List[
str]]) –The file paths to the .ini file to have their .dds files corrected. If this value is
None, then will correct all the .ini file in the mod
Default:
NonefixOnly (
bool) –Whether to not correct some .dds file if its corresponding RemapTex.dds already exists
Default:
True
- Returns:
The absolute file paths of the .dds files that were added
The exceptions encountered when trying to created some .dds files
The absolute file paths of the .dds files that were editted
The exceptions encountered when trying to edit some .dds files
For the exceptions, the keys are absolute filepath to the .dds file and the values are the exception encountered
- Return type:
[Set[
str], Dict[str,Exception], Set[str], Dict[str,Exception]]
- downloadFiles(downloadStats: CachedFileStats, iniPaths: List[str] | None = None, fixOnly: bool = False, proxy: str | None = None) List[Set[str] | Dict[str, Exception]]¶
Downloads the necessary files for a mod
Requires all the .ini files in the mod to have ran their
IniFile.parse()function- Parameters:
downloadStats (
CachedFileStats) – The stats to keep track of the downloadsiniPaths (Optional[List[
str]]) –The file paths to the .ini file to have downloads required. If this value is
None, then will download files from all the .ini files in the mod
Default:
NonefixOnly (
bool) –Whether to not download a file if the corresponding downloaded file already exists
Default:
True
- Returns:
The absolute file paths of the downloaded files
The exceptions encountered when trying to download some files
The keys are absolute filepath to the download file and the values are the exception encountered
- Return type:
- property files¶
The direct children files to the mod folder (does not include files located in a folder within the mod folder).
- Getter:
Returns the files to the mod
- Setter:
Sets up the files for the mod
- Type:
Optional[List[
str]]
- getOptionalFiles() List[List[str]]¶
Retrieves a list of each type of files that are not mandatory for the mod
- Returns:
The resultant files found for the following file categories (listed in the same order as the return type):
.ini files not created by this fix
RemapBKUP.txt files
RemapFix.ini files
Note
See
Mod.isIni(),Mod.isBackupIni(),Mod.isRemapCopyIni()for the specifics of each type of file- Return type:
- getOrigIniPath(remapCopyPath: str) str¶
Retrieves the file path to the original .ini file for some RemapFix.ini file
- handleSrcFiles(resourceStats: FileStats, getResourceModels: Callable[[IniFile], List[IniSrcResourceModel]], handleFile: Callable[[str, str, ModType, str, int, int, int, IniFixResourceModel, FileStats], str], iniPaths: List[str] | None = None, fileTypeName: str = '', fixOnly: bool = False, newTranslations: Dict[str, Callable[[List[str]], Any]] | None = None) List[Set[str] | Dict[str, Exception]]¶
Downloads the required files for the mod
- Parameters:
resourceStats (
FileStats) – The stats to keep track of a particular resourcegetResourceModels (Callable[[
IniFile], List[IniSrcResourceModel]]) – Function to retrieve all of the neededIniSrcResourceModelfrom some .ini filehandleFile (Callable[[
str,ModType,int,int,int,IniFixResourceModel,FileStats],str]) –Function to handle the resource file
The parameters for the function are as follows:
The full file path to the resource
The type of mod being fixed within the .ini files
The index of the part within the
IfTemplateThe index of the path within the particular part of the
IfTemplateThe version of the game to fix to
The current
IniSrcResourceModelbeing processedThe stats for the particular resource
The function returns a
strwith the fixed file path to the resourceiniPaths (Optional[List[
str]]) –The file paths to the .ini file to have files downloaded. If this value is
None, then will download files from all the .ini file in the mod
Default:
NonefileTypeName (
str) – The name of the file resourcefixOnly (
bool) –Whether to not correct some resource file if its corresponding fixed resource file already exists
Default:
FalsenewTranslations (Optional[Dict[
str, Callable[[…], Any]]]) –Event handlers to print output based on some event.
The keys are the names of the events and the values are the handlers.
The argument supports the following event handlers:
Event Name
Parameters
Description
alreadyHandled
fullPath:strThe full path to the file to handleWhen some file has already been handled
alreadyError
fullPath:strThe full path to the file to handleWhen some file already encountered an error
alreadyExists
fullPath:strThe full path to the file to handleWhen some file already exists
handled
fullPath:strThe full path to the file to handleWhen some file has already been handled
skipped
fullPath:strThe full path to the file to handleWhen skipping the handling of some file
correctionDone
fullPath:strThe full path to the file to handleWhen the correction has been done to the fixed file
onIniFirstCorrection
fullPath:strThe full path to the file to handleWhen handling the first file for a particular .ini file
handleError
error:ExceptionThe error that occured when trying to fix some resourceWhen an error occurs during the correction of a file
iniSpace
iniPath:strThe path to the .ini fileWhen printing out a seperator between .ini files
- Returns:
The absolute file paths of the files that were handled
The exceptions encountered when trying to handle some file
The keys are expected absolute filepath to the downloaded file and the values are the exception encountered
- Return type:
- classmethod isBackupIni(file: str) bool¶
Determines whether the file is a RemapBKUP.txt file that is used to make backup copies of .ini files
- classmethod isBlend(file: str) bool¶
Determines whether the file is a Blend.buf file which is the original blend file provided in the mod
- classmethod isIni(file: str) bool¶
Determines whether the file is a .ini file which is the file used to control how a mod behaves
- classmethod isRemapBlend(file: str) bool¶
Determines whether the file is a RemapBlend.buf file which is the fixed Blend.buf file created by this fix
- classmethod isRemapCopyIni(file: str) bool¶
Determines whether the file is RemapFix.ini file which are .ini files generated by this fix to remap specific type of mods
*eg. mods such as Keqing or Jean that are fixed by
GIMIObjMergeFixer*
- classmethod isRemapTexture(file: str) bool¶
Determines whether the file is a RemapTex.dds file which are texture .dds files generated by this fix to edit a particular texture file for some specific type of mods
*eg. mods such as Kirara or Nilou that are fixed by
GIMIRegEditFixer*
- classmethod isSrcIni(file: str) bool¶
Determines whether the file is a .ini file that is not created by this fix
- classmethod positionCorrection(positionFile: str | bytes, modType: ModType, modToFix: str, fixedPositionFile: str | None = None, version: str | float | Version | None = None) str | None | bytearray¶
Fixes a Position.buf file
- Parameters:
positionFile (Union[
str,bytes]) – The file path to the Position.buf file to fixmodType (
ModType) – The type of mod to fix frommodToFix (
str) – The name of the mod to fix tofixedPositionFile (Optional[
str]) –The file path for the fixed Position.buf file
Default:
Noneversion (Optional[Union[
str,float,VersionType]]) –The game version to fix to
If this value is
None, then will fix to the latest game version
Default:
None
- Raises:
BufFileNotRecognized – If the original Position.buf file provided by the parameter
positionFilecannot be readBadBufData – If the bytes passed into this function do not correspond to the format defined for a Position.buf file
- Returns:
If the argument
fixedPositionFileisNone, then will return an array of bytes for the fixed Position.buf file
Otherwise will return the filename to the fixed RemapPosition.buf file if the provided Position.buf file got corrected- Return type:
- print(funcName: str, *args, **kwargs)¶
Prints out output
- Parameters:
- Returns:
The return value from running the corresponding function in the logger
- Return type:
Any
- removeBackupInis()¶
Removes all RemapBKUP.txt contained in the mod
- removeFix(remapStats: RemapStats, keepBackups: bool = True, fixOnly: bool = False, readAllInis: bool = False, writeBackInis: bool = True) List[Set[str]]¶
Removes any previous changes done by this module’s fix
- Parameters:
remapStats (
RemapStats) – The stats for the remap processkeepBackups (
bool) –Whether to create or keep RemapBKUP.txt files in the mod
Default:
TruefixOnly (
bool) –Whether to not undo any changes created in the .ini files
Default:
FalsereadAllInis (
bool) –Whether to remove the .ini fix from all the .ini files encountered
Default:
FalsewriteBackInis (
bool) –Whether to write back the changes to the .ini files
Default:
True
- Returns:
The removed files that have their fix removed, where the types of files for the return value is based on the list below:
.ini files with their fix removed
RemapBlend.buf files that got deleted
RemapPosition.buf files that got deleted
RemapTex.dds files that got deleted
Download files that got deleted
- Return type:
- classmethod texCorrection(fixedTexFile: str, texEditor: BaseTexEditor, texFile: str | None = None) str | None¶
Fixes a .dds file
- Parameters:
fixedTexFile (
str) – The name of the file path to the fixed RemapTex.dds filetexEditor (
BaseTexEditor) – The texture editor to change the texture file
:param texFile Optional[
str]: The file path to the original texture .dds file
If this value is
None, then will use ‘fixedTexFile’ as the original file path to the texture .dds file (usually this case for creating a brand new .dds file by also passing in object of typeTexCreatorinto the ‘texEditor’ argument)
Default:
None- Returns:
The file path to the fixed texture, if the original texture exists
- Return type:
Optional[
str]
ModType¶
- deffixIni
- defgetModsToFix
- defgetPositionEditor
- defgetVGRemap
- defgetVertexCount
- defisName
- class ModType(name: str, hashes: Hashes | None = None, indices: Indices | None = None, vertexCounts: VertexCounts | None = None, aliases: List[str] | None = None, vgRemaps: VGRemaps | None = None, positionEditors: PositionEditors | None = None, iniParseBuilder: IniParseBuilder | None = None, iniFixBuilder: IniFixBuilder | None = None, iniRemoveBuilder: IniRemoveBuilder | None = None)¶
Class for defining a generic type of mod
- Parameters:
name (
str) – The default name for the type of modhashes (Optional[
Hashes]) –The hashes related to the mod and its fix
If this value is
None, then will create a new, emptyHashes
Default:
Noneindices (Optional[
Indices]) –The indices related to the mod and its fix
If this
None, then will create a new, emtpyIndices
Default:
Nonealiases (Optional[List[
str]]) –Other alternative names for the type of mod
Default:
NonevgRemaps (Optional[
VGRemaps]) –Maps the blend indices from the vertex group of one mod to another mod
If this value is
None, then will create a new, emptyVGRemaps
Default:
NonepositionEditors (Optional[
PositionEditors]) –The editors used for fixing position.buf files
If this
None, then will create a new, emtpyPositionEditors
Default:
NoneiniParseBuilder (Optional[
IniParseBuilder]) –The builder to build the parser used for .ini files
If this value is
None, then by default this attribute will be set to IniParseBuilder(:class:`GIMIParser`)
Default:
NoneiniFixBuilder (Optional[
IniFixBuilder]) –The builder to build the fixer used for .ini files
If this value is
None, then by default this attribute will be set to IniFixBuilder(:class:`GIMIFixer`)
Default:
NoneiniRemoveBuilder (Optional[
IniRemoveBuilder]) –The builder to build the remover used for .ini files
If this value is
None, then by default this attribute will be set to IniRemoveBuilder(:class:`IniRemover`)
Default:
None
- vertexCounts¶
The vertex counts related to the mod and its fix
- Type:
VertexCounts
- vgRemaps¶
The repository that stores the mapping for remapping vertex group blend indices of the mod to the vertex group blend indices of another mod
- Type:
- positionEditors¶
The editors used for fixing position.buf files
- Type:
PositionEditors
- iniParseBuilder¶
The builder to build the parser used for .ini files
- Type:
- iniFixBuilder¶
the builder to build the fixer used for .ini files
- Type:
- iniRemoveBuilder¶
the builder to build the remover used for .ini files
- Type:
- fixIni(iniFile: IniFile, keepBackup: bool = True, fixOnly: bool = False)¶
Fixes the .ini file associated to this type of mod
- getModsToFix() Set[str]¶
Retrieves the names of the mods this mod type will fix to
- Returns:
The names of the mods to fix to
- Return type:
Set[
str]
- getPositionEditor(modName: str, version: str | float | Version | None = None) BaseBufEditor | None¶
Retrieves the corresponding position editor for editting position.buf files
Attention
This function assumes that the specified map
positionEditors(PositionEditors.map) containsname(the name of this mod type) as a mod to map from- Parameters:
modName (
str) – The name of the mod to map toversion (Optional[Union[
str,float, packaging.version.Version]]) –The specific game version we want for the remap
If this value is
None, then will get the latest version of the remap
Default:
None
- Returns:
The corresponding position editor
- Return type:
Optional[
BaseBufEditor]
- getVGRemap(modName: str, version: str | float | Version | None = None) VGRemap¶
Retrieves the corresponding Vertex Group Remap
Attention
This function assumes that the specified map
vgRemaps(VGRemaps.map) containsname(the name of this mod type) as a mod to map from- Parameters:
modName (
str) – The name of the mod to map toversion (Optional[Union[
str,float, packaging.version.Version]]) –The specific game version we want for the remap
If this value is
None, then will get the latest version of the remap
Default:
None
- Returns:
The corresponding remap
- Return type:
- getVertexCount(version: str | float | Version | None = None) int¶
Retrieves the number of vertices for a mod
Attention
This function assumes that the specified dictionary
vertexCounts(VertexCounts.map) containsname(the name of this mod type) as a mod to get the vertex count for- Parameters:
version (Optional[Union[
str,float, packaging.version.Version]]) –The specific game version we want for the vertex count
If this value is
None, then will get the latest version of the vertex count
Default:
None- Returns:
The number of vertices for the mod
- Return type:
ModTypeBuilder¶
GIBuilder¶
- clsGIBuilder.amber
- clsGIBuilder.amberCN
- clsGIBuilder.arlecchino
- clsGIBuilder.ayaka
- clsGIBuilder.ayakaSpringBloom
- clsGIBuilder.barbara
- clsGIBuilder.barbaraSummerTime
- clsGIBuilder.cherryHutao
- clsGIBuilder.diluc
- clsGIBuilder.dilucFlamme
- clsGIBuilder.fischl
- clsGIBuilder.fischlHighness
- clsGIBuilder.ganyu
- clsGIBuilder.ganyuTwilight
- clsGIBuilder.huTao
- clsGIBuilder.jean
- clsGIBuilder.jeanCN
- clsGIBuilder.jeanSea
- clsGIBuilder.kaeya
- clsGIBuilder.kaeyaSailwind
- clsGIBuilder.keqing
- clsGIBuilder.keqingOpulent
- clsGIBuilder.kirara
- clsGIBuilder.kiraraBoots
- clsGIBuilder.klee
- clsGIBuilder.kleeBlossomingStarlight
- clsGIBuilder.lisa
- clsGIBuilder.lisaStudent
- clsGIBuilder.mona
- clsGIBuilder.monaCN
- clsGIBuilder.nilou
- clsGIBuilder.nilouBreeze
- clsGIBuilder.ningguang
- clsGIBuilder.ningguangOrchid
- clsGIBuilder.raiden
- clsGIBuilder.rosaria
- clsGIBuilder.rosariaCN
- clsGIBuilder.shenhe
- clsGIBuilder.shenheFrostFlower
- clsGIBuilder.xiangling
- clsGIBuilder.xianglingCheer
- clsGIBuilder.xingqiu
- clsGIBuilder.xingqiuBamboo
- class GIBuilder¶
This Class inherits from
ModTypeBuilderCreates new
ModTypeobjects for some anime game
ModAssets¶
- def_addVersion
- def_updateAssetContent
- defclearCache
- deffindClosestVersion
- defupdateRepo
- class ModAssets(repo: Dict[float, Dict[str, T]])¶
Class to handle assets of any type for a mod
- Parameters:
repo (Dict[
float, Dict[str, T]]) –The original source for any preset assets
The outer key is the game version number for the assets
The inner key is the name of the asset
The inner value is the content for the asset
- repo¶
The original source for any preset assets
The outer key is the game version number for the assets
The inner key is the name of the asset
The inner value is the content for the asset
- _updateAssetContent(srcAsset: T, newAsset: T) T¶
Combines the content of 2 assets
- Parameters:
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns:
The updated asset
- Return type:
T
- clearCache()¶
Clears out any cached data
- findClosestVersion(name: str, version: str | float | Version | None = None, fromCache: bool = True) Version¶
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters:
name (
str) – The name of the asset to searchversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version to be searched
If This value is
None, then will assume we want the latest version
Default:
NonefromCache (
bool) –Whether to use the result from the cache
Default:
None
- Raises:
KeyError – The name for the particular asset is not found
- Returns:
The latest game version from the assets that corresponds to the desired version
- Return type:
ModDictAssets¶
- def_addVersion
- def_updateAssetContent
- defclearCache
- deffindClosestVersion
- defget
- defupdateRepo
- class ModDictAssets(repo: Dict[float, Dict[str, T]])¶
This class inherits from
ModAssetsClass to handle assets of any type for a mod where retrieval is based on some key
Note
This is a dictionary that retrieves a certain asset for some game version
- Parameters:
repo (Dict[
float, Dict[str, T]]) –The original source for any preset assets
The outer key is the game version number for the assets
The inner key is the name of the asset
The inner value is the content for the asset
- _updateAssetContent(srcAsset: T, newAsset: T) T¶
Combines the content of 2 assets
- Parameters:
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns:
The updated asset
- Return type:
T
- clearCache()¶
Clears out any cached data
- findClosestVersion(name: str, version: str | float | Version | None = None, fromCache: bool = True) Version¶
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters:
name (
str) – The name of the asset to searchversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version to be searched
If This value is
None, then will assume we want the latest version
Default:
NonefromCache (
bool) –Whether to use the result from the cache
Default:
None
- Raises:
KeyError – The name for the particular asset is not found
- Returns:
The latest game version from the assets that corresponds to the desired version
- Return type:
- get(assetName: str, version: float | None = None) T¶
Retrieves the corresponding asset
- Parameters:
- Raises:
KeyError – If the corresponding asset based on the search parameters is not found
- Returns:
The found asset
- Return type:
T
ModDoubleDictAssets¶
- clsModDoubleDictAssets.updateMap
- def_addVersion
- def_partition
- def_updateAssetContent
- def_updateVersions
- defaddMap
- defaddMapping
- defclear
- defclearCache
- deffindClosestVersion
- defget
- defloadFromPreset
- defupdateRepo
- class ModDoubleDictAssets(repo: Dict[float, Dict[str, Dict[str, T]]], map: Dict[str, Set[str]] | None = None)¶
This class inherits from
ModMappedAssetsClass to handle retrieval of assets requiring 2 keys:
Assets to fix from
Assets to fix to
Note
This is a nested dictionary that retrieves a certain asset from:
The assets to fix from
The assets to fix to
The version of the game
- Parameters:
repo (Dict[
float, Dict[str, Dict[str, T]]]) –The original source for any preset assets
The outer key is the game version number for the assets
The inner key is the name of the asset
The inner value is the content for the asset
map (Optional[Dict[
str, Set[str]]]) –The adjacency list that maps the assets to fix from to the assets to fix to using the predefined mods
Default:
None
- _addVersion(fromAsset: str, toAsset: str, version: str | float | Version)¶
Adds a new version for a particular asset
- _partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]¶
Creates the bipartition for the assets to fix from vs the assets to fix to
Filters the mapping such that all the asset names in the new mapping exist in assets
- Parameters:
map (Dict[
str, Set[str]]) – The desired mapping for the assets for fixingassets (Dict[
float, Dict[str, Any]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The following output is in the same order as listed below:
The new mapping with all asset names being in assets
The names of the assets to fix from
The names of the assets to fix to
- Return type:
- _updateAssetContent(asset1: Dict[str, T], asset2: Dict[str, T]) T¶
Combines the content of 2 assets
- Parameters:
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns:
The updated asset
- Return type:
T
- _updateVersions(assets: Dict[float, Dict[str, Dict[str, VGRemap]]])¶
Updates the versioning of the assets
- Parameters:
assets (T) – The assets for checking the versioning
- addMap(assetMap: Dict[str, Set[str]], assets: Dict[float, Dict[str, T]] | None = None)¶
Adds a new map to the existing map on how to retrieve the assets
- Parameters:
assetMap (Dict[
str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix toassets (Optional[T]) –
Any new assets that needs to be added/updated to the existing assets to support the given map
Default:
None
- addMapping(fromAsset: str, toAssets: Set[str], assets: Any)¶
Adds a new mapping of how to fix the assets
- clearCache()¶
Clears out any cached data
- findClosestVersion(fromAsset: str, toAsset: str, version: str | float | Version | None = None, fromCache: bool = True) Version¶
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters:
fromAsset (
str) – The name of the asset to map fromtoAsset (
str) – The name of the asset to map toversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version to be searched
If This value is
None, then will assume we want the latest version
Default:
NonefromCache (
bool) –Whether to use the result from the cache
Default:
None
- Raises:
KeyError – The name for the particular asset is not found
- Returns:
The latest game version from the assets that corresponds to the desired version
- Return type:
- property fixFrom: Set[str]¶
The names of the assets to fix from using the predefined mods
- Getter:
Retrieves the names of assets used to fix from
- Type:
Set[
str]
- property fixTo: Set[str]¶
The names of the assets to fix to using the predefined mods
- Getter:
Retrives the names of assets to fix to
- Type:
Set[
str]
- get(fromAsset: str, toAsset: str, version: float | None = None) str¶
Retrieves the corresponding vertex group remap
- Parameters:
fromAsset (
str) – The name of the asset to map fromtoAsset (
str) – The name of the asset to map toversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version we want the remap to come from
If This value is
None, then will retrieve the asset of the latest version.
Default:
None
- Raises:
KeyError – If the corresponding asset based on the search parameters is not found
- Returns:
The found asset
- Return type:
- loadFromPreset()¶
Reinitializes to load the predefined mods
- property map: Dict[str, Set[str]]¶
The adjacency list used to map assets to fix from to assets to fix to
- Getter:
Retrieves the adjacency list
- Setter:
Sets a new adjacency list
- Type:
- classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]¶
Combines 2 maps together
- updateRepo(srcRepo: Dict[float, Dict[str, Any]], newRepo: Dict[float, Dict[str, Any]]) Dict[float, Dict[str, Any]]¶
Updates the values in
srcRepo
ModMappedAssets¶
- clsModMappedAssets.updateMap
- def_addVersion
- def_partition
- def_updateAssetContent
- def_updateVersions
- defaddMap
- defaddMapping
- defclear
- defclearCache
- deffindClosestVersion
- defloadFromPreset
- defupdateRepo
- class ModMappedAssets(repo: Dict[float, Dict[str, T]], map: Dict[str, Set[str]] | None = None)¶
This class inherits from
ModAssetsClass to handle assets of any type where asset retrieval is based on a mapping
Note
This is a bipartite graph that maps assets to fix from to assets to fix to
- Parameters:
repo (Dict[
float, Dict[str, T]]) –The original source for any preset assets
The outer key is the game version number for the assets
The inner key is the name of the asset
The inner value is the content for the asset
map (Optional[Dict[
str, Set[str]]]) –The adjacency list that maps the assets to fix from to the assets to fix to using the predefined mods
Default:
None
- _partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]¶
Creates the bipartition for the assets to fix from vs the assets to fix to
Filters the mapping such that all the asset names in the new mapping exist in assets
- Parameters:
map (Dict[
str, Set[str]]) – The desired mapping for the assets for fixingassets (Dict[
float, Dict[str, Any]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The following output is in the same order as listed below:
The new mapping with all asset names being in assets
The names of the assets to fix from
The names of the assets to fix to
- Return type:
- _updateAssetContent(srcAsset: T, newAsset: T) T¶
Combines the content of 2 assets
- Parameters:
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns:
The updated asset
- Return type:
T
- _updateVersions(assets: Dict[float, Dict[str, T]])¶
Updates the versioning of the assets
- Parameters:
assets (T) – The assets for checking the versioning
- addMap(assetMap: Dict[str, Set[str]], assets: Dict[float, Dict[str, T]] | None = None)¶
Adds a new map to the existing map on how to retrieve the assets
- Parameters:
assetMap (Dict[
str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix toassets (Optional[T]) –
Any new assets that needs to be added/updated to the existing assets to support the given map
Default:
None
- addMapping(fromAsset: str, toAssets: Set[str], assets: Any)¶
Adds a new mapping of how to fix the assets
- clearCache()¶
Clears out any cached data
- findClosestVersion(name: str, version: str | float | Version | None = None, fromCache: bool = True) Version¶
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters:
name (
str) – The name of the asset to searchversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version to be searched
If This value is
None, then will assume we want the latest version
Default:
NonefromCache (
bool) –Whether to use the result from the cache
Default:
None
- Raises:
KeyError – The name for the particular asset is not found
- Returns:
The latest game version from the assets that corresponds to the desired version
- Return type:
- property fixFrom: Set[str]¶
The names of the assets to fix from using the predefined mods
- Getter:
Retrieves the names of assets used to fix from
- Type:
Set[
str]
- property fixTo: Set[str]¶
The names of the assets to fix to using the predefined mods
- Getter:
Retrives the names of assets to fix to
- Type:
Set[
str]
- loadFromPreset()¶
Reinitializes to load the predefined mods
- property map: Dict[str, Set[str]]¶
The adjacency list used to map assets to fix from to assets to fix to
- Getter:
Retrieves the adjacency list
- Setter:
Sets a new adjacency list
- Type:
- classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]¶
Combines 2 maps together
ModIdAssets¶
- clsModIdAssets._getFromAssets
- clsModIdAssets.updateMap
- def_addVersion
- def_getToAssets
- def_partition
- def_updateAssetContent
- def_updateVersions
- defaddMap
- defaddMapping
- defclear
- defclearCache
- deffindClosestVersion
- defget
- defloadFromPreset
- defreplace
- defupdateRepo
- class ModIdAssets(repo: Dict[float, Dict[str, Dict[str, str]]], map: Dict[str, Set[str]] | None = None)¶
This class inherits from
ModMappedAssetsClass to handle hashes, indices, and other string id type assets for a mod
- Parameters:
repo (Dict[
float, Dict[str, Dict[str,str]]]) –The original source for any preset assets
The outer key is the game version of the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset
Note
The id value for each asset should be unique
map (Optional[Dict[
str, Set[str]]]) –The adjacency list that maps the assets to fix from to the assets to fix to using the predefined mods
Default:
None
- classmethod _getFromAssets(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[str, Tuple[Set[str], str]]¶
Retrieves the assets to fix from
- Parameters:
map (Dict[str, Set[str]]) – The mapping for fixing the assets
assets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- Return type:
- _getToAssets(assetNames: Set[str], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[float, Dict[str, Dict[str, str]]]¶
Retrieves the assets to fix to
- Parameters:
assetNames (Set[
str]) – The names of the assets to fix toassets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The assets to fix to
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Return type:
- _partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]¶
Creates the bipartition for the assets to fix from vs the assets to fix to
Filters the mapping such that all the asset names in the new mapping exist in assets
- Parameters:
map (Dict[
str, Set[str]]) – The desired mapping for the assets for fixingassets (Dict[
float, Dict[str, Any]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The following output is in the same order as listed below:
The new mapping with all asset names being in assets
The names of the assets to fix from
The names of the assets to fix to
- Return type:
- _updateAssetContent(srcAsset: Dict[str, str], newAsset: Dict[str, str]) Dict[str, str]¶
Combines the content of 2 assets
- Parameters:
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns:
The updated asset
- Return type:
T
- _updateVersions(assets: Dict[float, Dict[str, T]])¶
Updates the versioning of the assets
- Parameters:
assets (T) – The assets for checking the versioning
- addMap(assetMap: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]] | None = None)¶
Adds a new map to the existing map on how to retrieve the assets
- Parameters:
assetMap (Dict[
str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix toassets (Optional[T]) –
Any new assets that needs to be added/updated to the existing assets to support the given map
Default:
None
- addMapping(fromAsset: str, toAssets: Set[str], assets: Any)¶
Adds a new mapping of how to fix the assets
- clearCache()¶
Clears out any cached data
- findClosestVersion(name: str, version: str | float | Version | None = None, fromCache: bool = True) Version¶
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters:
name (
str) – The name of the asset to searchversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version to be searched
If This value is
None, then will assume we want the latest version
Default:
NonefromCache (
bool) –Whether to use the result from the cache
Default:
None
- Raises:
KeyError – The name for the particular asset is not found
- Returns:
The latest game version from the assets that corresponds to the desired version
- Return type:
- property fixFrom: Set[str]¶
The names of the assets to fix from using the predefined mods
- Getter:
Retrieves the names of assets used to fix from
- Type:
Set[
str]
- property fixTo: Set[str]¶
The names of the assets to fix to using the predefined mods
- Getter:
Retrives the names of assets to fix to
- Type:
Set[
str]
- property fromAssets: Dict[str, Tuple[Set[str], str]]¶
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- get(assetName: str, assetType: str, version: float | None = None) str¶
Retrieves the corresponding id asset from
ModStrAssets._toAssets- Parameters:
- Raises:
KeyError – If the corresponding asset based on the search parameters is not found
- Returns:
The found asset
- Return type:
- loadFromPreset()¶
Reinitializes to load the predefined mods
- property map: Dict[str, Set[str]]¶
The adjacency list used to map assets to fix from to assets to fix to
- Getter:
Retrieves the adjacency list
- Setter:
Sets a new adjacency list
- Type:
- replace(fromAsset: str, version: float | None = None, toAssets: str | Set[str] | None = None) str | None | Dict[str, str]¶
Retrieves the corresponding asset to replace ‘fromAsset’
- Parameters:
- Returns:
The corresponding assets for the fix to replace, if available
The result is a string if the passed in parameter ‘toAssets’ is also a string
Otherwise, the result is a dictionary such that:
The keys are the names of the assets
The values are the corresponding asset ids to replace
- Return type:
- property toAssets: Dict[float, Dict[str, Dict[str, str]]]¶
The outer key is the game version number for the assets
The first inner key is the name of the assets
The most inner key is the type of asset
The most inner value is the id for the asset
- classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]¶
Combines 2 maps together
VGRemap¶
- class VGRemap(vgRemap: Dict[int, int])¶
Class for handling the vertex group remaps for mods
- property maxIndex¶
The maximum index in the vertex group remap
- Getter:
Retrieves the max index
- Type:
VGRemaps¶
- clsVGRemaps.updateMap
- def_addVersion
- def_partition
- def_updateAssetContent
- def_updateVersions
- defaddMap
- defaddMapping
- defclear
- defclearCache
- deffindClosestVersion
- defget
- defloadFromPreset
- defupdateRepo
- class VGRemaps(repo: Dict[str | float | Version, Dict[str, Dict[str, VGRemap]]] | None = None, map: Dict[str, Set[str]] | None = None)¶
This class inherits from
ModMappedAssetsClass to handle Vertex Group Remaps fsor a mod
- Parameters:
repo (Optional[Dict[Union[
str,float, packaging.version.Version], Dict[str, Dict[str,VGRemap]]]]) –The original source for the vertex group remaps
The outer key is the game version number for the assets
The second outer key is the name of the asset to fix from
The inner key is the name of the asset to fix to
The inner value contains the vertex group remap
If this value is
None, will use the default vertex group remaps provided by the software
Default:
Nonemap (Optional[Dict[
str, Set[str]]]) –The adjacency list that maps the assets to fix from to the assets to fix to using the predefined mods
Default:
None
- _addVersion(fromAsset: str, toAsset: str, version: str | float | Version)¶
Adds a new version for a particular asset
- _partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]¶
Creates the bipartition for the assets to fix from vs the assets to fix to
Filters the mapping such that all the asset names in the new mapping exist in assets
- Parameters:
map (Dict[
str, Set[str]]) – The desired mapping for the assets for fixingassets (Dict[
float, Dict[str, Any]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The following output is in the same order as listed below:
The new mapping with all asset names being in assets
The names of the assets to fix from
The names of the assets to fix to
- Return type:
- _updateAssetContent(asset1: Dict[str, T], asset2: Dict[str, T]) T¶
Combines the content of 2 assets
- Parameters:
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns:
The updated asset
- Return type:
T
- _updateVersions(assets: Dict[float, Dict[str, Dict[str, VGRemap]]])¶
Updates the versioning of the assets
- Parameters:
assets (T) – The assets for checking the versioning
- addMap(assetMap: Dict[str, Set[str]], assets: Dict[float, Dict[str, T]] | None = None)¶
Adds a new map to the existing map on how to retrieve the assets
- Parameters:
assetMap (Dict[
str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix toassets (Optional[T]) –
Any new assets that needs to be added/updated to the existing assets to support the given map
Default:
None
- addMapping(fromAsset: str, toAssets: Set[str], assets: Any)¶
Adds a new mapping of how to fix the assets
- clearCache()¶
Clears out any cached data
- findClosestVersion(fromAsset: str, toAsset: str, version: str | float | Version | None = None, fromCache: bool = True) Version¶
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters:
fromAsset (
str) – The name of the asset to map fromtoAsset (
str) – The name of the asset to map toversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version to be searched
If This value is
None, then will assume we want the latest version
Default:
NonefromCache (
bool) –Whether to use the result from the cache
Default:
None
- Raises:
KeyError – The name for the particular asset is not found
- Returns:
The latest game version from the assets that corresponds to the desired version
- Return type:
- property fixFrom: Set[str]¶
The names of the assets to fix from using the predefined mods
- Getter:
Retrieves the names of assets used to fix from
- Type:
Set[
str]
- property fixTo: Set[str]¶
The names of the assets to fix to using the predefined mods
- Getter:
Retrives the names of assets to fix to
- Type:
Set[
str]
- get(fromAsset: str, toAsset: str, version: float | None = None) str¶
Retrieves the corresponding vertex group remap
- Parameters:
fromAsset (
str) – The name of the asset to map fromtoAsset (
str) – The name of the asset to map toversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version we want the remap to come from
If This value is
None, then will retrieve the asset of the latest version.
Default:
None
- Raises:
KeyError – If the corresponding asset based on the search parameters is not found
- Returns:
The found asset
- Return type:
- loadFromPreset()¶
Reinitializes to load the predefined mods
- property map: Dict[str, Set[str]]¶
The adjacency list used to map assets to fix from to assets to fix to
- Getter:
Retrieves the adjacency list
- Setter:
Sets a new adjacency list
- Type:
- classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]¶
Combines 2 maps together
- updateRepo(srcRepo: Dict[float, Dict[str, Any]], newRepo: Dict[float, Dict[str, Any]]) Dict[float, Dict[str, Any]]¶
Updates the values in
srcRepo
IniParseBuilderArgs¶
- def_addVersion
- def_updateAssetContent
- defclearCache
- deffindClosestVersion
- defget
- defupdateRepo
- class IniParseBuilderArgs(repo: Dict[str, Dict[str, Callable[[], Tuple[BaseIniParser, List[Any], Dict[str, Any]]]]] | None = None)¶
This class inherits from
ModDictAssetsClass for managing functions that create the arguments/keyword arguments for an
IniParseBuilder- Parameters:
repo (Optional[Dict[
str, Dict[str, Callable[[], Tuple[BaseIniParser, List[Any], Dict[str, Any]]]]]]) –The original source for any the function that create arguments
The outer key is the game version number for the assets
The inner key is the name of the asset
The inner value contains the functions that create arguments/keyword arguments for an
IniParseBuilder
If this value is
None, will use the default functions provided by the software
Default:
None
- _updateAssetContent(srcAsset: T, newAsset: T) T¶
Combines the content of 2 assets
- Parameters:
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns:
The updated asset
- Return type:
T
- clearCache()¶
Clears out any cached data
- findClosestVersion(name: str, version: str | float | Version | None = None, fromCache: bool = True) Version¶
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters:
name (
str) – The name of the asset to searchversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version to be searched
If This value is
None, then will assume we want the latest version
Default:
NonefromCache (
bool) –Whether to use the result from the cache
Default:
None
- Raises:
KeyError – The name for the particular asset is not found
- Returns:
The latest game version from the assets that corresponds to the desired version
- Return type:
- get(assetName: str, version: float | None = None) T¶
Retrieves the corresponding asset
- Parameters:
- Raises:
KeyError – If the corresponding asset based on the search parameters is not found
- Returns:
The found asset
- Return type:
T
IniFixBuilderArgs¶
- def_addVersion
- def_updateAssetContent
- defclearCache
- deffindClosestVersion
- defget
- defupdateRepo
- class IniFixBuilderArgs(repo: Dict[str, Dict[str, Callable[[], Tuple[BaseIniFixer, List[Any], Dict[str, Any]]]]] | None = None)¶
This class inherits from
ModDictAssetsClass for managing functions that create arguments/keyword arguments for an
IniFixBuilder- Parameters:
repo (Optional[Dict[
str, Dict[str, Callable[[], Tuple[BaseIniFixer, List[Any], Dict[str, Any]]]]]]) –The original source for any the function that create arguments
The outer key is the game version number for the assets
The inner key is the name of the asset
The inner value contains the functions that create arguments/keyword arguments for an
IniFixBuilder
If this value is
None, will use the default functions provided by the software
Default:
None
- _updateAssetContent(srcAsset: T, newAsset: T) T¶
Combines the content of 2 assets
- Parameters:
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns:
The updated asset
- Return type:
T
- clearCache()¶
Clears out any cached data
- findClosestVersion(name: str, version: str | float | Version | None = None, fromCache: bool = True) Version¶
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters:
name (
str) – The name of the asset to searchversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version to be searched
If This value is
None, then will assume we want the latest version
Default:
NonefromCache (
bool) –Whether to use the result from the cache
Default:
None
- Raises:
KeyError – The name for the particular asset is not found
- Returns:
The latest game version from the assets that corresponds to the desired version
- Return type:
- get(assetName: str, version: float | None = None) T¶
Retrieves the corresponding asset
- Parameters:
- Raises:
KeyError – If the corresponding asset based on the search parameters is not found
- Returns:
The found asset
- Return type:
T
Hashes¶
- clsHashes._getFromAssets
- clsHashes.updateMap
- def_addVersion
- def_getToAssets
- def_partition
- def_updateAssetContent
- def_updateVersions
- defaddMap
- defaddMapping
- defclear
- defclearCache
- deffindClosestVersion
- defget
- defloadFromPreset
- defreplace
- defupdateRepo
- class Hashes(map: Dict[str, Set[str]] | None = None)¶
This class inherits from
ModDictStrAssetsClass for managing hashes for a mod
- Parameters:
map (Optional[Dict[
str, Set[str]]]) –The adjacency list that maps the hashes to fix from to the hashes to fix to using the predefined mods
Default:
None
- classmethod _getFromAssets(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[str, Tuple[Set[str], str]]¶
Retrieves the assets to fix from
- Parameters:
map (Dict[str, Set[str]]) – The mapping for fixing the assets
assets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- Return type:
- _getToAssets(assetNames: Set[str], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[float, Dict[str, Dict[str, str]]]¶
Retrieves the assets to fix to
- Parameters:
assetNames (Set[
str]) – The names of the assets to fix toassets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The assets to fix to
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Return type:
- _partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]¶
Creates the bipartition for the assets to fix from vs the assets to fix to
Filters the mapping such that all the asset names in the new mapping exist in assets
- Parameters:
map (Dict[
str, Set[str]]) – The desired mapping for the assets for fixingassets (Dict[
float, Dict[str, Any]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The following output is in the same order as listed below:
The new mapping with all asset names being in assets
The names of the assets to fix from
The names of the assets to fix to
- Return type:
- _updateAssetContent(srcAsset: Dict[str, str], newAsset: Dict[str, str]) Dict[str, str]¶
Combines the content of 2 assets
- Parameters:
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns:
The updated asset
- Return type:
T
- _updateVersions(assets: Dict[float, Dict[str, T]])¶
Updates the versioning of the assets
- Parameters:
assets (T) – The assets for checking the versioning
- addMap(assetMap: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]] | None = None)¶
Adds a new map to the existing map on how to retrieve the assets
- Parameters:
assetMap (Dict[
str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix toassets (Optional[T]) –
Any new assets that needs to be added/updated to the existing assets to support the given map
Default:
None
- addMapping(fromAsset: str, toAssets: Set[str], assets: Any)¶
Adds a new mapping of how to fix the assets
- clearCache()¶
Clears out any cached data
- findClosestVersion(name: str, version: str | float | Version | None = None, fromCache: bool = True) Version¶
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters:
name (
str) – The name of the asset to searchversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version to be searched
If This value is
None, then will assume we want the latest version
Default:
NonefromCache (
bool) –Whether to use the result from the cache
Default:
None
- Raises:
KeyError – The name for the particular asset is not found
- Returns:
The latest game version from the assets that corresponds to the desired version
- Return type:
- property fixFrom: Set[str]¶
The names of the assets to fix from using the predefined mods
- Getter:
Retrieves the names of assets used to fix from
- Type:
Set[
str]
- property fixTo: Set[str]¶
The names of the assets to fix to using the predefined mods
- Getter:
Retrives the names of assets to fix to
- Type:
Set[
str]
- property fromAssets: Dict[str, Tuple[Set[str], str]]¶
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- get(assetName: str, assetType: str, version: float | None = None) str¶
Retrieves the corresponding id asset from
ModStrAssets._toAssets- Parameters:
- Raises:
KeyError – If the corresponding asset based on the search parameters is not found
- Returns:
The found asset
- Return type:
- loadFromPreset()¶
Reinitializes to load the predefined mods
- property map: Dict[str, Set[str]]¶
The adjacency list used to map assets to fix from to assets to fix to
- Getter:
Retrieves the adjacency list
- Setter:
Sets a new adjacency list
- Type:
- replace(fromAsset: str, version: float | None = None, toAssets: str | Set[str] | None = None) str | None | Dict[str, str]¶
Retrieves the corresponding asset to replace ‘fromAsset’
- Parameters:
- Returns:
The corresponding assets for the fix to replace, if available
The result is a string if the passed in parameter ‘toAssets’ is also a string
Otherwise, the result is a dictionary such that:
The keys are the names of the assets
The values are the corresponding asset ids to replace
- Return type:
- property toAssets: Dict[float, Dict[str, Dict[str, str]]]¶
The outer key is the game version number for the assets
The first inner key is the name of the assets
The most inner key is the type of asset
The most inner value is the id for the asset
- classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]¶
Combines 2 maps together
Indices¶
- clsIndices._getFromAssets
- clsIndices.updateMap
- def_addVersion
- def_getToAssets
- def_partition
- def_updateAssetContent
- def_updateVersions
- defaddMap
- defaddMapping
- defclear
- defclearCache
- deffindClosestVersion
- defget
- defloadFromPreset
- defreplace
- defupdateRepo
- class Indices(map: Dict[str, Set[str]] | None = None)¶
This class inherits from
ModDictStrAssetsClass for managing indices for a mod
- Parameters:
map (Optional[Dict[
str, Set[str]]]) –The adjacency list that maps the indices to fix from to the indices to fix to using the predefined mods
Default:
None
- classmethod _getFromAssets(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[str, Tuple[Set[str], str]]¶
Retrieves the assets to fix from
- Parameters:
map (Dict[str, Set[str]]) – The mapping for fixing the assets
assets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- Return type:
- _getToAssets(assetNames: Set[str], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[float, Dict[str, Dict[str, str]]]¶
Retrieves the assets to fix to
- Parameters:
assetNames (Set[
str]) – The names of the assets to fix toassets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The assets to fix to
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Return type:
- _partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]¶
Creates the bipartition for the assets to fix from vs the assets to fix to
Filters the mapping such that all the asset names in the new mapping exist in assets
- Parameters:
map (Dict[
str, Set[str]]) – The desired mapping for the assets for fixingassets (Dict[
float, Dict[str, Any]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns:
The following output is in the same order as listed below:
The new mapping with all asset names being in assets
The names of the assets to fix from
The names of the assets to fix to
- Return type:
- _updateAssetContent(srcAsset: Dict[str, str], newAsset: Dict[str, str]) Dict[str, str]¶
Combines the content of 2 assets
- Parameters:
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns:
The updated asset
- Return type:
T
- _updateVersions(assets: Dict[float, Dict[str, T]])¶
Updates the versioning of the assets
- Parameters:
assets (T) – The assets for checking the versioning
- addMap(assetMap: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]] | None = None)¶
Adds a new map to the existing map on how to retrieve the assets
- Parameters:
assetMap (Dict[
str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix toassets (Optional[T]) –
Any new assets that needs to be added/updated to the existing assets to support the given map
Default:
None
- addMapping(fromAsset: str, toAssets: Set[str], assets: Any)¶
Adds a new mapping of how to fix the assets
- clearCache()¶
Clears out any cached data
- findClosestVersion(name: str, version: str | float | Version | None = None, fromCache: bool = True) Version¶
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters:
name (
str) – The name of the asset to searchversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version to be searched
If This value is
None, then will assume we want the latest version
Default:
NonefromCache (
bool) –Whether to use the result from the cache
Default:
None
- Raises:
KeyError – The name for the particular asset is not found
- Returns:
The latest game version from the assets that corresponds to the desired version
- Return type:
- property fixFrom: Set[str]¶
The names of the assets to fix from using the predefined mods
- Getter:
Retrieves the names of assets used to fix from
- Type:
Set[
str]
- property fixTo: Set[str]¶
The names of the assets to fix to using the predefined mods
- Getter:
Retrives the names of assets to fix to
- Type:
Set[
str]
- property fromAssets: Dict[str, Tuple[Set[str], str]]¶
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- get(assetName: str, assetType: str, version: float | None = None) str¶
Retrieves the corresponding id asset from
ModStrAssets._toAssets- Parameters:
- Raises:
KeyError – If the corresponding asset based on the search parameters is not found
- Returns:
The found asset
- Return type:
- loadFromPreset()¶
Reinitializes to load the predefined mods
- property map: Dict[str, Set[str]]¶
The adjacency list used to map assets to fix from to assets to fix to
- Getter:
Retrieves the adjacency list
- Setter:
Sets a new adjacency list
- Type:
- replace(fromAsset: str, version: float | None = None, toAssets: str | Set[str] | None = None) str | None | Dict[str, str]¶
Retrieves the corresponding asset to replace ‘fromAsset’
- Parameters:
- Returns:
The corresponding assets for the fix to replace, if available
The result is a string if the passed in parameter ‘toAssets’ is also a string
Otherwise, the result is a dictionary such that:
The keys are the names of the assets
The values are the corresponding asset ids to replace
- Return type:
- property toAssets: Dict[float, Dict[str, Dict[str, str]]]¶
The outer key is the game version number for the assets
The first inner key is the name of the assets
The most inner key is the type of asset
The most inner value is the id for the asset
- classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]¶
Combines 2 maps together
Mod Files¶
Entities for representing some common used files in mods.
File¶
- class File(logger: Logger | None = None)¶
Base class for a file
IniFile¶
- _parser
- _remappedSectionNames
- _resourceBlends
- availableType
- defaultModType
- downloadMode
- file
- fileDownloadModels
- fileLines
- fileLinesRead
- filePath
- fileTxt
- folder
- forcedModType
- hideOriginalReplaced
- isClassified
- isFixed
- isModIni
- modTypes
- modsToFix
- remapBlendModels
- remapPositionModels
- sectionIfTemplates
- texAddModels
- texEditModels
- type
- version
- clsIniFile.compareResources
- clsIniFile.getFixedBlendFile
- clsIniFile.getFixedElementFile
- clsIniFile.getFixedPositionFile
- clsIniFile.getFixedTexFile
- clsIniFile.getMergedResourceIndex
- clsIniFile.getModSuffixedName
- clsIniFile.getRemapBlendName
- clsIniFile.getRemapBlendResourceName
- clsIniFile.getRemapDLName
- clsIniFile.getRemapDLResourceName
- clsIniFile.getRemapElementName
- clsIniFile.getRemapFixName
- clsIniFile.getRemapFixResourceName
- clsIniFile.getRemapIbName
- clsIniFile.getRemapPositionName
- clsIniFile.getRemapPositionResourceName
- clsIniFile.getRemapTexName
- clsIniFile.getRemapTexResourceName
- clsIniFile.getRemapTexcoordName
- clsIniFile.getResourceName
- clsIniFile.getResources
- clsIniFile.removeResourceName
- def_commentSection
- def_getCommandIfTemplate
- def_getCommands
- def_getFixer
- def_getIfTemplateResourceName
- def_getParser
- def_getReferencedModels
- def_getRemover
- def_isIfTemplateDraw
- def_isIfTemplateResource
- def_parseSection
- def_processIfTemplate
- def_readLines
- def_removeFix
- def_removeSection
- defaddFixBoilerPlate
- defclassify
- defclear
- defclearModels
- defclearRead
- defcommentSectionOptions
- defdisIni
- deffillIfTemplate
- deffix
- deffixBoilerPlate
- defgetFixCredit
- defgetFixFooter
- defgetFixHeader
- defgetFixModTypeHeadingname
- defgetFixModTypeName
- defgetFixStr
- defgetHeadingName
- defgetIfTemplates
- defgetReferencedFiles
- defgetReferencedFolders
- defgetSectionOptions
- defgetTexAddModels
- defgetTexEditModels
- defhideOriginalSections
- definjectAddition
- defmakeDLModel
- defmakeFixResourceModel
- defmakeSrcResourceModel
- defmakeTexModel
- defparse
- defprint
- defread
- defreadFileLines
- defreadIfTemplates
- defremoveFix
- defremoveSectionOptions
- defwrite
- class IniFile(file: str | None = None, logger: Logger | None = None, txt: str = '', modTypes: Set[ModType] | None = None, defaultModType: ModType | None = None, forcedModType: ModType | None = None, version: float | None = None, modsToFix: Set[str] | None = None, iniClassifier: IniClassifier | None = None, downloadMode: DownloadMode = DownloadMode.HardTexDriven)¶
This class inherits from
FileClass for handling .ini files
Note
We analyse the .ini file using Regex which is NOT the right way to do things since the modified .ini language that GIMI interprets is a CFG (context free grammer) and NOT a regular language.
But since we are lazy and don’t want make our own compiler with tokenizers, parsing algorithms (eg. SLR(1)), type checking, etc… this module should handle regular cases of .ini files generated using existing scripts (assuming the user does not do anything funny…)
- Parameters:
file (Optional[
str]) –The file path to the .ini file
Default:
Nonelogger (Optional[
Logger]) – The logger to print messages if necessarytxt (
str) –Used as the text content of the .ini file if
IniFile.fileis set toNone
Default: “”
modTypes (Optional[Set[
ModType]]) –The types of mods that the .ini file should belong to
Default:
NonemodsToFix (Optional[Set[
str]]) –The names of the mods we want to fix to
Default:
NonedefaultModType (Optional[
ModType]) –The type of mod to use if the .ini file has an unidentified mod type
If this value isNone, then will skip the .ini file with an unidentified mod type
Default:
NoneforcedModType (Optional[
ModType]) –The type of mod to forcibly assume the .ini file to belong to
Default:
Noneversion (Optional[Union[
str,float, packaging.version.Version]]) –The game version we want the .ini file to be compatible with
If this value is
None, then will retrieve the hashes/indices of the latest version.
Default:
NonedownloadMode (
DownloadMode) –The download mode to handle file downloads
Note
For more information about the available download modes to specify, see Download Modes
Default:
DownloadMode.HardTexDriveniniClassifier (Optional[
IniClassifier]) –The classifier used to identify what mod belongs to this .ini file
If this value is
None, then will use the default classifier used by the software fromIniModules.Classifier
Default:
None
- version¶
The game version we want the .ini file to be compatible with
If This value is
None, then will retrieve the hashes/indices of the latest version.- Type:
Optional[packaging.version.Version]
- downloadMode¶
The download mode to handle file downloads
Note
For more information about the available download modes to specify, see Download Modes
- Type:
- _parser¶
Parser used to parse very basic cases in a .ini file
- Type:
- defaultModType¶
The type of mod to use if the .ini file has an unidentified mod type
- Type:
Optional[
ModType]
- forcedModType¶
The type of mod to forcibly assume the .ini file to belong to
- Type:
Optional[
ModType]
- sectionIfTemplates¶
All the sections in the .ini file that can be parsed into an
IfTemplateFor more info see
IfTemplateAttention
The modified .ini language that GIMI uses introduces keywords that can be used before the key of a key-value pair
eg. defining constants
1[Constants] 2global persist $swapvar = 0 3global persist $swapscarf = 0 4global $active 5global $creditinfo = 0
Sections containing this type of pattern will not be parsed. But generally, these sections are irrelevant to fixing the Raiden Boss
- Type:
Dict[
str,IfTemplate]
- _resourceBlends¶
Sections that are linked to 1 or more Blend.buf files.
The keys are the name of the sections.
- Type:
Dict[
str,IfTemplate]
- remapBlendModels¶
The data for the
[Resource.*RemapBlend.*]sections used in the fix
The keys are the original names of the resource with the pattern
[Resource.*Blend.*]- Type:
Dict[
str,IniResourceModel]
- remapPositionModels¶
The data for the
[Resource.*RemapPosition.*]sections used in the fix
The keys are the original names of the resource with the pattern
[Resource.*Position.*]- Type:
Dict[
str,IniResourceModel]
- texEditModels¶
The data for the
[Resource.*]sections that belong to some texture file that got editted
The outer keys are the names for the type of texture files eg. MyBrandNewLightMap
The inner keys are the original names of the resource with the pattern
[Resource.*]
- Type:
Dict[
str, Dict[str,IniTexModel]]
- texAddModels¶
The data for the
[Resource.*]sections that belong to some texture file that got added
The outer keys are the names for the type of texture files eg. MyBrandNewLightMap
The inner keys are the names of the mod object eg. Head
- Type:
Dict[
str, Dict[str,IniTexModel]]
- fileDownloadModels¶
The data for the downloaded files in the fix
The keys are the names of the
[Resource.*]sections that have some downloaded file- Type:
Dict[
str,IniDownloadModel]
- _commentSection(startInd: int, endInd: int, fileLines: List[str], comment: str = ';')¶
Comments out a section
- Parameters:
- Returns:
The starting line index and the ending line index of the section that was commented
- Return type:
- _getCommandIfTemplate(sectionName: str, raiseException: bool = True) IfTemplate | None¶
Retrieves the
IfTemplatefor a certain section from IniFile._sectionIfTemplate- Parameters:
raiseException (
bool) – Whether to raise an exception when the section’sIfTemplateis not found
- Raises:
KeyError – If the
IfTemplatefor the section is not found andraiseExceptionis set to True- Returns:
The corresponding
IfTemplatefor the section- Return type:
Optional[
IfTemplate]
- _getCommands(sectionName: str, subCommands: Set[str], subCommandLst: List[str])¶
Low level function for retrieving all the commands/sections that are called from a certain section in the .ini file
- Parameters:
- Raises:
KeyError – If the
IfTemplateis not found for some section
- _getFixer()¶
Retrieves the fixer for fixing the .ini file
- Returns:
The resultant fixer
- Return type:
Optional[
BaseIniFixer]
- _getIfTemplateResourceName(ifTemplatePart: Dict[str, Any]) Any¶
Retrieves the value from the key, ‘vb1’, for some part of a section
- _getParser() BaseIniParser | None¶
Retrieves the parser for parsing the .ini file
- Returns:
The resultant parser
- Return type:
Optional[
BaseIniParser]
- _getReferencedModels() List[IniFixResourceModel]¶
Retrieves all the resources referenced by the .ini file
- Returns:
All the resource models referenced
- Return type:
List[
IniResourceModel]
- _getRemover() BaseIniRemover¶
Retrieves the remover for removing fixes from the .ini file
- Returns:
The resultant parser
- Return type:
- _isIfTemplateDraw(ifTemplatePart: Dict[str, Any]) bool¶
Whether the content for some part of a section contains the key ‘draw’
- _isIfTemplateResource(ifTemplatePart: Dict[str, Any]) bool¶
Whether the content for some part of a section contains the key ‘vb1’
- _parseSection(sectionName: str, srcTxt: str, save: Dict[str, Any] | None = None) Dict[str, str] | None¶
Regularly parses the key-value pairs of a certain section
The function parses uses ConfigParser to parse the section.
- Parameters:
- Returns:
The result from parsing the section
Note
If ConfigParser is unable to parse the section, then
Noneis returned- Return type:
- _processIfTemplate(startInd: int, endInd: int, fileLines: List[str], sectionName: str, srcTxt: str) IfTemplate¶
Parses a section in the .ini file as an
IfTemplateNote
See
IfTemplateto see how we define an ‘IfTemplate’- Parameters:
- Returns:
The generated
IfTemplatefrom the section- Return type:
- _readLines()¶
Decorator to read all the lines in the .ini file first before running a certain function
All the file lines will be saved in
IniFile._fileLinesExamples
1@_readLines 2def printLines(self): 3 for line in self._fileLines: 4 print(f"LINE: {line}")
- _removeFix(parse: bool = False, writeBack: bool = True) str¶
Removes any previous changes that were probably made by this script
For the .ini file will remove:
All code surrounded by the ‘—…— . Fix —…—-’* header/footer
All sections containing the keywords
RemapBlend
- _removeSection(startInd: int, endInd: int, fileLines: List[str], sectionName: str, srcTxt: str) Tuple[int, int]¶
Retrieves the starting line index and ending line index of where to remove a certain section from the read lines of the .ini file
- Parameters:
- Returns:
The starting line index and the ending line index of the section to remove
- Return type:
- addFixBoilerPlate(fix: str = '') str¶
Adds the boilerplate code to identify the .ini sections have been changed by this fix
- property availableType: ModType | None¶
Retrieves the type of mod identified for this .ini file
Note
This function is the same as
IniFile.type(), but will returnIniFile.defaultModTypeifIniFile.type()isNone- Getter:
Returns the type of mod identified
- Type:
Optional[
ModType]
- classify(flush: bool = False) bool¶
Classifies a .ini file by answering the following questions:
Does the .ini file belong to a mod?
What type of mod does the .ini file belong to?
Has the .ini file already been fixed?
Note
To access the result of the classification, you can call the following attributes:
- clear(eraseSourceTxt: bool = False)¶
Clears all the saved data for the .ini file
Note
Please see the note at
IniFile.clearRead()- Parameters:
eraseSourceTxt (
bool) –Whether to erase the only data source for this class if
IniFile.fileis set toNone, see the note atIniFile.clearRead()for more info
Default:
False
- clearModels()¶
Clears all the internal data models used in the .ini file
Note
This function will not clear the text data read in from the .ini file To clear this data, please see
clearRead()
- clearRead(eraseSourceTxt: bool = False)¶
Clears the saved text read in from the .ini file
Note
If
IniFile.fileis set toNone, then the default run of this function with the argumenteraseSourceTxtset toFalsewill have no effect since the provided text fromIniFile._fileTxtis the only source of data for theIniFileIf you also want to clear the above source text data, then run this function with the
eraseSourceTxtargument set toTrue- Parameters:
eraseSourceTxt (
bool) –Whether to erase the only data source for this class if
IniFile.fileis set toNone, see the note above for more info
Default:
False
- commentSectionOptions(section: str | Pattern | Callable[[str], bool], comment: str = ';')¶
Comments out a certain type of section from the .ini file
- classmethod compareResources(resourceTuple1: Tuple[str, int | None], resourceTuple2: Tuple[str, int | None]) int¶
Compare function used for sorting resources
The order for sorting is the resources is:
Resources that do are not suffixed by an index number
Resource that are suffixed by an index number (see
IniFile.getMergedResourceIndex()for more info)
- Parameters:
resourceTuple1 (Tuple[
str, Optional[int]]) –Data for the first resource in the compare function, contains:
Name of the resource
The index for the resource
resourceTuple2 (Tuple[
str, Optional[int]]) –Data for the second resource in the compare function, contains:
Name of the resource
The index for the resource
- Returns:
The result for a typical compare function used in sorting
returns -1 if
resourceTuple1should come beforeresourceTuple2returns 1 if
resourceTuple1should come afterresourceTuple2returns 0 if
resourceTuple1is equal toresourceTuple2
- Return type:
- disIni(makeCopy: bool = False)¶
Disables the .ini file
Note
For more info, see
FileService.disableFile()- Parameters:
makeCopy (
bool) –Whether to make a copy of the disabled .ini file
Default:
False
- property file: str | None¶
The file path to the .ini file
- Getter:
Returns the path to the file
- Setter:
Sets the new path for the file
- Type:
Optional[
str]
- property fileLines: List[str]¶
The text lines of the .ini file
Note
For the setter, each line must end with a newline character (same behaviour as readLines)
- Getter:
Returns the text lines of the .ini file
- Setter:
Reads the new value for both the text lines of the .ini file and the text content of the .ini file
- Type:
List[
str]
- property fileLinesRead: bool¶
Whether the .ini file has been read
- Getter:
Determines whether the .ini file has been read
- Type:
- property filePath: FilePath | None¶
The path to the .ini file
- Getter:
Returns the path to the file
- Type:
Optional[
FilePath]
- property fileTxt: str¶
The text content of the .ini file
- Getter:
Returns the content of the .ini file
- Setter:
Reads the new value for both the text content of the .ini file and the text lines of the .ini file
- Type:
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, str | Dict[str, Any], int, int, str], str], origSectionName: str | None = None) str¶
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters:
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str, Union[str, Dict[str, Any],int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns:
The text for the newly created
IfTemplate- Return type:
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False, hideOrig: bool = False) str | List[str]¶
Fixes the .ini file
- Parameters:
keepBackup (
bool) –Whether we want to make a backup copy of the .ini file
Default: True
fixOnly (
bool) –Whether we are only fixing the .ini file without removing any previous changes
Default: False
update (
bool) –Whether to also update the source text of this classs with the fix
Default:
FalsehideOrig (
bool) –Whether to hide the mod for the original character
Default:
False
- Returns:
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type:
- fixBoilerPlate()¶
Decorator used to add the boilerplate code to identify a code section has been changed by this fix in the .ini file
Examples
1@fixBoilerPlate 2def helloWorld(self) -> str: 3 return "Hello World"
- property folder: str¶
The folder where this .ini file resides
If
IniFile.fileis set toNone, then will return the folder where this script is ran- Getter:
Retrieves the folder
- Type:
- getFixCredit() str¶
Retrieves the credit text for the code generated in the .ini file
- Returns:
The credits to be displayed in the .ini file
- Return type:
Retrieves the footer text used to identify a code section has been changed by this fix in the .ini file
- Returns:
The footer section comment to be used in the .ini file
- Return type:
- getFixHeader() str¶
Retrieves the header text used to identify a code section has been changed by this fix in the .ini file
- Returns:
The header section comment to be used in the .ini file
- Return type:
- getFixModTypeHeadingname()¶
Retrieves the name of the type of mod corresponding to the .ini file to be used in the header/footer divider comment of the fix
- Returns:
The name for the type of mod to be displayed in the header/footer divider comment
- Return type:
Optional[
str]
- getFixModTypeName() str | None¶
Retrieves the name of the type of mod corresponding to the .ini file to be used for the comment of the fix
- Returns:
The name for the type of mod corresponding to the .ini file
- Return type:
Optional[
str]
- classmethod getFixedBlendFile(blendFile: str, modName: str = '') str¶
Retrieves the file path for the fixed RemapBlend.buf file
- classmethod getFixedElementFile(file: str, elementName: str, fileExt: str, modName: str = '') str¶
Retrieves the file path for a a fixed element
- Parameters:
- Returns:
The file path of the fixed file of the element
- Return type:
- classmethod getFixedPositionFile(positionFile: str, modName: str = '') str¶
Retrieves the file path for the fixed RemapPosition.buf file
- classmethod getFixedTexFile(texFile: str, modName: str = '') str¶
Retrieves the file path for the fixed RemapTex.dds file
- getHeadingName()¶
Retrieves the title for the header of the divider comment of the fix
- Returns:
The title for the header of the divider comment
- Return type:
- getIfTemplates(flush: bool = False) Dict[str, IfTemplate]¶
Retrieves all the :class:`IfTemplate`s for the .ini file
Note
This is the same as
IniFile.readIfTemplates(), but uses caching- Parameters:
flush (
bool) – Whether to re-parse the :class:`IfTemplates`s instead of using the saved cached values- Returns:
The parsed
IfTemplate`s :raw-html:`The keys are the name of the
IfTemplateThe values are the corresponding
IfTemplate
- Return type:
Dict[
str,IfTempalte]
- classmethod getMergedResourceIndex(mergedResourceName: str) int | None¶
Retrieves the index number of a resource created by GIMI’s
genshin_merge_mods.pyscriptExamples
>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend.8") 8
>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend.Score.-100") -100
>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend.UnitTests") None
>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend") None
- classmethod getModSuffixedName(name: str, suffix: str = '', modName: str = '')¶
Changes a section name to have the suffix of ‘modName’ followed by ‘suffix’
- getReferencedFiles() List[str]¶
Retrieves all the files referenced by the .ini file
- Returns:
The absolute paths to all the files
- Return type:
List[
str]
- getReferencedFolders() List[str]¶
Retrieves all the folders referenced by the .ini file
- Returns:
The absolute paths to all the folders
- Return type:
List[
str]
- classmethod getRemapBlendName(name: str, modName: str = '') str¶
Changes a section name to have the keyword ‘RemapBlend’ to identify that the section is created by this fix
Tip
See
getRemapElementName()for some examples
- classmethod getRemapBlendResourceName(name: str, modName: str = '') str¶
Changes the name of a section to be a new blend resource that this fix will create
Note
See
getResourceName()andgetRemapBlendName()for more info
- classmethod getRemapDLName(name: str, modName: str = '')¶
Changes a section name to have the suffix RemapDL to identify that the section is created by this fix
Examples
>>> IniFile.getRemapTexName("EiIsDoneWithRemapDL", "Raiden") "EiIsDoneWithRaidenRemapDL"
>>> IniFile.getRemapTexName("EiIsHappy", "Raiden") "EiIsHappyRaidenRemapDL"
- classmethod getRemapDLResourceName(name: str, modName: str = '')¶
Changes a section name to be a texture resource created by this fix
Note
See
IniFile.getResourceName()andIniFile.getRemapDLName()for more info
- classmethod getRemapElementName(name: str, elementName: str, modName: str = '')¶
Changes a section name to have the keyword from ‘elementName’ to identify that the section is created by this fix
Examples
>>> IniFile.getRemapElementName("EiTriesToUseBlenderAndFails", "Blend", "Raiden") "EiTriesToUseRaidenRemapBlenderAndFails"
>>> IniFile.getRemapElementName("EiTextsTheTexture", "Tex", "Yae") "EiTextsTheYaeRemapTexture"
>>> IniFile.getRemapElementName("ResourceCuteLittleEi", "Position", "Raiden") "ResourceCuteLittleEiRaidenRemapPosition"
>>> IniFile.getRemapElementName("ResourceCuteLittleEiRemapDango", "Dango" "Raiden") "ResourceCuteLittleEiRemapRaidenRemapDango"
- classmethod getRemapFixName(name: str, modName: str = '') str¶
Changes a section name to have the suffix RemapFix to identify that the section is created by this fix
Examples
>>> IniFile.getRemapFixName("EiIsDoneWithRemapFix", "Raiden") "EiIsDoneWithRaidenRemapFix"
>>> IniFile.getRemapFixName("EiIsHappy", "Raiden") "EiIsHappyRaidenRemapFix"
- classmethod getRemapFixResourceName(name: str, modName: str = '')¶
Changes a section name to be a new non-blend resource created by this fix
Note
See
IniFile.getResourceName()andIniFile.getRemapFix()for more info
- classmethod getRemapIbName(name: str, modName: str = '') str¶
Changes a section name to have the keyword ‘RemapIb’ to identify that the section is created by this fix
Tip
See
getRemapElementName()for some examples
- classmethod getRemapPositionName(name: str, modName: str = '') str¶
Changes a section name to have the keyword ‘RemapPosition’ to identify that the section is created by this fix
Tip
See
getRemapElementName()for some examples
- classmethod getRemapPositionResourceName(name: str, modName: str = '') str¶
Changes the name of a section to be a new position resource that this fix will create
Note
See
getResourceName()andgetRemapPositionName()for more info
- classmethod getRemapTexName(name: str, modName: str = '')¶
Changes a section name to have the suffix RemapFix to identify that the section is created by this fix
Examples
>>> IniFile.getRemapTexName("EiIsDoneWithRemapTex", "Raiden") "EiIsDoneWithRaidenRemapTex"
>>> IniFile.getRemapTexName("EiIsHappy", "Raiden") "EiIsHappyRaidenRemapTex"
- classmethod getRemapTexResourceName(name: str, modName: str = '')¶
Changes a section name to be a texture resource created by this fix
Note
See
IniFile.getResourceName()andIniFile.getRemapTexName()for more info
- classmethod getRemapTexcoordName(name: str, modName: str = '') str¶
Changes a section name to have the keyword ‘RemapTexcoord’ to identify that the section is created by this fix
Tip
See
getRemapElementName()for some examples
- classmethod getResourceName(name: str) str¶
Makes the name of a section to be used for the resource sections of a .ini file
Examples
>>> IniFile.getResourceName("CuteLittleEi") "ResourceCuteLittleEi"
>>> IniFile.getResourceName("ResourceCuteLittleEi") "ResourceCuteLittleEi"
- classmethod getResources(commandsGraph: IniSectionGraph, isIfTemplateResource: Callable[[IfContentPart], Any], getIfTemplateResource: Callable[[IfContentPart], str], addResource: Callable[[Any, IfContentPart], Any])¶
Retrieves all the referenced resources that were called by sections related to the
[TextureOverride.*Blend.*]sections- Parameters:
resources (Set[
str]) – The result for all the resource sections that were referencedcommandsGraph (
IniSectionGraph) – The subgraph for all the sections related to the resourceisIfTemplateResource (Callable[[
IfContentPart],bool]) – Checks whether a part in theIfTemplateof a section contains the key that reference the target resourcegetIfTemplateResource (Callable[[
IfContentPart], Any]) – Function to retrieve the target resource from a part in theIfTemplateof a sectionaddResource (Callable[[Any,
IfContentPart], Any]) –Function to add in the result of the found resource section
The parameter order for the function is:the retrieved resource section
the part in the
IfTemplatewhere the resource is found
- getSectionOptions(section: str | Pattern | Callable[[str], bool], postProcessor: Callable[[int, int, List[str], str, str], Any] | None = None, handleDuplicateFunc: Callable[[List[Any]], Any] | None = None, ignoreHideOriginal: bool = False) Dict[str, Any]¶
Reads the entire .ini file for a certain type of section
- Parameters:
section (Union[
str, Pattern, Callable[[str],bool]]) –The type of section to find
If this argument is a
str, then will check if the line in the .ini file exactly matches the argumentIf this argument is a Pattern, then will check if the line in the .ini file matches the specified Regex pattern
If this argument is a function, then will check if the line in the .ini file passed as an argument for the function will make the function return
True
postProcessor (Optional[Callable[[
int,int, List[str],str,str], Any]]) –Post processor used when a type of section has been found
The order of arguments passed into the post processor will be:
The starting line index of the section in the .ini file
The ending line index of the section in the .ini file
All the file lines read from the .ini file
The name of the section found
The entire text for the section
Default: None
handleDuplicateFunc (Optional[Callable[List[Any], Any]]) –
Function to used to handle the case of multiple sections names
If this value is set to
None, will keep all sections with the same namesNote
For this case, GIMI only keeps the first instance of all sections with same names
Default:
NoneignoreHideOriginal (
bool) –Whether to ignore the special comment created by this fix used to hide the original mod within the .ini txt
Default:
False
- Returns:
The resultant sections found
The keys are the names of the sections found and the values are the content for the section,
- Return type:
Dict[
str, Any]
- getTexAddModels() List[IniTexModel]¶
Retrieves all the file path data needed for creating new texture .dds file (transforms
IniFile.texAddModelsto a list)- Returns:
The data models needed for editting a texture .dds file
- Return type:
List[
IniTexModel]
- getTexEditModels() List[IniTexModel]¶
Retrieves all the file path data needed for editing a texture .dds file (transforms
IniFile.texEditModelsto a list)- Returns:
The data models needed for editting a texture .dds file
- Return type:
List[
IniTexModel]
- property hideOriginalReplaced: bool¶
Whether the comments created by this fix that is used to hide the original mod has been erased
- Getter:
Determines whether the comments are erased
- Type:
- hideOriginalSections()¶
Comments out all the sections referenced by the remap
Note
The .ini file need to be parsed first using the
parse()method
- injectAddition(addition: str, beforeOriginal: bool = True, keepBackup: bool = True, fixOnly: bool = False, update: bool = False) str¶
Adds and writes new text to the .ini file
- Parameters:
addition (
str) – The text we want to add to the filebeforeOriginal (
bool) –Whether to add the new text before the original text
Default:
TruekeepBackup (
bool) –Whether we want to make a backup copy of the .ini file
Default:
TruefixOnly (
bool) –Whether we are only fixing the .ini file without removing any previous changes
Default:
Falseupdate (
bool) –Whether to update the source text within this class to reflect the new addition
Default:
False
- Returns:
The content of the .ini file with the new text added
- Return type:
- property isClassified: bool¶
Whether the type of mod has already been identified for the .ini file
- Getter:
Determines whether the .ini file has already been classified
- Type:
- property isFixed: bool¶
Whether the .ini file has already been fixed
- Getter:
Returns whether the .ini file has already been fixed
- Type:
- property isModIni: bool¶
Whether the .ini file belongs to a mod
- Getter:
Returns whether the .ini file belongs to a mod
- Type:
- makeDLModel(ifTemplate: IfTemplate, downloads: FileDownload | Dict[int, Dict[str, List[FileDownload]]]) IniDownloadModel¶
Creates the data needed for a particular
[Resource.*]section for some file download in the .ini file- Parameters:
ifTemplate (
IfTemplate) – The particular section to extract datadownloads (Union[
FileDownload, Dict[int, List[BaseTexEditor]]]) –The downloaders for downloading files
If this argument is of type
FileDownload, then all files encountered within the parsed section will use the same downloadersIf this argument is a dictionary, then the structure of the dictionary follows the same structure as
IniDownloadModel.downloads
- Returns:
The data for downloading a particular resource
- Return type:
- makeFixResourceModel(ifTemplate: ~FixRaidenBoss2.model.iftemplate.IfTemplate.IfTemplate, toFix: ~typing.Set[str], getFixedFile: ~typing.Callable[[str, str], str] | None = None, iniResourceModelCls: ~typing.Type[~FixRaidenBoss2.model.iniresources.IniFixResourceModel.IniFixResourceModel] = <class 'FixRaidenBoss2.model.iniresources.IniFixResourceModel.IniFixResourceModel'>, iniResModelArgs: ~typing.List[~typing.Any] | None = None, iniResModelKwargs: ~typing.Dict[str, ~typing.Any] | None = None) IniFixResourceModel¶
Creates the data needed for fixing a particular
[Resource.*]section in the .ini file- Parameters:
ifTemplate (
IfTemplate) – The particular section to extract datatoFix (Set[
str]) – The names of the mods to fixgetFixedFile (Optional[Callable[[
str,str],str]]) –The function for transforming the file path of a found resource file into a new file path for the fixed resources file
If this value is
None, then will useIniFile.getFixedBlendFile()
The parameters for the function are:
# The path to the original file # The type of mod to fix to
Default:
NoneiniResourceModelCls (Type[
IniFixResourceModel]) –A subclass of
IniFixResourceModelfor constructing the required dataAttention
The constructor of this subclass must at least have the same arguments and keyword arguments as the constructor for
IniFixResourceModelDefault:
IniFixResourceModeliniResModelArgs (Optional[List[Any]]) –
Any arguments to add onto the contructor for creating the subclass of a
IniFixResourceModel
Default:
NoneiniResModelKwargs (Optional[Dict[
str, Any]]) –Any keyword arguments to add onto the constructor for creating the subclass of a
IniFixResourceModel
Default:
None
- Returns:
The data for fixing the particular resource
- Return type:
- makeSrcResourceModel(ifTemplate: ~FixRaidenBoss2.model.iftemplate.IfTemplate.IfTemplate, iniResourceModelCls: ~typing.Type[~FixRaidenBoss2.model.iniresources.IniFixResourceModel.IniFixResourceModel] = <class 'FixRaidenBoss2.model.iniresources.IniSrcResourceModel.IniSrcResourceModel'>, iniResModelArgs: ~typing.List[~typing.Any] | None = None, iniResModelKwargs: ~typing.Dict[str, ~typing.Any] | None = None) IniSrcResourceModel¶
Creates the data needed for a particular
[Resource.*]section in the original .ini file- Parameters:
ifTemplate (
IfTemplate) – The particular section to extract datainiResourceModelCls (Type[
IniSrcResourceModel]) –A subclass of
IniSrcResourceModelfor constructing the required dataAttention
The constructor of this subclass must at least have the same arguments and keyword arguments as the constructor for
IniSrcResourceModelDefault:
IniSrcResourceModeliniResModelArgs (Optional[List[Any]]) –
Any arguments to add onto the contructor for creating the subclass of a
IniSrcResourceModel
Default:
NoneiniResModelKwargs (Optional[Dict[
str, Any]]) –Any keyword arguments to add onto the constructor for creating the subclass of a
IniSrcResourceModel
Default:
None
- Returns:
The data for a particular source resource
- Return type:
- makeTexModel(ifTemplate: IfTemplate, toFix: Set[str], texEditors: BaseTexEditor | Dict[int, Dict[str, List[BaseTexEditor]]], getFixedFile: Callable[[str, str], str] | None = None) IniTexModel¶
Creates the data needed for fixing a particular
[Resource.*]section for some .dds texture file in the .ini file- Parameters:
ifTemplate (
IfTemplate) – The particular section to extract datatoFix (Set[
str]) – The names of the mods to fixtexEditors (Union[
BaseTexEditor, Dict[int, Dict[str, List[BaseTexEditor]]]]) –The texture editors for editting the found .dds files
If this argument is of type
BaseTexEditor, then all .dds files encountered within the parsed section will use the same texture editorIf this argument is a dictionary, then the structure of the dictionary follows the same structure as
IniTexModel.texEdits
getFixedFile (Optional[Callable[[
str,str],str]]) –The function for transforming the file path of a found .dds file into a new file path to the fixed .dds file
If this value is
None, then will useIniFile.getFixedBlendFile()
The parameters for the function are:
# The path to the original file # The type of mod to fix to
Default:
None
- Returns:
The data for fixing the particular texture
- Return type:
- parse(flushIfTemplates: bool = True)¶
Parses the .ini file
- Parameters:
flushIfTemplates (
bool) –Whether to re-parse the
IfTemplates`s instead of using the saved cached values :raw-html:`Default:
True- Raises:
KeyError – If a certain resource section is not found
(either the name of the section is not found in the .ini file or the section was skipped due to some error when parsing the section)
- print(funcName: str, *args, **kwargs)¶
Prints out output
- Parameters:
- Returns:
The return value from running the corresponding function in the logger
- Return type:
Any
- read() str¶
Reads the .ini file
If
IniFile.fileis set toNone, then will read the existing value fromIniFile.fileTxt- Returns:
The text content of the .ini file
- Return type:
- readFileLines() List[str]¶
Reads each line in the .ini file
If
IniFile.fileis set toNone, then will read the existing value fromIniFile.fileLines- Returns:
All the lines read from the .ini file
- Return type:
List[
str]
- readIfTemplates() Dict[str, IfTemplate]¶
Parses all the :class:`IfTemplate`s for the .ini file
- Returns:
The parsed
IfTemplate`s :raw-html:`The keys are the name of the
IfTemplateThe values are the corresponding
IfTemplate
- Return type:
Dict[
str,IfTempalte]
- removeFix(keepBackups: bool = True, fixOnly: bool = False, parse: bool = False, writeBack: bool = True) str¶
Removes any previous changes that were probably made by this script and creates backup copies of the .ini file
Tip
For more info about what gets removed from the .ini file, see
IniFile._removeFix()- Parameters:
keepBackup (
bool) –Whether we want to make a backup copy of the .ini file
Default:
TruefixOnly (
bool) –Whether we are only fixing the .ini file without removing any previous changes
Note
If this value is set to
True, then the previous changes made by this script will not be removedDefault:
Falseparse (
bool) –Whether to also parse for the .*RemapBlend.buf files that need to be removed
Default:
FalsewriteBack (
bool) –Whether to write back the changed text of the .ini file
Default:
True
- Returns:
The new text content of the .ini file with the changes removed
- Return type:
- classmethod removeResourceName(name: str) str¶
Removes the ‘Resource’ prefix from a section’s name
Examples
>>> IniFile.removeResourceName("ResourceCuteLittleEi") "CuteLittleEi"
>>> IniFile.removeResourceName("LittleMissGanyu") "LittleMissGanyu"
- removeSectionOptions(section: str | Pattern | Callable[[str], bool])¶
Removes a certain type of section from the .ini file
- property type: ModType | None¶
The type of mod the .ini file belongs to
- Getter:
Returns the type of mod the .ini file belongs to
- Type:
Optional[
ModType]
- write(txt: str | None = None) str¶
Writes back into the .ini files based off the content in
IniFile._fileLines- Parameters:
txt (Optional[
str]) –The text to write back into the .ini file
If this argument is
None, then will use theIniFile.fileTxtDefault:
none- Returns:
The text that is written to the .ini file
- Return type:
BlendFile¶
- clsBlendFile.getMissingIndicesRemap
- clsBlendFile.remapIndices
- defdecodeLine
- defencodeLine
- deffix
- defisValid
- defprint
- defread
- defremap
- class BlendFile(src: str | bytes)¶
This Class inherits from
BufFileUsed for handling blend.buf files
Note
We observe that a Blend.buf file is a binary file defined as:
a line corresponds to the data for a particular vertex in the mod
each line contains 32 bytes (256 bits)
each line uses little-endian mode (MSB is to the right while LSB is to the left)
the first 16 bytes of a line are for the blend weights, each weight is 4 bytes or 32 bits (4 weights/line)
the last 16 bytes of a line are for the corresponding indices for the blend weights, each index is 4 bytes or 32 bits (4 indices/line)
the blend weights are floating points while the blend indices are unsigned integers
- property bytesPerLine¶
The number of bytes per line (per vertex)
- Getter:
Retrieves the number of bytes per line
- Type:
- property data¶
The bytes read in from the source
- Getter:
Returns the bytes that were read
- Type:
- property elements: List[BufElementType]¶
The sequence of elements within the .buf file
- Getter:
Retrieves the elements
- Setter:
Sets the elements for the .buf file
- Type:
List[
BufElementType]
- encodeLine(src: Dict[str, List[Any]]) bytes¶
Encodes the data about a vertex to their corresponding bytes for the line
- fix(fixedFile: str | None = None, filters: List[Callable[[Dict[str, List[Any]], int, int, int], Dict[str, List[Any]]]] | None = None) str | None | bytearray¶
Fixes the .buf file
- Parameters:
fixedFile (Optional[
str]) –The file path for the fixed .buf file
Default:
Nonefilters (Optional[List[Callable[[Dict[
str, List[Any]],int,int,int], Dict[str, List[Any]]]]]) –The filters to process each element
The filters take in the following arguments:
The data for a particular line
The starting byte index of the line that is read
The line index being processed
The size of each line
The output of the filters is the resultant data that consists where the keys are the names of the elements within a line in the .buf file and the values are the resultant data for each element in the line
- Raises:
BufFileNotRecognized – If the original .buf file provided by the
srcattribute cannot be readBadBufData – If the bytes passed into the
srcattribute do not correspond to the format defined for the .buf file
- Returns:
If the argument
fixedFileisNone, then will return an array of bytes for the fixed .buf file
Otherwise will return the filename to the fixed .buf file if the provided .buf file got corrected- Return type:
- classmethod getMissingIndicesRemap(src: Dict[str, List[int] | List[float]], vgRemap: VGRemap) Dict[int, int]¶
Retrives the temporary remap for any missing blend indices not included in ‘vgRemap’
- Parameters:
- Returns:
The temporary remap for the missing indices.
The keys are the missing indices found and the values are the temporary remapped values for these missing indices
- Return type:
- isValid() bool¶
Whether the size of the data is divisible by the # of bytes per line
- Returns:
Whether the provided data for the .buf file is valid
- Return type:
- print(funcName: str, *args, **kwargs)¶
Prints out output
- Parameters:
- Returns:
The return value from running the corresponding function in the logger
- Return type:
Any
- remap(vgRemap: VGRemap, fixedBlendFile: str | None = None, remapMissingIndices: bool = True) str | None | bytearray¶
Remaps the blend indices in a Blend.buf file
- Parameters:
- Raises:
BlendFileNotRecognized – If the original Blend.buf file provided by the parameter
blendFilecannot be readBadBlendData – If the bytes passed into this function do not correspond to the format defined for a Blend.buf file
- Returns:
If the argument
fixedBlendFileisNone, then will return an array of bytes for the fixed Blend.buf file
Otherwise will return the filename to the fixed RemapBlend.buf file if the provided Blend.buf file got corrected- Return type:
- classmethod remapIndices(src: Dict[str, List[int] | List[float]], vgRemap: VGRemap, remapMissingIndices: bool = True) Dict[str, List[int] | List[float]]¶
Remaps the vertex group indices for a particular line (vertex)
- Parameters:
src (Dict[
str, Union[List[int, List[float]]]]) – The data for the blend weights and the blend indices for a particular vertexvgRemap (
VGRemap) – The vertex group remap for correcting the Blend.buf fileremapMissingIndices (
bool) –Whether to deactivate any missing blend indices that cannot be identified
Default:
True
- Returns:
The new data for the blend weights/blend indices, with the blend indices remapped
- Return type:
BufFile¶
- defdecodeLine
- defencodeLine
- deffix
- defisValid
- defprint
- defread
- class BufFile(src: str | bytes, elements: List[BufElementType], fileType: str = 'Buffer')¶
This class inherits from
BinaryFileA class to handle .buf files
- Parameters:
src (Union[
str,bytes]) – The source file or bytes for the .buf fileelements (List[
BufElementType]) – The sequence of elements within the .buf filefileType (
str) –The name for the type of .buf file
Default:
Buffer
- property bytesPerLine¶
The number of bytes per line (per vertex)
- Getter:
Retrieves the number of bytes per line
- Type:
- property data¶
The bytes read in from the source
- Getter:
Returns the bytes that were read
- Type:
- property elements: List[BufElementType]¶
The sequence of elements within the .buf file
- Getter:
Retrieves the elements
- Setter:
Sets the elements for the .buf file
- Type:
List[
BufElementType]
- encodeLine(src: Dict[str, List[Any]]) bytes¶
Encodes the data about a vertex to their corresponding bytes for the line
- fix(fixedFile: str | None = None, filters: List[Callable[[Dict[str, List[Any]], int, int, int], Dict[str, List[Any]]]] | None = None) str | None | bytearray¶
Fixes the .buf file
- Parameters:
fixedFile (Optional[
str]) –The file path for the fixed .buf file
Default:
Nonefilters (Optional[List[Callable[[Dict[
str, List[Any]],int,int,int], Dict[str, List[Any]]]]]) –The filters to process each element
The filters take in the following arguments:
The data for a particular line
The starting byte index of the line that is read
The line index being processed
The size of each line
The output of the filters is the resultant data that consists where the keys are the names of the elements within a line in the .buf file and the values are the resultant data for each element in the line
- Raises:
BufFileNotRecognized – If the original .buf file provided by the
srcattribute cannot be readBadBufData – If the bytes passed into the
srcattribute do not correspond to the format defined for the .buf file
- Returns:
If the argument
fixedFileisNone, then will return an array of bytes for the fixed .buf file
Otherwise will return the filename to the fixed .buf file if the provided .buf file got corrected- Return type:
- isValid() bool¶
Whether the size of the data is divisible by the # of bytes per line
- Returns:
Whether the provided data for the .buf file is valid
- Return type:
TextureFile¶
- class TextureFile(src: str)¶
This Class inherits from
FileUsed for handling .dds files
- open(format: str = 'RGBA') Image¶
Opens the texture file
- Parameters:
format (
str) –What format the image of the texture file should be opened as
Default: “RGBA”
- Returns:
The image for the texture file
- Return type:
PIL.Image
- print(funcName: str, *args, **kwargs)¶
Prints out output
- Parameters:
- Returns:
The return value from running the corresponding function in the logger
- Return type:
Any
Ini Parts¶
The different parts that are within a .ini file.
IfTemplate¶
- defadd
- deffind
- defgetKeyMissingParts
- defgetMods
- defisKeyFullyCover
- defnormalize
- class IfTemplate(parts: ~typing.List[~FixRaidenBoss2.model.iftemplate.IfTemplatePart.IfTemplatePart], name: str = '', treeCls: ~typing.Type[~FixRaidenBoss2.model.iftemplate.IfTemplateTree.IfTemplateTree] = <class 'FixRaidenBoss2.model.iftemplate.IfTemplateTree.IfTemplateNonEmptyNodeTree'>)¶
Data for storing information about a section in a .ini file
Note
Assuming every if/else clause must be on its own line, we have that an
IfTemplatehave a form looking similar to this:1...(does stuff)... 2...(does stuff)... 3if ...(bool)... 4 if ...(bool)... 5 ...(does stuff)... 6 else if ...(bool)... 7 ...(does stuff)... 8 endif 9else ...(bool)... 10 if ...(bool)... 11 if ...(bool)... 12 ...(does stuff)... 13 endif 14 endif 15endif 16...(does stuff)... 17...(does stuff)...
We split the above structure into parts (
IfTemplatePart) where each part is either:An If Predicate Part (:class:`IfPredPart`): a single line containing the keywords “if”, “else” or “endif”
ORA Content Part (:class:`IfContentPart`): a group of lines that “does stuff”
Note that: an
ifTemplatedoes not need to contain any parts containing the keywords “if”, “else” or “endif”. This case covers the scenario when the user does not use if..else statements for a particular sectionBased on the above assumptions, we can assume that every
[section]in a .ini file contains thisIfTemplateSupported Operations:
- for element in x
Iterates over all the parts of the
IfTemplate,x
- x[num]
Retrieves the part from the
IfTemplate,x, at indexnum
- x[num] = newPart
Sets the part at index
numof theIfTemplate,x, to have the value ofnewPart
- Parameters:
parts (List[
IfTemplatePart]) – The individual parts of how we divided anIfTemplatedescribed abovename (
str) –The name of the section for this
IfTemplateDefault:
""
- parts¶
The individual parts of how we divided an
IfTemplatedescribed above- Type:
List[
IfTemplatePart]
- tree¶
The parse tree for the
IfTemplate. Details on the structure of the tree can be found atIfTemplateTree- Type:
- calledSubCommands¶
Any other sections that this
IfTemplatereferences
The keys are the indices to the
IfContentPartin theIfTemplatethat the section is calledThe values are the referenced sections within the
IfContentPart
- hashes¶
The hashes this
IfTemplatereferences- Type:
Set[
str]
- indices¶
The indices this
IfTemplatereferences- Type:
Set[
str]
- treeCls¶
The class to construct the parse tree for the
IfTemplate
Default:
IfTemplateTree- Type:
Type[
IfTemplateTree]
- add(part: IfTemplatePart, updateTree: bool = False)¶
Adds a part to the
ifTemplate- Parameters:
part (
IfTemplatePart) – The part to add to theIfTemplateupdateTree (
bool) –Whether to update the parse tree for the
IfTemplate
Default:
False
- find(pred: Callable[[IfTemplate, int, IfTemplatePart], bool] | None = None, postProcessor: Callable[[IfTemplate, int, IfTemplatePart], Any] | None = None) Dict[int, Any]¶
Searches the
IfTemplatefor parts that meet a certain condition- Parameters:
pred (Optional[Callable[[
IfTemplate,int,IfTemplatePart],bool]]) –The predicate used to filter the parts
If this value is
None, then this function will return all the parts
The order of arguments passed into the predicate will be:
The
IfTemplatethat this method is calling fromThe index for the part in the
IfTemplateThe current part of the
IfTemplate
Default:
NonepostProcessor (Optional[Callable[[
IfTemplate,int,IfTemplatePart], Any]]) –A function that performs any post-processing on the found part that meets the required condition
The order of arguments passed into the post-processor will be:
The
IfTemplatethat this method is calling fromThe index for the part in the
IfTemplateThe current part of the
IfTemplate
If this value is
None, then will return the foundIfTemplatePart
Default:
None
- Returns:
The filtered parts that meet the search condition
The keys are the index locations of the parts and the values are the found parts
- Return type:
Dict[
int, Any]
- getKeyMissingParts(key: str, sections: Dict[str, IfTemplate], visited: Set[str], sectionsMissingParts: Dict[str, Set[IfContentPart]], sectionAllBranchesMissing: Dict[str, bool]) Set[IfContentPart]¶
Finds all the
IfContentPart`s that are referenced by this :class:`IfTemplatethat do not have the search ‘key’- Parameters:
key (
str) – The key to searchsections (Dict[
str,IfTemplate]) –The available sections in the graph (
IniSectionGraph) where thisIfTemplatebelongs to
The keys are the names for each section and the values are the corresponding
IfTemplatefor each sectionvisited (Set[
str]) – The names of the sections that have been visited by this methodsectionsMissingParts (Dict[
str,bool]) – The result of theIfContentPartwith missing keys for a particular section after searching all of its branches (names of sections that this method has finished visiting)sectionallBranchesMissing (Dict[
str,bool]) –Whether all the branches within some section are missing the key to search
The keys are the names for each section and the values are whether the section has the key missing in all its branches
- getMods(hashRepo: Hashes, indexRepo: Indices, version: float | None = None) Set[str]¶
Retrieves the corresponding mods the
IfTemplatewill fix to- Parameters:
- Returns:
Names of all the types of mods the
IfTemplatewill fix to- Return type:
Set[
str]
- isKeyFullyCover(key: str, sections: Dict[str, IfTemplate], visited: Set[str], sectionsKeyFullCover: Dict[str, bool]) bool¶
Checks whether a key appears in all branches of the
IfTemplate- Parameters:
key (
str) – The key to searchsections (Dict[
str,IfTemplate]) –The available sections in the graph (
IniSectionGraph) where thisIfTemplatebelongs to
The keys are the names for each section and the values are the corresponding
IfTemplatefor each sectionvisited (Set[
str]) – The names of the sections that have been visited by this methodsectionsKeyFullCover (Dict[
str,bool]) – The result of whether a particular section has the target key after searching of its branches (names of sections that this method has finished visiting)
- Returns:
Whether the key appears in all conditional branches
- Return type:
- normalize()¶
Normalizes the branching structure within this
ifTemplateto follosw the structure described atIfTemplateNormTree
IfTemplatePart¶
- deftoStr
- class IfTemplatePart¶
Base class for some part in an
IfTemplates
IfPredPart¶
- class IfPredPart(pred: str, type: IfPredPartType)¶
This class inherits from
IfTemplatePartClass for defining the predicate part of an
IfTemplateNote
see
IfTemplatefor more details- Parameters:
pred (
str) – The predicate string within theIfTemplatetype (
IfPredPartType) – The type of predicate encountered
- pred¶
The predicate string within the
IfTemplate- Type:
- type¶
The type of predicate encountered
- Type:
IfContentPart¶
- defaddKVP
- defaddKVPToFront
- defget
- defgetVals
- defremapKeys
- defremoveKey
- defremoveKeys
- defreplaceVals
- deftoStr
- class IfContentPart(src: Dict[str, List[Tuple[int, str]]], depth: int)¶
This class inherits from
IfTemplatePartClass for defining the content part of an
IfTemplateNote
see
IfTemplatefor more detailsSupported Operations:
- key in x
Determines if ‘key’ exists in the content part of the
IfContentPart
- x[key]
Retrieves the corresponding data value from the
IfContentPartbased off ‘key’
If ‘key’ is an
int, then will retrieve a tuple containing:Otherwise, will retrieve the corresponding value from
IfContentPart.src()
- for key, val, keyInd, orderInd in x
Iterates over all the key/value initializations and updates within the
IfContentPart,x
The tuples to iterate over are as follows:
key: (
str) A particular key in theIfContentPartval: (
str) The corresponding value to the keykeyInd: (
int) The occurence index of the same key within theIfContentPartorderInd: (:class:``int) The order index the KVP appears in the overall
IfContentPart
- Parameters:
src (Dict[
str, List[Tuple[int,str]]]) –The source for the part in the
IfTemplate
The keys are the name of the keys in the part
The values are the coresponding values for the keys for all instances where the particular key got instantiated/updated. Each element in the list contains:
depth (
int) – The depth the part is within theIfTemplate
- src¶
The source for the part in the
IfTemplate
The keys are the name of the keys in the part
- depth¶
The depth the part is within the
IfTemplate- Type:
- _order¶
- addKVP(key: str, value: str, toFront: bool = False)¶
Adds a new KVP into the part
- Parameters:
key (
str) – The name of the keyvalue (
str) – The corresponding value to the keytoFront (
bool) –Whether to add the new KVP to the front of the part
Warning
Please see the warning at
addKVPToFront()
- addKVPToFront(key: str, value: str)¶
Adds a new KVP into the part
Warning
This operation will take O(n) time, where n is the # of `KVP`_s within the part
- get(key: str | int, default: Any | None = None) List[Tuple[int, str]] | str | Any¶
Retrieves the corresponding data value from the
IfContentPartbased off ‘key’
If ‘key’ is an
int, then will retrieve a tuple containing:Otherwise, will retrieve the corresponding value from
IfContentPart.src()
If the ‘key’ is not found, then will return the value from ‘default’
Note
This is the same as the getitem operator specified for this class, but will return a default value if the key is not found
Paramters¶
- remapKeys(keyRemap: Dict[str, KeyRemapData | List[str | Tuple[str, Callable[[str, str], bool]] | RemappedKeyData]])¶
Remaps the keys in the `KVP`_s of the parts
- Parameters:
keyRemap (Dict[
str, Union[KeyRemapData, List[Union[str, Tuple[str, Callable[[str,str],bool]],RemappedKeyData]]]]) –The remap for the keys, where:
The keys are the old names of the keys to be remapped
the values are either:
The data for remapping a particular key OR
A list containing either:
The new names of the keys to remap to OR
A tuple containing a new name for the key to remap to and a predicate that takes in the old key and value of whether to remap the key. OR
A class that contains all the necessary information for remapping to the new key
- removeKey(key: str | Tuple[str, Callable[[Tuple[int, str]], bool]])¶
Removes a key from the part.
- Parameters:
key (
str) –The key to remove.
If given only a string, will delete all instances of the key.
If given a tuple containing a string and a predicate, will delete all the keys that satisfy the predicate. The predicate takes in a tuple that contains:
- removeKeys(keys: Set[str | Tuple[str, Callable[[Tuple[int, str]], bool]]])¶
Removes multiple keys from the part
- Parameters:
keys (Set[Union[
str, Callable[[Tuple[int,str]],bool]]]) –The keys to remove.
If given only a string, will delete all instances of the key.
If given a tuple containing a string and a predicate, will delete all the keys that satisfy the predicate. The predicate takes in a tuple that contains:
- replaceVals(newVals: Dict[str, str | List[str] | Tuple[str, Callable[[str], bool]]], addNewKVPs: bool = True)¶
Replaces the values in the `KVP`_s of the parts or adds in new `KVP`_s if the original key did not exist
- Parameters:
newVals (Dict[
str, Union[str, List[str], Tuple[str, Callable[[str],bool]]]]) –The new values for the KVP`_s in the parts :raw-html:`<br />
The keys are the corresponding keys for the `KVP`_s
The values can either contain:
A string, which represents the new value for all instances of the key OR
A list of strings, representing the individual new values for each instance of the key OR
A tuple containing a string and a predicate, representing the new value for certain instances of the key that satisfy the predicate. The predicate takes in the old value of the KVP as an argument
addNewKVPs (
bool) –Whether to add new KVPs if the corresponding key in ‘newVals’ does not exist
Default:
None
- property src¶
The raw content of the part
The keys are the names of the keys in the content part of the
IfTemplate. Note that the same key can appear multiple times in a particular content part.- The values consists of:
The order index the KVP appeared in the
IfContentPartThe corresponding value for the key
KeyRemapData¶
- class KeyRemapData(remappedKeys: List[RemappedKeyData], keepKeyWithoutRemap: bool = False)¶
Class to store data about a remapping a particular register
Supported Operations:
- x[ind]
Retrieves the corresponding
RemappedKeyDatabased off the index, ‘ind’
- len(x)
Retrieves the number of keys to remap to
- for remapped key in x
Iterates through all the data of the keys to remap to
- Parameters:
remappedKeys (List[
RemappedKeyData]) – The new registers to remap the old register tokeepKeyWithoutRemap (
bool) –Whether retain the old register, if the old register does not get remapped
Default:
False
- remappedKeys¶
The new registers to remap the old register to
- Type:
List[
RemappedKeyData]
- keepKeyWithoutRemap¶
Whether retain the old register, if the old register does not get remapped
- Type:
- classmethod build(remappedKeys: KeyRemapData | List[str | Tuple[str, Callable[[str, str], bool]] | RemappedKeyData], keepKeyWithoutRemap: bool = False) KeyRemapData¶
Build the object based off the raw ‘remappedKeys’ provided
- Parameters:
remappedKeys (Union[
KeyRemapData, List[Union[str, Tuple[str, Callable[[str,str],bool]],RemappedKeyData]]]) –raw data to provide into the object that contains either:
The data for remapping a particular key OR
A list containing:
The new names of the keys to remap to OR
A tuple containing a new name for the key to remap to and a predicate that takes in the old key and value of whether to remap the key. OR
A class that contains all the necessary information for remapping to the new key
keepKeyWithoutRemap (
bool) –Whether retain the old register, if the old register does not get remapped
Default:
False
RemappedKeyData¶
- class RemappedKeyData(key: str, check: Callable[[str, str], bool] | None = None, toInd: int | None = None)¶
Class to store data about a remapped register within a .ini section
- Parameters:
key (
str) – The new register name to remap the old register tocheck (Optional[Callable[[
str,str],bool]]) –Predicate to check whether to remap to the new register
The predicate takes in:
the old register name
the old register value
Default:
NonetoInd (Optional[
int]) –Whether to shift the remapped register to a particular index within the
IfContentPart
Default:
None
- toInd¶
Whether to shift all the remapped register to a particular index within the
IfContentPart- Type:
Optional[
int]
- classmethod build(data: str | Tuple[str, Callable[[str, str], bool]] | RemappedKeyData) RemappedKeyData¶
Builds the object based off the raw ‘data’ provided
- Parameters:
data (Union[
str, Tuple[str, Callable[[str,str],bool]]]) –The data to provide into the
RemappedKeyDataclass
The provided data either contains:
The new name of the key to remap to OR
A tuple containing a new name for the key to remap to and a predicate that takes in the old key and old value of whether to remap the key. OR
The object that contains all the necessary information for remapping to the new key
- Returns:
The constructed object
- Return type:
IfTemplateTree¶
- class IfTemplateTree¶
The parse tree for some
IfTemplateNote
The parse tree for the
IfTemplateis structured such that:A node conposes of
IfContentPartor other nodesThe children to the node occurs when the node enters a specific branching condition
eg. Suppose we have this branching structure
1...(does stuff)... 2if ...(bool)... 3 if ...(bool)... 4 ...(does stuff)... 5 else if ...(bool)... 6 ...(does stuff)... 7 endif 8else ...(bool)... 9 ...(does stuff)... 10 if ...(bool)... 11 if ...(bool)... 12 ...(does stuff)... 13 endif 14 ...(does stuff)... 15 endif 16 ...(does stuff)... 17 if 18 endif 19endif 20...(does stuff)...
Let C be some
IfContentPart(the parts that says …(does stuff)…) Let B be some branching point (the parts that say if or else) Let […] be some node Let X be a node without any partsThe parse tree generated for the above code would be:
[C B B C] | | +----+ +----+ | | [B B] [C B C B] | | | | +--+ +--+ [B C] X | | | [C] [C] [C]
- clear()¶
Clears the tree
- classmethod construct(parts: List[IfTemplatePart])¶
Constructs the parse tree
- Parameters:
parts (List[
IfTemplatePart]) – The parts within theIfTemplate
- property root¶
The root node in the parse tree
- Getter:
Retrieves the root node
- Type:
IfTemplateNonEmptyNodeTree¶
- class IfTemplateNonEmptyNodeTree¶
This class inherits from
IfTemplateTreeA variation of
IfTemplateTreesuch that leaf nodes that do not have any parts (eg. empty conditions) will include a emptyIfContentPartplaceholder.Tip
See
IfTemplateTreeon the basic structure of the parse tree for anIfTemplate
So conditions with forms of:
if endif
that have the following parse subtree:
[B] | X
will now become:
if ...(does nothing)... endif
with the following parse subtree:
[B] | [C]
Note
eg. Suppose we have this branching structure (same structure from the example at
IfTemplateTree)1...(does stuff)... 2if ...(bool)... 3 if ...(bool)... 4 ...(does stuff)... 5 else if ...(bool)... 6 ...(does stuff)... 7 endif 8else ...(bool)... 9 ...(does stuff)... 10 if ...(bool)... 11 if ...(bool)... 12 ...(does stuff)... 13 endif 14 ...(does stuff)... 15 endif 16 ...(does stuff)... 17 if 18 endif 19endif 20...(does stuff)...
Let C be some
IfContentPart(the parts that says …(does stuff)…) Let B be some branching point (the parts that say if or else) Let […] be some node Let X be a node without any partsThe parse tree generated for the above code would be:
[C B B C] | | +----+ +----+ | | [B B] [C B C B] | | | | +--+ +--+ [B C] | | | | | [C] [C] [C] [C]
- clear()¶
Clears the tree
- classmethod construct(parts: List[IfTemplatePart])¶
Constructs the parse tree
Note
The construction may change ‘parts’
- Parameters:
parts (List[
IfTemplatePart]) – The parts within theIfTemplate
- property root¶
The root node in the parse tree
- Getter:
Retrieves the root node
- Type:
IfTemplateNormTree¶
- class IfTemplateNormTree¶
This class inherits from
IfTemplateNonEmptyNodeTreeA variation of
IfTemplateNonEmptyNodeTreesuch that an emptyelseclause will be added for branches that do not end with a singleelseTip
See
IfTemplateTreeon the basic structure of the parse tree for anIfTemplate
So conditions with forms of:
if ...(does stuff)... else if ...(does stuff)... endif
that have the following parse subtree:
[B B] | | +-+ +-+ | | [C] [C]
will now become:
if ...(does stuff)... else if ...(does stuff)... else ...(does nothing)... endif
with the following parse subtree:
[B B B] | | | +-+ | +-+ | [C] | [C] [C]
Note
eg. Suppose we have this branching structure (same structure from the example at
IfTemplateTree)1...(does stuff)... 2if ...(bool)... 3 if ...(bool)... 4 ...(does stuff)... 5 else if ...(bool)... 6 ...(does stuff)... 7 endif 8else ...(bool)... 9 ...(does stuff)... 10 if ...(bool)... 11 if ...(bool)... 12 ...(does stuff)... 13 endif 14 ...(does stuff)... 15 endif 16 ...(does stuff)... 17 if 18 endif 19endif 20...(does stuff)...
This class will turn this branching structure into:
1...(does stuff)... 2if ...(bool)... 3 if ...(bool)... 4 ...(does stuff)... 5 else if ...(bool)... 6 ...(does stuff)... 7 else 8 ...(does nothing)... 9 endif 10else ...(bool)... 11 ...(does stuff)... 12 if ...(bool)... 13 if ...(bool)... 14 ...(does stuff)... 15 else 16 ...(does nothing)... 17 endif 18 ...(does stuff)... 19 else 20 ...(does nothing)... 21 endif 22 ...(does stuff)... 23 if 24 ...(does nothing)... 25 else 26 ...(does nothing)... 27 endif 28endif 29...(does stuff)...
Let C be some
IfContentPart(the parts that says …(does stuff)…) Let B be some branching point (the parts that say if or else) Let […] be some node Let X be a node without any partsThe parse tree generated for the above code would be:
[C B B C] | | +----+ +-------+ | | [B B B] [C B B C B B] | | | | | | | +--+ | +-+ +-+ +-+ | +--+ | | | | | | | [C] [C] [C] [B B C] | +-+ | | | | | [C] +-+ | [C] | | | [C] [C] [C]
- clear()¶
Clears the tree
- classmethod construct(parts: List[IfTemplatePart])¶
Constructs the parse tree
Note
The construction may change ‘parts’
- Parameters:
parts (List[
IfTemplatePart]) – The parts within theIfTemplate
- property root¶
The root node in the parse tree
- Getter:
Retrieves the root node
- Type:
IfTemplateNode¶
- clsIfTemplateNode.generateId
- defaddChild
- defaddIfContentPart
- defgetKeyMissingPart
- defgetKeyValues
- defhasKey
- class IfTemplateNode(id: Hashable | None = None, ifPredPart: IfPredPart | None = None)¶
This class inherits from
NodeA node within the parse tree of the
IfTemplate. This node contains a subset of theIfContentPartfrom the originalIfTemplateNote
For more details on the structure of the parse tree of an
IfTemplate, seeIfTemplateTree- Parameters:
id (Optional[Hashable]) –
The id for the node
If this argument is
None, then will generate the id for the node usinggenerateId()ifPredPart (Optional[
IfPredPart]) – The predicate part that is associated with this node
- id¶
The id for the node
- Type:
Hashable
- children¶
The children to this node
The keys are the ids of the children nodes and the values are the corresponding nodes for the children
- Type:
Dict[Hashable,
IfTemplateNode]
- parts¶
The parts of the
IfTemplatewithin the node- Type:
List[Union[
IfContentPart,IfTemplateNode]]
- partInd¶
The index of some
IfContentPartwithin theIfTemplate
The keys are the index position of the
IfContentPartwithin this node and the values are the index position of theIfContentPartwithin theIfTemplate
- addChild(node: IfTemplateNode)¶
Adds a child to the node
- Parameters:
node (
IfTemplateNode) – The child to be added
- addIfContentPart(part: IfContentPart)¶
Adds an
IfContentPartto the node- Parameters:
part (
IfContentPart) – The content part of theIfTemplateto add to this node
- getKeyMissingPart(key: str) Tuple[IfContentPart | None, bool]¶
Retrieves the first
IfContentPartif ‘key’ is not found in this node, without accounting for the key being in any other subcommands or other children nodes- Parameters:
key (
str) – The key to find- Returns:
A tuple containing:
The first part found, if all the :class:`IfContent`s within the node does not contain the key
Whether a
IfContentPartis found within the node
- Return type:
Tuple[Optional[
IfContentPart],bool]
- getKeyValues(key: str) List[List[Tuple[int, str]]]¶
Retrieves all the corresponding values to a certain key within the node
- Parameters:
key (
str) – The key to find- Returns:
All the corresponding values to the key in the node
- Return type:
IniSectionGraph¶
- def_dfsExplore
- defbuild
- defconstruct
- defgetCommonMods
- defgetKeyMissingParts
- defgetRemapNames
- defgetSection
- defisKeyFullyCover
- deftargetsAreFullyCovered
- deftargetsGetKeyMissingParts
- class IniSectionGraph(targetSections: Set[str] | List[str], allSections: Dict[str, IfTemplate], remapNameFunc: Callable[[str, str], str] | None = None, modsToFix: Set[str] | None = None)¶
Class for constructing a directed subgraph for how the sections in the .ini file are ran
Note
- Parameters:
sections (Set[
str]) – Names of the desired sections we want our subgraph to have from the sections of the .ini fileallSections (Dict[
str,IfTemplate]) –All the sections for the .ini file
Note
You can think of this as the adjacency list for the directed graph of all sections in the .ini file
remapNameFunc (Optional[Callable[[
str,str],str]]) –Function to get the corresponding remap names for the section names
If this value is
None, then will not get the remap names for the sections
The parameters for the function are:
Name of the section
Name fo the type of mod to fix
Default:
FalsemodsToFix (Optional[Set[
str]]) –The names of the mods that will be fixed by the .ini file
Default:
None
- remapNameFunc¶
Function to get the corresponding remap names for the section names
The parameters for the function are:
Name of the section
Name fo the type of mod to fix
- _dfsExplore(section: IfTemplate, visited: Dict[str, IfTemplate], runSequence: List[Tuple[str, IfTemplate]])¶
The typical recursive implementation of DFS for exploring a particular section (node)
- Parameters:
section (
IfTemplate) – The section that is currently being exploredvisited (Dict[
str,ifTemplate]) – The sections that have already been visitedrunSequence (List[Tuple[
str,IfTemplate]]) – The order the sections will be ran
- property allSections¶
All the sections of the .ini file
Note
You can think of this as the adjacency list for the directed graph of all sections in the .ini file
- Getter:
All the sections for the .ini file
- Setter:
Constructs a new subgraph based on the new sections for the .ini file
- Type:
Dict[
str,IfTemplate]
- build(newTargetSections: Set[str] | List[str] | None = None, newAllSections: Dict[str, IfTemplate] | None = None, newModsToFix: Set[str] | None = None)¶
Performs the initialization for rebuilding the subgraph
- Parameters:
newTargetSections (Optional[Set[
str], List[str]]) –The new desired sections we want in our subgraph
Default:
NonenewAllSections (Optional[Dict[
str,IfTemplate]]) –The new sections for the .ini file
Default:
NonenewModsToFix (Optional[Set[
str]]) –The new desired names of the mods that we want to fix for the .ini file
Default:
None
- construct() Dict[str, IfTemplate]¶
Constructs the subgraph for the sections using DFS
- Returns:
The sections that are part of the subgraph
- Return type:
Dict[
str,IfTemplate]
- getCommonMods(hashRepo: Hashes, indexRepo: Indices, version: float | None = None) Set[str]¶
Retrieves the common mods to fix to based off all the :class:`IfTemplate`s in the graph
- Parameters:
- Returns:
The common mods to fix to
- Return type:
Set[
str]
- getKeyMissingParts(key: str) Dict[str, Set[IfContentPart]]¶
Retrieves the parts in the sections that are not covered by ‘key’
- Parameters:
key (
key) – The target key to search- Returns:
The result for each section of the parts that ‘key’ does not cover
Tip
To filter only the result for sections that are the source nodes of the graph, you can call
targetsGetKeyMissingParts()instead- Return type:
- getRemapNames(newModsToFix: Set[str] | None = None) Dict[str, Dict[str, str]]¶
Retrieves the corresponding remap names of the sections made by this fix
- getSection(sectionName: str, raiseException: bool = True) IfTemplate | None¶
Retrieves the
IfTemplatefor a certain section- Parameters:
raiseException (
bool) – Whether to raise an exception when the section’sIfTemplateis not found
- Raises:
KeyError – If the
IfTemplatefor the section is not found andraiseExceptionis set toTrue- Returns:
The corresponding
IfTemplatefor the section- Return type:
Optional[
IfTemplate]
- isKeyFullyCover(key: str) Dict[str, bool]¶
Determines whether a key fully covers all the conditional branches of a section
- Parameters:
key (
key) – The target key to search- Returns:
The result for each section of whether the section has the key fully covering all its conditional branches
Tip
To filter only the result for sections that are the source nodes of the graph, you can call
targetsAreFullyCovered()instead- Return type:
- property modsToFix¶
The names of the mods that will be fixed by the .ini file
- Getter:
Retrieves the names of the mods to fix
- Type:
Set[
str]
- property remapNames¶
The corresponding names for the sections that the fix will make
- property runSequence¶
The order the sections will be ran
- Getter:
Retrieves the order the sections will be ran
- Type:
List[Tuple[
str,IfTemplate]]
- property sections¶
The sections that are part of the contructed subgraph based on the desired sections specified at
IniSectionGraph.targetSectionsNote
You can think of this as the adjacency list for the subgraph
- Getter:
All the sections for the subgraph
- Type:
Dict[
str,IfTemplate]
- property targetSections: List[str]¶
Names of the desired sections we want our subgraph to have from the sections of the .ini file
- targetsAreFullyCovered(key: str) Dict[str, bool]¶
Convenience function of
isKeyFullyCover()to determine whether the target sections fromtargetSections()are fully covered by a key in all their conditional branches
- targetsGetKeyMissingParts(key: str) Dict[str, bool]¶
Convenience function of
getKeyMissingParts()to get the parts referenced by the target sections fromtargetSections()that do not contain ‘key’
Ini Classifiers¶
These entities help identify what type of mod the software is fixing
BaseIniClassifier¶
- defclassify
- class BaseIniClassifier¶
Base class to help classify the type of mod given the mod’s .ini files
- classify(iniTxt: str | List[str], checkIsMod: bool = True, checkIsFixed: bool = True) IniClassifyStats¶
Determines the type of mod given the text from the mod’s .ini file
- Parameters:
iniTxt (Union[
str, List[str]]) –The text of the .ini file to read from, given as either:
the full text OR
lines of text with each line ending with a newline character
checkIsMod (
bool) –Whether to fully check the .ini file belongs to a mod
Default:
TruecheckIsFixed (
bool) –Whether to fully check the .ini file has been fixed
Default:
True
- Returns:
The stats about the classification of the .ini file
- Return type:
IniClassifier¶
- clsIniClassifier.getSectionName
- def_addTransition
- def_transition
- defbuild
- defcheckOnlyIsFixedOrisMod
- defclassify
- defclear
- defreadLine
- defreset
- defsetIsFixed
- defsetIsFixedAndIsMod
- defsetIsMod
- class IniClassifier(builder: BaseIniClassifierBuilder | None = None, ahoCorasickCls: Type[BaseAhoCorasickDFA] | None = None)¶
This class inherits from
BaseIniClassifierClass to help classify the type of mod given the mod’s .ini files
This classifier will read each line in the .ini file, and performs the following:
Keywords in a line are first quickly identified and filtered using Aho-Corasick . The large majority of the lines in a .ini file will be identified through this method.
State information between different lines in a .ini file are stored in a DFA
If there are any further ambiguity that keyword searching cannot solve, will perform any needed post-processing on the line (eg. regex matching). Very little to no lines in a .ini file will need to resort to such method.
- Parameters:
builder (Optional[
BaseIniClassifierBuilder]) –The builder used to build the data within the classifier
If this argument is
None, the constructor will not automatically build the data in the classifier and the user must callbuild()
Default:
NoneahoCorasickCls (Optional[Type[:class:BaseAhoCorasickDFA`]]) –
The class implementation of Aho-Corasick to use
If this parameter is
None, then will try toFastAhoCorasickDFAif possible, otherwise will fall back toAhoCorasickDFA
Default:
None
- builder¶
The builder used to build the data within the classifier, if available
- Type:
Optional[
BaseIniClassifierBuilder]
- _keywordDFA¶
The DFA that will use Aho-Corasick to quickly search/filter keywords in a line in the .ini file
- Type:
- _addTransition(srcStateId: Hashable, transition: str, destStateId: Hashable, transitionVal: ModType | None | IniClsAction | Callable[[IniClsActionArgs], Any])¶
Convenience function to add a transition to the classifier
- Parameters:
srcStateId (Hashable) – The id of the source state
transition (
str) – The keyword to trigger the transitiondestStateId (Hashable) –
The id of the destionation state
Note
If this state is created from this function, the state will not be an accepting state
transitionVal (Union[Optional[
ModType],IniClsAction, Callable[[IniActionArgs], Any]]) – The corresponding value to store at the transition
- _transition(stats: IniClassifyStats, line: str, keyword: str, keywordInd: int = -1, keywordEndInd: int = -1, keywordVals: IniClsTransitionVals | None = None)¶
Transitions the classifier to another state
- Parameters:
stats (
IniClassifyStats) – The resultant stats to store the classification result of the .ini fileline (
str) – The line in the .ini file that was readkeyword (
str) – The keyword found from the line of the .ini file readkeywordInd (
int) –The index where the keyword was found
Default:
-1keywordEndInd (
int) –The ending index of where the keyword was found
Default:
-1keywordVals (
IniClsTransitionVals) –The corresponding values for the keyword found
Default:
None
- build(builder: BaseIniClassifierBuilder)¶
Rebuilds the classifier
- Parameters:
builder (
BaseIniClassifierBuilder) – The builder to help build the classifier
- checkOnlyIsFixedOrisMod(line: str, stats: IniClassifyStats)¶
Reads a line in the .ini file and checks whether the line contains keywords for:
Whether the .ini file belongs to a mod OR
Whether the .ini file is fixed
- Parameters:
line (
str) – The line from the .ini file to readstats (
IniClassifyStats) – The resultant stats to store the classification result of the .ini file
- classify(iniTxt: str | List[str], checkIsMod: bool = True, checkIsFixed: bool = True) IniClassifyStats¶
Determines the type of mod given the text from the mod’s .ini file
- Parameters:
iniTxt (Union[
str, List[str]]) –The text of the .ini file to read from, given as either:
the full text OR
lines of text with each line ending with a newline character
checkIsMod (
bool) –Whether to fully check the .ini file belongs to a mod
Default:
TruecheckIsFixed (
bool) –Whether to fully check the .ini file has been fixed
Default:
True
- Returns:
The stats about the classification of the .ini file
- Return type:
- clear()¶
Clears all the saved data in the classifier
- classmethod getSectionName(line: str) str¶
Retrieves the name of a section from a line in the .ini file
- readLine(line: str, stats: IniClassifyStats)¶
Reads a single line in a .ini file
Note
If you do not care about what type of mod is returned and only want to know whether the .ini file belongs to a mod or has already been fixed, then it is recommended to use the
checkOnlyIsFixedOrisMod()method instead for faster computation- Parameters:
line (
str) – The line in the .ini filestats (
IniClassifyStats) – The resultant stats to store the classification result of the .ini file
- reset()¶
Resets the state the classifier is at
- setIsFixed(keyword: str, stats: IniClassifyStats)¶
Marks the .ini file to be fixed, after checking ‘keyword’
- Parameters:
keyword (
str) – The keyword to trigger the .ini file to be considered as fixedstats (
IniClassifyStats) – The resultant stats to store the classification result of the .ini file
- setIsFixedAndIsMod(keyword: str, stats: IniClassifyStats)¶
Marks the .ini file to belong to a mod and is fixed, based off the ‘keyword’s
- Parameters:
keyword (
str) – The keyword to trigger the .ini file to be a .ini file that belongs to some mod and the .ini file to be fixedstats (
IniClassifyStats) – The resultant stats to store the classification result of the .ini file
- setIsMod(keyword: str, stats: IniClassifyStats)¶
Marks the .ini file to belong to a mod, based off the ‘keyword’
- Parameters:
keyword (
str) – The keyword to trigger the .ini file to be a .ini file that belongs to some modstats (
IniClassifyStats) – The resultant stats to store the classification result of the .ini file
BaseIniClassifierBuilder¶
- defbuild
- class BaseIniClassifierBuilder¶
Base class to help build/customize a
IniClassifier- build(classifier: IniClassifier) IniClassifier¶
Builds/customize a
IniClassifier- Parameters:
classifier (
IniClassifier) – The classifier to build- Returns:
The classifier that has been built
- Return type:
IniClassifierBuilder¶
- def_addKeywordGroup
- defaddGIModType
- defbuild
- class IniClassifierBuilder¶
This class inherits from
BaseIniClassifierBuilder
Class to help build/customize a
IniClassifierused for this software- _addKeywordGroup(classifier: IniClassifier, keywords: List[str], srcStateId: Hashable, keywordsStateId: Hashable, transitionVal: ModType | None | IniClsAction | Callable[[IniClassifier, IniClassifyStats, str, str, Hashable, Hashable, bool, bool], Any])¶
Convenience function to add many keywords that transition from the same source state to the same destionation state
- Parameters:
classifier (
IniClassifier) – The classifier to identify mods from .ini fileskeywords (List[
str]) – The keywords to addsrcStateId (Hashable) – The id of the source state
keywordsStateId (Hashable) –
The id of the destionation state
Note
If this function creates the destionation state, the destionation state will not be an accepting state
transitionVal (Union[Optional[
ModType],IniClsAction, Callable[[IniClassifier,IniClassifyStats,str,str, Hashable, Hashable,bool,bool], Any]]) –The corresponding value to store at the transition
If this value is a function, refer to
IniClsAction.run()for the specifics of what paramters to pass to the function
- addGIModType(classifier: IniClassifier, modType: ModType, keywords: Dict[str | None, str | None | Pattern | Callable[[IniClsActionArgs], bool]])¶
Convenience function to add a mod type from the game GI
- Parameters:
classifier (
IniClassifier) – The classifier to identify mods from .ini filesmodType (
ModType) – The type of mod to registerkeywords (Dict[Optional[
str, Union[Optional[str, Pattern, Callable[[IniClsActionArgs],bool]]]]]) –The keywords used to identify the mod
The keys are the keywords to identify the type of mod when reading a line from the .ini file
The values are any further checks to verify the keyword
If value is a string, then will check if a line in the .ini file equals to this value
If value is a regex pattern, then will check if a line in the .ini file matches this regex pattern
If this value is a function, then will check if a line in the .ini file will make the function for this value return True
- build(classifier: IniClassifier)¶
Builds/customize a
IniClassifier- Parameters:
classifier (
IniClassifier) – The classifier to build- Returns:
The classifier that has been built
- Return type:
IniClassifyStats¶
- class IniClassifyStats(modType: ModType | None = None, isMod: bool = False, isFixed: bool = False)¶
A class that stores the statistics about the classification result of a .ini file
- Parameters:
IniClsActionArgs¶
- class IniClsActionArgs(classifier: IniClassifier, stats: IniClassifyStats, line: str, keyword: str, keywordInd: int, keywordEndInd: int, prevStateId: Hashable, currentStateId: Hashable, isAccept: bool, transitionMade: bool)¶
Class to store the arguments for a
IniClsAction- Parameters:
classifier (
IniClassifier) – The classifier to identify a mod given a .ini filestats (
IniClassiyStats) – The resultant stats about the classification of the .ini fileline (
str) – The current line being read from the .ini filekeyword (
str) – The keyword found from the current line read from the .ini filekeywordInd (
int) – The start index where the keyword was foundkeywordEndInd (
int) – The end index of the keywordprevStateId (Hashable) – The id of the previous state the classifier was on
currentStateId (Hashable) – The id of the current state the classifier is on
isAccept (
bool) – Whether the current state is an accepting statetransitionMade (
bool) – Whether a transition was made from the prevous state to the current state
- classifier¶
The classifier to identify a mod given a .ini file
- Type:
- stats¶
The resultant stats about the classification of the .ini file
- Type:
IniClassiyStats
IniClsAction¶
- class IniClsAction¶
Base class to handle any post-processing action to run after the
IniClassifiertransitions to a new state when a keyword is found in a lineSupported Operations:
- x(args)
Runs the action
xon the passed in arguments fromIniClsActionArgs
IniClsCond¶
- class IniClsCond(conds: List[Callable[[IniClsActionArgs], bool]], actions: List[IniClsAction | Callable[[IniClsActionArgs], Any]], default: IniClsAction | None | Callable[[IniClsActionArgs], Any])¶
This class inherits from
IniClsActionAn action for the
IniClassifierto handle branching conditionsSupported Operations:
- x(classifier, line, keyword, prevStateId, currentStateId, isAccept, transtionMade)
Calls
run()for theIniClsCond,x
- Parameters:
conds (List[Callable[[
IniClsActionArgs],bool]]) –A list of predicates to evaluate.
Tip
For a condition at position i in conds (conds[i]), you can assume the set of values that will be evaulated at this condition will be the values that do not satisfy the previous conditions (does not satisfy any condition at position j, where j < i)
Simply, the standard if … else … structure you expect from other programming languages
actions (List[Union[
IniClsAction, Callable[[IniClsActionArgs], Any]]]) – The actions to run after its corresponding predicate at ‘conds’ is evaluated to be truedefault (Union[Optional[
IniClsAction], Callable[[IniClsActionArgs], Any]]) – The default action to run if none of the predicates are satisfied
- conds¶
A list of predicates to evaluate.
- Type:
List[Callable[[
IniClsActionArgs],bool]]
- actions¶
The actions to run after its corresponding predicate at ‘conds’ is evaluated to be true
- Type:
List[Union[
IniClsAction, Callable[[IniClsActionArgs], Any]]]
- default¶
The default action to run if none of the predicates are satisfied
- Type:
Union[Optional[
IniClsAction], Callable[[IniClsActionArgs], Any]]
IniClsTransitionVals¶
- class IniClsTransitionVals(dict=None, /, **kwargs)¶
This class inherits from UserDict
Stores the values corresponding to the keyword transitions of
IniClassifier- clear() None. Remove all items from D.¶
- get(k[, d]) D[k] if k in D, else d. d defaults to None.¶
- items() a set-like object providing a view on D's items¶
- keys() a set-like object providing a view on D's keys¶
- pop(k[, d]) v, remove specified key and return the corresponding value.¶
If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair¶
as a 2-tuple; but raise KeyError if D is empty.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D¶
- update([E, ]**F) None. Update D from mapping/iterable E and F.¶
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
- values() an object providing a view on D's values¶
Ini Parsers¶
Entities to help read and analyze a .ini file.
BaseIniParser¶
- class BaseIniParser(iniFile: IniFile)¶
Base class to parse a .ini file
- Parameters:
iniFile (
IniFile) – The .ini file to parse
- clear()¶
Clears any saved data
- parse()¶
Parses the .ini file
IniParseBuilder¶
- defbuild
- class IniParseBuilder(buildCls: Type[BaseIniParser] | IniParseBuilderArgs, args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None)¶
This class inherits from
BuilderA class to help dynamically build a
BaseIniParser- Parameters:
buildCls (Union[Type[
BaseIniParser],IniParseBuilderArgs]) –Either:
The class to construct a
BaseIniFixerORSome provider that gives the required arguments needed for this class
args (Optional[List[Any]]) –
The constant arguments used to build the object
Note
If the
buildClsattribute is not a class of type Type[BaseIniParser], then this parameter has no effectDefault:
Nonekwargs (Optional[Dict[str, Any]]) –
The constant keyword arguments used to build the object
Note
If the
buildClsattribute is not a class of type Type[BaseIniParser], then this parameter has no effectDefault:
None
- _buildCls¶
The class for the parser, if available
- Type:
Optional[Type[
BaseIniParser]]
- _builderArgs¶
The provider for the arguments of this class, if available
- Type:
Optional[
IniParseBuilderArgs]
- build(iniFile: IniFile, modName: str | None = None, version: int | None = None) BaseIniParser¶
Builds the parser
- Parameters:
iniFile (
IniFile) – The .ini file to parsemodeName (Optional[
str]) –The name of the mod to build the parser for
If this argument is
None, then will use the mod name extracted fromIniFile.availableTypeWarning
This argument has no effect if
_buildClsis notNoneDefault:
Noneversion (Optional[
int]) –The game version to fix the mod to
If this argument is
None, will build the parser for the latest version of the gameWarning
This argument has no effect if
_buildClsis notNoneDefault:
None
- Returns:
The built parser
- Return type:
GIMIParser¶
- def_getSectionRoots
- def_makeRemapModels
- def_setToFix
- defclear
- defhasDownloads
- defmakeRemapData
- defnormalizeSections
- defparse
- defparseCommands
- defparseResources
- defsetupDownloads
- class GIMIParser(iniFile: IniFile, bufDownloads: Dict[str, Dict[str, DownloadData]] | None = None)¶
This class inherits from
BaseIniParserParses a .ini file used by a GIMI related importer
- Parameters:
iniFile (
IniFile) – The .ini file to parsebufDownloads (Optional[Dict[
str, Dict[str,DownloadData]]]) –The .buf files to download if the mod is missing some required .buf files
The outer keys are the names of the type of buffer. The available names are:
IniKeywords.Blend.value,IniKeywords.Position.value andIniKeywords.Texcoord.valueThe inner keys are the names of the registers
eg.
{IniKeywords.Position.value: {"vb0": ("Position", FileDownload("someServer.com/Position.buf", "Position.buf", {"type": "buffer", "stride": "40"}))}, IniKeywords.Blend.value: {"vb1": ("Blend", FileDownload("someServer.com/Blender.buf", "Blend.buf", {})), "vb999": ("NonExistantBlend", FileDownload("someServer.com/NonExistentBlend.buf", "fakeBlend.buf", {"type": "fakenews"}))}, IniKeywords.Texcoord.value: {"ps-t0": ("Texcoord", FileDownload("someServer.com/texcoord.buf", "textensor.buf", {"model": "resnet50"}))}}
Default:
None
- blendCommandsGraph¶
All the sections that are called by the
[TextureOverride.*Blend.*]section.- Type:
- blendResourceCommandsGraph¶
All the related sections to the
[Resource.*Blend.*]sections that are used by sections related to the[TextureOverride.*Blend.*]sections. The keys are the name of the sections.- Type:
- positionResourceCommandsGraph¶
All the related sections to the
[Resource.*Position.*]sections that are used by sections related to the[TextureOverride.*Position.*]sections. The keys are the name of the sections- Type:
- otherHashIndexCommandsGraph¶
All the sections that do not belong in the above section graphs and contains the target hashes/indices that need to be replaced
- Type:
- _sectionRoots¶
The names of the sections that are the root nodes to a particular group of sections in the section caller/callee graph
:raw-html:`<br />`parThe keys are the ids for a particular group of sections and the values are the root section names for that group
- bufDownloads¶
The .buf files to download if the mod is missing some required .buf files
The outer keys are the names of the type of buffer. The available names are:
IniKeywords.Blend.value,IniKeywords.Position.value andIniKeywords.Texcoord.valueThe inner keys are the names of the registers
- Type:
Dict[
str, Dict[str,DownloadData]]
- _getSectionRoots()¶
Retrieves the root sections names that correspond to a either
TextureOverride.*BlendorTextureOverride.*Position
- _makeRemapModels(result: Dict[str, IniFixResourceModel], resourceGraph: IniSectionGraph, getFixedFile: Callable[[str], str] | None = None, modsToFix: Set[str] | None = None)¶
Creates all the data needed for fixing the
[Resource.*Blend.*]sections in the .ini file- Parameters:
result (Dict[
str,IniResourceModel]) –The result to store the data for fixing the resource sections
The keys are the original names for the resource sections and the values are the required data for fixing the sections
resourceGraph (
IniSectionGraph) – The graph of sections for the resourcesgetFixedFile (Optional[Callable[[
str],str]]) –The function for transforming the file path of a found .*Blend.buf file into a .*RemapBlend.buf file
If this value is
None, then will useIniFile.getFixedBlendFile()
Default:
NonemodsToFix (Optional[Set[
str]]) –The mods to fix
If this value is
None, then will use_modsToFix
Default:
None
- _setToFix() Set[str]¶
Sets the names for the types of mods that will used in the fix
- Returns:
The names of the mods that will be used in the fix
- Return type:
Set[
str]
- clear()¶
Clears any saved data
- hasDownloads() bool¶
Whether there are required downloads needed to be added
Note
requires
setupDownloads()to be ran first- Returns:
Whether downloads are needed to be added
- Return type:
- makeRemapData()¶
Creates any required remap internal data required by the fix
- normalizeSections(sectionGraph: IniSectionGraph)¶
Normalize all the referenced sections within ‘sectionGraph’ to follow the branching structure described at
IfTemplateNormTree- Parameters:
sectionGraph (
IniSectionGraph) – The graph holding all the referenced sections
- parse()¶
Parses the .ini file
- parseResources()¶
Parses particular resource sections within the mod
Note
Needs
parseCommands()to be ran first, otherwise no resources will be parsed
GIMIObjParser¶
- def_getSectionRoots
- def_makeRemapModels
- def_makeTexModels
- def_setToFix
- defclear
- defclearTexGraphs
- defgetTexEditor
- defgetTexGraph
- defgetTexGraphs
- defhasDownloads
- defmakeRemapData
- defnormalizeSections
- defparse
- defparseCommands
- defparseResources
- defsetupDownloads
- class GIMIObjParser(iniFile: IniFile, objs: Set[str], texEdits: Dict[str, Dict[str, Dict[str, BaseTexEditor]]] | None = None, bufDownloads: Dict[str, Dict[str, DownloadData]] | None = None, objFileDownloads: Dict[str, Dict[str, DownloadData]] | None = None)¶
This class inherits from
GIMIParserParses a .ini file used by a GIMI related importer and parses section’s related to a specific mod object (head, body, dress, etc…)
Note
For the specific names of the objects for a particular mod, please refer to GIMI Assets
- Parameters:
iniFile (
IniFile) – The .ini file to parseobjs (Set[
str]) – The specific mod objects to keep track oftexEdits (Optional[Dict[
str, Dict[str, Dict[str,BaseTexEditor]]]]) –texture resource sections that require to be editted
The outer keys ares the name of the mod object the texture resource belongs in
The second outer keys are the name of the register the texture resource belongs in
The inner keys are the names of the type of texture files that are editted
The inner value is the editor for changing the texture files
Note
The new names of the texture files to be editted should be all unique
Default:
NonebufDownloads (Optional[Dict[
str, Dict[str,DownloadData]]]) –The .buf files to download if the mod is missing some required .buf files
The outer keys are the names of the type of buffer. The available names are:
IniKeywords.Blend.value,IniKeywords.Position.value andIniKeywords.Texcoord.valueThe inner keys are the names of the registers
eg.
{IniKeywords.Position.value: {"vb0": ("Position", FileDownload("someServer.com/Position.buf", "Position.buf", {"type": "buffer", "stride": "40"}))}, IniKeywords.Blend.value: {"vb1": ("Blend", FileDownload("someServer.com/Blender.buf", "Blend.buf", {})), "vb999": ("NonExistantBlend", FileDownload("someServer.com/NonExistentBlend.buf", "fakeBlend.buf", {"type": "fakenews"}))}, IniKeywords.Texcoord.value: {"ps-t0": ("Texcoord", FileDownload("someServer.com/texcoord.buf", "textensor.buf", {"model": "resnet50"}))}}
Default:
NoneobjFileDownloads (Optional[Dict[
str, Dict[str,DownloadData]]]) –The files to download for each mod object (eg. .dds, .ib files) if the mod is missing some required files for the mod object
The outer keys are the names of the mod object the texture belongs to
The inner keys are the names of the registers
eg.
{"head": {"ib": ("garry", FileDownload("CorelliLaFolia.com/handel/sarabandeinDminor.ib", "puppetMary.ib", {"flower": "rose"}))}, "body": {"ps-t3": ("ShadowRamp", FileDownload("someServer.com/bodyShadowRamp.dds", "bodyShadowRamp.dds", {})), "ps-t0": ("Diffuse", FileDownload("someServer.com/bodyDiffuse.dds", "bodyDiffuse.dds", {"model", "diffusion"}))}, "dress": {"ps-t0": ("Diffuse", FileDownload("someServer.com/dressDiffuse.dds", "dressDiffuse.dds", {}))}}
Default:
None
- objGraphs¶
The different sections related to each mod object
The keys are the names of the objects and the values are the graphs related to each object
- Type:
Dict[
str,IniSectionGraph]
- texGraphs¶
The different sections related to the textures to be editted
The outer keys are the name of the mod object
The inner keys are the name of the register within the mod object
The inner value are the graphs for each register specified
- Type:
Dict[
str, Dict[str,IniSectionGraph]]
- _objSearchPatterns¶
The Regex patterns used to find the roots of the sections related to each mod object
The keys are the names of the objects and the values are the Regex patterns
- Type:
Dict[
str, Pattern]
- _objRootSections¶
The root sections for each mod object
The keys are the names of the objects and the values are the names of the sections
- texEditRegs¶
The corresponding register for a particular texture resource to be editted
The keys are the names of the type of texture resource to edit
- The values contains info about the corresponding register for the texture. The tuple contains:
The name of the mod object the texture resource belongs to
The name of the register that holds the texture
- _getSectionRoots()¶
Retrieves the root sections names that correspond to a either
TextureOverride.*BlendorTextureOverride.*Position
- _makeRemapModels(result: Dict[str, IniFixResourceModel], resourceGraph: IniSectionGraph, getFixedFile: Callable[[str], str] | None = None, modsToFix: Set[str] | None = None)¶
Creates all the data needed for fixing the
[Resource.*Blend.*]sections in the .ini file- Parameters:
result (Dict[
str,IniResourceModel]) –The result to store the data for fixing the resource sections
The keys are the original names for the resource sections and the values are the required data for fixing the sections
resourceGraph (
IniSectionGraph) – The graph of sections for the resourcesgetFixedFile (Optional[Callable[[
str],str]]) –The function for transforming the file path of a found .*Blend.buf file into a .*RemapBlend.buf file
If this value is
None, then will useIniFile.getFixedBlendFile()
Default:
NonemodsToFix (Optional[Set[
str]]) –The mods to fix
If this value is
None, then will use_modsToFix
Default:
None
- _makeTexModels(texName: str, texGraph: IniSectionGraph, texEditor: BaseTexEditor, getFixedFile: Callable[[str], str] | None = None) Dict[str, Dict[str, IniTexModel]]¶
Creates all the data needed for fixing the
[Resource.*]sections related to texture files in the .ini file- Parameters:
texName (
str) – The name for the type of texture file to edittexGraph (
IniSectionGraph) – The graph of sections for the particular type of texturesgetFixedFile (Optional[Callable[[
str],str]]) –The function for transforming the file path of a found from the texture .dds file into a .*RemapFix.dds file
If this value is
None, then will useIniFile.getFixedTexFile()
Default:
None
- Returns:
The data for fixing the resource sections
- Return type:
Dict[
str, Dict[str,IniTexModel]]
- _setToFix() Set[str]¶
Sets the names for the types of mods that will used in the fix
- Returns:
The names of the mods that will be used in the fix
- Return type:
Set[
str]
- clear()¶
Clears any saved data
- clearTexGraphs()¶
Reset all the graphs for the texture edits
- getTexEditor(texName: str) BaseTexEditor | None¶
Retrieves the corresponding
BaseTexEditorbased on ‘texName’- Parameters:
texName (
str) – The name to the type of texture file to be editted- Returns:
The found texture editor
- Return type:
Optional[
BaseTexEditor]
- getTexGraph(texName: str) IniSectionGraph | None¶
Retrieves the corresponding
IniSectionGraphbased on ‘texName’- Parameters:
texName (
str) – The name to the type of texture file to be editted- Returns:
The found section graph
- Return type:
Optional[
IniSectionGraph]
- getTexGraphs(texNames: List[str]) List[IniSectionGraph]¶
Retrieves the corresponding section graphs based on ‘texNames’
- Parameters:
texNames (List[
str]) – The names to the type of texture files to be editted- Returns:
The found section graphs
- Return type:
List[
IniSectionGraph]
- hasDownloads()¶
Whether there are required downloads needed to be added
Note
requires
setupDownloads()to be ran first- Returns:
Whether downloads are needed to be added
- Return type:
- makeRemapData()¶
Creates any required remap internal data required by the fix
- normalizeSections(sectionGraph: IniSectionGraph)¶
Normalize all the referenced sections within ‘sectionGraph’ to follow the branching structure described at
IfTemplateNormTree- Parameters:
sectionGraph (
IniSectionGraph) – The graph holding all the referenced sections
- property objFileDownloads: Dict[str, Dict[str, DownloadData]]¶
The files to download for each mod object (eg. .dds, .ib files) if the mod is missing some required files for the mod object
The outer keys are the names of the mod object the texture belongs to
The inner keys are the names of the registers
- Getter:
Returns the required file downloads for the mod objects
- Setter:
Sets the new file downloads for the mod objects
- Type:
Dict[
str, Dict[str,DownloadData]]
- property objs¶
The specific mod objects to keep track of
- Getter:
Returns the names of the mod objects
- Setter:
Sets the new names for the mod objects to keep track of
- Type:
Set[
str]
- parse()¶
Parses the .ini file
- parseResources()¶
Parses particular resource sections within the mod
Note
Needs
parseCommands()to be ran first, otherwise no resources will be parsed
- setupDownloads(cleanup: bool = True)¶
Setup the required downloads resources, if not already setup
- cleanup:
bool Whether to cleanup any temporary results from this method
Default:
True
- cleanup:
- property texEdits¶
texture resource sections that require to be editted
The outer keys ares the name of the mod object the texture resource belongs in
The second outer keys are the name of the register the texture resource belongs in
The inner keys are the names of the type of texture files that are editted
The inner value is the editor for changing the texture files
- Getter:
Returns the specific registers to have their textures editted
- Setter:
Sets the new registers to have their textures editted
- Type:
Dict[
str, Dict[str, Dict[str,BaseTexEditor]]]
Ini Fixers¶
The classes below help perform correction on .ini files after the .ini file has been parsed by the Ini Parsers
BaseIniFixer¶
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- defclear
- deffillIfTemplate
- deffix
- defgetFix
- class BaseIniFixer(parser: BaseIniParser)¶
Base class to fix a .ini file
- Parameters:
parser (
BaseIniParser) – The associated parser to retrieve data for the fix
- _parser¶
The associated parser to retrieve data for the fix
- Type:
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the corresponding asset
- Parameters:
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns:
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type:
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the replacement for ‘asset’
- Parameters:
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns:
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type:
Union[
str, Any]
- clear()¶
Resets any saved states within the fixer
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str¶
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters:
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns:
The text for the newly created
IfTemplate- Return type:
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False, hideOrig: bool = False) str | List[str]¶
Fixes the .ini file
- Parameters:
keepBackup (
bool) –Whether to keep backups for the .ini file
Default:
TruefixOnly (
bool) –Whether to only fix the .ini file without undoing any fixes
Default:
Falseupdate (
bool) –Whether to also update the source text in the
IniFileobject with the latest fix
Default:
FalsehideOrig (
bool) –Whether to hide the mod for the original character
Default:
False
- Returns:
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type:
IniFixBuilder¶
- defbuild
- class IniFixBuilder(buildCls: Type[BaseIniFixer] | IniFixBuilderArgs, args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None)¶
This class inherits from
BuilderClass to dynamically build a
BaseIniFixerto fix .ini files- Parameters:
buildCls (Union[Type[
BaseIniFixer],IniFixBuilderArgs]) –Either:
The class to construct a
BaseIniFixerORSome provider that gives the required arguments needed for this class
args (Optional[List[Any]]) –
The constant arguments used to build the object
Note
If the
buildClsattribute is not a class of type Type[BaseIniFixer], then this parameter has no effectDefault:
Nonekwargs (Optional[Dict[str, Any]]) –
The constant keyword arguments used to build the object
Note
If the
buildClsattribute is not a class of type Type[BaseIniFixer], then this parameter has no effectDefault:
None
- _buildCls¶
The class for the fixer, if available
- Type:
Optional[Type[
BaseIniFixer]]
- _builderArgs¶
The provider for the arguments of this class, if available
- Type:
Optional[
IniFixBuilderArgs]
- build(parser: BaseIniParser, modName: str | None = None, version: int | None = None) BaseIniFixer¶
Builds the fixer
- Parameters:
parser (
BaseIniParser) – The corresponding parser for the .ini filemodeName (Optional[
str]) –The name of the mod to build the fixer for
If this argument is
None, then will use the mod name extracted fromIniFile.availableTypeofBaseIniParser._iniFileWarning
This argument has no effect if
_buildClsis notNoneDefault:
Noneversion (Optional[
int]) –The game version to fix the mod to
If this argument is
None, will build the fixer for the latest version of the gameWarning
This argument has no effect if
_buildClsis notNoneDefault:
None
- Returns:
The built fixer
- Return type:
GIMIFixer¶
- def_fillOtherHashIndexSections
- def_fillRemapBlendResource
- def_fillRemapPositionResource
- def_fillTextureOverrideRemapBlend
- def_fillTextureOverrideRemapIb
- def_fillTextureOverrideRemapPosition
- def_fillTextureOverrideRemapTexcoord
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- defclear
- defeditModelRegisters
- deffillIfTemplate
- deffix
- deffixMod
- defgetFix
- class GIMIFixer(parser: GIMIParser, postModelRegEditFilters: List[RegEditFilter] | None = None)¶
This class inherits from
BaseIniFixerFixes a .ini file used by a GIMI related importer
- Parameters:
parser (
GIMIParser) – The associated parser to retrieve data for the fixpostModelRegEditFilters (Optional[List[
RegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPartfor the sections related to the .VB or .IB of a mod Filters are executed based on the order specified in the list.
Default:
None
- postModelRegEditFilters¶
Filters used to edit the registers of a certain
IfContentPartfor the sections related to the .VB or .IB of a mod Filters are executed based on the order specified in the list.- Type:
List[
RegEditFilter]
- _fillOtherHashIndexSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillRemapBlendResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillRemapPositionResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Position.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Position.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapIb(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Ib.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideIb] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapPosition(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Position.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverridePosition] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapTexcoord(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Texcoord.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideTexcoord] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the corresponding asset
- Parameters:
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns:
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type:
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the replacement for ‘asset’
- Parameters:
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns:
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type:
Union[
str, Any]
- clear()¶
Resets any saved states within the fixer
- editModelRegisters(modName: str, part: IfContentPart, modelPartName: str, sectionName: str, filters: List[RegEditFilter])¶
Edits the registers for a
IfContentPartin the .VB or .IB sectionsNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters:
modName (
str) – The name of the mod to fix topart (
IfContentPart) – The part that is being edittedmodelPartName (
str) – The name of the part within the .VB or .IB sectionssectionName (
str) – The name of the section the part belongs tofilters (List[
BaseRegEditFilter]) – The filters used for editting the registers
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str¶
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters:
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns:
The text for the newly created
IfTemplate- Return type:
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False, hideOrig: bool = False) str | List[str]¶
Fixes the .ini file
- Parameters:
keepBackup (
bool) –Whether to keep backups for the .ini file
Default:
TruefixOnly (
bool) –Whether to only fix the .ini file without undoing any fixes
Default:
Falseupdate (
bool) –Whether to also update the source text in the
IniFileobject with the latest fix
Default:
FalsehideOrig (
bool) –Whether to hide the mod for the original character
Default:
False
- Returns:
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type:
GIMIObjReplaceFixer¶
- def_fillOtherHashIndexSections
- def_fillRemapBlendResource
- def_fillRemapPositionResource
- def_fillTexResource
- def_fillTextureOverrideRemapBlend
- def_fillTextureOverrideRemapIb
- def_fillTextureOverrideRemapPosition
- def_fillTextureOverrideRemapTexcoord
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- defclear
- defeditModelRegisters
- defeditTexRegisters
- deffillIfTemplate
- deffillObjOtherHashIndexSection
- deffix
- deffixMod
- defgetFix
- defgetObjRemapFixName
- defgetTexEditFile
- defgetTexResourceRemapFixName
- class GIMIObjReplaceFixer(parser: GIMIObjParser, preRegEditFilters: List[BaseRegEditFilter] | None = None, postRegEditFilters: List[BaseRegEditFilter] | None = None, preRegEditOldObj: bool = True, postModelRegEditFilters: List[RegEditFilter] | None = None)¶
This class inherits from
GIMIFixerBase class to fix a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap are replaced by other mod objectss
- Parameters:
parser (
GIMIObjParser) – The associated parser to retrieve data for the fixpreRegEditFilters (Optional[List[
BaseRegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPart. Filters are executed based on the order specified in the list.
Whether these filters reference the mod objects to be fixed of the new mod objects of the fixed mods is determined by
GIMIObjReplaceFixer.preRegEditOldObj
Default:
NonepostRegEditFilters (Optional[List[
BaseRegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPartfor the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.
Note
These filters are preceded by the filters at
GIMIObjReplaceFixer.preRegEditFiltersDefault:
NonepreRegEditOldObj (
bool) –Whether the register editting filters at
GIMIObjReplaceFixer.preRegEditFiltersreference the original mod objects of the mod to be fixed or the new mod objects of the fixed mods
Default:
TruepostModelRegEditFilters (Optional[List[
RegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPartfor the sections related to the .VB or .IB of a mod Filters are executed based on the order specified in the list.
Default:
None
- preRegEditOldObj¶
Whether the register editting filters at
GIMIObjReplaceFixer.preRegEditFiltersreference the original mod objects of the mod to be fixed or the new mod objects of the fixed mods- Type:
- addedTextures¶
The textures to be newly created
The outer keys are the name of the mod objects
The inner keys are the name of the registers
The inner values is a tuple that contains:
# The name of the texture # The texture creator for making the new texture
eg.
{"head": {"ps-t1": ("EmptyNormalMap", :class:`TexCreator`(4096, 1024))}, "body": {"ps-t3": ("NewLightMap", :class:`TexCreator`(1024, 1024, :class:`Colour`(0, 128, 0, 255))), "ps-t0": ("DummyShadowRamp", :class:`Colour`())}}- Type:
Dict[
str, Dict[str, Tuple[str,TexCreator]]]
- _fillOtherHashIndexSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillRemapBlendResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillRemapPositionResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Position.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Position.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*]sections of a texture fileTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content parttexName (
str) – The name of the type of texture fileoldModName (
str) – The name of the type of mod to fix fromsmodObjName (
str) – The name of the type of mod object associated to the sectiontexGraph (
IniSectionGraph) – The graph where the section belongs to
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapIb(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Ib.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideIb] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapPosition(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Position.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverridePosition] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapTexcoord(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Texcoord.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideTexcoord] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the corresponding asset
- Parameters:
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns:
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type:
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the replacement for ‘asset’
- Parameters:
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns:
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type:
Union[
str, Any]
- clear()¶
Clears all the saved states
- editModelRegisters(modName: str, part: IfContentPart, modelPartName: str, sectionName: str, filters: List[RegEditFilter])¶
Edits the registers for a
IfContentPartin the .VB or .IB sectionsNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters:
modName (
str) – The name of the mod to fix topart (
IfContentPart) – The part that is being edittedmodelPartName (
str) – The name of the part within the .VB or .IB sectionssectionName (
str) – The name of the section the part belongs tofilters (List[
BaseRegEditFilter]) – The filters used for editting the registers
- editTexRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str, filters: List[BaseRegEditFilter])¶
Edits the registers for a
IfContentPartin the texture related sectionNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters:
modName (
str) – The name of the mod to fix topart (
IfContentPart) – The part that is being edittedobj (
str) – The name of the mod object for the corresponding partsectionName (
str) – The name of the section the part belongs tofilters (List[
BaseRegEditFilter]) – The filters used for editting the registers
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str¶
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters:
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns:
The text for the newly created
IfTemplate- Return type:
- fillObjOtherHashIndexSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix where the sections reference some hash or index and the section is not explictely captured by the fixer. The original sections may come from a different mod object.Tip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content partobjName (
str) – The name of the original mod objectnewObjName (
str) – The name of the mod object to fix to
- Returns:
The created content part
- Return type:
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False, hideOrig: bool = False) str | List[str]¶
Fixes the .ini file
- Parameters:
keepBackup (
bool) –Whether to keep backups for the .ini file
Default:
TruefixOnly (
bool) –Whether to only fix the .ini file without undoing any fixes
Default:
Falseupdate (
bool) –Whether to also update the source text in the
IniFileobject with the latest fix
Default:
FalsehideOrig (
bool) –Whether to hide the mod for the original character
Default:
False
- Returns:
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type:
- fixMod(modName: str, fix: str = '') str¶
Generates the newly added code in the .ini file for the fix of a single type of mod
Note
- eg.
If we are making the fix from
Jean->JeanCNandJeanSeaBreeze, The code below will only make the fix forJeanCN
fixMod("JeanCN")
- getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str¶
Retrieves the new name of the section for a new mod object
- getTexEditFile(file: str, texName: str, modObj: str, modName: str = '') str¶
Makes the file path for an editted texture
- Parameters:
- Returns:
The file path of the fixed RemapTex.dds file
- Return type:
- getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str¶
Retrieves the new name of the section for a texture resource that is created/editted
- Parameters:
texTypeName (
str) – The name of the type of texture fileoldModName (
str) – The name of the mod to fix fromnewModName (
str) – The name of the mod to fix toobjName (
str) – The mod object the texture resource referecesaddInd (
bool) –Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type
Default:
False
- Returns:
The new name for the section
- Return type:
- property postRegEditFilters¶
Filters used to edit the registers of a certain
IfContentPartfor the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.- Getter:
Retrieves all the sequence of filters
- Setter:
Sets the new sequence of filters
- Type:
List[
BaseRegEditFilter]
- property preRegEditFilters¶
Filters used to edit the registers of a certain
IfContentPartfor the original mod objects to be fixed. Filters are executed based on the order specified in the list.- Getter:
Retrieves all the sequence of filters
- Setter:
Sets the new sequence of filters
- Type:
List[
BaseRegEditFilter]
GIMIObjSplitFixer¶
- def_fillOtherHashIndexSections
- def_fillRemapBlendResource
- def_fillRemapPositionResource
- def_fillTexResource
- def_fillTextureOverrideRemapBlend
- def_fillTextureOverrideRemapIb
- def_fillTextureOverrideRemapPosition
- def_fillTextureOverrideRemapTexcoord
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- defclear
- defeditModelRegisters
- defeditTexRegisters
- deffillIfTemplate
- deffillObjOtherHashIndexSection
- deffix
- deffixMod
- defgetFix
- defgetObjRemapFixName
- defgetTexEditFile
- defgetTexResourceRemapFixName
- class GIMIObjSplitFixer(parser: GIMIObjParser, objs: Dict[str, List[str]], preRegEditFilters: List[BaseRegEditFilter] | None = None, postRegEditFilters: List[BaseRegEditFilter] | None = None, preRegEditOldObj: bool = False, postModelRegEditFilters: List[RegEditFilter] | None = None)¶
This class inherits from
GIMIObjReplaceFixerFixes a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap are split into multiple mod objects in remapped mod
eg.
KeqingOpulent's "body" is split into Keqing's "body" and "dress" KeqingOpulent Keqing =============== ================= *** objects *** **** objects **** body -------+------> body head | head +------> dress
Note
For the order of how the registers are fixed, please see
GIMIObjReplaceFixer- Parameters:
parser (
GIMIObjParser) – The associated parser to retrieve data for the fixThe mod objects that will be split into multiple new mod objects
The keys are the names of the mod objects to be split and the values are the names of the new mod objects the original mod object will be split into
Note
The dictionary keys should align with the defined object names at
GIMIObjParser.objs()for your parserWarning
If multiple mod objects split into the same object, then the resultant .ini file will contain duplicate sections for that particular mod object
eg.
{"body": ["dress", "extra"], "head": ["face", "extra"]}preRegEditFilters (Optional[List[
BaseRegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPart. Filters are executed based on the order specified in the list.
Whether these filters reference the mod objects to be fixed of the new mod objects of the fixed mods is determined by
GIMIObjSplitFixer.preRegEditOldObj
Default:
NonepostRegEditFilters (Optional[List[
BaseRegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPartfor the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.
Note
These filters are preceded by the filters at
GIMIObjReplaceFixer.preRegEditFiltersDefault:
NonepreRegEditOldObj (
bool) –Whether the register editting filters at
GIMIObjReplaceFixer.preRegEditFiltersreference the original mod objects of the mod to be fixed or the new mod objects of the fixed mods
Default:
FalsepostModelRegEditFilters (Optional[List[
RegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPartfor the sections related to the .VB or .IB of a mod Filters are executed based on the order specified in the list.
Default:
None
- _fillOtherHashIndexSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillRemapBlendResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillRemapPositionResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Position.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Position.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*]sections of a texture fileTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content parttexName (
str) – The name of the type of texture fileoldModName (
str) – The name of the type of mod to fix fromsmodObjName (
str) – The name of the type of mod object associated to the sectiontexGraph (
IniSectionGraph) – The graph where the section belongs to
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapIb(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Ib.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideIb] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapPosition(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Position.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverridePosition] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapTexcoord(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Texcoord.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideTexcoord] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the corresponding asset
- Parameters:
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns:
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type:
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the replacement for ‘asset’
- Parameters:
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns:
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type:
Union[
str, Any]
- clear()¶
Clears all the saved states
- editModelRegisters(modName: str, part: IfContentPart, modelPartName: str, sectionName: str, filters: List[RegEditFilter])¶
Edits the registers for a
IfContentPartin the .VB or .IB sectionsNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters:
modName (
str) – The name of the mod to fix topart (
IfContentPart) – The part that is being edittedmodelPartName (
str) – The name of the part within the .VB or .IB sectionssectionName (
str) – The name of the section the part belongs tofilters (List[
BaseRegEditFilter]) – The filters used for editting the registers
- editTexRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str, filters: List[BaseRegEditFilter])¶
Edits the registers for a
IfContentPartin the texture related sectionNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters:
modName (
str) – The name of the mod to fix topart (
IfContentPart) – The part that is being edittedobj (
str) – The name of the mod object for the corresponding partsectionName (
str) – The name of the section the part belongs tofilters (List[
BaseRegEditFilter]) – The filters used for editting the registers
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str¶
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters:
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns:
The text for the newly created
IfTemplate- Return type:
- fillObjOtherHashIndexSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix where the sections reference some hash or index and the section is not explictely captured by the fixer. The original sections may come from a different mod object.Tip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content partobjName (
str) – The name of the original mod objectnewObjName (
str) – The name of the mod object to fix to
- Returns:
The created content part
- Return type:
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False, hideOrig: bool = False) str | List[str]¶
Fixes the .ini file
- Parameters:
keepBackup (
bool) –Whether to keep backups for the .ini file
Default:
TruefixOnly (
bool) –Whether to only fix the .ini file without undoing any fixes
Default:
Falseupdate (
bool) –Whether to also update the source text in the
IniFileobject with the latest fix
Default:
FalsehideOrig (
bool) –Whether to hide the mod for the original character
Default:
False
- Returns:
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type:
- fixMod(modName: str, fix: str = '') str¶
Generates the newly added code in the .ini file for the fix of a single type of mod
Note
- eg.
If we are making the fix from
Jean->JeanCNandJeanSeaBreeze, The code below will only make the fix forJeanCN
fixMod("JeanCN")
- getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str¶
Retrieves the new name of the section for a new mod object
- getTexEditFile(file: str, texName: str, modObj: str, modName: str = '') str¶
Makes the file path for an editted texture
- Parameters:
- Returns:
The file path of the fixed RemapTex.dds file
- Return type:
- getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str¶
Retrieves the new name of the section for a texture resource that is created/editted
- Parameters:
texTypeName (
str) – The name of the type of texture fileoldModName (
str) – The name of the mod to fix fromnewModName (
str) – The name of the mod to fix toobjName (
str) – The mod object the texture resource referecesaddInd (
bool) –Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type
Default:
False
- Returns:
The new name for the section
- Return type:
- property objs: Dict[str, List[str]]¶
The mods objects that will be split to multiple other mod objects
The keys are the names of the objects in the mod to be remapped and the values are the split objects of the remapped mod
- property postRegEditFilters¶
Filters used to edit the registers of a certain
IfContentPartfor the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.- Getter:
Retrieves all the sequence of filters
- Setter:
Sets the new sequence of filters
- Type:
List[
BaseRegEditFilter]
- property preRegEditFilters¶
Filters used to edit the registers of a certain
IfContentPartfor the original mod objects to be fixed. Filters are executed based on the order specified in the list.- Getter:
Retrieves all the sequence of filters
- Setter:
Sets the new sequence of filters
- Type:
List[
BaseRegEditFilter]
GIMIObjMergeFixer¶
- def_fillOtherHashIndexSections
- def_fillRemapBlendResource
- def_fillRemapPositionResource
- def_fillTexResource
- def_fillTextureOverrideRemapBlend
- def_fillTextureOverrideRemapIb
- def_fillTextureOverrideRemapPosition
- def_fillTextureOverrideRemapTexcoord
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- defclear
- defeditModelRegisters
- defeditTexRegisters
- deffillIfTemplate
- deffillObjOtherHashIndexSection
- deffix
- deffixMod
- defgetFix
- defgetObjRemapFixName
- defgetTexEditFile
- defgetTexResourceRemapFixName
- class GIMIObjMergeFixer(parser: GIMIObjParser, objs: Dict[str, List[str]], copyPreamble: str = '', preRegEditFilters: List[BaseRegEditFilter] | None = None, postRegEditFilters: List[BaseRegEditFilter] | None = None, iniPostModelRegEditFilters: List[List[RegEditFilter]] | None = None)¶
This class inherits from
GIMIObjReplaceFixerFixes a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap are merged to a single mod object
eg.
Keqing's "body" and "dress" are merged into KeqingOpulent's "body" Keqing KeqingOpulent =============== ================= *** objects *** **** objects **** body -----+----> body head | head dress -----+
Note
This class takes advantage of GIMI’s bug/feature of overlapping mods from loading multiple mods of the same character by creating different variations of the original .ini file
- Parameters:
parser (
GIMIObjParser) – The associated parser to retrieve data for the fixThe mod objects to be merged to a single mod object
The keys are the names of the merged objects and the values are the names of the mod objects to be merged
Note
The dictionary values should align with the defined object names at
GIMIObjParser.objs()for your parsercopyPreamble (
str) –Any text we want to put before the text of the newly generated .ini file variations
Default:
""preRegEditFilters (Optional[List[
BaseRegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPart. Filters are executed based on the order specified in the list.
Whether these filters reference the mod objects to be fixed of the new mod objects of the fixed mods is determined by
GIMIObjMergeFixer.preRegEditOldObj
Default:
NonepostRegEditFilters (Optional[List[
BaseRegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPartfor the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.
Note
These filters are preceded by the filters at
GIMIObjReplaceFixer.preRegEditFiltersDefault:
NoneiniPostModelRegEditFilters (Optional[List[List[
RegEditFilter]]]) –Filters used to edit the registers of a certain
IfContentPartfor the sections related to the .VB or .IB of a mod for each .ini file
Default:
None
- _targetObjs¶
Which original mod objects to show for each merged mod object in the current .ini file
The keys are the names of the original mod objects to display on the current .ini file and the values are the names of the merged objects.
- copyPreamble¶
Any text we want to put before the text of the newly generated .ini file variations
- Type:
- iniPostModelRegEditFilters¶
Filters used to edit the registers of a certain
IfContentPartfor the sections related to the .VB or .IB of a mod for each .ini file- Type:
List[List[
RegEditFilter]]
- postModelRegEditFilters¶
The filters used to edit the registers of a certain
IfContentPartfor the sections related to the .VB or .IB of a mod for the current .ini file being generated- Type:
List[
RegEditFilter]
- _fillOtherHashIndexSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillRemapBlendResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillRemapPositionResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Position.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Position.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*]sections of a texture fileTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content parttexName (
str) – The name of the type of texture fileoldModName (
str) – The name of the type of mod to fix fromsmodObjName (
str) – The name of the type of mod object associated to the sectiontexGraph (
IniSectionGraph) – The graph where the section belongs to
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapIb(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Ib.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideIb] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapPosition(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Position.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverridePosition] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapTexcoord(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Texcoord.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideTexcoord] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the corresponding asset
- Parameters:
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns:
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type:
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the replacement for ‘asset’
- Parameters:
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns:
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type:
Union[
str, Any]
- clear()¶
Clears all the saved states
- editModelRegisters(modName: str, part: IfContentPart, modelPartName: str, sectionName: str, filters: List[RegEditFilter])¶
Edits the registers for a
IfContentPartin the .VB or .IB sectionsNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters:
modName (
str) – The name of the mod to fix topart (
IfContentPart) – The part that is being edittedmodelPartName (
str) – The name of the part within the .VB or .IB sectionssectionName (
str) – The name of the section the part belongs tofilters (List[
BaseRegEditFilter]) – The filters used for editting the registers
- editTexRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str, filters: List[BaseRegEditFilter])¶
Edits the registers for a
IfContentPartin the texture related sectionNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters:
modName (
str) – The name of the mod to fix topart (
IfContentPart) – The part that is being edittedobj (
str) – The name of the mod object for the corresponding partsectionName (
str) – The name of the section the part belongs tofilters (List[
BaseRegEditFilter]) – The filters used for editting the registers
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str¶
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters:
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns:
The text for the newly created
IfTemplate- Return type:
- fillObjOtherHashIndexSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix where the sections reference some hash or index and the section is not explictely captured by the fixer. The original sections may come from a different mod object.Tip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content partobjName (
str) – The name of the original mod objectnewObjName (
str) – The name of the mod object to fix to
- Returns:
The created content part
- Return type:
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False, hideOrig: bool = False) str | List[str]¶
Fixes the .ini file
- Parameters:
keepBackup (
bool) –Whether to keep backups for the .ini file
Default:
TruefixOnly (
bool) –Whether to only fix the .ini file without undoing any fixes
Default:
Falseupdate (
bool) –Whether to also update the source text in the
IniFileobject with the latest fix
Default:
FalsehideOrig (
bool) –Whether to hide the mod for the original character
Default:
False
- Returns:
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type:
- fixMod(modName: str, fix: str = '') str¶
Generates the newly added code in the .ini file for the fix of a single type of mod
Note
- eg.
If we are making the fix from
Jean->JeanCNandJeanSeaBreeze, The code below will only make the fix forJeanCN
fixMod("JeanCN")
- getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str¶
Retrieves the new name of the section for a new mod object
- getTexEditFile(file: str, texName: str, modObj: str, modName: str = '') str¶
Makes the file path for an editted texture
- Parameters:
- Returns:
The file path of the fixed RemapTex.dds file
- Return type:
- getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str¶
Retrieves the new name of the section for a texture resource that is created/editted
- Parameters:
texTypeName (
str) – The name of the type of texture fileoldModName (
str) – The name of the mod to fix fromnewModName (
str) – The name of the mod to fix toobjName (
str) – The mod object the texture resource referecesaddInd (
bool) –Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type
Default:
False
- Returns:
The new name for the section
- Return type:
- property objs¶
The mod objects to be merged to a single mod object
The keys are the names of the merged objects and the values are the names of the mod objects to be merged
- property postRegEditFilters¶
Filters used to edit the registers of a certain
IfContentPartfor the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.- Getter:
Retrieves all the sequence of filters
- Setter:
Sets the new sequence of filters
- Type:
List[
BaseRegEditFilter]
- property preRegEditFilters¶
Filters used to edit the registers of a certain
IfContentPartfor the original mod objects to be fixed. Filters are executed based on the order specified in the list.- Getter:
Retrieves all the sequence of filters
- Setter:
Sets the new sequence of filters
- Type:
List[
BaseRegEditFilter]
GIMIObjRegEditFixer¶
- def_fillOtherHashIndexSections
- def_fillRemapBlendResource
- def_fillRemapPositionResource
- def_fillTexResource
- def_fillTextureOverrideRemapBlend
- def_fillTextureOverrideRemapIb
- def_fillTextureOverrideRemapPosition
- def_fillTextureOverrideRemapTexcoord
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- defclear
- defeditModelRegisters
- defeditTexRegisters
- deffillIfTemplate
- deffillObjOtherHashIndexSection
- deffix
- deffixMod
- defgetFix
- defgetObjRemapFixName
- defgetTexEditFile
- defgetTexResourceRemapFixName
- class GIMIObjRegEditFixer(parser: GIMIObjParser, preRegEditFilters: List[BaseRegEditFilter] | None = None, postRegEditFilters: List[BaseRegEditFilter] | None = None, postModelRegEditFilters: List[RegEditFilter] | None = None)¶
This class inherits from
GIMIObjSplitFixerFixes a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap needs to have their registers remapped or removed
Note
For the order of how the registers are fixed, please see
GIMIObjReplaceFixer- Parameters:
parser (
GIMIObjParser) – The associated parser to retrieve data for the fixpreRegEditFilters (Optional[List[
BaseRegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPart. Filters are executed based on the order specified in the list.
Whether these filters reference the mod objects to be fixed of the new mod objects of the fixed mods is determined by
GIMIObjRegEditFixer.preRegEditOldObj
Default:
NonepostRegEditFilters (Optional[List[
BaseRegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPartfor the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.
Note
These filters are preceded by the filters at
GIMIObjReplaceFixer.preRegEditFiltersDefault:
NonepostModelRegEditFilters (Optional[List[
RegEditFilter]]) –Filters used to edit the registers of a certain
IfContentPartfor the sections related to the .VB or .IB of a mod Filters are executed based on the order specified in the list.
Default:
None
- _fillOtherHashIndexSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillRemapBlendResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillRemapPositionResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Position.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Position.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*]sections of a texture fileTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content parttexName (
str) – The name of the type of texture fileoldModName (
str) – The name of the type of mod to fix fromsmodObjName (
str) – The name of the type of mod object associated to the sectiontexGraph (
IniSectionGraph) – The graph where the section belongs to
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapIb(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Ib.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideIb] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapPosition(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Position.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverridePosition] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _fillTextureOverrideRemapTexcoord(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str¶
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Texcoord.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideTexcoord] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns:
The created content part
- Return type:
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the corresponding asset
- Parameters:
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns:
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type:
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the replacement for ‘asset’
- Parameters:
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns:
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type:
Union[
str, Any]
- clear()¶
Clears all the saved states
- editModelRegisters(modName: str, part: IfContentPart, modelPartName: str, sectionName: str, filters: List[RegEditFilter])¶
Edits the registers for a
IfContentPartin the .VB or .IB sectionsNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters:
modName (
str) – The name of the mod to fix topart (
IfContentPart) – The part that is being edittedmodelPartName (
str) – The name of the part within the .VB or .IB sectionssectionName (
str) – The name of the section the part belongs tofilters (List[
BaseRegEditFilter]) – The filters used for editting the registers
- editTexRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str, filters: List[BaseRegEditFilter])¶
Edits the registers for a
IfContentPartin the texture related sectionNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters:
modName (
str) – The name of the mod to fix topart (
IfContentPart) – The part that is being edittedobj (
str) – The name of the mod object for the corresponding partsectionName (
str) – The name of the section the part belongs tofilters (List[
BaseRegEditFilter]) – The filters used for editting the registers
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str¶
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters:
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns:
The text for the newly created
IfTemplate- Return type:
- fillObjOtherHashIndexSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)¶
Creates the content part of an
IfTemplatefor the new sections created by this fix where the sections reference some hash or index and the section is not explictely captured by the fixer. The original sections may come from a different mod object.Tip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters:
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content partobjName (
str) – The name of the original mod objectnewObjName (
str) – The name of the mod object to fix to
- Returns:
The created content part
- Return type:
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False, hideOrig: bool = False) str | List[str]¶
Fixes the .ini file
- Parameters:
keepBackup (
bool) –Whether to keep backups for the .ini file
Default:
TruefixOnly (
bool) –Whether to only fix the .ini file without undoing any fixes
Default:
Falseupdate (
bool) –Whether to also update the source text in the
IniFileobject with the latest fix
Default:
FalsehideOrig (
bool) –Whether to hide the mod for the original character
Default:
False
- Returns:
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type:
- fixMod(modName: str, fix: str = '') str¶
Generates the newly added code in the .ini file for the fix of a single type of mod
Note
- eg.
If we are making the fix from
Jean->JeanCNandJeanSeaBreeze, The code below will only make the fix forJeanCN
fixMod("JeanCN")
- getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str¶
Retrieves the new name of the section for a new mod object
- getTexEditFile(file: str, texName: str, modObj: str, modName: str = '') str¶
Makes the file path for an editted texture
- Parameters:
- Returns:
The file path of the fixed RemapTex.dds file
- Return type:
- getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str¶
Retrieves the new name of the section for a texture resource that is created/editted
- Parameters:
texTypeName (
str) – The name of the type of texture fileoldModName (
str) – The name of the mod to fix fromnewModName (
str) – The name of the mod to fix toobjName (
str) – The mod object the texture resource referecesaddInd (
bool) –Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type
Default:
False
- Returns:
The new name for the section
- Return type:
- property objs: Dict[str, List[str]]¶
The mods objects that will be split to multiple other mod objects
The keys are the names of the objects in the mod to be remapped and the values are the split objects of the remapped mod
- property postRegEditFilters¶
Filters used to edit the registers of a certain
IfContentPartfor the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.- Getter:
Retrieves all the sequence of filters
- Setter:
Sets the new sequence of filters
- Type:
List[
BaseRegEditFilter]
- property preRegEditFilters¶
Filters used to edit the registers of a certain
IfContentPartfor the original mod objects to be fixed. Filters are executed based on the order specified in the list.- Getter:
Retrieves all the sequence of filters
- Setter:
Sets the new sequence of filters
- Type:
List[
BaseRegEditFilter]
MultiModFixer¶
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- defbuildFixers
- defclear
- deffillIfTemplate
- deffix
- defgetFix
- class MultiModFixer(parser: BaseIniParser, fixBuilders: Dict[str, IniFixBuilder])¶
This class inherits from
BaseIniFixerFixes a .ini file where each mod to fix requires a different
BaseIniFixerstrategy- Parameters:
parser (
BaseIniParser) – The associated parser to retrieve data for the fixfixBuilders (Dict[
str,IniFixBuilder]) –The different builders to dynamcally construct the
BaseIniFixerused for each mod to fix
The keys are the names of the mods to fix and the values are the different
IniFixBuilderused to construct theBaseIniFixerto fix the mod
- _fixBuilders¶
The different builders to dynamcally construct the
BaseIniFixerused for each mod to fix
The keys are the names of the mods to fix and the values are the different
IniFixBuilderused to construct theBaseIniFixerto fix the mod- Type:
Dict[
str,IniFixBuilder]
- _fixers¶
The different fixers to fix each type of mod
The keys are the names of the mods to fix and the values are the fixers to fix the mod
- Type:
Dict[
str,BaseIniFixer]
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the corresponding asset
- Parameters:
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns:
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type:
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any¶
Retrieves the replacement for ‘asset’
- Parameters:
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns:
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type:
Union[
str, Any]
- buildFixers()¶
Rebuilds the
BaseIniFixerused for each mod
- clear()¶
Resets any saved states within the fixer
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str¶
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters:
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns:
The text for the newly created
IfTemplate- Return type:
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False, hideOrig: bool = False) str | List[str]¶
Fixes the .ini file
- Parameters:
keepBackup (
bool) –Whether to keep backups for the .ini file
Default:
TruefixOnly (
bool) –Whether to only fix the .ini file without undoing any fixes
Default:
Falseupdate (
bool) –Whether to also update the source text in the
IniFileobject with the latest fix
Default:
FalsehideOrig (
bool) –Whether to hide the mod for the original character
Default:
False
- Returns:
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type:
Ini Removers¶
These entities help remove fixes from .ini files that were made from previous runs.
BaseIniRemover¶
- defremove
- class BaseIniRemover(iniFile: IniFile)¶
Base class to remove fixes from a .ini file
- Parameters:
iniFile (
IniFile) – The .ini file to remove the fix from
- static _readLines(func)¶
Decorator to read all the lines in the .ini file first before running a certain function
All the file lines will be saved in
IniFile._fileLinesExamples
1@_readLines 2def printLines(self): 3 for line in self.iniFile.fileLines: 4 print(f"LINE: {line}")
IniRemoveBuilder¶
- class IniRemoveBuilder(cls: Type[BaseIniRemover], args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None, cache: bool = True)¶
This class inherits from
FlyweightBuilderA class to help dynamically build a
BaseIniRemover- Parameters:
cls (Type[
BaseIniRemover]) – The class to construct aBaseIniRemoverargs (Optional[List[Any]]) –
The constant arguments used to build the object
Default:
Nonekwargs (Optional[Dict[str, Any]]) –
The constant keyword arguments used to build the object
Default:
Nonecache (
bool) –Whether to cache the built object
Default:
True
- build(iniFile: IniFile, id: Hashable | None = None) BaseIniRemover¶
Builds the remover
- Parameters:
- Returns:
The built remover
- Return type:
IniRemover¶
- defremove
- class IniRemover(iniFile: IniFile)¶
This class inherits from
BaseIniRemoverClass for the basic removal of the fixes from .ini files
- Parameters:
iniFile (
IniFile) – The .ini file to remove the fix from
- static _readLines(func)¶
Decorator to read all the lines in the .ini file first before running a certain function
All the file lines will be saved in
IniFile._fileLinesExamples
1@_readLines 2def printLines(self): 3 for line in self.iniFile.fileLines: 4 print(f"LINE: {line}")
Register Editting Filters¶
Used for subclasses of the GIMIObjRegEditFixer class to handle editting registers within an IfTemplate in the .ini file
BaseRegEditFilter¶
- class BaseRegEditFilter¶
Base class for editting registers within an
IfContentPart- clear()¶
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart¶
Edits the registers for the current
IfContentPart- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
RegEditFilter¶
- def_editReg
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegEditFilter¶
This class inherits from
BaseRegEditFilterclass for editting registers within an
IfContentPart- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: BaseIniFixer) IfContentPart¶
The main function to edit the registers for the current
IfContentPart- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
BaseIniFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- clear()¶
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart¶
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
RegNewVals¶
- def_editReg
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegNewVals(vals: Dict[str, Dict[str, str | Callable[[str], bool]]] | None = None)¶
This class inherits from
RegEditFilterClass for assigning new values to specific registers for some
IfContentPart- Parameters:
vals –
Defines which registers will have their values changed
The outer keys are the names of the new mod objects where the registers are found
The inner keys are the new names of the registers to have their values changed
The inner values contains either
A string representing the new changed values for all instances of the register OR
A tuple containing a string and a predicate, representing the new changed values for only certain instances of the registers. The predicate takes the old value of the register as the argument.
eg.
{"head": {"ps-t1": "newVal"}, "body": {"ps-t3": "newVal2", "ps-t0": "newVal3"}, "dress": {"ps-t0": ("newVal4", lambda val: val == "replaceMe")}}
- vals¶
Defines which registers will have their values changed
The outer keys are the names of the new mod objects where the registers are found
The inner keys are the new names of the registers to have their values changed
The inner values contains either
A string representing the new changed values for all instances of the register OR
A tuple containing a string and a predicate, representing the new changed values for only certain instances of the registers. The predicate takes the old value of the register as the argument.
- _regUpdates¶
The value updates to do on the current
IfContentPartbeing parsed
The keys are the names of the registers and the values are the corresponding values to the registers
- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: BaseIniFixer) IfContentPart¶
The main function to edit the registers for the current
IfContentPart- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
BaseIniFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- clear()¶
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart¶
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
RegRemap¶
- def_editReg
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegRemap(remap: Dict[str, Dict[str, KeyRemapData | List[str | Tuple[str, Callable[[str, str], bool]] | RemappedKeyData]]] | None = None)¶
This class inherits from
RegEditFilterClass for remapping the register keys for some
IfContentPart- Parameters:
remap (Optional[Dict[
str, Dict[str, Union[KeyRemapData, List[Union[str, Tuple[str, Callable[[str,str],bool]],RemappedKeyData]]]]]]) –Defines how the register values in the parts of an
IfTemplateare mapped to a new register in the remapped mod for particular mod objects
The outer keys are the name of the mod object to have their registers remapped
The inner keys are the names of the registers that hold the register values to be remapped
The inner values are the new names of the registers that will hold the register values that contains either:
The data for remapping a particular key OR
A list containing either:
The new names of the keys to remap to OR
A tuple containing a new name for the key to remap to and a predicate that takes in the old key and value of whether to remap the key. OR
A class that contains all the necessary information for remapping to the new key
eg.
{"head": {"ps-t1": ["new_ps-t2", "new_ps-t3"]}, "body": {"ps-t3": [ps-t0"], "ps-t0": [], "ps-t1": [("ps-t8", lambda reg, val: val.find("NormalMap") != -1)]}}
Default:
None
- remap¶
Defines how the register values in the parts of an
IfTemplateare mapped to a new register in the remapped mod for particular mod objects
The outer keys are the name of the mod object to have their registers remapped
The inner keys are the names of the registers that hold the register values to be remapped
The inner values are the new names of the registers that will hold the register values that contains either:
The data for remapping a particular key OR
A list containing either:
The new names of the keys to remap to OR
A tuple containing a new name for the key to remap to and a predicate that takes in the old key and value of whether to remap the key. OR
A class that contains all the necessary information for remapping to the new key
eg.
{"head": {"ps-t1": ["new_ps-t2", "new_ps-t3"]}, "body": {"ps-t3": [ps-t0"], "ps-t0": [], "ps-t1": [("ps-t8", lambda reg, val: val.find("NormalMap") != -1)]}}
- Type:
Dict[
str, Dict[str, Union[KeyRemapData, List[Union[str, Tuple[str, Callable[[str,str],bool]],RemappedKeyData]]]]]
- _regRemap¶
The register remap to do on the current
IfContentPartbeing parsed
The keys are the names of the registers and the values are the newly mapped registers
- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: BaseIniFixer) IfContentPart¶
The main function to edit the registers for the current
IfContentPart- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
BaseIniFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- clear()¶
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart¶
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
RegRemove¶
- def_editReg
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegRemove(remove: Dict[str, Set[str | Tuple[str, Callable[[Tuple[int, str]], bool]]]] | None = None)¶
This class inherits from
RegEditFilterClass for removing keys from a
IfContentPart- Parameters:
remove (Optional[Dict[
str, Set[Union[str, Callable[[Tuple[int,str]],bool]]]]]) –Defines whether some register assignments should be removed from the sections from the mod objects
The keys are the names of the objects to have their registers removed
the values are the names of the register to be removed.
If given only a string, will remove all instance of the register
If given a tuple containing a string and a predicate, will remove instance of the register that satistfy the predicate The predicate takes in a tuple that contains:
The order index where the current KVP of the register resides in the
IfContentPartThe corresponding value for the current KVP
eg.
{"head": {"ps-t1", "ps-t2"}, "body": {"ps-t3", "ps-t0"}}
Default:
None
- remove¶
Defines whether some register assignments should be removed from the sections from the mod objects
The keys are the names of the objects to have their registers removed
the values are the names of the register to be removed.
If given only a string, will remove all instance of the register
If given a tuple containing a string and a predicate, will remove instance of the register that satistfy the predicate The predicate takes in a tuple that contains:
The order index where the current KVP of the register resides in the
IfContentPartThe corresponding value for the current KVP
eg.
{"head": {"ps-t1", "ps-t2"}, "body": {"ps-t3", "ps-t0"}}
- _regRemove¶
The register removal to do on the current
IfContentPartbeing parsed- Type:
Optional[Set[
str]]
- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: BaseIniFixer) IfContentPart¶
The main function to edit the registers for the current
IfContentPart- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
BaseIniFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- clear()¶
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart¶
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
RegTexAdd¶
- def_editReg
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegTexAdd(textures: Dict[str, Dict[str, Tuple[str, TexCreator]]] | None = None, mustAdd: bool = True)¶
This class inherits from
RegEditFilterClass for adding new texture .dds files to a
IfContentPart- Parameters:
textures (Optional[Dict[
str, Dict[str, Tuple[str,TexCreator,bool]]]]) –New texture .dds files to be created
The outer key are the names of the mod object
The inner keys are the names of the register
- The inner values contanis:
The name of the type of texture file
The object that will create the new texture file
eg.
{"head": {"ps-t1": ("EmptyNormalMap", :class:`TexCreator`(4096, 1024))}, "body": {"ps-t3": ("NewLightMap", :class:`TexCreator`(1024, 1024, :class:`Colour`(0, 128, 0, 255))), "ps-t0": ("DummyShadowRamp", :class:`Colour`())}}
Default:
NonemustAdd (
bool) – Whether the texture files will still be created for a particularIfContentParteven if the corresponding register for the texture file does not exist within that particularIfContentPart
- textures¶
New texture .dds files to be created
The outer key are the names of the mod object
The inner keys are the names of the register
- The inner values contanis:
The name of the type of texture file
The object that will create the new texture file
eg.
{"head": {"ps-t1": ("EmptyNormalMap", :class:`TexCreator`(4096, 1024))}, "body": {"ps-t3": ("NewLightMap", :class:`TexCreator`(1024, 1024, :class:`Colour`(0, 128, 0, 255))), "ps-t0": ("DummySshadowRamp", :class:`Colour`())}}- Type:
Dict[
str, Dict[str, Tuple[str,TexCreator]]]
- mustAdd¶
Whether the texture files will still be created for a particular
IfContentParteven if the corresponding register for the texture file does not exist within that particularIfContentPart- Type:
- _regAddVals¶
The texture additions to do on the current
IfContentPartbeing parsed
The keys are the name of the registers and the values are the section names for the textures
- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart¶
The main function to edit the registers for the current
IfContentPart- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
BaseIniFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- clear()¶
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart¶
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
RegTexEdit¶
- def_editReg
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegTexEdit(textures: Dict[str, List[str | Tuple[str, Callable[[str, str], bool]]]] | None = None)¶
This class inherits from
RegEditFilterClass for editting texture .dds files to a
IfContentPart- Parameters:
textures (Optional[Dict[
str, List[Union[str, Tuple[str, Callable[[str,str],bool]]]]]]) –Texture .dds files to be editted from existing textures files
The keys are the name of the type of texture files of the mod object
The values are either:
the name of the registers to hold the editted textures
a tuple containing the name of the register to hold the editted texture and a predicate, will edit the texture to the corresponding register only if the predicate returns
Truefor the register valueThe predicate takes in:
The old register key of the texture to be editted
The correspondnig value for the old register key
eg.
{"NormalMap": ["ps-t1", "r13", "ps-t0", lambda key, val: val.find("NormalMap") != -1], "ShinyMetalMap": ["ps-t2"]}
Default:
None
- _regEditVals¶
The texture edits to do on the current
IfContentPartbeing parsed
The keys are the name of the registers and the values are the section names for the textures
- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart¶
The main function to edit the registers for the current
IfContentPart- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
BaseIniFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- clear()¶
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart¶
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns:
The resultant part of the
IfTemplatethat got its registers editted- Return type:
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)¶
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters:
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- property textures: Dict[str, List[str]]¶
Texture .dds files to be editted from existing textures files
The keys are the name of the type of texture files of the mod object
The values are the name of the registers to hold the editted textures
eg.
{"NormalMap": ["ps-t1", "r13", "ps-t0"], "ShinyMetalMap": ["ps-t2"]}
Buffer Files¶
Some data related to .buf files
BufType¶
- class BufType(name: str)¶
The base class for a type in a .buf file
- Parameters:
name (
str) – The name of the element
BufDataType¶
- class BufDataType(name: str, size: int, isBigEndian: bool = False)¶
This class inherits from
BufTypeThe type definition for an elementary data type within a .buf file
- Parameters:
- decode(src: bytes) Any¶
Decode the raw bytes to the required format for the type
Warning
Please make sure the number of bytes passed into ‘src’ matches the size of the type
- Parameters:
src (
bytes) – The raw bytes to decode- Returns:
The decoded format for the type
- Return type:
Any
- encode(src: Any) bytes¶
Encodes the format of the type back to raw bytes
Warning
Please make sure ‘src’ is within the acceptable range for the type
- Parameters:
src (Any) – The decoded format for the type
- Returns:
The encoded raw bytes
- Return type:
- property isBigEndian: bool¶
The endianness for the data type
- Getter:
Retrieves whether the data type is in big endian mode
- Setter:
Sets the new endianness for the data type
- Type:
BufBaseInt¶
- class BufBaseInt(name: str, size: int, isBigEndian: bool = False, isSigned: bool = True)¶
This class inherits from
BufDataTypeThe type definition for some generic integer type within a .buf file
- Parameters:
- decode(src: bytes) int¶
Decode the raw bytes to an integer
Warning
Please make sure the number of bytes passed into ‘src’ matches the size of the type
- encode(src: int) bytes¶
Encodes an integer back to raw bytes
Warning
Please make sure ‘src’ is within the acceptable range for the type
- property isBigEndian: bool¶
The endianness for the data type
- Getter:
Retrieves whether the data type is in big endian mode
- Setter:
Sets the new endianness for the data type
- Type:
BufSignedInt¶
- class BufSignedInt(name: str = 'SignedInt32', size: int = 4, isBigEndian: bool = False)¶
This class inherits from
BufBaseIntThe type definition for some signed integer type within a .buf file
- Parameters:
name (
str) –The name of the element
Default:
BufDataTypeNames.Int32.valuesize (
int) –The byte size for the data type
Default:
ByteSize.Int32.valueisBigEndian (
bool) –Whether the type is in big endian mode
Default:
False
- decode(src: bytes) int¶
Decode the raw bytes to an integer
Warning
Please make sure the number of bytes passed into ‘src’ matches the size of the type
- encode(src: int) bytes¶
Encodes an integer back to raw bytes
Warning
Please make sure ‘src’ is within the acceptable range for the type
- property isBigEndian: bool¶
The endianness for the data type
- Getter:
Retrieves whether the data type is in big endian mode
- Setter:
Sets the new endianness for the data type
- Type:
BufUnSignedInt¶
- class BufUnSignedInt(name: str = 'UnsignedInt32', size: int = 4, isBigEndian: bool = False)¶
This class inherits from
BufBaseIntThe type definition for some signed integer type within a .buf file
- Parameters:
name (
str) –The name of the element
Default:
BufDataTypeNames.UInt32.valuesize (
int) –The byte size for the data type
Default:
ByteSize.UInt32.valueisBigEndian (
bool) –Whether the type is in big endian mode
Default:
False
- decode(src: bytes) int¶
Decode the raw bytes to an integer
Warning
Please make sure the number of bytes passed into ‘src’ matches the size of the type
- encode(src: int) bytes¶
Encodes an integer back to raw bytes
Warning
Please make sure ‘src’ is within the acceptable range for the type
- property isBigEndian: bool¶
The endianness for the data type
- Getter:
Retrieves whether the data type is in big endian mode
- Setter:
Sets the new endianness for the data type
- Type:
BufBaseFloat¶
- class BufBaseFloat(name: str, size: int, isBigEndian: bool = False)¶
This class inherits from
BufDataTypeThe type definition for a generic floating point number within a .buf file
- Parameters:
- decode(src: bytes) int¶
Decode the raw bytes to a floating point number
Warning
Please make sure the number of bytes passed into ‘src’ matches the size of the type
- Parameters:
src (
bytes) – The raw bytes to decode- Returns:
The decoded floating point
- Return type:
- encode(src: Any) bytes¶
Encodes the floating point back to raw bytes
Warning
Please make sure ‘src’ is within the acceptable range for the type
- Parameters:
src (
float) – The floating point to encode- Returns:
The encoded raw bytes
- Return type:
- property isBigEndian: bool¶
The endianness for the data type
- Getter:
Retrieves whether the data type is in big endian mode
- Setter:
Sets the new endianness for the data type
- Type:
BufFloat¶
- class BufFloat(isBigEndian: bool = False)¶
This class inherits from
BufBaseFloatThe type definition for a 32-bit floating point number within a .buf file
- Parameters:
isBigEndian (
bool) –Whether the type is in big endian mode
Default:
False
- decode(src: bytes) int¶
Decode the raw bytes to a floating point number
Warning
Please make sure the number of bytes passed into ‘src’ matches the size of the type
- Parameters:
src (
bytes) – The raw bytes to decode- Returns:
The decoded floating point
- Return type:
- encode(src: Any) bytes¶
Encodes the floating point back to raw bytes
Warning
Please make sure ‘src’ is within the acceptable range for the type
- Parameters:
src (
float) – The floating point to encode- Returns:
The encoded raw bytes
- Return type:
- property isBigEndian: bool¶
The endianness for the data type
- Getter:
Retrieves whether the data type is in big endian mode
- Setter:
Sets the new endianness for the data type
- Type:
BufFloat16¶
- class BufFloat16(isBigEndian: bool = False)¶
This class inherits from
BufBaseFloatThe type definition for a 16-bit half precision floating point number within a .buf file
- Parameters:
isBigEndian (
bool) –Whether the type is in big endian mode
Default:
False
- decode(src: bytes) int¶
Decode the raw bytes to a floating point number
Warning
Please make sure the number of bytes passed into ‘src’ matches the size of the type
- Parameters:
src (
bytes) – The raw bytes to decode- Returns:
The decoded floating point
- Return type:
- encode(src: Any) bytes¶
Encodes the floating point back to raw bytes
Warning
Please make sure ‘src’ is within the acceptable range for the type
- Parameters:
src (
float) – The floating point to encode- Returns:
The encoded raw bytes
- Return type:
- property isBigEndian: bool¶
The endianness for the data type
- Getter:
Retrieves whether the data type is in big endian mode
- Setter:
Sets the new endianness for the data type
- Type:
BufUnorm¶
- class BufUnorm(name: str, size: int, isBigEndian: bool = False)¶
This class inherits from
BufBaseIntThe type definition for an unsigned normalized integer number within a .buf file
- Parameters:
- decode(src: bytes) float¶
Decode the raw bytes to the floating point value for the unsigned normalized integer
Warning
Please make sure the number of bytes passed into ‘src’ matches the size of the type
- Parameters:
src (
bytes) – The raw bytes to decode- Returns:
The decoded floating point
- Return type:
- encode(src: float) bytes¶
Encodes the floating point back to raw bytes
Warning
Please make sure ‘src’ is within the acceptable range for the type
- Parameters:
src (
float) – The floating point to encode- Returns:
The encoded raw bytes
- Return type:
- property isBigEndian: bool¶
The endianness for the data type
- Getter:
Retrieves whether the data type is in big endian mode
- Setter:
Sets the new endianness for the data type
- Type:
BufElementType¶
- class BufElementType(name: str, formatName: str, dataTypes: List[BufDataType])¶
This class inherits from
BufTypeThe type definition for an element within a .buf file
- Parameters:
name (
str) – The name of the elementformatName (
str) – The name of the type format according to 3dmigotodataTypes (List[
BufDataType]) – The data types composed within the element
- property dataTypes: List[BufDataType]¶
The data types composed within the element
- Getter:
Retrieves the data types within the element
- Setter:
Sets the new data types for the element
- Type:
List[
BufDataType]
- decode(src: bytes) List[Any]¶
Decode the raw bytes to the required format for the type
Warning
Please make sure the number of bytes passed into ‘src’ matches the size of the type
- Parameters:
src (
bytes) – The raw bytes to decode- Returns:
The decoded format for the type
- Return type:
Any
BaseBufEditor¶
- deffix
- class BaseBufEditor¶
Base class to edit some .buf file
- fix(bufFile: BufFile, fixedBufFile: str) str | None | bytearray¶
Edits the binary file
- Parameters:
- Returns:
If the argument
fixedBufFileisNone, then will return an array of bytes for the fixed .buf file
Otherwise will return the filename to the fixed .buf file if the provided .buf file got corrected- Return type:
BufEditor¶
- deffix
- class BufEditor(filters: List[Callable[[Dict[str, List[Any]], int, int, int], Dict[str, List[Any]]]] | None = None)¶
This class inherits from
BaseBufEditorClass to edit some .buf file
- Parameters:
filters (Optional[List[Callable[[Dict[
str, List[Any]],int,int,int], Dict[str, List[Any]]]]]) –The filters used to edit the data for each line in the .buf file
The filters take in the following arguments:
The data for a particular line
The starting byte index of the line that is read
The line index being processed
The size of each line
The output of the filters is the resultant data that consists where the keys are the names of the elements within a line in the .buf file and the values are the resultant data for each element in the line
Default:
None
- fix(bufFile: BufFile, fixedBufFile: str) str | None | bytearray¶
Edits the binary file
- Parameters:
- Returns:
If the argument
fixedBufFileisNone, then will return an array of bytes for the fixed .buf file
Otherwise will return the filename to the fixed .buf file if the provided .buf file got corrected- Return type:
Models¶
Some internal data models used in the project.
Model¶
- class Model(logger: Logger | None = None)¶
Generic class used for any data models in the fix
- Parameters:
logger (Optional[
Logger]) –The logger used to print messages to the console
Default:
None
IniResourceModel¶
- class IniResourceModel(iniFolderPath: str)¶
Contains data for some particular resource in a .ini file
- Parameters:
iniFolderPath (
str) – The folder path to where the .ini file of the resource is located
IniFixResourceModel¶
- defclear
- class IniFixResourceModel(iniFolderPath: str, fixedPaths: Dict[int, Dict[str, List[str]]], origPaths: Dict[int, List[str]] | None = None)¶
This class inherits from
IniResourceModelContains data for fixing a particular resource in a .ini file
Supported Operations:
- for fixedPath, fixedFullPath, origPath, origFullPath in x
Iterates over all the fixed paths to some resource within a
IfContentPart,x
The tuples to iterate over are as follows: #. fixedPath: (
str) The path name of the fixed file #. fixedFullPath: (str) The full path name to the fixed file #. origPath: (Optional[str]) The path to the orignal file, if available #. origFullPath: (Optional[str]) The full path name to the original file, if available
- Parameters:
iniFolderPath (
str) – The folder path to where the .ini file of the resource is locatedfixedPaths (Dict[
int, Dict[str, List[str]]]) –The file paths to the fixed files for the resource
The outer keys are the indices to the
IfContentPartthat the resource file appears in theIfTemplatefor some resourceThe inner keys are the names for the type of mod to fix to
The inner values are the file paths within the
IfContentPart
origPaths (Optional[Dict[
int, List[str]]]) –The file paths for the resource
The keys are the indices to the
IfContentPartthat the resource file appears in theIfTemplatefor some resourceThe values are the file paths within the
IfContentPart
Default:
None
- fixedPaths¶
The file paths to the fixed files for the resource
The outer keys are the indices to the
IfContentPartthat the resource files appear in theIfTemplatefor some resourceThe inner keys are the names for the type of mod to fix to
The inner values are the file paths within the
IfContentPart
- origPaths¶
The file paths to the files for the resource
The keys are the indices to the
IfContentPartthat the files appear in theIfTemplatefor some resourceThe values are the file paths within the
IfContentPart
- fullPaths¶
The absolute paths to the fixed resource files for the resource
The outer keys are the indices to the
IfContentPartthat the files appear in theIfTemplatefor some resourceThe inner keys are the names for the type of mod to fix to
The inner values are the file paths within the
IfContentPart
- origFullPaths¶
The absolute paths to the files for the resource
The keys are the indices to the
IfContentPartthat the resource files appear in theIfTemplatefor some resourceThe values are the file paths within the
IfContentPart
- clear()¶
Clears out all the path data stored
IniSrcResourceModel¶
- class IniSrcResourceModel(iniFolderPath: str, paths: Dict[int, List[str]])¶
This class inherits from
IniResourceModelContains data for a particular resource in the original .ini file
Supported Operations:
- for path, fullPath in x
Iterates over all the paths to some resource within a
IfContentPart,x
The tuples to iterate over are as follows: #. path: (
str) The path to the file #. fullPath: (str) The full path to the file
- Parameters:
iniFolderPath (
str) – The folder path to where the .ini file of the resource is locatedpaths (Dict[
int, List[str]]) –The file paths to the fixed files for the resource
The keys are the indices to the
IfContentPartthat the resource file appears in theIfTemplatefor some resourceThe values are the file paths within the
IfContentPart
- paths¶
The file paths to the fixed files for the resource
The keys are the indices to the
IfContentPartthat the resource file appears in theIfTemplatefor some resourceThe values are the file paths within the
IfContentPart
- fullPaths¶
The absolute paths to the fixed resource files for the resource
The keys are the indices to the
IfContentPartthat the files appear in theIfTemplatefor some resourceThe values are the file paths within the
IfContentPart
IniTexModel¶
- defclear
- class IniTexModel(iniFolderPath: str, fixedPaths: Dict[int, Dict[str, List[str]]], texEdits: Dict[int, Dict[str, List[BaseTexEditor]]], origPaths: Dict[int, List[str]] | None = None)¶
This class inherits from
IniResourceModelContains data for editting some texture files in a .ini file
Supported Operations:
- for fixedPath, fixedFullPath, origPath, origFullPath in x
Iterates over all the fixed paths to some texture within a
IfContentPart,x
The tuples to iterate over are as follows: #. fixedPath: (
str) The path name of the fixed file #. fixedFullPath: (str) The full path name to the fixed file #. origPath: (Optional[str]) The path to the orignal file, if available #. origFullPath: (Optional[str]) The full path name to the original file, if available
- Parameters:
iniFolderPath (
str) – The folder path to where the .ini file of the resource is locatedfixedPaths (Dict[
int, Dict[str, List[str]]]) –The file paths to the fixed files for the resource
The outer keys are the indices to the
IfContentPartthat the .dds files appears in theIfTemplatefor some textureThe inner keys are the names for the type of mod to fix to
The inner values are the file paths within the
IfContentPart
texEdits (Dict[
int, Dict[str, List[BaseTexEditor]]]) –The texture editors used to edit the texture
The outer keys are the indices to the
IfContentPartthat the .dds files appears in theIfTemplatefor some textureThe inner keys are the names for the type of mod to fix to
The inner values are the different texture editors used to the .dds files
origPaths (Optional[Dict[
int, List[str]]]) –The file paths for the resource
The keys are the indices to the
IfContentPartthat the .dds files appears in theIfTemplatefor some textureThe values are the file paths within the
IfContentPart
Default:
None
- clear()¶
Clears out all the path data stored
IniDownloadModel¶
- class IniDownloadModel(iniFolderPath: str, paths: Dict[int, List[str]], downloads: Dict[int, List[FileDownload]])¶
This class inherits from:
IniSrcResourceModelContains data about a particular resource to download in the original .ini file
Supported Operations:
- for path, fullPath in x
Iterates over all the paths to some resource within a
IfContentPart,x
The tuples to iterate over are as follows: #. path: (
str) The path to the file #. fullPath: (str) The full path to the file
- Parameters:
iniFolderPath (
str) – The folder path to where the .ini file of the resource is locatedpaths (Dict[
int, List[str]]) –The file paths to the download files for the resource
The keys are the indices to the
IfContentPartthat the resource file appears in theIfTemplatefor some resourceThe values are the file paths within the
IfContentPart
downloads (Dict[
int, List[FileDownload]]) –The downloader associated for each file
The keys are the indices to the
IfContentPartthat the resource file appears in theIfTemplatefor some resourceThe values are the downloaders for the files within the
IfContentPart
- downloads¶
The downloader associated for each file
The keys are the indices to the
IfContentPartthat the resource file appears in theIfTemplatefor some resourceThe values are the downloaders for the files within the :class:`IfContentPart`s
- Type:
Dict[
int, List[FileDownload]]
DownloadData¶
- defaddToPart
- defaddToSection
- class DownloadData(name: str, download: FileDownload, resourceKeys: Dict[str, str] | None = None)¶
Download data used by the .ini files
- Parameters:
name (
str) – The name of the download resource in the .ini filedownload (
FileDownload) – The file download to initiateresourceKeys (Dict[
str,str]) –Any additional KVPs to add to the resource section of the download resource
Default:
Nonename – The name of the download resource in the .ini file
download – The file download to initiate
resourceKeys – Any additional KVPs to add to the resource section of the download resource
- addToPart(part: IfContentPart, key: str, val: str, **kwargs)¶
Adds a reference to the download into ‘part’
- Parameters:
part (
IfContentPart) – The part to add the reference**kwargs – Any additional keyword arguments for this method
- addToSection(ifTemplate: IfTemplate, key: str, val: str)¶
Adds a reference to the download into the ‘ifTemplate’
BlendDownloadData¶
- defaddToPart
- defaddToSection
- class BlendDownloadData(name: str, download: FileDownload, resourceKeys: Dict[str, str] | None = None)¶
This class inherits from
DownloadDataBlend.buf download data used by the .ini files
- Parameters:
- addToPart(part: IfContentPart, key: str, val: str, vertexCount: int = 0, **kwargs)¶
Adds a reference to the download into ‘part’
- Parameters:
part (
IfContentPart) – The part to add the referencevertexCount (
int) –The number of vertices in the model (.vb file or its .buf counterparts)
Tip
From
BlendFile, we know that a line in a Blend.buf file for a character usually contains 32 bytes.Since a line in a
Blend.buffile usually references a single vertex, You can calculate the vertex count by doing:(# of bytes in the Blend.buf file) / 32 = vertexCount
**kwargs – Any additional keyword arguments for this method
- addToSection(ifTemplate: IfTemplate, key: str, val: str)¶
Adds a reference to the download into the ‘ifTemplate’
FileStats¶
- defaddFixed
- defaddRemoved
- defaddSkipped
- defaddUndoed
- defaddVisitedAtRemoval
- defclear
- defupdate
- defupdateFixed
- defupdateRemoved
- defupdateSkipped
- defupdateUndoed
- defupdateVisitedAtRemoval
- class FileStats¶
Keeps track of different types of files encountered by the program
- skippedByMods¶
The exceptions to file paths that were skipped due to errors, grouped for each mod folder paths
The outer keys are the names to the mod folders
The inner keys are the names of the file paths
The inner values are the errors encountered
- undoed¶
The file paths for files that got undoed to a previous state before the software was ran
- Type:
Set[
str]
- visitedAtRemoval¶
The file paths for files that got visited when attempting to remove those files
- Type:
Set[
str]
- addFixed(filePath: str)¶
Adds in the file path to the paths of fixed files
- Parameters:
filePath (
str) – the new file path to a fixed file
- addRemoved(filePath: str)¶
Adds in a new file path that got removed
- Parameters:
filePath (
str) – The file path that got removed
- addSkipped(filePath: str, error: Exception, modFolder: str | None = None)¶
Adds a new file path to the paths of skipped files
- Parameters:
- addUndoed(filePath: str)¶
Adds in a new file path that got undoeds
- Parameters:
filePath (
str) – The file path that got undoed
- addVisitedAtRemoval(filePath: str)¶
Adds in a new file path that got visited when the software attempts to remove the file
- Parameters:
filePath (
str) – The file path that got visited when the software attempts to remove the file
- clear()¶
Clears out all saved data about the files
- update(modFolder: str | None = None, newFixed: Set[str] | None = None, newSkipped: Dict[str, Exception] | None = None, newRemoved: Set[str] | None = None, newUndoed: Set[str] | None = None, newVisitedAtRemoval: Set[str] | None = None)¶
Updates the overall file paths in this class
Note
See
FileStats.updateFixed(),FileStats.updateSkipped()andFileStats.updateRemoved()for more details- Parameters:
modFolder (Optional[
str]) –The folder where the files got skipped
Default:
NonenewFixed (Optional[Set[
str]]) –The newly updated file paths that got fixed
Default:
NonenewSkipped (Optional[Dict[
str,Exception]]) –The newly skipped file paths due to errors within a particular mod folder
Default:
NonenewRemoved (Optional[Set[
str]]) –The newly updated file paths that got removed
Default:
NonenewUndoed (Optional[Set[
str]]) –The newly updated file paths that got contents undoed to a previous state before the software was ran
Default:
NonenewVisitedAtRemoved (Optional[Set[
str]]) –The newly updated file paths that got visited when the software attempts to remove those files
Default:
None
- updateFixed(newFixed: Set[str])¶
Updates the fixed file paths
- Parameters:
newFixed (Set[
str]) – The newly added file paths that got fixed
- updateRemoved(newRemoved: Set[str])¶
Updates the file paths that got removed
- Parameters:
newRemoved (Set[
str]) – The newly updated file paths that got removed
- updateSkipped(newSkipped: Dict[str, Exception], modFolder: str | None = None)¶
Updates the file paths that got skipped due to errors
CachedFileStats¶
- defaddFixed
- defaddHit
- defaddRemoved
- defaddSkipped
- defaddUndoed
- defaddVisitedAtRemoval
- defclear
- defupdate
- defupdateFixed
- defupdateHit
- defupdateRemoved
- defupdateSkipped
- defupdateUndoed
- defupdateVisitedAtRemoval
- class CachedFileStats¶
-
- addFixed(filePath: str)¶
Adds in the file path to the paths of fixed files
- Parameters:
filePath (
str) – the new file path to a fixed file
- addHit(filePath: str)¶
Adds a new file path to the paths of cache hit files
- Parameters:
filePath (
str) – the new file path to that was hit
- addRemoved(filePath: str)¶
Adds in a new file path that got removed
- Parameters:
filePath (
str) – The file path that got removed
- addSkipped(filePath: str, error: Exception, modFolder: str | None = None)¶
Adds a new file path to the paths of skipped files
- Parameters:
- addUndoed(filePath: str)¶
Adds in a new file path that got undoeds
- Parameters:
filePath (
str) – The file path that got undoed
- addVisitedAtRemoval(filePath: str)¶
Adds in a new file path that got visited when the software attempts to remove the file
- Parameters:
filePath (
str) – The file path that got visited when the software attempts to remove the file
- clear()¶
Clears out all saved data about the files
- update(modFolder: str | None = None, newFixed: Set[str] | None = None, newSkipped: Dict[str, Exception] | None = None, newRemoved: Set[str] | None = None, newUndoed: Set[str] | None = None, newVisitedAtRemoval: Set[str] | None = None, newHit: Set[str] | None = None)¶
Updates the overall file paths in this class
Note
See
FileStats.updateFixed(),FileStats.updateSkipped()andFileStats.updateRemoved()for more details- Parameters:
modFolder (Optional[
str]) –The folder where the files got skipped
Default:
NonenewFixed (Optional[Set[
str]]) –The newly updated file paths that got fixed
Default:
NonenewSkipped (Optional[Dict[
str,Exception]]) –The newly skipped file paths due to errors within a particular mod folder
Default:
NonenewRemoved (Optional[Set[
str]]) –The newly updated file paths that got removed
Default:
NonenewUndoed (Optional[Set[
str]]) –The newly updated file paths that got contents undoed to a previous state before the software was ran
Default:
NonenewVisitedAtRemoved (Optional[Set[
str]]) –The newly updated file paths that got visited when the software attempts to remove those files
Default:
None
- updateFixed(newFixed: Set[str])¶
Updates the fixed file paths
- Parameters:
newFixed (Set[
str]) – The newly added file paths that got fixed
- updateHit(newHit: Set[str])¶
Updates the file paths that have a cache hit
- Parameters:
newHit (Set[
str]) – The new file paths that got a hit
- updateRemoved(newRemoved: Set[str])¶
Updates the file paths that got removed
- Parameters:
newRemoved (Set[
str]) – The newly updated file paths that got removed
- updateSkipped(newSkipped: Dict[str, Exception], modFolder: str | None = None)¶
Updates the file paths that got skipped due to errors
RemapStats¶
- class RemapStats¶
The file stats for the overall remap process at
RemapService- blend¶
Stats about whether some Blend.buf files got fixed/skipped/removed
Note
removed Blend.buf files refer to RemapBlend.buf files that were previously made by this software on a previous run
- Type:
- position¶
Stats about whether some Position.buf files got fixed/skipped/removed
Note
removed Position.buf files refer to RemapPosition.buf files that were previously made by this software on a previous run
- Type:
- ini¶
Stats about whether some .ini files got fixed/skipped/undoed
Note
The skipped .ini files may or may not have been previously fixed. A path to some .ini file in this attribute DOES NOT imply that the .ini file previously had a fix
- Type:
- texEdit¶
Stats about whether some brand new texture file created by this software has been created/removed
- Type:
- download¶
Stats about whether some downloaded mod files have been recently downloaded/removed
- Type:
- clear()¶
Clears all the stats for the remap process
Texture Editing¶
Classes to help with editting texture files.
BaseTexEditor¶
- deffix
- class BaseTexEditor¶
Base class to edit some .dds file
- fix(texFile: TextureFile, fixedTexFile: str)¶
Edits the texture file
- Parameters:
texFile (
TextureFile) – The texture .dds file to be modifiedfixedTexFile (
str) – The name of the fixed texture file
TexEditor¶
- class TexEditor(filters: List[BaseTexFilter | Callable[[TextureFile], Any]] | None = None)¶
This class inherits from
BaseTexEditorClass for editing a texture file
- Parameters:
filters (Optional[List[Union[
BaseTexFilter, Callable[[TextureFile], Any]]]]) –The filters for editting the image
Default:
None
- filters¶
The filters for editting the image
Default:
None- Type:
List[Union[
BaseTexFilter, Callable[[TextureFile], Any]]]
- classmethod adjustBrightness(texFile: TextureFile, brightness: float)¶
Adjust the brightness of the texture
- Parameters:
texFile (
TextureFile) – The texture file to be edittedbrightness (
float) –The brightness to adjust the texture.
0 => make the image black 1 => original brightness of the image >1 => make the image brighter
- classmethod adjustSaturation(texFile: TextureFile, saturation: float)¶
Adjust the saturation of the texture
- Parameters:
texFile (
TextureFile) – The texture file to be edittedbrightness (
float) –The brightness to adjust the texture.
0 => make the image black and white 1 => original saturation of the image >1 => make the image really saturated like a TV
- fix(texFile: TextureFile, fixedTexFile: str)¶
Edits the texture file
- Parameters:
texFile (
TextureFile) – The texture .dds file to be modifiedfixedTexFile (
str) – The name of the fixed texture file
- classmethod setTransparency(texFile: TextureFile, alpha: int)¶
Sets the transparency of the texture
- Parameters:
texFile (
TextureFile) – The texture file to be edittedalpha (
int) –The value for the alpha (transparency) channel of each pixel. Range from 0 - 255.
0 => Transparent 255 => Opaque
TexCreator¶
- deffix
- class TexCreator(width: int, height: int, colour: Colour | None = None)¶
This class inherits from
BaseTexEditorCreates a brand new .dds file if the file doe not exist
- fix(texFile: TextureFile, fixedTexFile: str)¶
Edits the texture file
- Parameters:
texFile (
TextureFile) – The texture .dds file to be modifiedfixedTexFile (
str) – The name of the fixed texture file
Colour¶
- clsColour.boolToColourChannel
- clsColour.boundColourChannel
- defcopy
- deffromTuple
- defgetId
- defgetTuple
- defmatch
- class Colour(red: int = 255, green: int = 255, blue: int = 255, alpha: int = 255)¶
Class to store data for a colour
Supported Operations:
- hash(x)
Retrieves the hash id for the colour based off
Colour.getId()
- Parameters:
red (
int) –The red channel for the colour
Default:
255green (
int) –The green channel for the colour
Default:
255blue (
int) –The blue channel for the colour
Default:
255alpha (
int) –The transparency (alpha) channel for the colour with a range from 0-255. 0 = transparent, 255 = opaque
Default:
255
- alpha¶
The transparency (alpha) channel for the colour with a range from 0-255. 0 = transparent, 255 = opaque
- Type:
- classmethod boolToColourChannel(val: bool, min: int = 0, max: int = 255) int¶
Converts a boolean value to a value for a colour channel
- classmethod boundColourChannel(val: int, min: int = 0, max: int = 255)¶
Makes a colour channel to be in between the minimum and maximum value
- getId() str¶
Retrieves a unique id for the colour
Note
The id generated will not correspond to any id generated from
ColourRange.getId()- Returns:
The id for the colour
- Return type:
ColourRange¶
- class ColourRange(min: Colour, max: Colour)¶
Class to store data for a colour
Supported Operations:
- hash(x)
Retrieves the hash id for the colour range based off
ColourRange.getId()
- Parameters:
- getId() str¶
Retrieves a unique id for the colour range
Note
The id generated will not correspond to any id generated from
Colour.getId()- Returns:
The id for the colour range
- Return type:
Texture Filters¶
Classes to transform the image within a TextureFile
BaseTexFilter¶
- deftransform
- class BaseTexFilter¶
Base class for transforming a texture file
Supported Operations:
- x(texFile)
Calls
transform()for the filters,x
- transform(texFile: TextureFile)¶
Applies a Transformation to ‘texFile’
- Parameters:
texFile (
TextureFile) – The texture to be editted
GammaFilter¶
- class GammaFilter(gamma: float)¶
This class inherits from
BaseTexFilterPerforms a Gamma Correction on the texture file. See
CorrectGammafor more detailsSupported Operations:
- x(texFile)
Calls
transform()for the filter,x
- Parameters:
gamma (
float) – The luminance parameter for how bright humans perceive the image.
- transform(texFile: TextureFile)¶
Applies a Transformation to ‘texFile’
- Parameters:
texFile (
TextureFile) – The texture to be editted
InvertAlphaFilter¶
- deftransform
- class InvertAlphaFilter¶
This class inherits from
BaseTexFilterInverts the alpha channel of an image.
Supported Operations:
- x(texFile)
Calls
transform()for the filter,x
- transform(texFile: TextureFile)¶
Applies a Transformation to ‘texFile’
- Parameters:
texFile (
TextureFile) – The texture to be editted
ColourReplaceFilter¶
- deftransform
- class ColourReplaceFilter(replaceColour: Colour, coloursToReplace: Set[Colour | ColourRange] | None = None, replaceAlpha: bool = True)¶
This class inherits from
BaseTexFilterReplaces specific colours in the image
Supported Operations:
- x(texFile)
Calls
transform()for the filter,x
Paramaters¶
- replaceColour:
Colour The colour to fill in
- coloursToReplace: Optional[Set[Union[
Colour,ColourRange]]] The colours to find to be replaced. If this value is
None, then will always replace the colour of the pixel
Default:
None- replaceAlpha:
bool Whether to also replace the alpha channel of the original colour
Default:
True
- coloursToReplace¶
The colour to find to be replaced. If this value is
None, then will always replace the colour of the pixel- Type:
Optional[Set[Union[
Colour,ColourRange]]]
- transform(texFile: TextureFile)¶
Applies a Transformation to ‘texFile’
- Parameters:
texFile (
TextureFile) – The texture to be editted
TransparencyAdjustFilter¶
- defadjustTransparency
- deftransform
- class TransparencyAdjustFilter(alphaChange: int, coloursToFilter: Set[Colour | ColourRange] | None = None)¶
This class inherits from
BaseTexFilterAdjust the trasparency (alpha channel) for an image
Supported Operations:
- x(texFile)
Calls
transform()for the filter,x
- Parameters:
alphaChange (
int) –How much to adjust the alpha channel of each pixel. Range from -255 to 255
Note
The alpha channel for an image is inclusively bounded from 0 to 255
coloursToFilter (Optional[Set[Union[
Colour,ColourRange]]]) –The specific colours to have their transparency adjusted. If this value is
None, then will adjust the transparency for the entire image`<br />`Default:
None
- adjustTransparency(texFile: TextureFile)¶
Adjusts the transparency for the entire image
- Parameters:
texFile (
TextureFile) – The texture to be editted
- transform(texFile: TextureFile)¶
Applies a Transformation to ‘texFile’
- Parameters:
texFile (
TextureFile) – The texture to be editted
HueAdjust¶
- def_adjustHue
- deftransform
- class HueAdjust(hue: int)¶
This class inherits from
BaseTexFilterAdjusts the hue of a texture file
Supported Operations:
- x(texFile)
Calls
transform()for the filter,x
- Parameters:
hue (
int) – The hue to adjust the image. Value is from -180 to 180
- transform(texFile: TextureFile)¶
Applies a Transformation to ‘texFile’
- Parameters:
texFile (
TextureFile) – The texture to be editted
PixelFilter¶
- deftransform
- class PixelFilter(transforms: List[BasePixelTransform | Callable[[Colour, int, int], Colour]] | None = None)¶
This class inherits from
BaseTexFilterManipulates each pixel within an image
Warning
This filter iterates through every pixel of the image using Python’s for loops. It is recommended to try to use the different filters inherited from the
BaseTexFilterclass since those filters have more capability to interact with Pillow API or the Numpy API, where their implementation are written at the C level, allowing images to be editted A LOT faster.Supported Operations:
- x(texFile)
Calls
transform()for the filter,x
- Parameters:
transforms (Optional[List[Union[
BasePixelTransform, Callable[[Colour,int,int], Any]]]]) –The functions to edit a single pixel in the texture file
The functions take the following parameters:
The RGBA colour of the pixel
The x-coordinate
The y-coordinate
Default:
None
- transforms¶
The transformation functions to edit a single pixel in the texture file
- Type:
List[Union[
BasePixelTransform, Callable[[Colour],Colour]]]
- transform(texFile: TextureFile)¶
Changes each individual pixel in the image
- Parameters:
texFile (
TextureFile) – The texture to be editteds
TexMetadataFilter¶
- class TexMetadataFilter(edits: Dict[str, Any] | None = None, removes: Set[str] | None = None)¶
This class inherits from
BaseTexFilterA pseudo-filter used to manipulate the metadata of a texture file (PIL.Image.Image.info)
Warning
Currently, any metadata won’t actually be saved into the texture file due to the image library (Pillow) facing difficulty porting the BCn Encoding Algorithm from C/C# to Python.
https://github.com/python-pillow/Pillow/issues/4864
But the following metadata will affect how this software saves the texture file:
gamma
Supported Operations:
- x(texFile)
Calls
transform()for the filter,x
- Parameters:
- transform(texFile: TextureFile)¶
Changes metadata of the image
- Parameters:
texFile (
TextureFile) – The texture to be editted
Pixel Transforms¶
Classes to help transform a single pixel within a texture file.
Warning
These transforms are used by the FixRaidenBoss2.PixelFilter class to iterate through every pixel of an image
using Python’s for loops. It is recommended to try to use the different filters inherited from the FixRaidenBoss2.BaseTexFilter
class since those filters have more capability to interact with Pillow API or the Numpy API,
where their implementation are written at the C++ level, allowing images to be editted A LOT faster.
BasePixelTransform¶
- deftransform
- class BasePixelTransform¶
Base class for transforming a pixel in a texture file
Supported Operations:
- x(pixel, xCoord, yCoord)
Calls
BasePixelTransform.transform()for theBasePixelTransform,x
ColourReplace¶
- deftransform
- class ColourReplace(replaceColour: Colour, coloursToReplace: Set[Colour | ColourRange] | None = None, replaceAlpha: bool = True)¶
This class inherits from
BasePixelTransformReplaces a coloured pixel
Paramaters¶
- replaceColour:
Colour The colour to fill in
- coloursToReplace: Optional[Set[Union[
Colour,ColourRange]]] The colours to find to be replaced. If this value is
None, then will always replace the colour of the pixel
Default:
None- replaceAlpha:
bool Whether to also replace the alpha channel of the original colour
Default:
True
- coloursToReplace¶
The colour to find to be replaced. If this value is
None, then will always replace the colour of the pixel- Type:
Optional[Set[Union[
Colour,ColourRange]]]
- replaceColour:
CorrectGamma¶
- class CorrectGamma(gamma: float)¶
This class inherits from
BasePixelTransformPerforms a Gamma Correction on an individual pixel using the following simple Gamma Correction Algorithm
- Parameters:
gamma (
float) –The luminance parameter for how bright humans perceive the image. Based off the following Power Law Relationship`_:
V_out = V_in ^ gamma
Where
V_outis the perceived brightness by human eyes whileV_inis the actual brightness of the imageNote
higher gamma values make the image look brighter and less saturated while lower gamma values make the image look darker and more saturated.
HighlightShadow¶
- class HighlightShadow(highlight: float = 0, shadow: float = 0)¶
This class inherits from
BasePixelTransformA filter that approximates the adjustment of the shadow/hightlight of an image
Note
Reference: Highlight Shadow Approximation Reference
- Parameters:
- highlight¶
The amount of shadow to apply to the pixel. Range from -1 to 1, and 0 = no change
- Type:
- shadow¶
The amount of shadow to apply to the pixel. Range from -1 to 1, and 0 = no change
- Type:
InvertAlpha¶
- deftransform
- class InvertAlpha¶
This class inherits from
BasePixelTransformInverts the alpha channel of a pixel
TempControl¶
- deftransform
- class TempControl(temp: float = 0)¶
This class inherits from
BasePixelTransformControls the temperature of a texture file using a modified version of the Simple Image Temperature/Tint Adjust Algorithm such that the colour channels increase/decrease linearly with respect to their corresponding pixel value and the user selected temperature
- Parameters:
temp (
float) –The temperature to set the image. Range from -1 to 1
Default:
0
TintTransform¶
- class TintTransform(tint: int = 0)¶
This class inherits from
BasePixelTransformControls the tint of a texture file using the Simple Image Temperature/Tint Adjust Algorithm
- Parameters:
tint (
int) –The tint to set the image. Range from -100 to 100
Default:
0
Transparency¶
- deftransform
- class Transparency(alphaChange: int)¶
This class inherits from
BasePixelTransformAdjust the trasparency (alpha channel) for an image
- Parameters:
alphaChange (
int) –How much to adjust the alpha channel of each pixel. Range from -255 to 255
Note
The alpha channel for an image is inclusively bounded from 0 to 255
Views¶
Different display views for the project.
Logger¶
- clsLogger.getBulletStr
- clsLogger.getNumberedStr
- def_addLogTxt
- def_setDefaultHeadingAtts
- defbox
- defbulletPoint
- defclear
- defcloseHeading
- deferror
- defgetStr
- defhandleException
- definput
- deflist
- deflog
- defopenHeading
- defspace
- defsplit
- defwaitExit
- class Logger(prefix: str = '', logTxt: bool = False, verbose: bool = True)¶
Class for pretty printing output to display on the console
- Parameters:
- _headings¶
A stack of headings that have been opened (by calling
Heading.open()), but have not been closed yet (have not calledHeading.close()yet)- Type:
Deque[
Heading]
- _addLogTxt(txt: str)¶
Appends the text to the logged output to be printed to a .txt file
- Parameters:
txt (
str) – The text to be added onto the logged output
- _setDefaultHeadingAtts()¶
Sets the default attributes for printing out a header line
- box(message: str, header: str)¶
Prints the message to be sandwiched by the text defined in the argument,
header
- bulletPoint(txt: str)¶
Prints out an item in an unordered list
- Parameters:
txt (
str) – The message we want to print out
- clear()¶
Clears out any saved text from the logger
- closeHeading()¶
Prints out a closing heading that corresponds to a previous opening heading printed (see line 3 of the example at
Heading)
- error(message: str)¶
Prints an error message
- Parameters:
message (
str) – The message we want to print out
- handleException(exception: Exception)¶
Prints the message for an error
- Parameters:
exception (
Exception) – The error we want to handle
- list(lst: List[str], transform: Callable[[str], str] | None = None)¶
Prints out an ordered list
- Parameters:
- log(message: str)¶
Regularly prints text onto the console
- Parameters:
message (
str) – The message we want to print out
- openHeading(txt: str, sideLen: int = 2, headingChar='=')¶
Prints out an opening heading
- Parameters:
txt (
str) – The message we want to print outsideLen (
int) –How many characters we want for the side border of the heading
(see line 1 of the example atHeading)
Default: 2
headingChar (
str) –The type of character used to print the side border of the heading
(see line 3 of the example atHeading)
Default: “=”
- property prefix¶
The line of text that is printed before any message is printed out
- Getter:
Returns such a prefix
- Setter:
Sets up such a prefix for the logger
- Type:
- space()¶
Prints out a space
- split()¶
Prints out a new line
- waitExit()¶
Prints the message used when the script finishes running
Heading¶
- class Heading(title: str = '', sideLen: int = 0, sideChar: str = '=')¶
Class for handling information about a heading for pretty printing
Examples
1======= Title: Fix Raiden Boss 2 ======= 2... 3========================================
- Parameters:
- sideLen¶
The number of characters we want one side for the border of the opening heading to have
- Type:
Enums¶
Some useful Enumerations and constants.
ModTypeNames¶
- Amber
- AmberCN
- Arlecchino
- ArlecchinoBoss
- Ayaka
- AyakaSpringbloom
- Barbara
- BarbaraSummertime
- CherryHuTao
- Diluc
- DilucFlamme
- Fischl
- FischlHighness
- Ganyu
- GanyuTwilight
- HuTao
- Jean
- JeanCN
- JeanSea
- Kaeya
- KaeyaSailwind
- Keqing
- KeqingOpulent
- Kirara
- KiraraBoots
- Klee
- KleeBlossomingStarlight
- Lisa
- LisaStudent
- Mona
- MonaCN
- Nilou
- NilouBreeze
- Ningguang
- NingguangOrchid
- Raiden
- RaidenBoss
- Rosaria
- RosariaCN
- Shenhe
- ShenheFrostFlower
- Xiangling
- XianglingCheer
- Xingqiu
- XingqiuBamboo
- class ModTypeNames(value)¶
The names of the different types of mods this fix will fix from or fix to
- Amber = 'Amber'¶
Amber from GI
- AmberCN = 'AmberCN'¶
Amber Chinese version from GI
- Arlecchino = 'Arlecchino'¶
Arlecchino from GI
- ArlecchinoBoss = 'ArlecchinoBoss'¶
The first phase of the Arlecchino boss from GI
- Ayaka = 'Ayaka'¶
Ayaka from GI
- AyakaSpringbloom = 'AyakaSpringBloom'¶
Ayaka Fontaine skin from GI
- Barbara = 'Barbara'¶
Barabara from GI
- BarbaraSummertime = 'BarbaraSummertime'¶
Barbara summer skin from GI
- CherryHuTao = 'CherryHuTao'¶
Hu Tao Lantern Rite skin from GI
- Diluc = 'Diluc'¶
Diluc from GI
- DilucFlamme = 'DilucFlamme'¶
Diluc Red Dead of the Night skin from GI
- Fischl = 'Fischl'¶
Fischl from GI
- FischlHighness = 'FischlHighness'¶
Fischl summer skin from GI
- Ganyu = 'Ganyu'¶
Ganyu from GI
- GanyuTwilight = 'GanyuTwilight'¶
Ganyu Lantern Rite skin from GI
- HuTao = 'HuTao'¶
HuTao from GI
- Jean = 'Jean'¶
Jean from GI
- JeanCN = 'JeanCN'¶
Jean Chinese version from GI
- JeanSea = 'JeanSea'¶
Jean summer skin from GI
- Kaeya = 'Kaeya'¶
Kaeya from GI
- KaeyaSailwind = 'KaeyaSailwind'¶
KaeyaSailwind from GI
- Keqing = 'Keqing'¶
Keqing from GI
- KeqingOpulent = 'KeqingOpulent'¶
Keqing Lantern Rite skin from GI
- Kirara = 'Kirara'¶
Kirara from GI
- KiraraBoots = 'KiraraBoots'¶
Kirara summer skin from GI
- Klee = 'Klee'¶
Klee from GI
- KleeBlossomingStarlight = 'KleeBlossomingStarlight'¶
Klee summer skin from GI
- Lisa = 'Lisa'¶
Lisa from GI
- LisaStudent = 'LisaStudent'¶
Lisa Sumeru skin from GI
- Mona = 'Mona'¶
Mona from GI
- MonaCN = 'MonaCN'¶
Mona Chinese version from GI
- Nilou = 'Nilou'¶
Nilou from GI
- NilouBreeze = 'NilouBreeze'¶
Nilou summer skin from GI
- Ningguang = 'Ningguang'¶
Ningguang from GI
- NingguangOrchid = 'NingguangOrchid'¶
Ningguang Lantern Rite from GI
- Raiden = 'Raiden'¶
Ei from GI
- RaidenBoss = 'RaidenBoss'¶
The first phase of the Raiden Shogun boss from GI
- Rosaria = 'Rosaria'¶
Rosaria from GI
- RosariaCN = 'RosariaCN'¶
Rosaria Chinese version from GI
- Shenhe = 'Shenhe'¶
Shenhe from GI
- ShenheFrostFlower = 'ShenheFrostFlower'¶
Shenhe Lantern Rite skin from GI
- Xiangling = 'Xiangling'¶
Xiangling from GI
- XianglingCheer = 'XianglingCheer'¶
Xiangling Lantern Rite skin from GI
- Xingqiu = 'Xingqiu'¶
Xingqiu from GI
- XingqiuBamboo = 'XingqiuBamboo'¶
Xingqiu Lantern Rite skin from GI
ModTypes¶
- Amber
- AmberCN
- Arlecchino
- Ayaka
- AyakaSpringBloom
- Barbara
- BarbaraSummertime
- CherryHuTao
- Diluc
- DilucFlamme
- Fischl
- FischlHighness
- Ganyu
- GanyuTwilight
- HuTao
- Jean
- JeanCN
- JeanSea
- Kaeya
- KaeyaSailwind
- Keqing
- KeqingOpulent
- Kirara
- KiraraBoots
- Klee
- KleeBlossomingStarlight
- Lisa
- LisaStudent
- Mona
- MonaCN
- Nilou
- NilouBreeze
- Ningguang
- NingguangOrchid
- Raiden
- Rosaria
- RosariaCN
- Shenhe
- ShenheFrostFlower
- Xiangling
- XianglingCheer
- Xingqiu
- XingqiuBamboo
- class ModTypes(value)¶
The supported types of mods that can be fixed
Caution
The different
ModTypeobjects in this enum are used by the software to help fix specific types of mods.Modifying the objects within this enum will also modify the behaviour of how this software fixes a particular mod. If this side effect is not your intention, then you can construct a brand new
ModTypeobject from theGIBuilderclassTip
Before parsing the regexes below, the text is normalized by being converted to all lowercase
- Amber¶
Amber mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(amber)((?!cn).)*\]- Type:
- AmberCN¶
Amber Chinese mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(ambercn).*\]- Type:
- Ayaka¶
Ayaka mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(ayaka)((?!(springbloom)).)*\]- Type:
- AyakaSpringBloom¶
Ayaka Fontaine mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(ayakaspringbloom).*\]- Type:
- Arlecchino¶
Arlecchino mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(arlecchino).*\]- Type:
- Barbara¶
Barabara mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(barbara)((?!summertime).)*\]- Type:
- BarbaraSummertime¶
Barabara Summer mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(barbarasummertime).*\]- Type:
- CherryHuTao¶
Hu Tao Lantern Rite mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(cherryhutao|hutaocherry).*\]- Type:
- Diluc¶
Diluc mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(diluc)((?!flamme).)*\]- Type:
- DilucFlamme¶
Diluc Red Dead of the Night mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(dilucflamme).*\]- Type:
- Fischl¶
Fischl mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(fischl)((?!highness).)*\]- Type:
- FischlHighness¶
Fischl Summer mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(fischlhighness).*\]- Type:
- Ganyu¶
Ganyu mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(ganyu)((?!(twilight)).)*\]- Type:
- GanyuTwilight¶
Ganyu Latern Rite mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(ganyutwilight).*\]- Type:
- HuTao¶
Hu Tao mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride((?!cherry).)*(hutao)((?!cherry).)*\]- Type:
- Jean¶
Jean mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(jean)((?!(cn|sea)).)*\]- Type:
- JeanCN¶
Jean Chinese mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(jeancn)((?!sea).)*\]- Type:
- JeanSea¶
Jean Summertime mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(jeansea)((?!cn).)*\]- Type:
- Kaeya¶
Kaeya mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(kaeya)((?!(sailwind)).)*\]- Type:
- KaeyaSailwind¶
Kaeya Summertime mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(kaeyasailwind).*\]- Type:
- Keqing¶
Keqing mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(keqing)((?!(opulent)).)*\]- Type:
- KeqingOpulent¶
Keqing Lantern Rite mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(keqingopulent).*\]- Type:
- Kirara¶
Kirara mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(kirara)((?!boots).)*\]- Type:
- KiraraBoots¶
Kirara in Boots mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(kiraraboots).*\]- Type:
- Klee¶
Klee mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(klee)((?!blossomingstarlight).)*\]- Type:
- KleeBlossomingStarlight¶
Klee Summertime mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(kleeblossomingstarlight).*\]- Type:
- Lisa¶
Lisa mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(lisa)((?!student).)*\]- Type:
- LisaStudent¶
Lisa Sumeru mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(lisastudent).*\]- Type:
- Mona¶
Mona mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(mona)((?!(cn)).)*\]- Type:
- MonaCN¶
Mona Chinese mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(monacn).*\]- Type:
- Nilou¶
Nilou mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(nilou)((?!(breeze)).)*\]- Type:
- NilouBreeze¶
Nilou Forest Fairy mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(niloubreeze).*\]- Type:
- Ningguang¶
Ningguang Chinese mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(ningguang)((?!(orchid)).)*\]- Type:
- NingguangOrchid¶
Ningguang Lantern Rite mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(ningguangorchid).*\]- Type:
- Raiden¶
Raiden mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(raiden|shogun).*\]- Type:
- Rosaria¶
Rosaria mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(rosaria)((?!(cn)).)*\]- Type:
- RosariaCN¶
Rosaria Chinese mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(rosariacn).*\]- Type:
- Shenhe¶
Shenhe mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(shenhe)((?!frostflower).)*\]- Type:
- ShenheFrostFlower¶
Shenhe Lantern Rite mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(shenhefrostflower).*\]- Type:
- Xiangling¶
Xiangling mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(xiangling)((?!cheer).)*\]- Type:
- XianglingCheer¶
Xiangling Lantern Rite mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(xiangling(cheer|newyear)).*\]- Type:
- Xingqiu¶
Xingqiu mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(xingqiu)((?!bamboo).)*\]- Type:
- XingqiuBamboo¶
Xingqiu Lantern Rite mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*textureoverride.*(xingqiubamboo).*\]- Type:
ModData¶
- class ModData(value)¶
Raw data used by the software
Danger
Modifying these data may change how the software fixes mods. If you do not want this side-effect, please make a deep-copy of the data before editting the data
- Hashes¶
Hash data for the mods
The outer key is the game version
The second outer key is the name of the mod
The inner key is the name of the type of hash
The inner value is the hexadecimal hash
- Indices¶
Index data for the mods
The outer key is the game version
The second outer key is the name of the mod
The inner key is the name of the mod object
The inner value is starting index for the mod object
- VertexCounts¶
The # of vertices for a mod
The outer key is the game version
The second outer key is the name of the mod
The inner value is the number of vertices in the mod
- VGRemapData¶
Vertex group remaps to change the Blend.buf files of the mods
The outer key is the game version
The second outer key is the name of the mod to fix from
The inner key is the name of the mod to fix to
The inner value is vertex group remap
- TexcoordByteSize¶
The byte size of the texture coordinate data for a single vertex
The outer key is the game version
The second outer key is the name of the mod
The inner value is byte size for the texture coordinate of a single vertex
- PositionEditors¶
Position editors for changing the Position.buf files of the mods
The outer key is the game version
The second outer key is the name of the mod to fix from
The inner key is the name of the mod to fix to
The inner value is the editor that will edit the Position.buf files
- Type:
Dict[Union[
str,float], Dict[str, Dict[str, Optional[BaseBufEditor]]]]
- IniParseBuilderArgs¶
The functions that create the arguments/keyword arguments for
IniParseBuilderto build the correct .ini parserThe outer key is the game version
The second outer key is the name of the mod to fix from
The inner value is the function that will create the arguments/keyword arguments
- Type:
Dict[Union[
str,float], Dict[str, Callable[[], Tuple[BaseIniParser, List[Any], Dict[str, Any]]]]]
- IniFixBuilderArgs¶
The functions that create the arguments/keyword arguments for
IniFixBuilderto build the correct .ini fixerThe outer key is the game version
The second outer key is the name of the mod to fix from
The inner value is the function that will create the arguments/keyword arguments
- Type:
Dict[Union[
str,float], Dict[str, Callable[[], Tuple[BaseIniFixer, List[Any], Dict[str, Any]]]]]
- FileDownloadData¶
The file downloads for missing files required by mods
The outer key is the game version
The second outer key is the name of the mod to fix from
The third outer key can be either the mod object or the name of the type of .buf resource
The inner key is the register within the mod object
ModDataAssets¶
- class ModDataAssets(value)¶
Refined data used by the software, grouped by version of the game
Danger
Modifying these data may change how the software fixes mods. If you do not want this side-effect, please make a deep-copy of the data before editting the data
- IniParseBuilderArgs¶
The functions that create the arguments/keyword arguments for
IniParseBuilderto build the correct .ini parser- Type:
- IniFixBuilderArgs¶
The functions that create the arguments/keyword arguments for
IniFixBuilderto build the correct .ini fixer- Type:
- VertexCounts¶
The total # of vertices for each mod
- Type:
ByteSize¶
- class ByteSize(value)¶
Different byte sizes for particular elements in the binary files of mods
- Float16 = 2¶
Number of bytes in a half precision floating point
- Float32 = 4¶
Number of bytes in a floating point
- Int32 = 4¶
Number of bytes in a signed integer
- UInt32 = 4¶
Number of bytes in an unsigned integer
- UNorm8 = 1¶
Number of bytes in an 8-bit unsigned normalized integer
BufFormatNames¶
- class BufFormatNames(value)¶
Names for the different 3dmigoto types for the elements within a .buf file
For more info on the types, please see the type definitions here: https://learn.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-data-conversion
- Float32RG = 'R32G32_FLOAT'¶
A type with 2 channels of floating point numbers
- Float32RGB = 'R32G32B32_FLOAT'¶
A type with 3 channels of floating point numbers
- Float32RGBA = 'R32G32B32A32_FLOAT'¶
A type with 4 channels of floating point numbers
- Int32RGBA = 'R32G32B32A32_SINT'¶
A type with 4 channels of signed integers
- UNORM8RGBA = 'R8G8B8A8_UNORM'¶
A type with 4 channels of unsigned normalized integers with 8 bits per integer
BufDataTypeNames¶
- class BufDataTypeNames(value)¶
The names of the data types within a .buf file
- Float16 = 'Float16'¶
- Float32 = 'Float32'¶
floating point number
- Int32 = 'SignedInt32'¶
Signed integer
- UInt32 = 'UnsignedInt32'¶
Unsigned integer
- UNorm8 = 'UNORM8'¶
An 8-bit unsigned normalized integer
BufElementNames¶
- class BufElementNames(value)¶
Usual names for the elements within a .buf file
- BlendIndices = 'BLENDINDICES'¶
The vertex groups that a vertex belongs to
- BlendWeight = 'BLENDWEIGHT'¶
The distribution of how much a vertex belongs to a certain vertex group
- Colour = 'COLOR'¶
The colour at the vertex
- Normal = 'NORMAL'¶
The normal vector of some vertex of a mod
- Position = 'POSITION'¶
The coordinate of some vertex of a mod
- Tangent = 'TANGENT'¶
The tangent vector of some vertex of a mod
- TextureCoordinate = 'TEXCOORD'¶
The coordinate of the texture file that the vertex is associated with
BufDataTypes¶
- class BufDataTypes(value)¶
Different elementary data types within a .buf file
- Float32 = <FixRaidenBoss2.model.buffers.BufFloat.BufFloat object>¶
Floating point number
- Int32 = <FixRaidenBoss2.model.buffers.BufInt.BufSignedInt object>¶
A signed integer
- UInt32 = <FixRaidenBoss2.model.buffers.BufInt.BufUnSignedInt object>¶
An unsigned integer
- UNorm8 = <FixRaidenBoss2.model.buffers.BufUnorm.BufUnorm object>¶
BufElementTypes¶
- class BufElementTypes(value)¶
Different types for the elements within a .buf file
- PositionFloatRGB¶
The position for the vertex of a mod within an R3 vector space
- Type:
- NormalFloatRGB¶
The normal vector for the vertex of a mod
- Type:
- TangentFloatRGBA¶
The tangent vector for the vertex of a mod
- Type:
- BlendWeightFloatRGBA¶
The distribution for the vertex groups for a particular vertex in a mod
- Type:
- BlendIndicesIntRGBA¶
The vertex groups a vertex from a mod belongs to
- Type:
- ColourRGBA¶
The colour for a vertex in a mod
- Type:
- TextureCoordinateRG¶
The corresponding R2 vector space coordinate from a texture file that is associated to the vertex in a mod
- Type:
IniKeywords¶
- Blend
- Draw
- DrawIndexed
- Filename
- Handling
- Hash
- HashNotFound
- HideOriginalComment
- Ib
- IndexNotFound
- MatchFirstIndex
- ORFixPath
- Position
- Remap
- RemapBlend
- RemapDL
- RemapFix
- RemapIb
- RemapPosition
- RemapTex
- RemapTexcoord
- Resource
- Run
- TexFxFolder
- TexFxShortTransparency0
- TexFxShortTransparency0Natlan
- TexFxShortTransparency1
- TexFxShortTransparency1Natlan
- Texcoord
- Vb0
- Vb1
- class IniKeywords(value)¶
Common keywords used in the .ini file
- Blend = 'Blend'¶
The substring that usually occurs in the name of a section to indicate that the section will call some *.Blend.buf file
- Draw = 'draw'¶
Location to draw a resource
- DrawIndexed = 'drawindexed'¶
How to draw the triangular of the model
- Filename = 'filename'¶
The filename for some resource
- Handling = 'handling'¶
How to handle some resource
- Hash = 'hash'¶
The unique id for a part in the mod
- HashNotFound = 'HashNotFound'¶
The hash for a mod has not been found
- HideOriginalComment = ';RemapFixHideOrig -->'¶
Comment used to hide the sections or the original character
- Ib = 'ib'¶
Index buffer
- IndexNotFound = 'IndexNotFound'¶
The index for a mod has not been found
- MatchFirstIndex = 'match_first_index'¶
The index location to map some resource
- Position = 'Position'¶
The substring that usually occurs in the name of a section to indicate that the section will call some *.Position.buf file
- RemapBlend = 'RemapBlend'¶
The substring used to indicate that the section references some *.RemapBlend.buf file
- RemapDL = 'RemapDL'¶
The substring used to indicate that the section contains some downloaded file from the internet
- RemapIb = 'RemapIB'¶
The substring used to indicate that the section is called by
[TextureOverride.*Ib.*]section.
- RemapPosition = 'RemapPosition'¶
The substring used to indicate that the section references some *.RemapPosition.buf file
- RemapTex = 'RemapTex'¶
The substring used to indicate that the section contains some editted/created texture *.Remap.dds file
- RemapTexcoord = 'RemapTexcoord'¶
The substring used to indicate that the section is called by
[TextureOverride.*Texcoord.*]section.
- TexFxShortTransparency0 = 'CommandList\\TexFx\\T.0'¶
Short alias of transparency sub command in TexFx module mapping to ps-t0
- TexFxShortTransparency0Natlan = 'CommandList\\TexFx\\TN.0'¶
Short alias of transparency sub command in TexFx module mapping to ps-t0 for GI version 5.0 +
- TexFxShortTransparency1 = 'CommandList\\TexFx\\T.1'¶
Short alias of transparency sub command in TexFx module mapping to ps-t1
- TexFxShortTransparency1Natlan = 'CommandList\\TexFx\\TN.1'¶
Short alias of transparency sub command in TexFx module mapping to ps-t1 for GI version 5.0 +
- Texcoord = 'Texcoord'¶
The substring that usually occurs in the name of a section to indicate that the section will call some *.Texcoord.buf file
- Vb0 = 'vb0'¶
Vertex buffer #0
- Vb1 = 'vb1'¶
Vertex buffer #1
IfPredPartType¶
- class IfPredPartType(value)¶
Enum for the possible types for an
IfPredPart- Elif = 'elif'¶
The part contains the starting keyword ‘elif’
- Else = 'else'¶
The part contains the staring keyword ‘else’
- EndIf = 'endif'¶
The part contains the staring keyword ‘endif’
- If = 'if'¶
The part contains the staring keyword ‘if’
- classmethod getType(rawPredPart: str)¶
Retrieves the type for an
IfPredPart- Parameters:
rawPredPart (
str) – The predicate string for theIfPredPart- Returns:
The type found based off ‘rawPredPart’
- Return type:
Optional[
IfPredPartType]
ColourConsts¶
- class ColourConsts(value)¶
Constants about colours
- MaxColourDegree = 360¶
Maximum degrees for some HSV/HSL images
- MaxColourValue = 255¶
Maximum bound for a colour channel
- MinColourDegree = 0¶
Minimum degrees for some HSV/HSL images
- MinColourValue = 0¶
Minimum bound for a colour channel
- PaintTempDecBlueFactor = 2¶
The parameter for approximately how fast the blue channel increases for the temperature decrease algorithm from Paint.net
- PaintTempDecRedFactor = 0.5¶
The parameter for approximately how fast the red channel decreases for the temperature decrease algorithm from Paint.net
- PaintTempIncBlueFactor = 0.44¶
The parameter for approximately how fast the blue channel decreases for the temperature increase algorithm from Paint.net
- PaintTempIncRedFactor = 0.41¶
The parameter for approximately how fast the red channel increases for the temperature increase algorithm from Paint.net
- SRGBGamma = 0.45454545454545453¶
The standard gamma value (1/2.2) typically used in computer displays, sRGB images, Adobe RGB images. See
CorrectGammafor more info.
- StandardGamma = 2.2¶
The reciprocal of the standard gamma value (1/2.2) used in computer displays, sRGB images, Adobe RGB images. See
CorrectGammafor more info.
Colours¶
- class Colours(value)¶
Some common colours used
- LightMapGreenMin¶
Minimum range for the green colour usually in the LightMap.dds
- Type:
Colour(0, 125, 0, 0)
- LightMapGreenMax¶
Maximum range for the green colour usually in the LightMap.dds
- Type:
Colour(50, 150, 50, 255)
- NormalMapYellow¶
The yellow that usually appears in the NormalMap.dds
- Type:
Colour(128, 128, 0, 255)
- NormalMapBlue¶
The light blue that usually appears in the NormalMap.dds
- Type:
Colour(128, 128, 255, 255)
- NormalMapPurple1¶
The light purple with rgb(128, 98, 128) that appears in the NormalMap.dds
- Type:
Colour(128, 98, 128, 255)
ColourRanges¶
- class ColourRanges(value)¶
Some common colour ranges used
- LightMapGreen¶
The colour range for the green usually present in LightMap.dds
- NormalMapPurple1¶
The colour range for the colour
Colour.NormalMapPurple1that usually appears in NormalMap.dds
ImgFormats¶
- class ImgFormats(value)¶
Different formats for an image
- Bit = '1'¶
Image with a single bit channel that has values of either 0 or 1
- HSV = 'HSV'¶
HSV (hue, saturation, value) image
- RGB = 'RGB'¶
RGB (red, green blue) image
- RGBA = 'RGBA'¶
RGBA (red, green, blue) image
TexMetadataNames¶
- class TexMetadataNames(value)¶
Names for the metadata keys in the texture files
- Gamma = 'gamma'¶
Adjusts the gamma value of the texture file
DownloadMode¶
- class DownloadMode(value)¶
The download mode of how the software handles file downloads
- Always = 'always'¶
Will always perform file downloads for every mod, if possible
- AlwaysBuf = 'alwaysbuf'¶
Only download .buf files, if possible
- AlwaysTex = 'alwaystex'¶
Only download textures or .ib files
- Buf = 'buf'¶
Only download .buf files if there is a specified branch in the .vb sections that does not reference the files
- Disabled = 'disabled'¶
Will not perform any file downloads for any mods
- HardTexDriven = 'hardtexdriven'¶
Will perform file downloads based off the following heuristics:
Download textures or .ib files if there is a specified branch in the texture sections that does not reference the files
If any texture/.ib downloads needed to be performed, then download .buf files at specified branches with missing resources
- HardTexDrivenAll = 'texdrivenall'¶
Will perform file downloads based off the following heuristics:
Download textures or .ib files if there is a specified branch in the texture sections that does not reference the files
If any texture/.ib downloads needed to be performed, then download model .buf files at specified/unspecified branch cases with missing resources
- SoftTexDriven = 'softtexdriven'¶
Will perform file downloads based off the following heuristics:
Download textures or .ib files if there is a specified branch in the texture sections that does not reference the files
Download .buf files if either texture/.ib downloads needed to be performed or there are specified branch cases with missing resources
- SoftTexDrivenAll = 'softtexdrivenall'¶
Will perform file downloads based off the following heuristics:
Download textures or .ib files if there is a specified branch in the texture sections that does not reference the files
Download .buf files if either texture/.ib downloads needed to be performed or there are specified/unspecified branch cases with missing resources
- Tex = 'tex'¶
Only download textures or .ib files if there is a specified branch in the texture sections that does not reference the files
- classmethod search(mode: str) DownloadMode | None¶
Searches a download mode based off the provided name
- Parameters:
mode (
str) – The name of the download mode to search for- Returns:
The found download mode based off the provided name
- Return type:
Optional[
DownloadMode]
FileExt¶
- class FileExt(value)¶
Different file extensions for files
- Buf = '.buf'¶
Buffer file extension
- DDS = '.dds'¶
Direct Draw Surface file extension
- Ini = '.ini'¶
Initialization file extension
- Txt = '.txt'¶
Text file extension
FileTypes¶
- class FileTypes(value)¶
Different types of files the software encounters
- Blend = 'Blend.buf'¶
Blend.buf files
- Default = 'file'¶
Default file type
- Ini = '*.ini file'¶
Initialization files
- Log = 'RemapFixLog.txt'¶
Log file
- Position = 'Position.buf'¶
Position.buf files
- RemapBlend = 'RemapBlend.buf'¶
RemapBlend.buf files
- RemapDownload = 'RemapDL download'¶
RemapDL download files
- RemapPosition = 'RemapPosition.buf'¶
RemapPostion.buf files
- RemapTexture = 'RemapTex.dds'¶
RemapTex.dds files
- Texture = '*.dds'¶
Texture .dds files
GlobalIniClassifiers¶
- class GlobalIniClassifiers(value)¶
Global modules used by the sofware to help identify what mod belongs to a .ini file
- Classifier¶
The classifier used to identify whether the .ini file belongs to some mod
- Type:
GlobalClassifiers¶
- class GlobalClassifiers(value)¶
Global modules used by the sofware to help classify strings into different sets
- ModOptFiles¶
The classifier used to identify the type of file within a mod
- Type:
- DownloadModes¶
The classifier used to identify the
DownloadModefor some string- Type:
- IniModelParts¶
The classfier for the different parts of the model of a mod, according to most .ini files
- Type:
GlobalIniRemoveBuilders¶
- class GlobalIniRemoveBuilders(value)¶
Global builders used by the software to dynamically create modules to remove fixes from the .ini file
- RemoveBuilder¶
The builder to dynamically create modules that remove fixes from the .ini file
- Type:
GlobalPackageManager¶
- class GlobalPackageManager(value)¶
Global pacakge manager for handling external libraries
- Packager¶
The pacakge manager used by the softwares
- Type:
- classmethod get(packageData: PackageData) ModuleType¶
Convenience function to call
PackageManager.get()fromPackager- Parameters:
packageData (
PackageData) – The data needed for install the external package- Returns:
The module to the external package
- Return type:
Utilities¶
Some useful utility classes.
FileService¶
- clsFileService.absPathOfRelPath
- clsFileService.changeExt
- clsFileService.copyFile
- clsFileService.disableFile
- clsFileService.getFiles
- clsFileService.getFilesAndDirs
- clsFileService.getRelPath
- clsFileService.getSingleFiles
- clsFileService.ntPathToPosix
- clsFileService.parseOSPath
- clsFileService.read
- clsFileService.readBinary
- clsFileService.rename
- clsFileService.writeBinary
- class FileService¶
Tools for handling with files and folders
- classmethod absPathOfRelPath(dstPath: str, relFolder: str) str¶
Retrieves the absolute path of the relative path of a file with respect to a certain folder
- classmethod disableFile(file: str, filePrefix: str = 'RemapBKUP') str¶
Marks a file as disabled and changes the file to a .txt file
- classmethod getFiles(path: str | None = None, filters: List[Callable[[str], bool]] | None = None, files: List[str] | None = None) List[str] | List[List[str]]¶
Retrieves many different types of files within a folder
Note
Only retrieves files that are the direct children of the folder (will not retrieve files nested in a folder within the folder we are searching)
- Parameters:
path (Optional[
str]) –The path to the target folder we are working with. If this value is set to
None, then will use the current directory of where this module is loaded
Default:
Nonefilters (Optional[List[Callable[[
str],bool]]]) –Different filter functions for each type of file we are trying to get. If this values is either
Noneor[], then will default to a filter to get all the files
Default:
Nonefiles (Optional[List[
str]]) –The files contained in the target folder
If this value is set to
None, then the function will search for the files
Default:
None
- Returns:
The files partitioned into the different types specified by the filters
If ‘filters’ only has 1 element, then the function returns List[
str] Otherwise, will return List[List[str]]- Return type:
- classmethod getFilesAndDirs(path: str | None = None, recursive: bool = False) List[List[str]]¶
Retrieves the files and folders contained in a certain folder
- Parameters:
- Returns:
The files and directories within the folder. The order for the result is:
files
folders
- Return type:
- classmethod getRelPath(path: str, start: str) str¶
Tries to get the relative path of a file/folder relative to another folder, if possible.
If it is not possible to get the relative path, will return back the original file path
Note
An example where it would not be possible to get the relative path would be:
If the file is located in one mount (eg. C:/ drive) and the folder is located in another mount (eg. D:/ drive)
- classmethod getSingleFiles(path: str | None = None, filters: Dict[str, Callable[[str], bool]] | None = None, files: List[str] | None = None, optional: bool = False) str | None | List[str] | List[str | None]¶
Retrieves exactly 1 of each type of file in a folder
- Parameters:
path (Optional[
str]) –The path to the target folder we are searching.
If this value is set to
None, then will use the current directory of where this module is loaded
Default:
Nonefilters (Optional[Dict[str, Callable[[
str],bool]]]) –Different filter functions for each type of file we are trying to get. If this value is
Noneor{}, then will default to use a filter to get all filesThe keys are the names for the file type
Default:
Nonefiles (Optional[List[
str]]) –The files contained in the target folder
If this value is set to
None, then the function will search for the files
Default:
Noneoptional (
bool) –Whether we want to send an exception if there is not exactly 1 file for a certain type of file
If this value is
Falseand there are no files for a certain type of file, then will raise aMissingFileExceptionIf this value is
Falseand there are more than 1 file for a certain type of file, then will raise aDuplicateFileExceptionIf this value is
Trueand there are no files for a certain type of file, then the file for that type of file will beNoneIf this value is
Trueand there are more than 1 file for a certain type of file, then will retrieve the first file for that type of file
Default:
False
- Raises:
MissingFileException – if
optionalis set toFalseand there are not files for a certain type of fileDuplicateFileException – if
optionalis set toFalseand there are more than 1 file for a certain type of file
- Returns:
The files partitioned for each type of file
- Return type:
- classmethod ntPathToPosix(path: str) str¶
Converts a file path from the ntpath library to a file path for the os library
Note
The character for the folder paths (
/or\) used in both libraries may be different depending on the OS
- classmethod parseOSPath(path: str)¶
Retrieves a normalized file path from a string
- Parameters:
path (
str) – The string containing some sort of file path
- classmethod read(file: str, fileCode: str, postProcessor: Callable[[TextIoWrapper], Any]) Any¶
Tries to read a file using different file encodings
Will interact with the file using the following order of encodings:
utf-8
latin1
- Parameters:
file (
str) – The file we are trying to read fromfileCode (
str) – What file mode to interact with the file (eg. r, rb, r+, etc…)postProcessor (Callable[[TextIoWrapper], Any]) – A function used to process the file pointer of the opened file
- Returns:
The result after processing the file pointer of the opened file
- Return type:
Any
DictTools¶
- class DictTools¶
Tools for handling with Dictionaries
- classmethod combine(dict1: Dict[Hashable, Any], dict2: Dict[Hashable, Any], combineDuplicate: Callable[[Hashable, Any, Any], Any] | None = None) Dict[Hashable, Any]¶
Creates a new dictionary from combining 2 dictionaries
- Parameters:
dict1 (Dict[Hashable, Any]) – The destination of where we want the combined dictionaries to be stored
dict2 (Dict[Hashable, Any]) – The dictionary we want to combine with
combineDuplicate (Optional[Callable[[Hashable, Any, Any], Any]]) –
Function for handling cases where there contains the same key in both dictionaries
The first parameter is the key that is in both dictionary
The second parameter is the value that comes from
srcDictThe third parameter is the value that comes from
newDict
If this value is set to
None, then will use the key from ‘dict2’
Default:
NonemakeNewCopy (
bool) – Whether we want the resultant dictionary to be newly created or to be updated intodict1
- Returns:
The new combined dictionary
- Return type:
Dict[Hashable, Any]
- classmethod filter(dict: Dict[Hashable, Any], predicate: Callable[[Hashable, Any], bool]) Dict[Hashable, Any]¶
Filters a dictionary
- Parameters:
dict (Dict[Hashable, Hashable]) – The dictionary to filter
predicate (Callable[[Hashable, Any],
bool]) –The predicate used for the filter
The predicate has the following parameters
The key of the dictionary
The value of the dictionary
- Returns:
The filtered dictionary
- Return type:
Dict[Hashable, Any]
- classmethod forDict(nestedDict: Dict[Hashable, Any], keyNames: List[str], func: Callable[[Dict[str, Hashable], Dict[str, Any]], Any])¶
Iterates over a nested dictionary
- Parameters:
nestedDict (Dict[Hashable, Any]) – The nested dictionary to iterate over
keyNames (List[
str]) – The variable names of the keys in the nested dictionaryfunc (Callable[Dict[
str, Hashable], Dict[str, Any], Any]) –callback function that will be called at the leaf node of the nested dictionary
The function contains the following arguments: #. The dictionary keys encountered in the current iteration #. The corresponding values encountered at each dictionary layer in the current iteration
- classmethod getFirstKey(dict: Dict[Any, Any]) Any¶
Retrieves the first key in a dictionary
- Parameters:
dict (Dict[Any, Any]) –
The dictionary we are working with
Note
The dictionary must not be empty
- Returns:
The first key of the dictionary
- Return type:
Any
- classmethod getFirstValue(dict: Dict[Any, Any]) Any¶
Retrieves the first value in a dictionary
- Parameters:
dict (Dict[Any, Any]) – The dictionary we are working with
- Returns:
The first value of the dictionary
- Return type:
Any
- classmethod invert(dict: Dict[Hashable, Hashable]) Dict[Hashable, Hashable]¶
Inverts a dictionary by making the keys the values and the values the keys
- Parameters:
dict (Dict[Hashable, Hashable]) – The dictionary to invert
- Returns:
The inverted dictionary
- Return type:
Dict[Hashable, Hashable]
- classmethod update(srcDict: Dict[Hashable, Any], newDict: Dict[Hashable, Any], combineDuplicate: Callable[[Hashable, Any, Any], Any] | None = None) Dict[Hashable, Any]¶
Updates
srcDictbased off the new values fromnewDict- Parameters:
srcDict (Dict[Hashable, Any]) – The dictionary to be updated
newDict (Dict[Hashable, Any]) – The dictionary to help with updating
srcDictcombineDuplicate (Optional[Callable[[Hashable, Any, Any], Any]]) –
Function for handling cases where there contains the same key in both dictionaries
The first parameter is the key that is in both dictionary
The second parameter is the value that comes from
srcDictThe third parameter is the value that comes from
newDict
If this value is set to
None, then will use the key fromnewDict
Default:
None
- Returns:
Reference to the updated dictionary
- Return type:
Dict[Hashable, Any]
TextTools¶
- class TextTools¶
-
- classmethod capitalizeOnlyFirstChar(txt: str) str¶
Capitalize only the beginning letter of ‘txt’ while leaving the rest of ‘txt’ as lowercase
- classmethod getTextLines(txt: str) List[str]¶
Retrieves the lines of text, split by the newline character, similar to how python’s readlines function works
- classmethod removeLines(txtLines: List[str], partIndices: List[Tuple[int, int]]) List[str]¶
Removes multiple sub-lists of lines from a list of text lines
- Parameters:
- Returns:
The new lines of text with the removed lines
- Return type:
List[
str]
IntTools¶
- class IntTools¶
Tools for handling integers
- classmethod toBase(num: int, base: int) Tuple[List[int], bool]¶
Converts a base 10 number to an arbitrary base number
- Parameters:
- Raises:
ZeroDivisionError – The base is smaller or equal to 1
- Returns:
Retrieves the following data in the tuple:
The digits in the converted number
Whether the number is negative
- Return type:
- classmethod toBase64(num: int, getDigit: str | List[str] | Callable[[int], str] | None = None, negativeChar: str = '-') str¶
Converts a base 10 number to a base 64 number
- Parameters:
num (
int) – The base 10 number to convertgetDigit (Optional[Union[
str, List[str], Callable[[int],str]]]) –how to get the string representation of a digit.
If this argument is a string or a list, each element is the string representation of the digit at the particular index of the string/list.
If this argument is
None, then will use the following string for each digit:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_This is the same digit representation as the standard base 64 except that the 63rd digit (
/) is replaced with the_character
Default:
None
negativeChar (
str) –The character representation for the negative symbol
Default:
"-"
- Returns:
The converted string representation of the arbitrary base 64 number
- Return type:
- classmethod toStrBase(num: int, base: int, getDigit: str | List[str] | Callable[[int], str], negativeChar: str) str¶
Converts a base 10 number to an arbitrary base number, such that the characters in this arbitrary based number are all characters
- Parameters:
num (
int) – The base 10 number to convertbase (
int) – The base to convert togetDigit (Union[
str, List[str], Callable[[int],str]]) –how to get the string representation of a digit.
If this argument is a string or a list, each element is the string representation of the digit at the particular index of the string/list.
negativeChar (
str) – The character representation for the negative symbol
- Returns:
The converted string representation of the arbitrary base number
- Return type:
HashTools¶
- class HashTools¶
Tools for custom hashing
- classmethod base64DeterministicShortUniqueHash(obj: Hashable) str¶
Converts the hash from a naive hash function that acts as incrementor to a unique and short base 64 hash
- Parameters:
obj (Hashable) – The object to hash
- Returns:
The unique base 64 hash
- Return type:
- classmethod base64Hash(obj: Hashable, hashFunc: Callable[[Hashable], int] | None = None) str¶
Converts the hash to base 64
- Parameters:
obj (Hashable) – The object to hash
hashFunc (Optional[Callable[[Hashable],
int]]) –The base hash function to use.
if this value is
None, then the hash function will be the builtin hash
Default:
None
- Returns:
The base 64 hash
- Return type:
- classmethod base64ShortUniqueHash(obj: Hashable) str¶
Converts the hash from builtin hash function to a unique and unique and short base 64 hash
- Parameters:
obj (Hashable) – The object to hash
- Returns:
The unique base 64 hash
- Return type:
FilePath¶
- class FilePath(path: str)¶
Class for storing info about a file path
- Parameters:
path (
str) – The file path
- property base¶
The base for the file path (includes file extension)
- Getter:
Retrieves the base
- Setter:
Sets the new base for the file path
- Type:
- property baseName¶
The basename for the file path without any file extensions
- Getter:
Retrieves the basename
- Setter:
Sets the new basename for the file path
- Type:
- property folder¶
The parent folder for the path
- Getter:
Retrieves the parent folder name
- Setter:
Sets the new parent folder name
- Type:
FileDownload¶
- class FileDownload(url: str, filename: str, cache: bool = True)¶
Class to handle file downloads from some server
- Parameters:
- cache¶
Whether to copy the previous downloaded file if possible instead of downloading another copy of the file
- Type:
Cache¶
- defclear
- class Cache(capacity: int = 128, cacheStorage: Any | None = None)¶
Class for a generic cache
Supported Operations:
- len(x)
Retrieves the size of the
Cache,x
- x[key]
Retrieves the value from the
Cache,x, from the keykey
- x[key] = newValue
Sets the key
keyof theCache,x, to have the value ofnewValue
- Parameters:
LruCache¶
- defclear
- class LruCache(capacity: int = 128)¶
This class inherits from
CacheClass for an LRU cache
Supported Operations:
- len(x)
Retrieves the size of the
LruCache,x
- x[key]
Retrieves the value from the
LruCache,x, from the keykey
- x[key] = newValue
Sets the key
keyof theLruCache,x, to have the value ofnewValue
- Parameters:
capacity (
int) –The maximum capacity of the cache
Default: 128
Node¶
- class Node(id: Hashable)¶
Class for a node in a graph
Supported Operations:
- hash(x)
Retrieves the id of the node as the hash value
- Parameters:
id (Hashable) – The id for the node
HeapNode¶
- class HeapNode(val: T, compare: Callable[[T, T], int])¶
Class for a node in a heap
Supported Operations:
- x < y
Whether the value in the node x is smaller than the value in the node y
- x <= y
- Whether the value in the node x is smaller or equal to the value in the node y
- x > y
Whether the value in the node x is bigger than the value in the node y
- x >= y
Whether the value in the node x is bigger or equal to the value in the node y
- x == y
Whether the value in the node x is equal to the value in node y
- x != y
Whether the value in the node x is not equal to the value in node y
- Parameters:
val (T) – The value to be stored in the node
compare (Callable[[T, T],
int]) – The compare function for comparing elements in the heap
- val¶
The value within the node
- Type:
T
- compare¶
The compare function for comparing elements in the heap
- Type:
Callable[[T, T],
int]
DFA¶
- def_constructNode
- defaddState
- defaddTransition
- defclear
- defreset
- deftransition
- class DFA(nodeCls: ~typing.Type[~FixRaidenBoss2.tools.Node.Node] = <class 'FixRaidenBoss2.tools.Node.Node'>)¶
Class for a DFA (Deterministic Finite Automaton)
- _states¶
The states in the DFA
The keys are the ids of the states and values are the nodes for the states
- Type:
Dict[Hashable,
Node]
- _neighbours¶
The out-neighbour nodes of a state
The outer keys are the ids of the states
The inner keys are the transition from one state to another
The inner values are the ids of the neighbour states
- Type:
Dict[Hashable, Dict[Hashable, Hashable]]
- _accept¶
The ids of the states that are considered as accepting states
- Type:
Set[Hashable]
- _startId¶
The id for the start state
- Type:
Hashable
- _currentStateId¶
The id for the current state
- Type:
Hashable
- _constructNode(id: Hashable, *args, **kwargs) Node¶
Constructs a node for the DFA
- Parameters:
id (Hashable) – The id for the node
*args – Any extra arguments used to construct the node
**kwargs – Any extra keyword arguments used to construct the node
- Returns:
The contructed node
- Return type:
- addState(id: Hashable, isAccept: bool = False, isStart: bool = False) Tuple[Node, bool]¶
Add a new state to the DFA
- Parameters:
- Returns:
Retrieves the data about the newly added state, including:
The corresponding state
Whether the state was newly added
- Return type:
- addTransition(srcId: Hashable, keyword: Hashable, destId: Hashable)¶
Adds a transition to the DFA
- Parameters:
srcId (Hashable) –
The id of the source state for the transition
Caution
The id to the source state must refer to an existing state to the DFA
keyword (Hashable) –
The keyword that will trigger a transition from the source state to the destination state
Warning
If the source state already has such a transition, then will overwrite the destination state for this transition
destId (Hashable) –
The id of the destionation state for the transition
- property currentStateId: Hashable¶
The id of the state the DFA is currently at
Warning
The setter may raise a
KeyErrorif the newly current id does not correspond to any state within the DFA- Getter:
Retrieves the id of the current state
- Setter:
Sets the new id of the current state the DFA is on
- Type:
Hashable
- property startId: Hashable¶
The id to the start state
Warning
The setter may raise a
KeyErrorif the newly given start id does not correspond to any state within the DFA- Getter:
Retrieves the start id
- Setter:
Sets the new start id
- Type:
Hashable
- transition(keyword: Hashable) Tuple[Hashable, bool, bool]¶
Transitions to a new state
- Parameters:
keyword (Hashable) – The keyword to trigger the transition to the new state
- Returns:
Resultant data regarding the new transitioned state, which includes:
The id of the new state
Whether the new state is an accepting state
Whether a transition was taken
- Return type:
Trie¶
- def_addKVP
- def_addKeyword
- def_addNode
- def_compareKeywordIds
- def_constructNode
- defadd
- defbuild
- defclear
- defclearCache
- class Trie(data: ~typing.Dict[str, ~FixRaidenBoss2.constants.GenericTypes.T] | None = None, handleDuplicate: ~typing.Callable[[str, ~FixRaidenBoss2.constants.GenericTypes.T, ~FixRaidenBoss2.constants.GenericTypes.T], ~FixRaidenBoss2.constants.GenericTypes.T] | None = None, nodeCls: ~typing.Type[~FixRaidenBoss2.tools.Node.Node] = <class 'FixRaidenBoss2.tools.Node.Node'>)¶
A class for a basic trie
Supported Operations:
- key in x
Determines if ‘key’ is found
- x[key]
Retrieves the corresponding value to ‘key’
- x[key] = val
Sets the new KVP
- Parameters:
data (Optional[Dict[
str, T]]) –Any initial data to insert
The keys are the keywords to put into the trie and the values are the corresponding values to the keywords
Default:
NonehandleDuplicate (Optional[Callable[[
str, T, T], T]]) –Function to handle the case where 2 KVPs inserted have the same key(word)
The function takes in the following parameters:
If this value is
None, will return the value of the new KVP by default
Default:
NonenodeCls (Type[
Node]) – The class used to construct a node in the trie
- _nodes¶
The nodes in the trie
The keys are the ids for the node and the values are the physical node
- _children¶
The children nodes associated to a node
The outer keys are the ids of the nodes
The inner keys are the string sequences of the edges between a node and its children
The inner values are the ids for the children
Note
This is the adjacency list for the trie
- _parent¶
The parent node associated to a node
The keys are the ids of a node and the values are the ids of the parents
- _keywords¶
The keywords inside of the trie
The keys are the ids for the keywords and the values are the text for the keywords
- _vals¶
The corresponding values to the keywords
The keys are the ids of the keywords and the values corresponding data values for the keyword
- Type:
Dict[
int, T]
- _out¶
The keywords found at a node
The keys are the ids for the nodes and the values are the ids for the found keywords
- _addKVP(keyword: str, value: T) int¶
Adds in a new KVP
Warning
If ‘keyword’ already exists, then the new value for the KVP will be determined based off the
handleDuplicatefunction- Returns:
The id to the keyword
- Return type:
- _compareKeywordIds(keywordId1: int, keywordId2: int) int¶
The compare function for the ids of the keywords
The sorting order for keyword ids is as follows:
ids to existing keywords go before ids that do not correspond to a keyword
ids with longer length keywords go before ids with shorter length keywords
keywords of ids are ordered in alphabetical order
Paramters¶
- returns:
The comparison result of a compare function
- rtype:
- _constructNode(id: Hashable, *args, **kwargs) Node¶
Constructs a a node used for the trie
- Parameters:
id (Hashable) – The id for the node
*args – Any extra arguments to pass to the node
**kwargs – Any extra keyword arguments to pass to the node
- Returns:
The constructed node
- Return type:
- clear()¶
Clears the data
- clearCache()¶
Clears any cached search results
- get(keyword: str, errorOnNotFound: bool = True, default: Any = None) T | Any¶
Retrieves the corresponding value to ‘keyword’
- Parameters:
- Raises:
KeyError – If ‘keyword’ is not found
- Returns:
Either the found value for the keyword or the value specified at ‘default’, if ‘keyword’ is not found and ‘errorOnNotFound’ is set to
False- Return type:
Union[T, Any]
BaseAhoCorasickDFA¶
- defadd
- defbuild
- defclear
- defclearCache
- deffindAll
- deffindFirstAll
- defgetAll
- class BaseAhoCorasickDFA(data: Dict[str, T] | None = None, handleDuplicate: Callable[[str, T, T], T] | None = None)¶
Base class for the DFA (Deterministic Finite Automaton) used in the Aho-Corasick algorithm
- Parameters:
data (Optional[Dict[
str, T]]) –Any initial data to put into the DFA
The keys are the keywords to put into the DFA and the values are the corresponding values to the keywords
Default:
NonehandleDuplicate (Optional[Callable[[
str, T, T], T]]) –Function to handle the case where 2 KVPs inserted have the same key(word)
The function takes in the following parameters:
If this value is
None, will return the value of the new KVP by default
Default:
None
- add(keyword: str, value: T)¶
Adds a new keyword
Caution
Adding a new keyword may trigger the entire DFA to be rebuilt
- Parameters:
keyword (
str) – The keyword to addvalue (T) – The value associated with the keyword
- clearCache()¶
Clears any cached search results
- findAll(txt: str) Dict[str, List[Tuple[int, int]]]¶
Finds all occurences of the keywords from the DFA in the given text
- Parameters:
txt (
str) – The text to search for keywords- Returns:
The indices for all the found keywords within the given text
The keys are the keywords found
The values are all instances of the keyword found
The tuple contains the starting index of the found instance and the ending index of the found instance
- Return type:
- findFirstAll(txt: str) Dict[str, Tuple[int, int]]¶
Finds the first occurences of the keywords from the DFA in the given text
- Parameters:
txt (
str) – The text to search for keywords- Returns:
The indices for all the found keywords within the given text
The keys are the keywords found
The tuple contains the starting index of the found instance and the ending index of the first found instance
- Return type:
- findMaximal(txt: str, count: int = 1) Tuple[str | None | List[str], int | List[int]]¶
Finds the first few largest keywords within ‘txt’
Note
This function is a greedy version of
find()or Maximal Munch that consumes only a limited amount of tokens- Parameters:
- Returns:
Data of the found keyword:
If the ‘count’ argument is less than or equal to 1, then the data will contain:
The keyword found
The starting index of where the keyword was found. If no keywords were found, this index is -1
If the ‘count’ argument is greater than 1, then the data will contain:
The list of keywords found
The corresponding starting indices for where the keyword were found
- Return type:
Tuple[Union[Optional[
str], List[str]], Union[int, List[int]]]
- get(txt: str, errorOnNotFound: bool = True, default: Any = None) Tuple[str | None, T | Any]¶
Retrieves the corresponding value from the first keyword fround in ‘txt’
Note
This function retrieves the corresponding value after running
find()- Parameters:
- Raises:
KeyError – If no keywords are found
- Returns:
Retrieves the following resultant data:
The first keyword found
Either the found value for the first keyword found or the value specified at ‘default’, if no keywords were found and ‘errorOnNotFound’ is set to
False
- Return type:
Tuple[Optional[
str], Union[T, Any]]
- getAll(txt: str) Dict[str, T]¶
Retrieves all the corresponding values to all the keywords found within ‘txt’
- getKeyVal(txt: str, errorOnNotFound: bool = True, default: Any = None) T | Any¶
Retrieves the corresponding value of the key given in ‘txt’
- Parameters:
- Raises:
KeyError – If the keyword is found
- Returns:
Either the found value for the first largest keyword found or the value specified at ‘default’, if no keywords were found and ‘errorOnNotFound’ is set to
False- Return type:
Union[T, Any]
- getMaximal(txt: str, errorOnNotFound: bool = True, default: Any = None, count: int = 1) Tuple[str | None | List[str], T | Any | List[T]]¶
Retrieves the corresponding value from the first largest keyword fround in ‘txt’
Note
This function retrieves the corresponding value after running
findMaximal()- Parameters:
txt (
str) – The text to search for a keyworderrorOnNotFound (
bool) – If no keywords are found, whether to raise an exceptiondefault (Any) – If ‘errorOnNotFound’ is
False, then the default value to return if no keywords are foundcount (
int) –The count of how many keywords to find in the search string
Default:
1
- Raises:
KeyError – If no keywords are found
- Returns:
Retrieves the following resultant data:
If the ‘count’ argument is less than or equal to 1, then the data contains:
The first largest keyword found
#. Either the found value for the first largest keyword found or the value specified at ‘default’, if no keywords were found and ‘errorOnNotFound’ is set to
FalseIf the ‘count’ argument is greater than 1, then the data contains:
The list of keywords found
The corresponding found values to the keywords
- Return type:
Tuple[Union[Optional[
str], List[str]], Union[T, Any, List[T]]]
FastAhoCorasickDFA¶
- defadd
- defbuild
- defclear
- defclearCache
- deffindAll
- deffindFirstAll
- defgetAll
- class FastAhoCorasickDFA(data: Dict[str, T] | None = None, handleDuplicate: Callable[[str, T, T], T] | None = None)¶
A wrapper class over pyahocorasick.Automaton
The DFA (Deterministic Finite Automaton) used in the Aho-Corasick algorithm, implemented at the C level
Supported Operations:
- txt in x
Determines if a keyword is found within ‘txt’
- x[txt]
Retrieves the following data:
The found keyword
The corresponding value to the found keyword
Note
See
getMaximal()for more details
- Parameters:
data (Optional[Dict[
str, T]]) –Any initial data to put into the DFA
The keys are the keywords to put into the DFA and the values are the corresponding values to the keywords
Default:
NonehandleDuplicate (Optional[Callable[[
str, T, T], T]]) –Function to handle the case where 2 KVPs inserted have the same key(word)
The function takes in the following parameters:
If this value is
None, will return the value of the new KVP by default
Default:
None
- add(keyword: str, value: T)¶
Adds a new keyword
Caution
Adding a new keyword may trigger the entire DFA to be rebuilt
- Parameters:
keyword (
str) – The keyword to addvalue (T) – The value associated with the keyword
- clearCache()¶
Clears any cached search results
- findAll(txt: str) Dict[str, List[Tuple[int, int]]]¶
Finds all occurences of the keywords from the DFA in the given text
- Parameters:
txt (
str) – The text to search for keywords- Returns:
The indices for all the found keywords within the given text
The keys are the keywords found
The values are all instances of the keyword found
The tuple contains the starting index of the found instance and the ending index of the found instance
- Return type:
- findFirstAll(txt: str) Dict[str, Tuple[int, int]]¶
Finds the first occurences of the keywords from the DFA in the given text
- Parameters:
txt (
str) – The text to search for keywords- Returns:
The indices for all the found keywords within the given text
The keys are the keywords found
The tuple contains the starting index of the found instance and the ending index of the first found instance
- Return type:
- findMaximal(txt: str, count: int = 1) Tuple[str | None | List[str], int | List[int]]¶
Finds the first few largest keywords within ‘txt’
Note
This function is a greedy version of
find()or Maximal Munch that consumes only a limited amount of tokens- Parameters:
- Returns:
Data of the found keyword:
If the ‘count’ argument is less than or equal to 1, then the data will contain:
The keyword found
The starting index of where the keyword was found. If no keywords were found, this index is -1
If the ‘count’ argument is greater than 1, then the data will contain:
The list of keywords found
The corresponding starting indices for where the keyword were found
- Return type:
Tuple[Union[Optional[
str], List[str]], Union[int, List[int]]]
- get(txt: str, errorOnNotFound: bool = True, default: Any = None) Tuple[str | None, T | Any]¶
Retrieves the corresponding value from the first keyword fround in ‘txt’
Note
This function retrieves the corresponding value after running
find()- Parameters:
- Raises:
KeyError – If no keywords are found
- Returns:
Retrieves the following resultant data:
The first keyword found
Either the found value for the first keyword found or the value specified at ‘default’, if no keywords were found and ‘errorOnNotFound’ is set to
False
- Return type:
Tuple[Optional[
str], Union[T, Any]]
- getAll(txt: str) Dict[str, T]¶
Retrieves all the corresponding values to all the keywords found within ‘txt’
- getKeyVal(txt: str, errorOnNotFound: bool = True, default: Any = None) T | Any¶
Retrieves the corresponding value of the key given in ‘txt’
- Parameters:
- Raises:
KeyError – If the keyword is found
- Returns:
Either the found value for the first largest keyword found or the value specified at ‘default’, if no keywords were found and ‘errorOnNotFound’ is set to
False- Return type:
Union[T, Any]
- getMaximal(txt: str, errorOnNotFound: bool = True, default: Any = None, count: int = 1) Tuple[str | None | List[str], T | Any | List[T]]¶
Retrieves the corresponding value from the first largest keyword fround in ‘txt’
Note
This function retrieves the corresponding value after running
findMaximal()- Parameters:
txt (
str) – The text to search for a keyworderrorOnNotFound (
bool) – If no keywords are found, whether to raise an exceptiondefault (Any) – If ‘errorOnNotFound’ is
False, then the default value to return if no keywords are foundcount (
int) –The count of how many keywords to find in the search string
Default:
1
- Raises:
KeyError – If no keywords are found
- Returns:
Retrieves the following resultant data:
If the ‘count’ argument is less than or equal to 1, then the data contains:
The first largest keyword found
#. Either the found value for the first largest keyword found or the value specified at ‘default’, if no keywords were found and ‘errorOnNotFound’ is set to
FalseIf the ‘count’ argument is greater than 1, then the data contains:
The list of keywords found
The corresponding found values to the keywords
- Return type:
Tuple[Union[Optional[
str], List[str]], Union[T, Any, List[T]]]
AhoCorasickDFA¶
- def_addKVP
- def_addKeyword
- def_addNode
- def_compareKeywordIds
- def_constructNode
- defadd
- defbuild
- defclear
- defclearCache
- deffindAll
- deffindFirstAll
- defgetAll
- class AhoCorasickDFA(data: ~typing.Dict[str, ~FixRaidenBoss2.constants.GenericTypes.T] | None = None, handleDuplicate: ~typing.Callable[[str, ~FixRaidenBoss2.constants.GenericTypes.T, ~FixRaidenBoss2.constants.GenericTypes.T], ~FixRaidenBoss2.constants.GenericTypes.T] | None = None, nodeCls: ~typing.Type[~FixRaidenBoss2.tools.Node.Node] = <class 'FixRaidenBoss2.tools.Node.Node'>)¶
This class inherits from
TrieandBaseAhoCorasickDFAThe DFA (Deterministic Finite Automaton) used in the Aho-Corasick algorithm, implemented using pure Python
Supported Operations:
- txt in x
Determines if a keyword is found within ‘txt’
- x[txt]
Retrieves the following data:
The found keyword
The corresponding value to the found keyword
Note
See
getMaximal()for more details
- Parameters:
data (Optional[Dict[
str, T]]) –Any initial data to put into the DFA
The keys are the keywords to put into the DFA and the values are the corresponding values to the keywords
Default:
NonehandleDuplicate (Optional[Callable[[
str, T, T], T]]) –Function to handle the case where 2 KVPs inserted have the same key(word)
The function takes in the following parameters:
If this value is
None, will return the value of the new KVP by default
Default:
NonenodeCls (Type[
Node]) – The class used to construct a node in the trie
- _fail¶
The failure edges in the DFA
The keys are the ids to the sources node of the edges and the values are the ids to the sink nodes of the edges
- _addKVP(keyword: str, value: T) int¶
Adds in a new KVP
Warning
If ‘keyword’ already exists, then the new value for the KVP will be determined based off the
handleDuplicatefunction- Returns:
The id to the keyword
- Return type:
- _compareKeywordIds(keywordId1: int, keywordId2: int) int¶
The compare function for the ids of the keywords
The sorting order for keyword ids is as follows:
ids to existing keywords go before ids that do not correspond to a keyword
ids with longer length keywords go before ids with shorter length keywords
keywords of ids are ordered in alphabetical order
Paramters¶
- returns:
The comparison result of a compare function
- rtype:
- _constructNode(id: Hashable, *args, **kwargs) Node¶
Constructs a a node used for the trie
- Parameters:
id (Hashable) – The id for the node
*args – Any extra arguments to pass to the node
**kwargs – Any extra keyword arguments to pass to the node
- Returns:
The constructed node
- Return type:
- _getNextState(currentStateId: int, letter: str) Tuple[int, bool]¶
Retrieves the next state for travel to in the DFA
- clear()¶
Clears the data
- clearCache()¶
Clears any cached search results
- findAll(txt: str) Dict[str, List[Tuple[int, int]]]¶
Finds all occurences of the keywords from the DFA in the given text
- Parameters:
txt (
str) – The text to search for keywords- Returns:
The indices for all the found keywords within the given text
The keys are the keywords found
The values are all instances of the keyword found
The tuple contains the starting index of the found instance and the ending index of the found instance
- Return type:
- findFirstAll(txt: str) Dict[str, Tuple[int, int]]¶
Finds the first occurences of the keywords from the DFA in the given text
- Parameters:
txt (
str) – The text to search for keywords- Returns:
The indices for all the found keywords within the given text
The keys are the keywords found
The tuple contains the starting index of the found instance and the ending index of the first found instance
- Return type:
- findMaximal(txt: str, count: int = 1) Tuple[str | None | List[str], int | List[int]]¶
Finds the first few largest keywords within ‘txt’
Note
This function is a greedy version of
find()or Maximal Munch that consumes only a limited amount of tokens- Parameters:
- Returns:
Data of the found keyword:
If the ‘count’ argument is less than or equal to 1, then the data will contain:
The keyword found
The starting index of where the keyword was found. If no keywords were found, this index is -1
If the ‘count’ argument is greater than 1, then the data will contain:
The list of keywords found
The corresponding starting indices for where the keyword were found
- Return type:
Tuple[Union[Optional[
str], List[str]], Union[int, List[int]]]
- get(txt: str, errorOnNotFound: bool = True, default: Any = None) Tuple[str | None, T | Any]¶
Retrieves the corresponding value to ‘keyword’
- Parameters:
- Raises:
KeyError – If ‘keyword’ is not found
- Returns:
Either the found value for the keyword or the value specified at ‘default’, if ‘keyword’ is not found and ‘errorOnNotFound’ is set to
False- Return type:
Union[T, Any]
- getAll(txt: str) Dict[str, T]¶
Retrieves all the corresponding values to all the keywords found within ‘txt’
- getKeyVal(txt: str, errorOnNotFound: bool = True, default: Any = None) T | Any¶
Retrieves the corresponding value of the key given in ‘txt’
- Parameters:
- Raises:
KeyError – If the keyword is found
- Returns:
Either the found value for the first largest keyword found or the value specified at ‘default’, if no keywords were found and ‘errorOnNotFound’ is set to
False- Return type:
Union[T, Any]
- getMaximal(txt: str, errorOnNotFound: bool = True, default: Any = None, count: int = 1) Tuple[str | None | List[str], T | Any | List[T]]¶
Retrieves the corresponding value from the first largest keyword fround in ‘txt’
Note
This function retrieves the corresponding value after running
findMaximal()- Parameters:
txt (
str) – The text to search for a keyworderrorOnNotFound (
bool) – If no keywords are found, whether to raise an exceptiondefault (Any) – If ‘errorOnNotFound’ is
False, then the default value to return if no keywords are foundcount (
int) –The count of how many keywords to find in the search string
Default:
1
- Raises:
KeyError – If no keywords are found
- Returns:
Retrieves the following resultant data:
If the ‘count’ argument is less than or equal to 1, then the data contains:
The first largest keyword found
#. Either the found value for the first largest keyword found or the value specified at ‘default’, if no keywords were found and ‘errorOnNotFound’ is set to
FalseIf the ‘count’ argument is greater than 1, then the data contains:
The list of keywords found
The corresponding found values to the keywords
- Return type:
Tuple[Union[Optional[
str], List[str]], Union[T, Any, List[T]]]
AhoCorasickBuilder¶
- defbuild
- class AhoCorasickBuilder(buildCls: Type[BaseAhoCorasickDFA] | None = None, args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None)¶
This class inherits from
BuilderA class to build some implementation of the Aho-Corasick algorithm
- Parameters:
buildCls (Optional[Type[
BaseAhoCorasickDFA]]) –The class to construct a
BaseAhoCorasickDFA
If this parameters is
None, the class will be aFastAhoCorasickDFA
Default:
Noneargs (Optional[List[Any]]) –
The constant arguments used to build the object
Default:
Nonekwargs (Optional[Dict[str, Any]]) –
The constant keyword arguments used to build the object
Default:
None
- build(*args, **kwargs)¶
Builds the DFA
Warning
If failed to construct the DFA for the class given, will fallback to constructing a
AhoCorasickDFA- Parameters:
*args – arguments to build the object
**kwargs – keyword arguments to build the object
- Returns:
The built DFA
- Return type:
AhoCorasickSingleton¶
- class AhoCorasickSingleton(builder: AhoCorasickBuilder, *args, **kwargs)¶
Wrapper class to the
BaseAhoCorasickDFAthat only setup the data in the DFA once at some point during runtime- Parameters:
builder (
AhoCorasickBuilder) – The builder that constructs theBaseAhoCorasickDFA*args – Any extra arguments to provide into
AhoCorasickBuilder.build()during the initial construction of theBaseAhoCorasickDFA**kwargs – Any extra keyword arguments to provide into
AhoCorasickBuilder.build()during the initial construction of theBaseAhoCorasickDFA
- dfa¶
The DFA used in the Aho-Corasick algorithm
- Type:
Algo¶
- clsAlgo.binaryInsert
- clsAlgo.binarySearch
- clsAlgo.merge
- class Algo¶
Tools for some basic algorithms
- classmethod binaryInsert(lst: List[T], target: T, compare: Callable[[T, T], int], optionalInsert: bool = False) bool¶
Insert’s ‘target’ into ‘lst’ using binary search
- Parameters:
lst (List[T]) – The sorted list we want to insert the target element
target (T) – The target element to insert
compare (Callable[[T, T],
int]) – The compare function for comparing elements in the list with the target elementoptionalInsert (
bool) –Whether to still insert the target element into the list if the element target element is found in the list
Default:
False
- Returns:
Whether the target element has been inserted into the list
- Return type:
- classmethod binarySearch(lst: List[T], target: T, compare: Callable[[T, T], int]) List[int | bool]¶
Performs binary search to search for ‘target’ in ‘lst’
- Parameters:
lst (List[T]) – The sorted list we are searching from
target (T) – The target element to search for in the list
compare (Callable[[T, T],
int]) – The compare function for comparing elements in the list with the target element
- Returns:
The first element is whether the target element is found in the list
The second element is the found index or the index that we expect the target element to be in the list
- Return type:
- classmethod merge(sortedLsts: List[List[T]], compare: Callable[[T, T], int]) List[T]¶
Merges k sorted lists toghether
Note
Implemented using the standard heap solution (See k-way merge problem for more details)
- Parameters:
sortedLsts (List[List[T]]) – The sorted lists to merge
compare (Callable[[T, T],
int]) – The compare function for comparing elements in the lists
- Returns:
A new list with all elements from the given lists merged toghether, preserving ordering
- Return type:
List[T]
Builder¶
- class Builder(buildCls: Type[BuildCls], args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None)¶
Class to dynamically create a new object
- Parameters:
buildCls (Type[T]) – The class for the objects to be built from
args (Optional[List[Any]]) –
The constant arguments used to build the object
Default:
Nonekwargs (Optional[Dict[str, Any]]) –
The constant keyword arguments used to build the object
Default:
None
- _buildCls¶
The class for the objects to be built from
- Type:
Type[T]
- _args¶
The constant arguments used to build the object
- Type:
List[Any]
- build(*args, **kwargs) BuildCls¶
Creates the object
- Parameters:
*args – arguments to build the object
**kwargs – keyword arguments to build the object
- Returns:
The built objects
- Return type:
T
FlyweightBuilder¶
- defbuild
- class FlyweightBuilder(buildCls: Type[BuildCls], args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None)¶
This class inherits from
BuilderA flyweight builder for building the same reusable objects (based off flyweight design pattern)
- Parameters:
buildCls (Type[T]) – The class for the objects to be built from
args (Optional[List[Any]]) –
The constant arguments used to build the object
Default:
Nonekwargs (Optional[Dict[str, Any]]) –
The constant keyword arguments used to build the object
Default:
None
- build(args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None, id: Hashable | None = None, cache: bool = True) BuildCls¶
Builds the object
- Parameters:
args (Optional[List[Any]]) –
arguments to build the object
Default:
Nonekwargs (Optional[Dict[str, Any]]) –
keyword arguments to build the object
Default:
Noneid (Optional[Hashable]) –
The id for the repeating states to be built by the object
If this value is
None, then will auto-generate an id
Default:
Nonecache (
bool) –Whether to cache the built object
Note
If this value is set to
False, then this function behaves the same asBuilder.build()Default:
True
- Returns:
The built objects
- Return type:
T
PackageManager¶
- class PackageManager(proxy: str | None = None, options: List[str] | None = None)¶
Class to handle external packages for the library at runtime
- proxy¶
The link to the proxy server used for any internet network requests made
Default:
None- Type:
Optional[
str]
- Parameters:
- get(packageData: PackageData, installOptions: List[str] | None = None)¶
Retrieves an external package
- Parameters:
packageData (
PackageData) – The data needed for install the external packageinstallOptions (Optional[List[
str]]) –Additional installation options to supply to pip
Note
Please see the
installOptionsargument inload()for more details
- Returns:
The module to the external package
- Return type:
- load(module: str, installName: str | None = None, installOptions: List[str] | None = None, save: bool = True) ModuleType¶
Imports an external package
- Parameters:
module (
str) – The name of the module to importinstall (Optional[
str]) –The name of the installation for the package when using pip to download from pypi
If this value is
None, then assume that the name of the installation is the same as the name of the package
Default:
NoneinstallOptions (Optional[List[
str]]) –Additional installation options to supply into pip
Default:
Nonesave (
bool) – Whether to save the installed package into this class
- Returns:
The module to the external package
- Return type:
PackageData¶
- class PackageData(module: str, installName: str | None = None)¶
Data class to hold data relating to retrieving/installing a package at runtime
ConcurrentManager¶
- class ConcurrentManager(executionCls: Type[T], jobNo: int | None = None)¶
Base class to manage running many executions
Paramaters¶
- executionCls: Type[T]
The class for building the executions
- jobNo: Optional[
int] The number of executions to run at once
If this argument is
None, will run all the executions at once
Default:
None
- executionCls¶
The class for building the executions
- Type:
Type[T]
- execution¶
The executions to run
- Type:
List[T]
- add(*args, **kwargs)¶
Adds an execution
- Parameters:
*args – The arguments to provide into the class at
executionCls**kwargs – The keyword arguments to provide into
executionCls
- clear()¶
Clears all the executions
- waitAll()¶
Runs all the executions at once and waits until all the executions have finished running
ThreadManager¶
- class ThreadManager(jobNo: int | None = None)¶
Class to manage running many threads
Paramaters¶
- jobNo: Optional[
int] The number of processes to run at once
If this argument is
None, will run all the processes at once
Default:
None
- add(*args, **kwargs)¶
Adds an execution
- Parameters:
*args – The arguments to provide into the class at
executionCls**kwargs – The keyword arguments to provide into
executionCls
- clear()¶
Clears all the executions
- waitAll()¶
Runs all the executions at once and waits until all the executions have finished running
- jobNo: Optional[
ProcessManager¶
- class ProcessManager(jobNo: int | None = None)¶
Class to manage running many processes
Danger
This class is susceptible to keyboard interrupts. However, this vulnerability seem to be rooted to a bug in Python itself: https://stackoverflow.com/questions/1408356/keyboard-interrupts-with-pythons-multiprocessing-pool
Paramaters¶
- jobNo: Optional[
int] The number of processes to run at once
If this argument is
None, will run all the processes at once
Default:
None
- add(*args, **kwargs)¶
Adds an execution
- Parameters:
*args – The arguments to provide into the class at
executionCls**kwargs – The keyword arguments to provide into
executionCls
- clear()¶
Clears all the executions
- waitAll()¶
Runs all the processes at once and waits until all the processes have finished running
- jobNo: Optional[
Exceptions¶
Error¶
- class Error(message: str)¶
The base exception used by this module
- Parameters:
message (
str) – the error message to print out
FileException¶
- class FileException(message: str, path: str | None = None)¶
This Class inherits from
ErrorExceptions relating to files
- Parameters:
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
DuplicateFileException¶
- class DuplicateFileException(files: List[str], fileType: str = 'file', path: str | None = None)¶
This Class inherits from
FileExceptionException when there are multiple files of the same type in a folder
- Parameters:
files (List[
str]) – The files that triggered the exceptionfileType (
str) –The name for the type of files
Default: “file”
path (Optional[
str]) –The path to the folder where the files are located If this value is
None, then the path will be the current directory where this module is loaded
Default:
None
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
MissingFileException¶
- class MissingFileException(fileType: str = 'file', path: str | None = None)¶
This Class inherits from
FileExceptionException when a certain type of file is missing from a folder
- Parameters:
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
RemapMissingBlendFile¶
- class RemapMissingBlendFile(remapBlend: str)¶
This Class inherits from
FileExceptionException when a RemapBlend.buf file is missing its corresponding Blend.buf file
- Parameters:
remapBlend (
str) – The path to the RemapBlend.buf file
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
BufFileNotRecognized¶
- class BufFileNotRecognized(filePath: str, fileType: str = 'Buffer')¶
This Class inherits from
FileExceptionException when a Blend.buf file cannot be read
- Parameters:
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
BadBufData¶
- class BadBufData(fileType: str = 'Buffer')¶
This Class inherits from
ErrorException when certain bytes do not correspond to the format defined for a .buf file
- Parameters:
fileType (
str) –The name for the type of .buf file
Default:
Buffer
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
ConflictingOptions¶
- class ConflictingOptions(options: List[str])¶
This Class inherits from
ErrorException when the script or
RemapServiceis ran with options that cannot be used together- Parameters:
options (List[
str]) – The options that cannot be used together
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
InvalidModType¶
- class InvalidModType(type: str)¶
This Class inherits from
ErrorException when the type of mod specified to fix is not found
- Parameters:
type (
str) – The name for the type of mod specified
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
InvalidDownloadMode¶
- class InvalidDownloadMode(mode: str)¶
This Class inherits from
ErrorException when the download mode to activate is not found
- Parameters:
mode (
str) – The name for the download mode specified
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.