Repository navigation
Expand file tree
/
Copy pathFunctionsModule.py
More file actions
122 lines (96 loc) · 2.5 KB
/
Copy pathFunctionsModule.py
File metadata and controls
122 lines (96 loc) · 2.5 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import importlib
from importlib import reload
# def backup():
# f = open('id.py')
# data = f.read()
# f.close()
# f = open('backup.py', 'w')
# f.write(data)
# f.close()
def genlist(line):
c = '\n'
for i in range(len(line)):
k = i + 1
c += str(k) + '. ' + line[i] + '\n'
return c
def geninfo(line):
c = '\n'
for i in range(len(line)):
line[i] = line[i].replace('_', ' ')
k = i + 1
c += str(k) + '. ' + line[i][15:] + '\n /\n'
return c
def gensell(line):
c = '\n'
for i in range(len(line)):
line[i] = line[i].replace('_', ' ')
k = i + 1
c += str(k) + '. ' + line[i] + '\n'
return c
def genhands(line):
c = '\n'
for i in range(len(line)):
line[i] = line[i].replace('_', ' ')
c += '💨️' + line[i] + ' шт.\n'
return c
def search(line):
importlib.reload(id)
if hasattr(id, str(line)):
return 1
else:
return 0
def deepsearch(word):
deeplist = [line for line in open('Data/id.py') if word in line]
for i in range(len(deeplist)):
deeplist[i] = deeplist[i][:-1]
if deeplist:
return deeplist
else:
return ['________________Пусто_']
def getvalue(word):
if word == '________________Пусто_':
return 0
else:
reload(id)
var = list(word.split(sep=' '))
var = str(var[-1])
return int(var)
def create(line):
f = open('Data/id.py', 'a+')
line = line + ' = 0\n'
f.write(line)
f.close()
reload(id)
def edit(line, newvalue):
f = open('Data/id.py')
data = f.read()
oldvalue = getattr(id, line)
data = data.replace(line + ' = ' + str(oldvalue), line + ' = ' + str(newvalue))
f.close()
f = open('Data/id.py', 'w')
f.write(data)
f.close()
def add(line, change):
reload(id)
f = open('Data/id.py')
data = f.read()
oldvalue = getattr(id, line)
newvalue = oldvalue + int(change)
data = data.replace(line + ' = ' + str(oldvalue), line + ' = ' + str(newvalue))
f.close()
f = open('Data/id.py', 'w')
f.write(data)
f.close()
def delite(line):
f = open('Data/id.py')
data = f.read()
oldvalue = getattr(id, line)
data = data.replace(line + ' = ' + str(oldvalue), '')
f.close()
f = open('Data/id.py', 'w')
f.write(data)
f.close()
with open('Data/id.py', 'rw') as file:
for line in file:
if not line.isspace():
file.write(line)