atomicshop 2.14.11__py3-none-any.whl → 2.14.12__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 CHANGED
@@ -1,4 +1,4 @@
1
1
  """Atomic Basic functions and classes to make developer life easier"""
2
2
 
3
3
  __author__ = "Den Kras"
4
- __version__ = '2.14.11'
4
+ __version__ = '2.14.12'
@@ -53,7 +53,11 @@ class DnsRequestResponseTrace:
53
53
  """
54
54
 
55
55
  self.attrs = attrs
56
- self.skip_record_list = skip_record_list
56
+
57
+ if skip_record_list:
58
+ self.skip_record_list: list = skip_record_list
59
+ else:
60
+ self.skip_record_list: list = list()
57
61
 
58
62
  if not session_name:
59
63
  session_name = ETW_DEFAULT_SESSION_NAME
@@ -1,13 +1,12 @@
1
- import os
2
1
  import datetime
3
2
  import statistics
4
3
  import json
5
- from typing import Literal
4
+ from typing import Literal, Union
6
5
 
7
6
  from .. import filesystem, domains, datetimes, urls
8
7
  from ..basics import dicts
9
8
  from ..file_io import tomls, xlsxs, csvs, jsons
10
- from ..wrappers.loggingw import reading
9
+ from ..wrappers.loggingw import reading, consts
11
10
  from ..print_api import print_api
12
11
 
13
12
 
@@ -479,7 +478,7 @@ def calculate_moving_average(
479
478
  moving_average_window_days,
480
479
  top_bottom_deviation_percentage: float,
481
480
  print_kwargs: dict = None
482
- ):
481
+ ) -> list:
483
482
  """
484
483
  This function calculates the moving average of the daily statistics.
485
484
 
@@ -490,7 +489,7 @@ def calculate_moving_average(
490
489
  :param print_kwargs: dict, the print_api arguments.
491
490
  """
492
491
 
493
- date_pattern: str = '%Y_%m_%d'
492
+ date_pattern: str = consts.DEFAULT_ROTATING_SUFFIXES_FROM_WHEN['midnight']
494
493
 
495
494
  # Get all the file paths and their midnight rotations.
496
495
  logs_paths: list = reading.get_logs_paths(
@@ -782,19 +781,19 @@ def find_deviation_from_moving_average(
782
781
 
783
782
  def moving_average_calculator_main(
784
783
  statistics_file_path: str,
785
- output_directory: str,
786
784
  moving_average_window_days: int,
787
- top_bottom_deviation_percentage: float
788
- ) -> int:
785
+ top_bottom_deviation_percentage: float,
786
+ output_json_file_path: str = None
787
+ ) -> Union[list, None]:
789
788
  """
790
789
  This function is the main function for the moving average calculator.
791
790
 
792
791
  :param statistics_file_path: string, the statistics file path.
793
- :param output_directory: string, the output directory.
794
792
  :param moving_average_window_days: integer, the moving average window days.
795
793
  :param top_bottom_deviation_percentage: float, the top bottom deviation percentage. Example: 0.1 for 10%.
796
- :return: integer, the return code.
794
+ :param output_json_file_path: string, if None, no json file will be written.
797
795
  -----------------------------
796
+ :return: the deviation list of dicts.
798
797
 
799
798
  Example:
800
799
  import sys
@@ -804,9 +803,9 @@ def moving_average_calculator_main(
804
803
  def main():
805
804
  return statistic_analyzer.moving_average_calculator_main(
806
805
  statistics_file_path='statistics.csv',
807
- output_directory='output',
808
806
  moving_average_window_days=7,
809
- top_bottom_deviation_percentage=0.1
807
+ top_bottom_deviation_percentage=0.1,
808
+ output_json_file='C:\\output\\deviation_list.json'
810
809
  )
811
810
 
812
811
 
@@ -828,13 +827,15 @@ def moving_average_calculator_main(
828
827
  )
829
828
 
830
829
  if deviation_list:
831
- for deviation_list_index, deviation in enumerate(deviation_list):
832
- convert_data_value_to_string('request_sizes', deviation_list_index)
833
- convert_data_value_to_string('response_sizes', deviation_list_index)
834
- convert_value_to_string('ma_data', deviation_list_index)
830
+ if output_json_file_path:
831
+ for deviation_list_index, deviation in enumerate(deviation_list):
832
+ convert_data_value_to_string('request_sizes', deviation_list_index)
833
+ convert_data_value_to_string('response_sizes', deviation_list_index)
834
+ convert_value_to_string('ma_data', deviation_list_index)
835
+
836
+ print_api(f'Deviation Found, saving to file: {output_json_file_path}', color='blue')
837
+ jsons.write_json_file(deviation_list, output_json_file_path, use_default_indent=True)
835
838
 
836
- file_path = output_directory + os.sep + 'deviation.json'
837
- print_api(f'Deviation Found, saving to file: {file_path}', color='blue')
838
- jsons.write_json_file(deviation_list, file_path, use_default_indent=True)
839
+ return deviation_list
839
840
 
840
- return 0
841
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.14.11
3
+ Version: 2.14.12
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- atomicshop/__init__.py,sha256=j4I9LL6R2TZPz5HJCn6_tLwz-NnCBoG0zgr315IRFG8,124
1
+ atomicshop/__init__.py,sha256=X3k111NJA7eZtjRpWoDPX-8UI7APCHhTzJOfr58o7vQ,124
2
2
  atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
3
3
  atomicshop/_create_pdf_demo.py,sha256=Yi-PGZuMg0RKvQmLqVeLIZYadqEZwUm-4A9JxBl_vYA,3713
4
4
  atomicshop/_patch_import.py,sha256=ENp55sKVJ0e6-4lBvZnpz9PQCt3Otbur7F6aXDlyje4,6334
@@ -108,7 +108,7 @@ atomicshop/etws/providers.py,sha256=CXNx8pYdjtpLIpA66IwrnE64XhY4U5ExnFBMLEb8Uzk,
108
108
  atomicshop/etws/sessions.py,sha256=b_KeiOvgOBJezJokN81TRlrvJiQNJlIWN4Z6UVjuxP0,1335
109
109
  atomicshop/etws/trace.py,sha256=WMOjdazK97UcIdhVgcnjh98OCbuEJcnm1Z_yPp_nE2c,7258
110
110
  atomicshop/etws/traces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
111
- atomicshop/etws/traces/trace_dns.py,sha256=rWQ8bv8eMHBRRkA8oxO9caYqj0h4Emw4aZXmoI3Q6fg,6292
111
+ atomicshop/etws/traces/trace_dns.py,sha256=WvOZm7KNdP4r6ofkZhUGi9WjtYlkV3mUp_yxita3Qg4,6399
112
112
  atomicshop/etws/traces/trace_sysmon_process_creation.py,sha256=OM-bkK38uYMwWLZKNOTDa0Xdk3sO6sqsxoMUIiPvm5g,4656
113
113
  atomicshop/file_io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
114
114
  atomicshop/file_io/csvs.py,sha256=eS2SSGwcC1MlRPPgoqyFyE-qqH2esUWQvv3wWLMiOuA,5876
@@ -127,7 +127,7 @@ atomicshop/mitm/initialize_engines.py,sha256=YnXPK1UKrmULnfL4zLo2LOpKWq-aGKzc9p3
127
127
  atomicshop/mitm/initialize_mitm_server.py,sha256=j1yMUbHsnFh9l5rFiUgBQA0mRZqREOKviP0frRzYikM,14611
128
128
  atomicshop/mitm/message.py,sha256=u2U2f2SOHdBNU-6r1Ik2W14ai2EOwxUV4wVfGZA098k,1732
129
129
  atomicshop/mitm/shared_functions.py,sha256=PaK_sbnEA5zo9k2ktEOKLmvo-6wRUunxzSNRr41uXIQ,1924
130
- atomicshop/mitm/statistic_analyzer.py,sha256=ctsf-MBIUvG4-R0K4gFQyi_b42-VCq-5s7hgO9jMOes,38415
130
+ atomicshop/mitm/statistic_analyzer.py,sha256=uUf6b6uLXxUMetEj5l225B1Id69acEmVRRX4zHsUs4M,38600
131
131
  atomicshop/mitm/engines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
132
132
  atomicshop/mitm/engines/create_module_template.py,sha256=tRjVSm1sD6FzML71Qbuwvita0qsusdFGm8NZLsZ-XMs,4853
133
133
  atomicshop/mitm/engines/create_module_template_example.py,sha256=X5xhvbV6-g9jU_bQVhf_crZmaH50LRWz3bS-faQ18ds,489
@@ -285,8 +285,8 @@ atomicshop/wrappers/socketw/socket_server_tester.py,sha256=AhpurHJmP2kgzHaUbq5ey
285
285
  atomicshop/wrappers/socketw/socket_wrapper.py,sha256=aXBwlEIJhFT0-c4i8iNlFx2It9VpCEpsv--5Oqcpxao,11624
286
286
  atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
287
287
  atomicshop/wrappers/socketw/statistics_csv.py,sha256=t3dtDEfN47CfYVi0CW6Kc2QHTEeZVyYhc57IYYh5nmA,826
288
- atomicshop-2.14.11.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
289
- atomicshop-2.14.11.dist-info/METADATA,sha256=GQTzZr5oR0sbtuoNqgw0kIIB80QY36y2sYn1I9qG1i4,10479
290
- atomicshop-2.14.11.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
291
- atomicshop-2.14.11.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
292
- atomicshop-2.14.11.dist-info/RECORD,,
288
+ atomicshop-2.14.12.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
289
+ atomicshop-2.14.12.dist-info/METADATA,sha256=ml2p_-2MUkPlV2TOi-uFOF0ecFg7-1bf1mDSr16JxxE,10479
290
+ atomicshop-2.14.12.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
291
+ atomicshop-2.14.12.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
292
+ atomicshop-2.14.12.dist-info/RECORD,,