Skip to content

Commit fc450f8

Browse files
authored
chore: bump regex_match function to _regex_match to prevent compile errors (#92)
Signed-off-by: peefy <[email protected]>
1 parent d8d845c commit fc450f8

File tree

9 files changed

+57
-57
lines changed

9 files changed

+57
-57
lines changed

examples/kube_resource/complex/muti_models/models/core_oam_dev_v1alpha2_containerized_workload.k

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
44
"""
55
import regex
66
import k8s.apimachinery.pkg.apis.meta.v1
7-
regex_match = regex.match
7+
_regex_match = regex.match
88

99

1010
schema ContainerizedWorkload:
@@ -150,7 +150,7 @@ schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0EnvItems0:
150150

151151

152152
check:
153-
regex_match(str(name), r"^[-_a-zA-Z0-9]+$")
153+
_regex_match(str(name), r"^[-_a-zA-Z0-9]+$")
154154

155155

156156
schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0LivenessProbe:
@@ -286,7 +286,7 @@ schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0PortsItems0:
286286

287287

288288
check:
289-
regex_match(str(name), r"^[a-z]+$")
289+
_regex_match(str(name), r"^[a-z]+$")
290290

291291

292292
schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0ReadiessProbe:

pkg/kube_resource/generator/testdata/all_of_pattern/models/karpenter_k8s_aws_v1beta1_e_c2_node_class.k

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
44
"""
55
import regex
66
import k8s.apimachinery.pkg.apis.meta.v1
7-
regex_match = regex.match
7+
_regex_match = regex.match
88

99

1010
schema EC2NodeClass:
@@ -125,7 +125,7 @@ schema KarpenterK8sAwsV1beta1EC2NodeClassSpecAmiSelectorTermsItems0:
125125

126126

127127
check:
128-
regex_match(str(id), r"ami-[0-9a-z]+") if id
128+
_regex_match(str(id), r"ami-[0-9a-z]+") if id
129129

130130

131131
schema KarpenterK8sAwsV1beta1EC2NodeClassSpecBlockDeviceMappingsItems0:
@@ -203,8 +203,8 @@ schema KarpenterK8sAwsV1beta1EC2NodeClassSpecBlockDeviceMappingsItems0Ebs:
203203

204204

205205
check:
206-
regex_match(str(volumeSize), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if volumeSize
207-
regex_match(str(volumeSize), r"^((?:[1-9][0-9]{0,3}|[1-4][0-9]{4}|[5][0-8][0-9]{3}|59000)Gi|(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-3][0-9]{3}|64000)G|([1-9]||[1-5][0-7]|58)Ti|([1-9]||[1-5][0-9]|6[0-3]|64)T)$") if volumeSize
206+
_regex_match(str(volumeSize), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if volumeSize
207+
_regex_match(str(volumeSize), r"^((?:[1-9][0-9]{0,3}|[1-4][0-9]{4}|[5][0-8][0-9]{3}|59000)Gi|(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-3][0-9]{3}|64000)G|([1-9]||[1-5][0-7]|58)Ti|([1-9]||[1-5][0-9]|6[0-3]|64)T)$") if volumeSize
208208

209209

210210
schema KarpenterK8sAwsV1beta1EC2NodeClassSpecMetadataOptions:
@@ -266,7 +266,7 @@ schema KarpenterK8sAwsV1beta1EC2NodeClassSpecSecurityGroupSelectorTermsItems0:
266266

267267

268268
check:
269-
regex_match(str(id), r"sg-[0-9a-z]+") if id
269+
_regex_match(str(id), r"sg-[0-9a-z]+") if id
270270

271271

272272
schema KarpenterK8sAwsV1beta1EC2NodeClassSpecSubnetSelectorTermsItems0:
@@ -288,7 +288,7 @@ schema KarpenterK8sAwsV1beta1EC2NodeClassSpecSubnetSelectorTermsItems0:
288288

289289

290290
check:
291-
regex_match(str(id), r"subnet-[0-9a-z]+") if id
291+
_regex_match(str(id), r"subnet-[0-9a-z]+") if id
292292

293293

294294
schema KarpenterK8sAwsV1beta1EC2NodeClassStatus:

pkg/kube_resource/generator/testdata/array_branch/models/operator_victoriametrics_com_v1beta1_vm_agent.k

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
44
"""
55
import regex
66
import k8s.apimachinery.pkg.apis.meta.v1
7-
regex_match = regex.match
7+
_regex_match = regex.match
88

99

1010
schema VMAgent:
@@ -372,8 +372,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpec:
372372

373373

374374
check:
375-
regex_match(str(scrapeInterval), r"[0-9]+(ms|s|m|h)") if scrapeInterval
376-
regex_match(str(scrapeTimeout), r"[0-9]+(ms|s|m|h)") if scrapeTimeout
375+
_regex_match(str(scrapeInterval), r"[0-9]+(ms|s|m|h)") if scrapeInterval
376+
_regex_match(str(scrapeTimeout), r"[0-9]+(ms|s|m|h)") if scrapeTimeout
377377

378378

379379
schema OperatorVictoriametricsComV1beta1VMAgentSpecAPIServerConfig:
@@ -879,8 +879,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecClaimTemplatesItems0SpecResou
879879

880880

881881
check:
882-
all _, limits in limits {regex_match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
883-
all _, requests in requests {regex_match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests
882+
all _, limits in limits {_regex_match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
883+
all _, requests in requests {_regex_match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests
884884

885885

886886
schema OperatorVictoriametricsComV1beta1VMAgentSpecClaimTemplatesItems0SpecSelector:
@@ -958,8 +958,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecClaimTemplatesItems0Status:
958958

959959

960960
check:
961-
all _, allocatedResources in allocatedResources {regex_match(str(allocatedResources), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if allocatedResources } if allocatedResources
962-
all _, capacity in capacity {regex_match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity
961+
all _, allocatedResources in allocatedResources {_regex_match(str(allocatedResources), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if allocatedResources } if allocatedResources
962+
all _, capacity in capacity {_regex_match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity
963963

964964

965965
schema OperatorVictoriametricsComV1beta1VMAgentSpecClaimTemplatesItems0StatusConditionsItems0:
@@ -1737,7 +1737,7 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecRemoteWriteItems0:
17371737

17381738

17391739
check:
1740-
regex_match(str(sendTimeout), r"[0-9]+(ms|s|m|h)") if sendTimeout
1740+
_regex_match(str(sendTimeout), r"[0-9]+(ms|s|m|h)") if sendTimeout
17411741

17421742

17431743
schema OperatorVictoriametricsComV1beta1VMAgentSpecRemoteWriteItems0BasicAuth:
@@ -2454,7 +2454,7 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecRemoteWriteSettings:
24542454

24552455

24562456
check:
2457-
regex_match(str(flushInterval), r"[0-9]+(ms|s|m|h)") if flushInterval
2457+
_regex_match(str(flushInterval), r"[0-9]+(ms|s|m|h)") if flushInterval
24582458

24592459

24602460
schema OperatorVictoriametricsComV1beta1VMAgentSpecResources:
@@ -2476,8 +2476,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecResources:
24762476

24772477

24782478
check:
2479-
all _, limits in limits {regex_match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
2480-
all _, requests in requests {regex_match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests
2479+
all _, limits in limits {_regex_match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
2480+
all _, requests in requests {_regex_match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests
24812481

24822482

24832483
schema OperatorVictoriametricsComV1beta1VMAgentSpecRollingUpdate:
@@ -2717,7 +2717,7 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageEmptyDir:
27172717

27182718

27192719
check:
2720-
regex_match(str(sizeLimit), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if sizeLimit
2720+
_regex_match(str(sizeLimit), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if sizeLimit
27212721

27222722

27232723
schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageVolumeClaimTemplate:
@@ -2877,8 +2877,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageVolumeClaimTem
28772877

28782878

28792879
check:
2880-
all _, limits in limits {regex_match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
2881-
all _, requests in requests {regex_match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests
2880+
all _, limits in limits {_regex_match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
2881+
all _, requests in requests {_regex_match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests
28822882

28832883

28842884
schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageVolumeClaimTemplateSpecSelector:
@@ -2956,8 +2956,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageVolumeClaimTem
29562956

29572957

29582958
check:
2959-
all _, allocatedResources in allocatedResources {regex_match(str(allocatedResources), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if allocatedResources } if allocatedResources
2960-
all _, capacity in capacity {regex_match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity
2959+
all _, allocatedResources in allocatedResources {_regex_match(str(allocatedResources), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if allocatedResources } if allocatedResources
2960+
all _, capacity in capacity {_regex_match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity
29612961

29622962

29632963
schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageVolumeClaimTemplateStatusConditionsItems0:

pkg/kube_resource/generator/testdata/int_or_string_validation/models/crd_projectcalico_org_v1_global_network_policy.k

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
44
"""
55
import regex
66
import k8s.apimachinery.pkg.apis.meta.v1
7-
regex_match = regex.match
7+
_regex_match = regex.match
88

99

1010
schema GlobalNetworkPolicy:
@@ -42,7 +42,7 @@ schema GlobalNetworkPolicy:
4242

4343

4444
check:
45-
all _, capacity in capacity {regex_match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity
45+
all _, capacity in capacity {_regex_match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity
4646

4747

4848
schema CrdProjectcalicoOrgV1GlobalNetworkPolicyDestination:
@@ -100,8 +100,8 @@ schema CrdProjectcalicoOrgV1GlobalNetworkPolicyDestination:
100100

101101

102102
check:
103-
all notPorts in notPorts {regex_match(str(notPorts), r"^.*") if notPorts } if notPorts
104-
all ports in ports {regex_match(str(ports), r"^.*") if ports } if ports
103+
all notPorts in notPorts {_regex_match(str(notPorts), r"^.*") if notPorts } if notPorts
104+
all ports in ports {_regex_match(str(ports), r"^.*") if ports } if ports
105105

106106

107107
schema CrdProjectcalicoOrgV1GlobalNetworkPolicyDestinationServiceAccounts:

pkg/kube_resource/generator/testdata/map_default_value/models/acid_zalan_do_v1_operator_configuration.k

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
44
"""
55
import regex
66
import k8s.apimachinery.pkg.apis.meta.v1
7-
regex_match = regex.match
7+
_regex_match = regex.match
88

99

1010
schema OperatorConfiguration:
@@ -294,10 +294,10 @@ schema AcidZalanDoV1OperatorConfigurationConfigurationConnectionPooler:
294294

295295

296296
check:
297-
regex_match(str(connection_pooler_default_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if connection_pooler_default_cpu_limit
298-
regex_match(str(connection_pooler_default_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if connection_pooler_default_cpu_request
299-
regex_match(str(connection_pooler_default_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if connection_pooler_default_memory_limit
300-
regex_match(str(connection_pooler_default_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if connection_pooler_default_memory_request
297+
_regex_match(str(connection_pooler_default_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if connection_pooler_default_cpu_limit
298+
_regex_match(str(connection_pooler_default_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if connection_pooler_default_cpu_request
299+
_regex_match(str(connection_pooler_default_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if connection_pooler_default_memory_limit
300+
_regex_match(str(connection_pooler_default_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if connection_pooler_default_memory_request
301301
connection_pooler_number_of_instances >= 1 if connection_pooler_number_of_instances not in [None, Undefined]
302302

303303

@@ -714,11 +714,11 @@ schema AcidZalanDoV1OperatorConfigurationConfigurationLogicalBackup:
714714

715715

716716
check:
717-
regex_match(str(logical_backup_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if logical_backup_cpu_limit
718-
regex_match(str(logical_backup_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if logical_backup_cpu_request
719-
regex_match(str(logical_backup_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if logical_backup_memory_limit
720-
regex_match(str(logical_backup_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if logical_backup_memory_request
721-
regex_match(str(logical_backup_schedule), r"^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$") if logical_backup_schedule
717+
_regex_match(str(logical_backup_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if logical_backup_cpu_limit
718+
_regex_match(str(logical_backup_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if logical_backup_cpu_request
719+
_regex_match(str(logical_backup_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if logical_backup_memory_limit
720+
_regex_match(str(logical_backup_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if logical_backup_memory_request
721+
_regex_match(str(logical_backup_schedule), r"^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$") if logical_backup_schedule
722722

723723

724724
schema AcidZalanDoV1OperatorConfigurationConfigurationMajorVersionUpgrade:
@@ -804,14 +804,14 @@ schema AcidZalanDoV1OperatorConfigurationConfigurationPostgresPodResources:
804804

805805

806806
check:
807-
regex_match(str(default_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if default_cpu_limit
808-
regex_match(str(default_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if default_cpu_request
809-
regex_match(str(default_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if default_memory_limit
810-
regex_match(str(default_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if default_memory_request
811-
regex_match(str(max_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if max_cpu_request
812-
regex_match(str(max_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if max_memory_request
813-
regex_match(str(min_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if min_cpu_limit
814-
regex_match(str(min_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if min_memory_limit
807+
_regex_match(str(default_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if default_cpu_limit
808+
_regex_match(str(default_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if default_cpu_request
809+
_regex_match(str(default_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if default_memory_limit
810+
_regex_match(str(default_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if default_memory_request
811+
_regex_match(str(max_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if max_cpu_request
812+
_regex_match(str(max_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if max_memory_request
813+
_regex_match(str(min_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if min_cpu_limit
814+
_regex_match(str(min_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if min_memory_limit
815815

816816

817817
schema AcidZalanDoV1OperatorConfigurationConfigurationScalyr:
@@ -853,10 +853,10 @@ schema AcidZalanDoV1OperatorConfigurationConfigurationScalyr:
853853

854854

855855
check:
856-
regex_match(str(scalyr_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if scalyr_cpu_limit
857-
regex_match(str(scalyr_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if scalyr_cpu_request
858-
regex_match(str(scalyr_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if scalyr_memory_limit
859-
regex_match(str(scalyr_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if scalyr_memory_request
856+
_regex_match(str(scalyr_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if scalyr_cpu_limit
857+
_regex_match(str(scalyr_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if scalyr_cpu_request
858+
_regex_match(str(scalyr_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if scalyr_memory_limit
859+
_regex_match(str(scalyr_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if scalyr_memory_request
860860

861861

862862
schema AcidZalanDoV1OperatorConfigurationConfigurationTeamsAPI:

pkg/kube_resource/generator/testdata/muti_models/models/core_oam_dev_v1alpha2_containerized_workload.k

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
44
"""
55
import regex
66
import k8s.apimachinery.pkg.apis.meta.v1
7-
regex_match = regex.match
7+
_regex_match = regex.match
88

99

1010
schema ContainerizedWorkload:
@@ -150,7 +150,7 @@ schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0EnvItems0:
150150

151151

152152
check:
153-
regex_match(str(name), r"^[-_a-zA-Z0-9]+$")
153+
_regex_match(str(name), r"^[-_a-zA-Z0-9]+$")
154154

155155

156156
schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0LivenessProbe:
@@ -286,7 +286,7 @@ schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0PortsItems0:
286286

287287

288288
check:
289-
regex_match(str(name), r"^[a-z]+$")
289+
_regex_match(str(name), r"^[a-z]+$")
290290

291291

292292
schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0ReadiessProbe:

pkg/swagger/generator/templates/header.gotmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
1919
import {{ .ImportPath }}{{ if .MustAsName }} as {{ .AsName }}{{ end }}
2020
{{- end }}
2121
{{- if .HasPatternValidation }}
22-
regex_match = regex.match
22+
_regex_match = regex.match
2323
{{- end }}
2424
{{- end }}
2525
{{ "\n" -}}

pkg/swagger/generator/templates/schemaexpr.gotmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{{- end }}
77
{{- if .MinLength }}len({{ .EscapedName }}) >= {{.MinLength}}{{ if not .Required }} if {{ .EscapedName }} not in [None, Undefined]{{ end }}
88
{{- end }}
9-
{{- if .Pattern }}regex_match(str({{ .EscapedName }}), r"{{.Pattern}}"){{ if not .Required }} if {{ .EscapedName }}{{ end }}
9+
{{- if .Pattern }}_regex_match(str({{ .EscapedName }}), r"{{.Pattern}}"){{ if not .Required }} if {{ .EscapedName }}{{ end }}
1010
{{- end }}
1111
{{- if .UniqueItems }}isunique({{ .EscapedName }}){{ if not .Required }} if {{ .EscapedName }}{{ end }}
1212
{{- end }}

pkg/swagger/generator/templates/schemavalidator.gotmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
len({{ .EscapedName }}) >= {{.MinLength}}{{ if not .Required }} if {{ .EscapedName }}{{ end }}
1515
{{- end }}
1616
{{- if .Pattern }}
17-
regex_match(str({{ .EscapedName }}), r"{{.Pattern}}"){{ if not .Required }} if {{ .EscapedName }}{{ end }}
17+
_regex_match(str({{ .EscapedName }}), r"{{.Pattern}}"){{ if not .Required }} if {{ .EscapedName }}{{ end }}
1818
{{- end }}
1919
{{- if .UniqueItems }}
2020
isunique({{ .EscapedName }}){{ if not .Required }} if {{ .EscapedName }}{{ end }}

0 commit comments

Comments
 (0)