Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 44 additions & 42 deletions src/core/raise_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def MethodIsNotImplemented(
assert type(methodName) is str
assert methodName != ""

errMsg = "Method {0}::{1} is not implemented.".format(
errMsg = "Method {}::{} is not implemented.".format(
classType.__name__,
methodName,
)
Expand All @@ -34,7 +34,7 @@ def GetPropertyIsNotImplemented(
assert type(methodName) is str
assert methodName != ""

errMsg = "Get property {0}::{1} is not implemented.".format(
errMsg = "Get property {}::{} is not implemented.".format(
classType.__name__,
methodName,
)
Expand All @@ -54,7 +54,7 @@ def OptionNameHasBadType(
assert nameType is not None
assert type(nameType) is type

errMsg = "Option name has nad type [{0}]".format(
errMsg = "Option name has nad type [{}]".format(
nameType.__name__,
)
raise Exception(errMsg)
Expand All @@ -79,7 +79,7 @@ def NoneOptionValueItemIsNotSupported(
assert type(optionName) is str
assert optionName != ""

errMsg = "None value item of option [{0}] is not supported.".format(
errMsg = "None value item of option [{}] is not supported.".format(
optionName,
)
raise Exception(errMsg)
Expand Down Expand Up @@ -125,7 +125,7 @@ def BadOptionValueType(
assert type(optionValueType) is type
assert type(expectedType) is type

errMsg = "Bad option [{0}] value type [{1}]. Expected type is [{2}].".format(
errMsg = "Bad option [{}] value type [{}]. Expected type is [{}].".format(
optionName,
optionValueType.__name__,
expectedType.__name__,
Expand All @@ -143,12 +143,10 @@ def CantConvertOptionValue(
assert type(sourceType) is type
assert type(targetType) is type

errMsg = (
"Can't convert option [{0}] value from type [{1}] to type [{2}].".format(
optionName,
sourceType.__name__,
targetType.__name__,
)
errMsg = "Can't convert option [{}] value from type [{}] to type [{}].".format(
optionName,
sourceType.__name__,
targetType.__name__,
)
raise Exception(errMsg)

Expand All @@ -163,12 +161,10 @@ def BadOptionValueItemType(
assert type(optionValueItemType) is type
assert type(expectedType) is type

errMsg = (
"Bad option [{0}] value item type [{1}]. Expected type is [{2}].".format(
optionName,
optionValueItemType.__name__,
expectedType.__name__,
)
errMsg = "Bad option [{}] value item type [{}]. Expected type is [{}].".format(
optionName,
optionValueItemType.__name__,
expectedType.__name__,
)
raise Exception(errMsg)

Expand Down Expand Up @@ -213,7 +209,7 @@ def OptionIsAlreadyExistInAnotherFile(
assert filePath != ""
assert optionName != ""

errMsg = "Option [{0}] already exist in another file [{1}].".format(
errMsg = "Option [{}] already exist in another file [{}].".format(
optionName,
filePath,
)
Expand All @@ -230,7 +226,7 @@ def OptionIsAlreadyExistInFile(
assert filePath != ""
assert optionName != ""

errMsg = "Option [{0}] already exist in the file [{1}].".format(
errMsg = "Option [{}] already exist in the file [{}].".format(
optionName,
filePath,
)
Expand All @@ -246,7 +242,7 @@ def OptionValueItemIsAlreadyDefined(
assert type(filePath) is str
assert type(optName) is str

errMsg = "Another definition of option [{1}] value item [{2}] is found in the file [{0}].".format(
errMsg = "Another definition of option [{}] value item [{}] is found in the file [{}].".format(
filePath,
optName,
valueItem,
Expand All @@ -263,10 +259,10 @@ def OptionValueItemIsAlreadyDefinedInAnotherFile(
assert type(filePath) is str
assert type(optName) is str

errMsg = "Definition of option [{1}] value item [{2}] is found in another file [{0}].".format(
filePath,
errMsg = "Definition of option [{}] value item [{}] is found in another file [{}].".format(
optName,
valueItem,
filePath,
)
raise Exception(errMsg)

Expand All @@ -275,7 +271,7 @@ def OptionValueItemIsAlreadyDefinedInAnotherFile(
def UnknownFileName(fileName: str) -> typing.NoReturn:
assert type(fileName) is str

errMsg = "Unknown file name [{0}].".format(
errMsg = "Unknown file name [{}].".format(
fileName,
)
raise Exception(errMsg)
Expand All @@ -289,7 +285,7 @@ def MultipleDefOfFileIsFound(
assert type(fileName) is str
assert type(count) is int

errMsg = "Multiple definitition of file [{0}] is found - {1}.".format(
errMsg = "Multiple definitition of file [{}] is found - {}.".format(
fileName,
count,
)
Expand All @@ -312,7 +308,7 @@ def FileWasModifiedExternally(
assert type(ourLastMDate) is datetime.datetime
assert type(curLastMDate) is datetime.datetime

errMsg = "File [{0}] was modified externally. Our timestamp is [{1}]. The current file timestamp is [{2}].".format(
errMsg = "File [{}] was modified externally. Our timestamp is [{}]. The current file timestamp is [{}].".format(
filePath,
ourLastMDate,
curLastMDate,
Expand All @@ -330,7 +326,7 @@ def FileLineAlreadyHasComment() -> typing.NoReturn:
def FileLineAlreadyHasOption(optionName: str) -> typing.NoReturn:
assert type(optionName) is str

errMsg = "File line already has the option [{0}].".format(
errMsg = "File line already has the option [{}].".format(
optionName,
)
raise Exception(errMsg)
Expand All @@ -353,7 +349,7 @@ def CfgReader__UnexpectedSymbol(
assert type(colNum) is int
assert type(ch) is str

errMsg = "Unexpected symbol in line {0}, column {1}: [{2}]".format(
errMsg = "Unexpected symbol in line {}, column {}: [{}]".format(
lineNum,
colNum,
ch,
Expand All @@ -366,7 +362,9 @@ def CfgReader__IncludeWithoutPath(lineNum: int) -> typing.NoReturn:
assert type(lineNum) is int
assert lineNum >= 0

errMsg = "Include directive in line {0} does not have a path.".format(lineNum)
errMsg = "Include directive in line {} does not have a path.".format(
lineNum,
)
raise Exception(errMsg)

# --------------------------------------------------------------------
Expand All @@ -375,7 +373,7 @@ def CfgReader__EndOfIncludePathIsNotFound(lineNum: int) -> typing.NoReturn:
assert type(lineNum) is int
assert lineNum >= 0

errMsg = "The end of an include path is not found. Line {0}.".format(
errMsg = "The end of an include path is not found. Line {}.".format(
lineNum,
)
raise Exception(errMsg)
Expand All @@ -386,7 +384,7 @@ def CfgReader__IncompletedEscapeInInclude(lineNum: int) -> typing.NoReturn:
assert type(lineNum) is int
assert lineNum >= 0

errMsg = "Escape in an include path is not completed. Line {0}.".format(
errMsg = "Escape in an include path is not completed. Line {}.".format(
lineNum,
)
raise Exception(errMsg)
Expand All @@ -405,10 +403,12 @@ def CfgReader__UnknownEscapedSymbolInInclude(
assert colNum >= 0
assert ch != ""

errMsg = "Unknown escape symbol [{2}] in an include path. Line {0}. Column {1}.".format(
lineNum,
colNum,
ch,
errMsg = (
"Unknown escape symbol [{}] in an include path. Line {}. Column {}.".format(
ch,
lineNum,
colNum,
)
)
raise Exception(errMsg)

Expand All @@ -420,7 +420,7 @@ def CfgReader__IncludeHasEmptyPath(
assert type(lineNum) is int
assert lineNum >= 0

errMsg = "Include in line {0} has an empty path.".format(
errMsg = "Include in line {} has an empty path.".format(
lineNum,
)
raise Exception(errMsg)
Expand All @@ -436,7 +436,7 @@ def CfgReader__OptionWithoutValue(
assert lineNum >= 0
assert optionName != ""

errMsg = "Option [{0}] in line {1} does not have a value.".format(
errMsg = "Option [{}] in line {} does not have a value.".format(
optionName,
lineNum,
)
Expand All @@ -453,7 +453,7 @@ def CfgReader__EndQuotedOptionValueIsNotFound(
assert lineNum >= 0
assert optionName != ""

errMsg = "Value of quoted option [{0}] is not completed. Line {1}.".format(
errMsg = "Value of quoted option [{}] is not completed. Line {}.".format(
optionName,
lineNum,
)
Expand All @@ -470,9 +470,11 @@ def CfgReader__IncompletedEscapeInQuotedOptionValue(
assert lineNum >= 0
assert optionName != ""

errMsg = "Escape in a value of quoted option [{0}] is not completed. Line {1}.".format(
optionName,
lineNum,
errMsg = (
"Escape in a value of quoted option [{}] is not completed. Line {}.".format(
optionName,
lineNum,
)
)
raise Exception(errMsg)

Expand All @@ -491,11 +493,11 @@ def CfgReader__UnknownEscapedSymbolInQuotedOptionValue(
assert optionName != ""
assert ch != ""

errMsg = "Unknown escape symbol [{3}] in a value of quoted option [{0}]. Line {1}. Column {2}.".format(
errMsg = "Unknown escape symbol [{}] in a value of quoted option [{}]. Line {}. Column {}.".format(
ch,
optionName,
lineNum,
colNum,
ch,
)
raise Exception(errMsg)

Expand Down
Loading