-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
55 lines (46 loc) · 1.56 KB
/
__init__.py
File metadata and controls
55 lines (46 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# AWS Global Pulse - Modular Infrastructure Auditor
import warnings
from auditor import AWSPulseAuditor
from report_generator import HTMLReportGenerator
from config import *
__version__ = "2.0.1"
# Lazy loading dla skanerów - obsługa błędów przy importach
def _import_scanners():
"""Import scanners with graceful error handling."""
scanners_map = {}
try:
from scanners import REGIONAL_SCANNERS
scanners_map['REGIONAL_SCANNERS'] = REGIONAL_SCANNERS
except ImportError as e:
warnings.warn(f"Failed to import REGIONAL_SCANNERS: {e}")
scanners_map['REGIONAL_SCANNERS'] = []
try:
from scanners import S3Scanner
scanners_map['S3Scanner'] = S3Scanner
except ImportError as e:
warnings.warn(f"Failed to import S3Scanner: {e}")
scanners_map['S3Scanner'] = None
try:
from scanners import IAMScanner
scanners_map['IAMScanner'] = IAMScanner
except ImportError as e:
warnings.warn(f"Failed to import IAMScanner: {e}")
scanners_map['IAMScanner'] = None
return scanners_map
# Initialize on first access
_SCANNERS_CACHE = None
def __getattr__(name):
"""Lazy loading dla skanerów."""
global _SCANNERS_CACHE
if _SCANNERS_CACHE is None:
_SCANNERS_CACHE = _import_scanners()
if name in _SCANNERS_CACHE:
return _SCANNERS_CACHE[name]
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
__all__ = [
"AWSPulseAuditor",
"HTMLReportGenerator",
"REGIONAL_SCANNERS",
"S3Scanner",
"IAMScanner"
]