articlib 0.2.4__py3-none-any.whl → 0.2.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of articlib might be problematic. Click here for more details.
- articlib/articFileUtils.py +33 -15
- articlib/testEngine.py +12 -6
- {articlib-0.2.4.dist-info → articlib-0.2.5.dist-info}/METADATA +1 -1
- {articlib-0.2.4.dist-info → articlib-0.2.5.dist-info}/RECORD +6 -6
- {articlib-0.2.4.dist-info → articlib-0.2.5.dist-info}/LICENSE +0 -0
- {articlib-0.2.4.dist-info → articlib-0.2.5.dist-info}/WHEEL +0 -0
articlib/articFileUtils.py
CHANGED
|
@@ -2,65 +2,83 @@ import os
|
|
|
2
2
|
import shutil
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
def deleteFile(path):
|
|
5
|
+
def deleteFile(path: str):
|
|
6
6
|
os.remove(path)
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
def createFile(path):
|
|
9
|
+
def createFile(path: str):
|
|
10
10
|
file = open(path, "r")
|
|
11
11
|
file.close()
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def copyFile(source, destination):
|
|
14
|
+
def copyFile(source: str, destination: str):
|
|
15
15
|
shutil.copy(source, destination)
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
def fileExists(path):
|
|
18
|
+
def fileExists(path: str):
|
|
19
19
|
return os.path.isfile(path)
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
def getFilesInDirectory(path):
|
|
22
|
+
def getFilesInDirectory(path: str):
|
|
23
23
|
return os.listdir(path)
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def deleteDirectory(path):
|
|
26
|
+
def deleteDirectory(path: str):
|
|
27
27
|
os.rmdir(path)
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
def createDirectory(path):
|
|
30
|
+
def createDirectory(path: str):
|
|
31
31
|
os.makedirs(path, exist_ok=True)
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
class FileIO:
|
|
35
|
-
def __init__(self, path, readIt=False):
|
|
35
|
+
def __init__(self, path: str, readIt: bool = False) -> None:
|
|
36
36
|
self.path = path
|
|
37
37
|
if readIt:
|
|
38
38
|
self.readFile()
|
|
39
39
|
else:
|
|
40
|
-
lines = []
|
|
40
|
+
self.lines = []
|
|
41
41
|
|
|
42
|
-
def readFile(self):
|
|
42
|
+
def readFile(self) -> None:
|
|
43
43
|
filePointer = open(self.path, "r")
|
|
44
44
|
self.lines = filePointer.readlines()
|
|
45
|
+
self.lines = [line[:-1] for line in self.lines]
|
|
45
46
|
filePointer.close()
|
|
46
47
|
|
|
47
|
-
def writeFile(self):
|
|
48
|
+
def writeFile(self) -> None:
|
|
48
49
|
filePointer = open(self.path, "w")
|
|
49
50
|
for line in self.lines:
|
|
50
51
|
filePointer.write(line + "\n")
|
|
51
52
|
filePointer.close()
|
|
52
53
|
|
|
53
|
-
def appendToFile(self):
|
|
54
|
+
def appendToFile(self) -> None:
|
|
54
55
|
filePointer = open(self.path, "a")
|
|
55
56
|
for line in self.lines:
|
|
56
57
|
filePointer.write(line + "\n")
|
|
57
58
|
filePointer.close()
|
|
58
59
|
|
|
59
|
-
def addLine(self, line):
|
|
60
|
+
def addLine(self, line: str) -> None:
|
|
60
61
|
self.lines.append(line)
|
|
61
62
|
|
|
62
|
-
def modifyLine(self, lineNumber, line):
|
|
63
|
+
def modifyLine(self, lineNumber: int, line: str) -> None:
|
|
63
64
|
self.lines[lineNumber] = line
|
|
64
65
|
|
|
65
|
-
def
|
|
66
|
+
def removeLine(self, lineNumber: int) -> None:
|
|
67
|
+
del self.lines[lineNumber]
|
|
68
|
+
|
|
69
|
+
def removeLastLine(self) -> None:
|
|
70
|
+
del self.lines[-1]
|
|
71
|
+
|
|
72
|
+
def findLine(self, text: str) -> int:
|
|
73
|
+
result = []
|
|
74
|
+
for i in range(len(self.lines)):
|
|
75
|
+
if text in self.lines[i]:
|
|
76
|
+
result.append(i)
|
|
77
|
+
return result
|
|
78
|
+
|
|
79
|
+
def findAndReplace(self, find: str, replace: str) -> None:
|
|
80
|
+
for i in range(len(self.lines)):
|
|
81
|
+
self.lines[i] = self.lines[i].replace(find, replace)
|
|
82
|
+
|
|
83
|
+
def lineCount(self) -> int:
|
|
66
84
|
return len(self.lines)
|
articlib/testEngine.py
CHANGED
|
@@ -63,8 +63,10 @@ class testEngine:
|
|
|
63
63
|
def testIfGreaterEqual(self, expected, testValue, message):
|
|
64
64
|
response = self.testIftrue(expected >= testValue, message)
|
|
65
65
|
if response == 2:
|
|
66
|
-
printMagenta(
|
|
67
|
-
|
|
66
|
+
printMagenta(
|
|
67
|
+
f"""\t\tExpected value greater
|
|
68
|
+
or equal than {expected}"""
|
|
69
|
+
)
|
|
68
70
|
printMagenta(f"\t\tValue equal to {testValue}")
|
|
69
71
|
|
|
70
72
|
def testIfLess(self, expected, testValue, message):
|
|
@@ -85,11 +87,15 @@ class testEngine:
|
|
|
85
87
|
|
|
86
88
|
def endScenario(self, name):
|
|
87
89
|
if self.escenarioPassed:
|
|
88
|
-
print(
|
|
89
|
-
|
|
90
|
+
print(
|
|
91
|
+
f"""Scenario {self.scenarioCount}:{name} ended
|
|
92
|
+
with result: PASSED"""
|
|
93
|
+
)
|
|
90
94
|
else:
|
|
91
|
-
print(
|
|
92
|
-
|
|
95
|
+
print(
|
|
96
|
+
f"""Scenario {self.scenarioCount}:{name} ended
|
|
97
|
+
with result: FAILED"""
|
|
98
|
+
)
|
|
93
99
|
if self.escenarioFailed:
|
|
94
100
|
self.passed = False
|
|
95
101
|
self.failed = True
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
articlib/articFileUtils.py,sha256=
|
|
1
|
+
articlib/articFileUtils.py,sha256=6DEL_3aBdHT4327dXH937CrI1Q3E87wMHRICJKcbi6k,2004
|
|
2
2
|
articlib/articLogger.py,sha256=ebdrn2V6DwTBm2kuyZS6Hav-olyf8CgQ6Oc2iLZUQcw,2922
|
|
3
3
|
articlib/consoleUtils.py,sha256=lGRazY1upmUTbPR0kXqg9C_Nxmc9xH580WcN8TOK-BI,932
|
|
4
4
|
articlib/dateTime.py,sha256=heTdkfYgTCQ5PMcA94zn_r4bLDgmycOTs8-wFwFYas8,4303
|
|
5
5
|
articlib/dice.py,sha256=eqKRuddChCldl9O11c0_Q2ne9moixusABb_GjmDP8Dk,798
|
|
6
6
|
articlib/sqliteEngine.py,sha256=bG1yaxJR0LdY9v2gJyjwnnYPzSs5lQvmtiYwYoim9jY,2394
|
|
7
7
|
articlib/systemUtils.py,sha256=6HXFCtq5PbosgyBwyHPz4MsJlBu0u-EkZN9Gror3dro,803
|
|
8
|
-
articlib/testEngine.py,sha256=
|
|
9
|
-
articlib-0.2.
|
|
10
|
-
articlib-0.2.
|
|
11
|
-
articlib-0.2.
|
|
12
|
-
articlib-0.2.
|
|
8
|
+
articlib/testEngine.py,sha256=w6OvaJy2kYd_s0HS13GabBoNeJHaTVy1GPpjKSVJJI8,4507
|
|
9
|
+
articlib-0.2.5.dist-info/LICENSE,sha256=3-aTTjabtkZs4isOSc-gRzV0yFur4FhDOXt61keEaqo,1073
|
|
10
|
+
articlib-0.2.5.dist-info/METADATA,sha256=iI07rO8r3FHcqTPlmQQOIkGXjfUkJyNv-hM-YI9Nz7M,1958
|
|
11
|
+
articlib-0.2.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
12
|
+
articlib-0.2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|