atomicshop 2.2.8__py3-none-any.whl → 2.2.9__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 atomicshop might be problematic. Click here for more details.
- atomicshop/__init__.py +1 -1
- atomicshop/datetimes.py +0 -1
- atomicshop/file_io/csvs.py +21 -0
- atomicshop/filesystem.py +10 -0
- atomicshop/wrappers/loggingw/reading.py +24 -5
- {atomicshop-2.2.8.dist-info → atomicshop-2.2.9.dist-info}/METADATA +1 -1
- {atomicshop-2.2.8.dist-info → atomicshop-2.2.9.dist-info}/RECORD +10 -10
- {atomicshop-2.2.8.dist-info → atomicshop-2.2.9.dist-info}/LICENSE.txt +0 -0
- {atomicshop-2.2.8.dist-info → atomicshop-2.2.9.dist-info}/WHEEL +0 -0
- {atomicshop-2.2.8.dist-info → atomicshop-2.2.9.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
atomicshop/datetimes.py
CHANGED
atomicshop/file_io/csvs.py
CHANGED
|
@@ -2,6 +2,7 @@ import csv
|
|
|
2
2
|
from typing import Tuple, List
|
|
3
3
|
|
|
4
4
|
from .file_io import read_file_decorator
|
|
5
|
+
from . import file_io
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
@read_file_decorator
|
|
@@ -57,3 +58,23 @@ def write_list_to_csv(csv_list: list, csv_filepath: str) -> None:
|
|
|
57
58
|
writer.writeheader()
|
|
58
59
|
# Write list of dits as rows.
|
|
59
60
|
writer.writerows(csv_list)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def get_header(file_path: str, print_kwargs: dict = None) -> list:
|
|
64
|
+
"""
|
|
65
|
+
Function to get header from CSV file.
|
|
66
|
+
|
|
67
|
+
:param file_path: Full file path to CSV file.
|
|
68
|
+
:param print_kwargs: Keyword arguments dict for 'print_api' function.
|
|
69
|
+
|
|
70
|
+
:return: list of strings, each string is a header field.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
if not print_kwargs:
|
|
74
|
+
print_kwargs = dict()
|
|
75
|
+
|
|
76
|
+
# Get the first line of the file as text, which is the header.
|
|
77
|
+
header = file_io.read_file(file_path, read_to_list=True, **print_kwargs)[0]
|
|
78
|
+
# Split the header to list of keys.
|
|
79
|
+
header = header.split(',')
|
|
80
|
+
return header
|
atomicshop/filesystem.py
CHANGED
|
@@ -44,6 +44,16 @@ def add_object_to_path(path: str, object_string: str) -> str:
|
|
|
44
44
|
return os.path.join(path, object_string)
|
|
45
45
|
|
|
46
46
|
|
|
47
|
+
def get_file_name_with_extension(file_path: str) -> str:
|
|
48
|
+
"""
|
|
49
|
+
The function will return file name with extension of the file.
|
|
50
|
+
|
|
51
|
+
:param file_path: string, full file path.
|
|
52
|
+
:return: string.
|
|
53
|
+
"""
|
|
54
|
+
return str(Path(file_path).name)
|
|
55
|
+
|
|
56
|
+
|
|
47
57
|
def get_list_of_directories_in_file_path(
|
|
48
58
|
file_path: str, get_last_part: bool = True, convert_drive_to_string: bool = False) -> list:
|
|
49
59
|
"""
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import os
|
|
1
2
|
from typing import Literal
|
|
2
3
|
|
|
3
|
-
from ... import filesystem
|
|
4
|
-
from ...file_io import csvs
|
|
4
|
+
from ... import filesystem, datetimes
|
|
5
|
+
from ...file_io import csvs
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def get_logs(
|
|
@@ -10,6 +11,7 @@ def get_logs(
|
|
|
10
11
|
log_type: Literal['csv'] = 'csv',
|
|
11
12
|
header_type_of_files: Literal['first', 'all'] = 'first',
|
|
12
13
|
remove_logs: bool = False,
|
|
14
|
+
move_to_path: str = None,
|
|
13
15
|
print_kwargs: dict = None
|
|
14
16
|
):
|
|
15
17
|
"""
|
|
@@ -23,12 +25,16 @@ def get_logs(
|
|
|
23
25
|
'first' - Only the first file has a header for CSV. This header will be used for the rest of the files.
|
|
24
26
|
'all' - Each CSV file has a header. Get the header from each file.
|
|
25
27
|
:param remove_logs: Boolean, if True, the logs will be removed after getting them.
|
|
28
|
+
:param move_to_path: Path to move the logs to.
|
|
26
29
|
:param print_kwargs: Keyword arguments dict for 'print_api' function.
|
|
27
30
|
"""
|
|
28
31
|
|
|
29
32
|
if not print_kwargs:
|
|
30
33
|
print_kwargs = dict()
|
|
31
34
|
|
|
35
|
+
if remove_logs and move_to_path:
|
|
36
|
+
raise ValueError('Both "remove_logs" and "move_to_path" cannot be True/specified at the same time.')
|
|
37
|
+
|
|
32
38
|
logs_files: list = filesystem.get_files_and_folders(
|
|
33
39
|
path, string_contains=pattern)
|
|
34
40
|
|
|
@@ -54,13 +60,26 @@ def get_logs(
|
|
|
54
60
|
|
|
55
61
|
# if not header:
|
|
56
62
|
# # Get the first line of the file as text, which is the header.
|
|
57
|
-
# header =
|
|
58
|
-
# # Split the header to list of keys.
|
|
59
|
-
# header = header.split(',')
|
|
63
|
+
# header = csvs.get_header(single_file, **print_kwargs)
|
|
60
64
|
|
|
61
65
|
if remove_logs:
|
|
62
66
|
# Remove the statistics files.
|
|
63
67
|
for single_file in logs_files:
|
|
64
68
|
filesystem.remove_file(single_file)
|
|
65
69
|
|
|
70
|
+
if move_to_path:
|
|
71
|
+
# Get formatted time stamp for file name.
|
|
72
|
+
time_stamp = datetimes.TimeFormats().get_current_formatted_time_filename_stamp()
|
|
73
|
+
# Remove last separator from path if it exists.
|
|
74
|
+
move_to_path_with_timestamp = filesystem.remove_last_separator(move_to_path)
|
|
75
|
+
# Add time stamp to path.
|
|
76
|
+
move_to_path_with_timestamp = f'{move_to_path_with_timestamp}{os.sep}{time_stamp}'
|
|
77
|
+
# Create the path.
|
|
78
|
+
filesystem.create_directory(move_to_path_with_timestamp)
|
|
79
|
+
# Move the statistics files.
|
|
80
|
+
for single_file in logs_files:
|
|
81
|
+
single_file_name = filesystem.get_file_name(single_file)
|
|
82
|
+
move_to_path_with_file = f'{move_to_path_with_timestamp}{os.sep}{single_file_name}'
|
|
83
|
+
filesystem.move_file(single_file, move_to_path_with_file)
|
|
84
|
+
|
|
66
85
|
return logs_content
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=7FCapWCMZHR5sCrftNZYkTxSJzc7M99vB1QB_20E0ws,122
|
|
2
2
|
atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
|
|
3
3
|
atomicshop/appointment_management.py,sha256=N3wVGJgrqJfsj_lqiRfaL3FxMEe57by5Stzanh189mk,7263
|
|
4
4
|
atomicshop/archiver.py,sha256=KKdNI150yiMO_Y1TZdKjXtw4TP5LI5FJzI8VbvFKVwo,4763
|
|
@@ -6,12 +6,12 @@ atomicshop/certificates.py,sha256=nxuq6HPBT7RfwRTSipOxoRHBS-nZLsaHR9m6UdHmDn4,29
|
|
|
6
6
|
atomicshop/command_line_processing.py,sha256=u5yT9Ger_cu7ni5ID0VFlRbVD46ARHeNC9tRM-_YXrQ,1038
|
|
7
7
|
atomicshop/console_output.py,sha256=G-6jxnWooT1nJSaPxcCqIuw8S22R_0lOJcfrdovRhwE,1372
|
|
8
8
|
atomicshop/console_user_response.py,sha256=31HIy9QGXa7f-GVR8MzJauQ79E_ZqAeagF3Ks4GGdDU,3234
|
|
9
|
-
atomicshop/datetimes.py,sha256=
|
|
9
|
+
atomicshop/datetimes.py,sha256=B_RYGyC9HxKwYdjxjdl0OrdtHQ-cDyoK1KM4-p9cLJ8,13497
|
|
10
10
|
atomicshop/diff_check.py,sha256=RON9cSTgy3jAnwUmAUkOyfF6bgrBKOq9Sbgyl3RYodw,12350
|
|
11
11
|
atomicshop/dns.py,sha256=bNZOo5jVPzq7OT2qCPukXoK3zb1oOsyaelUwQEyK1SA,2500
|
|
12
12
|
atomicshop/domains.py,sha256=i4PioZSumzaIYfutwph0MQ-iO9--MJYv3-JreTkn86Q,2831
|
|
13
13
|
atomicshop/emails.py,sha256=I0KyODQpIMEsNRi9YWSOL8EUPBiWyon3HRdIuSj3AEU,1410
|
|
14
|
-
atomicshop/filesystem.py,sha256=
|
|
14
|
+
atomicshop/filesystem.py,sha256=4JOlQVDavx2W7Xx6TzsQuAjVsGB2SUF01xQCWLz4eNM,17658
|
|
15
15
|
atomicshop/functions.py,sha256=VqLjxAxhaxUr-Ad8P1cw9bZGdZpbtqfCaXQyHf3CM9g,509
|
|
16
16
|
atomicshop/github_wrapper.py,sha256=7pZkhliP4vdcdeVtbgTDEzBS3lUw3-mp5PMWUDA19V0,4347
|
|
17
17
|
atomicshop/hashing.py,sha256=6523xFxuW0Cm1pcJCE63NWeiwt3al3t-FXLv0f0Kzpg,2989
|
|
@@ -75,7 +75,7 @@ atomicshop/etw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
75
75
|
atomicshop/etw/dns_trace.py,sha256=ZbEf1gptnUnJwaRURUW9ENDwC9Q41Zl6NtxgMNELJcg,5198
|
|
76
76
|
atomicshop/etw/etw.py,sha256=xVJNbfCq4KgRfsDnul6CrIdAMl9xRBixZ-hUyqiB2g4,2403
|
|
77
77
|
atomicshop/file_io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
78
|
-
atomicshop/file_io/csvs.py,sha256=
|
|
78
|
+
atomicshop/file_io/csvs.py,sha256=4R4Kij8FmxNwXFjDtlF_A0flAk0Hj5nZKlEnqC5VxgQ,3125
|
|
79
79
|
atomicshop/file_io/file_io.py,sha256=d7HYaixw12wf0WKKoCpWWjOWtmsFqgGztcSuWL41nlQ,5650
|
|
80
80
|
atomicshop/file_io/jsons.py,sha256=XgQs--Q6LGqC4ZtcyKvlMY_Fajjjp_l5bi6xYCy2fQQ,3383
|
|
81
81
|
atomicshop/mitm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -126,7 +126,7 @@ atomicshop/wrappers/loggingw/formatters.py,sha256=mUtcJJfmhLNrwUVYShXTmdu40dBaJu
|
|
|
126
126
|
atomicshop/wrappers/loggingw/handlers.py,sha256=qm5Fbu8eDmlstMduUe5nKUlJU5IazFkSnQizz8Qt2os,5479
|
|
127
127
|
atomicshop/wrappers/loggingw/loggers.py,sha256=DHOOTAtqkwn1xgvLHSkOiBm6yFGNuQy1kvbhG-TDog8,2374
|
|
128
128
|
atomicshop/wrappers/loggingw/loggingw.py,sha256=30uaJOJhPJExYptEmwc5HWScI2RbnDlNgybOsxW7klc,11609
|
|
129
|
-
atomicshop/wrappers/loggingw/reading.py,sha256=
|
|
129
|
+
atomicshop/wrappers/loggingw/reading.py,sha256=3zT1ahK_xU9YAi3-xk6F2QEzC40lfwTWQr1MrkMpF8o,3786
|
|
130
130
|
atomicshop/wrappers/playwrightw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
131
131
|
atomicshop/wrappers/playwrightw/_tryouts.py,sha256=l1BLkFsiIMNlgv7nfZd1XGEvXQkIQkIcg48__9OaC00,4920
|
|
132
132
|
atomicshop/wrappers/playwrightw/base.py,sha256=zwHfbFZV7qqpmReJg5lEpKtOO23DRxEd61ZdoLBU_9Q,9833
|
|
@@ -154,8 +154,8 @@ atomicshop/wrappers/socketw/socket_server_tester.py,sha256=7-G1t2yyDA-cNQF8zCpQS
|
|
|
154
154
|
atomicshop/wrappers/socketw/socket_wrapper.py,sha256=aXBwlEIJhFT0-c4i8iNlFx2It9VpCEpsv--5Oqcpxao,11624
|
|
155
155
|
atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
|
|
156
156
|
atomicshop/wrappers/socketw/statistics_csv.py,sha256=t3dtDEfN47CfYVi0CW6Kc2QHTEeZVyYhc57IYYh5nmA,826
|
|
157
|
-
atomicshop-2.2.
|
|
158
|
-
atomicshop-2.2.
|
|
159
|
-
atomicshop-2.2.
|
|
160
|
-
atomicshop-2.2.
|
|
161
|
-
atomicshop-2.2.
|
|
157
|
+
atomicshop-2.2.9.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
158
|
+
atomicshop-2.2.9.dist-info/METADATA,sha256=uXxMGqgUIcJdkLOtXGzXJ0RNNDaXtX1ex4gwK0Dz-14,9506
|
|
159
|
+
atomicshop-2.2.9.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
160
|
+
atomicshop-2.2.9.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
161
|
+
atomicshop-2.2.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|