File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515# https://docs-v2.readthedocs.io/en/latest/using-workflow/process-types-and-the-procfile/#declaring-process-types
1616PROCTYPE_MATCH = re .compile (r'^(?P<type>[a-z0-9]+)$' )
1717MEMLIMIT_MATCH = re .compile (r'^(?P<mem>[0-9]+(MB|KB|GB|[BKMG]))$' , re .IGNORECASE )
18- CPUSHARE_MATCH = re .compile (r'^(?P<cpu>[0-9. ]+[m]{0,1})$' )
18+ CPUSHARE_MATCH = re .compile (r'^(?P<cpu>[-+]?[ 0-9]*\.?[0-9 ]+[m]{0,1})$' )
1919TAGVAL_MATCH = re .compile (r'^(?:[a-zA-Z\d][-\.\w]{0,61})?[a-zA-Z\d]$' )
2020CONFIGKEY_MATCH = re .compile (r'^[a-z_]+[a-z0-9_]*$' , re .IGNORECASE )
2121
@@ -167,15 +167,6 @@ def validate_cpu(self, data):
167167 if not shares :
168168 raise serializers .ValidationError ("CPU shares must be a numeric value" )
169169
170- for share in shares .groupdict ().values ():
171- try :
172- if share [- 1 ] == "m" :
173- float (share [:- 1 ])
174- else :
175- float (share )
176- except ValueError :
177- raise serializers .ValidationError ("CPU units must be a numeric value" )
178-
179170 return data
180171
181172 def validate_tags (self , data ):
@@ -194,6 +185,7 @@ def validate_tags(self, data):
194185 if len (prefix ) > 253 :
195186 raise serializers .ValidationError (
196187 "Tag key prefixes must 253 characters or less." )
188+
197189 for part in prefix .split ('/' ):
198190 if not re .match (TAGVAL_MATCH , part ):
199191 raise serializers .ValidationError (
You can’t perform that action at this time.
0 commit comments