-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest.py
More file actions
34 lines (28 loc) · 767 Bytes
/
Copy pathtest.py
File metadata and controls
34 lines (28 loc) · 767 Bytes
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
from git import Repo
import os
import sys
import git
import re
if __name__ == '__main__':
t = 'user: zst gender: g3d age: 18'
pattern = re.compile(r'(username|user): (?P<name>[a-zA-Z0-9._-]+) gender: (?P<gender>[a-zA-Z0-9._-]+) age: (?P<age>\w+)')
m = pattern.match(t)
if m is None:
print("match failed")
else:
print("match success")
d = m.groupdict()
print("username", d['name'])
# p = '/tmp/mysql_playbook'
#
# if not os.path.exists(p):
# os.mkdir(p)
# Repo.clone_from('git@github.com:textworld/ansible_zst_mysql.git', p)
#
# if not os.path.isdir(p):
# print("is not dir")
# sys.exit(1)
#
# repo = Repo(p)
#
# repo.remote("origin").pull()