Skip to content

Commit de43404

Browse files
Usage of @staticmethod (#24)
1 parent 3d83b5d commit de43404

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

src/core/data_verificator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99

1010
class DataVerificator:
11+
@staticmethod
1112
def CheckOptionName(name: str):
1213
if name is None:
1314
RaiseError.OptionNameIsNone()
@@ -24,6 +25,7 @@ def CheckOptionName(name: str):
2425
sm_InvalidCommentSymbols: str = "\n\r\0"
2526

2627
# --------------------------------------------------------------------
28+
@staticmethod
2729
def IsValidCommentText(text: str) -> bool:
2830
assert text is not None
2931
assert type(text) is str
@@ -37,6 +39,7 @@ def IsValidCommentText(text: str) -> bool:
3739
return True
3840

3941
# --------------------------------------------------------------------
42+
@staticmethod
4043
def CheckCommentText(text: str):
4144
assert text is not None
4245
assert type(text) is str
@@ -49,6 +52,7 @@ def CheckCommentText(text: str):
4952
# OK
5053

5154
# --------------------------------------------------------------------
55+
@staticmethod
5256
def CheckStringOfFilePath(text: str):
5357
assert text is not None
5458
assert type(text) is str

src/implementation/v00/configuration_base.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,7 @@ def __init__(
10691069
self.m_EventID = eventID
10701070

10711071
# ---------------------------------------------------------------------
1072+
@staticmethod
10721073
def Create__OptWasUpdated(
10731074
cfg: PostgresConfiguration_Base, optData: PgCfgModel__OptionData
10741075
) -> PostgresConfigurationSetOptionValueResult_Base:
@@ -1081,6 +1082,7 @@ def Create__OptWasUpdated(
10811082
)
10821083

10831084
# ---------------------------------------------------------------------
1085+
@staticmethod
10841086
def Create__OptWasAdded(
10851087
cfg: PostgresConfiguration_Base, optData: PgCfgModel__OptionData
10861088
) -> PostgresConfigurationSetOptionValueResult_Base:
@@ -1093,12 +1095,14 @@ def Create__OptWasAdded(
10931095
)
10941096

10951097
# ---------------------------------------------------------------------
1098+
@staticmethod
10961099
def Create__OptWasDeleted() -> PostgresConfigurationSetOptionValueResult_Base:
10971100
return __class__(
10981101
None, None, PostgresConfigurationSetOptionValueEventID.OPTION_WAS_DELETED
10991102
)
11001103

11011104
# ---------------------------------------------------------------------
1105+
@staticmethod
11021106
def Create__OptValueItemWasAlreadyDefined(
11031107
cfg: PostgresConfiguration_Base, optData: PgCfgModel__OptionData
11041108
) -> PostgresConfigurationSetOptionValueResult_Base:
@@ -1113,6 +1117,7 @@ def Create__OptValueItemWasAlreadyDefined(
11131117
)
11141118

11151119
# ---------------------------------------------------------------------
1120+
@staticmethod
11161121
def Create__OptValueItemWasAdded(
11171122
cfg: PostgresConfiguration_Base, optData: PgCfgModel__OptionData
11181123
) -> PostgresConfigurationSetOptionValueResult_Base:
@@ -2994,6 +2999,7 @@ def Helper__FinalRegSimpleOptionValue__File(
29942999
return result
29953000

29963001
# --------------------------------------------------------------------
3002+
@staticmethod
29973003
def Helper__DoesOptionValueAlreadyHaveThisUniqueItem(
29983004
optionData: PgCfgModel__OptionData, optionValueItem: typing.Any
29993005
) -> bool:
@@ -3030,6 +3036,7 @@ def Debug__CheckOurObjectData(self, data: PgCfgModel__ObjectData):
30303036

30313037

30323038
class PostgresConfigurationFactory_Base:
3039+
@staticmethod
30333040
def GetObject(
30343041
cfg: PostgresConfiguration_Base, objectData: PgCfgModel__ObjectData
30353042
) -> PostgresConfigurationObject:
@@ -3075,6 +3082,7 @@ def GetObject(
30753082
return cfgObject
30763083

30773084
# --------------------------------------------------------------------
3085+
@staticmethod
30783086
def Helper__CreateObject(
30793087
cfg: PostgresConfiguration_Base,
30803088
objectData: PgCfgModel__ObjectData,
@@ -3107,6 +3115,7 @@ def Helper__CreateObject(
31073115
BugCheckError.UnkObjectDataType(typeOfObjectData)
31083116

31093117
# --------------------------------------------------------------------
3118+
@staticmethod
31103119
def Helper__CreateFile(
31113120
objectData: PgCfgModel__FileData,
31123121
objectParent: PostgresConfigurationObject,
@@ -3124,6 +3133,7 @@ def Helper__CreateFile(
31243133
RaiseError.MethodIsNotImplemented(__class__, "Helper__CreateFile")
31253134

31263135
# --------------------------------------------------------------------
3136+
@staticmethod
31273137
def Helper__CreateFileLine(
31283138
objectData: PgCfgModel__FileLineData,
31293139
objectParent: PostgresConfigurationObject,
@@ -3136,6 +3146,7 @@ def Helper__CreateFileLine(
31363146
return PostgresConfigurationFileLine_Base(objectParent, objectData)
31373147

31383148
# --------------------------------------------------------------------
3149+
@staticmethod
31393150
def Helper__CreateFileLineComment(
31403151
fileLineDataItem: PgCfgModel__FileLineData.tagItem,
31413152
fileLine: PostgresConfigurationObject,
@@ -3148,6 +3159,7 @@ def Helper__CreateFileLineComment(
31483159
return PostgresConfigurationComment_Base(fileLine, fileLineDataItem)
31493160

31503161
# --------------------------------------------------------------------
3162+
@staticmethod
31513163
def Helper__CreateOption(
31523164
objectData: PgCfgModel__OptionData,
31533165
objectParent: PostgresConfigurationObject,
@@ -3165,6 +3177,7 @@ def Helper__CreateOption(
31653177

31663178

31673179
class PostgresConfigurationReader_Base:
3180+
@staticmethod
31683181
def LoadConfigurationFile(
31693182
cfg: PostgresConfiguration_Base, filePath: str
31703183
) -> PostgresConfigurationTopLevelFile_Base:
@@ -3329,6 +3342,7 @@ def Helper__LoadFileContent(
33293342
__class__.Helper__ProcessLineData(file, lineReader)
33303343

33313344
# --------------------------------------------------------------------
3345+
@staticmethod
33323346
def Helper__ProcessLineData(
33333347
file: PostgresConfigurationFile_Base, lineReader: ReadUtils__LineReader
33343348
):
@@ -3405,6 +3419,7 @@ def Helper__ProcessLineData(
34053419
)
34063420

34073421
# --------------------------------------------------------------------
3422+
@staticmethod
34083423
def Helper__ProcessLineData__Comment(
34093424
fileLine: PostgresConfigurationFileLine_Base, lineReader: ReadUtils__LineReader
34103425
):
@@ -3430,6 +3445,7 @@ def Helper__ProcessLineData__Comment(
34303445
fileLine.AddComment(commentText, commentOffset)
34313446

34323447
# --------------------------------------------------------------------
3448+
@staticmethod
34333449
def Helper__ProcessLineData__Include(
34343450
fileLine: PostgresConfigurationFileLine_Base,
34353451
lineReader: ReadUtils__LineReader,
@@ -3554,6 +3570,7 @@ def Helper__ProcessLineData__Include(
35543570
fileLine.AddInclude(filePath, includeOffset)
35553571

35563572
# --------------------------------------------------------------------
3573+
@staticmethod
35573574
def Helper__ProcessLineData__Option(
35583575
fileLine: PostgresConfigurationFileLine_Base,
35593576
lineReader: ReadUtils__LineReader,
@@ -3616,6 +3633,7 @@ def Helper__ProcessLineData__Option(
36163633
)
36173634

36183635
# --------------------------------------------------------------------
3636+
@staticmethod
36193637
def Helper__ProcessLineData__Option__Quoted(
36203638
fileLine: PostgresConfigurationFileLine_Base,
36213639
lineReader: ReadUtils__LineReader,
@@ -3719,6 +3737,7 @@ def Helper__ProcessLineData__Option__Quoted(
37193737
fileLine.AddOption(optionName, optionValue, optionOffset)
37203738

37213739
# --------------------------------------------------------------------
3740+
@staticmethod
37223741
def Helper__ProcessLineData__Option__Generic(
37233742
fileLine: PostgresConfigurationFileLine_Base,
37243743
lineReader: ReadUtils__LineReader,
@@ -4234,6 +4253,7 @@ def Helper__IncludeToString(
42344253

42354254

42364255
class PostgresConfigurationController__Base:
4256+
@staticmethod
42374257
def AddOption(
42384258
cfg: PostgresConfiguration_Base,
42394259
target: typing.Union[None, PgCfgModel__FileData, PgCfgModel__FileLineData],
@@ -4277,6 +4297,7 @@ def AddOption(
42774297
return option
42784298

42794299
# --------------------------------------------------------------------
4300+
@staticmethod
42804301
def SetOptionValue(
42814302
cfg: PostgresConfiguration_Base,
42824303
targetData: typing.Union[None, PgCfgModel__FileData, PgCfgModel__OptionData],
@@ -4325,6 +4346,7 @@ def SetOptionValue(
43254346
return r
43264347

43274348
# --------------------------------------------------------------------
4349+
@staticmethod
43284350
def SetOptionValueItem(
43294351
cfg: PostgresConfiguration_Base,
43304352
targetData: typing.Union[None, PgCfgModel__FileData, PgCfgModel__OptionData],
@@ -4371,6 +4393,7 @@ def SetOptionValueItem(
43714393
return r
43724394

43734395
# --------------------------------------------------------------------
4396+
@staticmethod
43744397
def GetOptionValue(
43754398
cfg: PostgresConfiguration_Base,
43764399
sourceData: typing.Union[None, PgCfgModel__FileData, PgCfgModel__OptionData],
@@ -4394,6 +4417,7 @@ def GetOptionValue(
43944417
return r
43954418

43964419
# Helper methods -----------------------------------------------------
4420+
@staticmethod
43974421
def Helper__PrepareSetValue(
43984422
cfg: PostgresConfiguration_Base, optionName: str, optionValue: typing.Any
43994423
) -> typing.Any:
@@ -4412,6 +4436,7 @@ def Helper__PrepareSetValue(
44124436
return prepareHandler.PrepareSetValue(prepareCtx)
44134437

44144438
# --------------------------------------------------------------------
4439+
@staticmethod
44154440
def Helper__PrepareSetValueItem(
44164441
cfg: PostgresConfiguration_Base, optionName: str, optionValueItem: typing.Any
44174442
) -> typing.Any:

src/implementation/v00/configuration_std.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ def Helper__GetOptionHandlers(self, name: str) -> tagOptionHandlers:
509509

510510

511511
class PostgresConfigurationReader_Std:
512+
@staticmethod
512513
def LoadConfiguration(cfg: PostgresConfiguration_Std) -> None:
513514
assert isinstance(cfg, PostgresConfiguration_Std)
514515

@@ -526,6 +527,7 @@ def LoadConfiguration(cfg: PostgresConfiguration_Std) -> None:
526527

527528

528529
class PostgresConfigurationWriter_Std:
530+
@staticmethod
529531
def WriteConfiguration(cfg: PostgresConfiguration_Std) -> None:
530532
assert isinstance(cfg, PostgresConfiguration_Std)
531533

0 commit comments

Comments
 (0)