articlib 0.2.4__tar.gz → 0.2.5__tar.gz

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: articlib
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Small set of tools and utilities in python. Destined to be use in my personal projects.
5
5
  License: MIT
6
6
  Author: Artic42
@@ -0,0 +1,84 @@
1
+ import os
2
+ import shutil
3
+
4
+
5
+ def deleteFile(path: str):
6
+ os.remove(path)
7
+
8
+
9
+ def createFile(path: str):
10
+ file = open(path, "r")
11
+ file.close()
12
+
13
+
14
+ def copyFile(source: str, destination: str):
15
+ shutil.copy(source, destination)
16
+
17
+
18
+ def fileExists(path: str):
19
+ return os.path.isfile(path)
20
+
21
+
22
+ def getFilesInDirectory(path: str):
23
+ return os.listdir(path)
24
+
25
+
26
+ def deleteDirectory(path: str):
27
+ os.rmdir(path)
28
+
29
+
30
+ def createDirectory(path: str):
31
+ os.makedirs(path, exist_ok=True)
32
+
33
+
34
+ class FileIO:
35
+ def __init__(self, path: str, readIt: bool = False) -> None:
36
+ self.path = path
37
+ if readIt:
38
+ self.readFile()
39
+ else:
40
+ self.lines = []
41
+
42
+ def readFile(self) -> None:
43
+ filePointer = open(self.path, "r")
44
+ self.lines = filePointer.readlines()
45
+ self.lines = [line[:-1] for line in self.lines]
46
+ filePointer.close()
47
+
48
+ def writeFile(self) -> None:
49
+ filePointer = open(self.path, "w")
50
+ for line in self.lines:
51
+ filePointer.write(line + "\n")
52
+ filePointer.close()
53
+
54
+ def appendToFile(self) -> None:
55
+ filePointer = open(self.path, "a")
56
+ for line in self.lines:
57
+ filePointer.write(line + "\n")
58
+ filePointer.close()
59
+
60
+ def addLine(self, line: str) -> None:
61
+ self.lines.append(line)
62
+
63
+ def modifyLine(self, lineNumber: int, line: str) -> None:
64
+ self.lines[lineNumber] = line
65
+
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:
84
+ return len(self.lines)
@@ -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(f"""\t\tExpected value greater
67
- or equal than {expected}""")
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(f"""Scenario {self.scenarioCount}:{name} ended
89
- with result: PASSED""")
90
+ print(
91
+ f"""Scenario {self.scenarioCount}:{name} ended
92
+ with result: PASSED"""
93
+ )
90
94
  else:
91
- print(f"""Scenario {self.scenarioCount}:{name} ended
92
- with result: FAILED""")
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,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "articlib"
3
- version = "0.2.4"
3
+ version = "0.2.5"
4
4
  description = "Small set of tools and utilities in python. Destined to be use in my personal projects."
5
5
  authors = ["Artic42 <engineer@artic42.com>"]
6
6
  license = "MIT"
@@ -1,66 +0,0 @@
1
- import os
2
- import shutil
3
-
4
-
5
- def deleteFile(path):
6
- os.remove(path)
7
-
8
-
9
- def createFile(path):
10
- file = open(path, "r")
11
- file.close()
12
-
13
-
14
- def copyFile(source, destination):
15
- shutil.copy(source, destination)
16
-
17
-
18
- def fileExists(path):
19
- return os.path.isfile(path)
20
-
21
-
22
- def getFilesInDirectory(path):
23
- return os.listdir(path)
24
-
25
-
26
- def deleteDirectory(path):
27
- os.rmdir(path)
28
-
29
-
30
- def createDirectory(path):
31
- os.makedirs(path, exist_ok=True)
32
-
33
-
34
- class FileIO:
35
- def __init__(self, path, readIt=False):
36
- self.path = path
37
- if readIt:
38
- self.readFile()
39
- else:
40
- lines = []
41
-
42
- def readFile(self):
43
- filePointer = open(self.path, "r")
44
- self.lines = filePointer.readlines()
45
- filePointer.close()
46
-
47
- def writeFile(self):
48
- filePointer = open(self.path, "w")
49
- for line in self.lines:
50
- filePointer.write(line + "\n")
51
- filePointer.close()
52
-
53
- def appendToFile(self):
54
- filePointer = open(self.path, "a")
55
- for line in self.lines:
56
- filePointer.write(line + "\n")
57
- filePointer.close()
58
-
59
- def addLine(self, line):
60
- self.lines.append(line)
61
-
62
- def modifyLine(self, lineNumber, line):
63
- self.lines[lineNumber] = line
64
-
65
- def lineCount(self):
66
- return len(self.lines)
File without changes
File without changes
File without changes
File without changes