@@ -105,8 +105,9 @@ def clear(self):
105105 def get_count (self ):
106106 return len (self .__items )
107107
108- def __is_valid_integer (self , value : str ) -> bool :
109- if self .__value_is_valid (value ):
108+ @classmethod
109+ def __is_valid_integer (cls , value : str ) -> bool :
110+ if cls .__value_is_valid (value ):
110111 try :
111112 int (value )
112113 return True
@@ -145,30 +146,31 @@ def get_size_value(self, key: str, default_value: int) -> int:
145146
146147 return result
147148
148- def size_to_int (self , value : str , default_value : int ) -> int :
149+ @classmethod
150+ def size_to_int (cls , value : str , default_value : int ) -> int :
149151 if not isinstance (value , str ):
150152 raise TypeError ("Value must be a string" )
151153 if not isinstance (default_value , int ):
152154 raise TypeError ("Default value must be an int" )
153155
154156 result = default_value
155- factor = self .__KB_FACTOR
157+ factor = cls .__KB_FACTOR
156158 value = value .strip ()
157159
158160 if len (value ) >= 2 :
159161 unit = value [- 2 :].lower ()
160162
161- if self .__is_valid_size_unit (unit ):
163+ if cls .__is_valid_size_unit (unit ):
162164 value = value [:- 2 ].strip ()
163165
164166 if unit == "kb" :
165- factor = self .__KB_FACTOR
167+ factor = cls .__KB_FACTOR
166168 elif unit == "mb" :
167- factor = self .__MB_FACTOR
169+ factor = cls .__MB_FACTOR
168170 elif unit == "gb" :
169- factor = self .__GB_FACTOR
171+ factor = cls .__GB_FACTOR
170172
171- if self .__is_valid_integer (value ):
173+ if cls .__is_valid_integer (value ):
172174 try :
173175 result = factor * int (value )
174176 except ValueError :
0 commit comments