pycopyer 0.2__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.
pycopyer/__Init__.py ADDED
@@ -0,0 +1 @@
1
+ from .main import write_file, write_text_into_file
pycopyer/main.py ADDED
@@ -0,0 +1,48 @@
1
+ from termcolor import cprint
2
+
3
+ def write_file(first_file, second_file):
4
+ try:
5
+ with open(first_file, "rb") as f:
6
+ result = f.read()
7
+
8
+ with open(second_file, "wb") as fi:
9
+ fi.write(result)
10
+
11
+
12
+ cprint("Succeed to write " + second_file, "green")
13
+
14
+ except Exception as e:
15
+ cprint(e, "red")
16
+ cprint("\nFailed to write " + second_file, "red")
17
+
18
+ cprint("\nThank you for using pycopyer", "blue")
19
+
20
+
21
+
22
+ encodings = [
23
+ "utf-8", "utf-16", "latin-1", "ascii",
24
+ "windows-1252", "windows-1256", "iso-8859-1",
25
+ "iso-8859-6", "cp1252", "cp864", "cp720",
26
+ "mac_arabic", "utf-8-sig", "utf-16-le",
27
+ "windows-1250", "windows-1251", "windows-1255",
28
+ "shift-jis", "gb2312", "big5",
29
+ ]
30
+
31
+
32
+
33
+ def write_text_into_file(text, file):
34
+ for encoding in encodings:
35
+ try:
36
+
37
+ with open(file, "w", encoding=encoding) as f:
38
+ f.write(text)
39
+
40
+
41
+ cprint("Succeed to write " + file, "green")
42
+ cprint("\nThank you for using pycopyer", "blue")
43
+ return
44
+
45
+ except Exception as e:
46
+ cprint(str(e), "red")
47
+ cprint("\nFailed to write " + file, "red")
48
+ cprint("\nThank you for using pycopyer", "blue")
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: pycopyer
3
+ Version: 0.2
4
+ Summary: Write the content of the first written file name into the second written file name and takes any text you give it and writes it directly into the file you specify
5
+ Author: The-coder
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: termcolor
8
+ Dynamic: author
9
+ Dynamic: description
10
+ Dynamic: description-content-type
11
+ Dynamic: requires-dist
12
+ Dynamic: summary
13
+
14
+ # pycopyer
15
+
16
+ A simple Python package that does two things:
17
+
18
+ 1. **Copies files** — Reads the content from one file and writes it into another file (works with any file type: .txt, .pdf, .jpg, .py, everything!)
19
+ 2. **Writes text** — Takes any text you give it and writes it directly into the file you specify
20
+
21
+ ## Installation
22
+ pip install pycopyer
23
+
24
+ ## Usage
25
+
26
+ ```python
27
+ from pycopyer import write_file
28
+ write_file("first-file-name", "-second-file-name")# Copy the content of the first file into the second file
29
+
30
+ # And when writing the path, you should add r before the first file and before the second file as the following:
31
+ write_file(r"first-file-name", r"-second-file-name")
32
+
33
+ from pycopyer import write_text_into_file
34
+ write_text_into_file("the-text-you-want-to-write-here", "the-file-name")# Write the text into the file
35
+
36
+ # And add r before the written file as the following:
37
+ write_text_into_file("the-text-you-want-to-write-here", r"the-file-name")
@@ -0,0 +1,6 @@
1
+ pycopyer/__Init__.py,sha256=mUEazKOdP41wb_BwHoNCrJPQyRDU4DzcQZIawX9gi30,50
2
+ pycopyer/main.py,sha256=SVuZGa5RyEBLgA8glzSfAKYpLxtw9RzjjvrPTLufj20,1269
3
+ pycopyer-0.2.dist-info/METADATA,sha256=n2ZFIM5OOVv2PyKiRZVFWwxl0IPIhAfc8FbWJMeadjA,1416
4
+ pycopyer-0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ pycopyer-0.2.dist-info/top_level.txt,sha256=kjc_svkabYzlKeDPE-jMTi8VidOUJFxxlaRIkhEyKYg,9
6
+ pycopyer-0.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ pycopyer