atomicshop 2.16.20__py3-none-any.whl → 2.16.21__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.16.20'
4
+ __version__ = '2.16.21'
@@ -2,6 +2,7 @@ import os
2
2
  import datetime
3
3
  import json
4
4
  from typing import Union, Literal
5
+ import argparse
5
6
 
6
7
  from .statistic_analyzer_helper import analyzer_helper, moving_average_helper
7
8
  from .. import filesystem, domains, datetimes, urls
@@ -344,7 +345,7 @@ def analyze(main_file_path: str):
344
345
  # ======================================================================================================================
345
346
 
346
347
 
347
- def deviation_calculator_by_moving_average_main(
348
+ def deviation_calculator_by_moving_average(
348
349
  statistics_file_directory: str,
349
350
  by_type: Literal['host', 'url'],
350
351
  moving_average_window_days: int,
@@ -470,3 +471,64 @@ def deviation_calculator_by_moving_average_main(
470
471
  return deviation_list
471
472
 
472
473
  return []
474
+
475
+
476
+ def deviation_calculator_by_moving_average_main():
477
+ def parse_args():
478
+ description_full: str = (
479
+ f'Description: Calculate deviation by moving average.')
480
+
481
+ parser = argparse.ArgumentParser(
482
+ description=description_full)
483
+
484
+ parser.add_argument(
485
+ '-d', '--directory', type=str, required=True,
486
+ help='Provide full path to directory with statistics.csv files.')
487
+ parser.add_argument(
488
+ '-of', '--output_file', type=str, required=True, help='Provide full path to output file.')
489
+ parser.add_argument(
490
+ '-ot', '--output_type', type=str, required=True, help='Provide output type: [json] or [csv].')
491
+ parser.add_argument(
492
+ '-by', '--by_type', type=str, required=True, help='Calculate by [host] or [url].')
493
+ parser.add_argument(
494
+ '-f', '--full_details', action='store_true', required=False,
495
+ help='(OPTIONAL) Output full processing details instead of summary.')
496
+ parser.add_argument(
497
+ '-w', '--window', type=int, required=True, help='Moving average window in days.')
498
+ parser.add_argument(
499
+ '-p', '--percentage', type=float, required=True,
500
+ help='Percentage of deviation from moving average. Example: 0.1 for 10%%.')
501
+
502
+ return parser.parse_args()
503
+
504
+ args = parse_args()
505
+
506
+ if args.output_type == 'csv' and args.full_details:
507
+ print_api("Full details output is not supported for csv files.", color='red')
508
+ return 1
509
+
510
+ if not os.path.isdir(args.directory):
511
+ print_api(f"Directory does not exist: {args.directory}", color='red')
512
+ return 1
513
+
514
+ if not filesystem.get_paths_from_directory(
515
+ directory_path=args.directory, get_file=True, simple_list=True, file_name_check_pattern='*statistics*.csv'):
516
+ print_api(f"No statistics files found in: {args.directory}", color='red')
517
+ return 1
518
+
519
+ if args.full_details:
520
+ summary = False
521
+ else:
522
+ summary = True
523
+
524
+ _ = deviation_calculator_by_moving_average(
525
+ statistics_file_directory=args.directory,
526
+ by_type=args.by_type,
527
+ moving_average_window_days=args.window,
528
+ top_bottom_deviation_percentage=args.percentage,
529
+ summary=summary,
530
+ output_file_path=args.output_file,
531
+ output_file_type=args.output_type,
532
+ )
533
+
534
+ return 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.16.20
3
+ Version: 2.16.21
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=glTwF3AaXumcMYRK9aEiKxF7orYtHdc0gWXmh8wXceg,124
1
+ atomicshop/__init__.py,sha256=zKVPai5VQ8seJQHyf_xQ-rQvYdF2i_Ndo5C7J_u4bvA,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
@@ -131,7 +131,7 @@ atomicshop/mitm/message.py,sha256=d_sm3O_aoZf87dDQP44xOMNEG-uZBN1ZecQgMCacbZs,18
131
131
  atomicshop/mitm/mitm_main.py,sha256=CdCv4nYt_jwd23AI14v6lC2H8SZeIZqsXjFhwq61UtM,21285
132
132
  atomicshop/mitm/recs_files.py,sha256=B8fSuvYXlh50LWfwLRw_bYswreTjmdZLuHJzbDC5Gss,2930
133
133
  atomicshop/mitm/shared_functions.py,sha256=hplm98tz8pgJ4WHUVI9sf_oVqUM2KJ1Y2pD6EFSb8P0,1879
134
- atomicshop/mitm/statistic_analyzer.py,sha256=AzL9rQhg0tLJj33gZfxdwWghmbXGLh_HyMBDpzuBmsQ,24709
134
+ atomicshop/mitm/statistic_analyzer.py,sha256=0QYmkdSp5tjHkyl5MGWVEsgpRR3FgN7A2fE6pKTSO8I,27164
135
135
  atomicshop/mitm/engines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
136
136
  atomicshop/mitm/engines/create_module_template.py,sha256=tRjVSm1sD6FzML71Qbuwvita0qsusdFGm8NZLsZ-XMs,4853
137
137
  atomicshop/mitm/engines/create_module_template_example.py,sha256=X5xhvbV6-g9jU_bQVhf_crZmaH50LRWz3bS-faQ18ds,489
@@ -309,8 +309,8 @@ atomicshop/wrappers/socketw/ssl_base.py,sha256=kmiif84kMhBr5yjQW17p935sfjR5JKG0L
309
309
  atomicshop/wrappers/socketw/statistics_csv.py,sha256=V_m1D0KpizQox3IEWp2AUcncwWy5kG25hbFrc-mBSJE,3029
310
310
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
311
311
  atomicshop/wrappers/winregw/winreg_network.py,sha256=bQ8Jql8bVGBJ0dt3VQ56lga_1LBOMLI3Km_otvvbU6c,7138
312
- atomicshop-2.16.20.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
313
- atomicshop-2.16.20.dist-info/METADATA,sha256=_6DtjLTOAPxjimk_EMT_AWrtPUCkdYItaZUWlrTRqDE,10473
314
- atomicshop-2.16.20.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
315
- atomicshop-2.16.20.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
316
- atomicshop-2.16.20.dist-info/RECORD,,
312
+ atomicshop-2.16.21.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
313
+ atomicshop-2.16.21.dist-info/METADATA,sha256=laLfi_M6QxDCtlg45NOSU4pblQDzfKTAavug5lp8Ewo,10473
314
+ atomicshop-2.16.21.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
315
+ atomicshop-2.16.21.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
316
+ atomicshop-2.16.21.dist-info/RECORD,,