-
Notifications
You must be signed in to change notification settings - Fork 2
/
testpad.py
62 lines (53 loc) · 1.36 KB
/
testpad.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from gator.resources.build import build_changeset, register_custom_resource
from pydantic import BaseModel
from pathlib import Path
from gator.resources.models import CodeChangeResource
spec = """
kind: Changeset
version: v1alpha
spec:
name: time to do a thing
issue_title: stuff
issue_body: other stuff
filters:
- kind: RegexFilter
version: v1alpha
spec:
regex: '([ \t]+)bo1c2\:'
paths:
- "asd"
- k8s.yml
code_changes:
- kind: RegexReplaceCodeChange
version: v1alpha
spec:
replacement_details:
- regex: '(?<=black==)(22\.1\.0|21\.\w+)'
replace_term: "22.3.0"
paths:
- "requirements-test.txt"
"""
print(build_changeset(spec))
class DoNothingSpec(BaseModel):
some_value: str
class DoNothingCodeChange(CodeChangeResource):
kind = 'DoNothingCodeChange'
version = 'v1alpha'
spec: DoNothingSpec
def make_code_changes(self, path: Path) -> None:
pass
register_custom_resource(DoNothingCodeChange)
another_spec = """
kind: Changeset
version: v1alpha
spec:
name: time to do a thing
issue_title: stuff
issue_body: other stuff
code_changes:
- kind: DoNothingCodeChange
version: v1alpha
spec:
some_value: "concrete value"
"""
print(build_changeset(another_spec))