MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / get_ai_network_summary

Function get_ai_network_summary

webapp_modern.py:19084–19114  ·  view source on GitHub ↗

Get AI-generated network security summary

()

Source from the content-addressed store, hash-verified

19082 virtual_path = f"{vroot}/{slug}/{inner}"
19083
19084 files.append({
19085 'filename': fname,
19086 'category': category,
19087 'size': _format_bytes_simple(stat.st_size),
19088 'modified': _format_timestamp_simple(stat.st_mtime),
19089 'virtual_path': virtual_path,
19090 })
19091 except OSError:
19092 pass
19093
19094 return jsonify({
19095 'success': True,
19096 'slug': slug,
19097 'ssid': ssid,
19098 'files': files,
19099 'total': len(files),
19100 })
19101 except Exception as exc:
19102 logger.error(f"Error listing files for network '{slug}': {exc}")
19103 return jsonify({'success': False, 'error': str(exc)}), 500
19104
19105
19106def _format_bytes_simple(size):
19107 for unit in ('B', 'KB', 'MB', 'GB'):
19108 if size < 1024:
19109 return f"{size:.1f} {unit}" if unit != 'B' else f"{size} B"
19110 size /= 1024
19111 return f"{size:.1f} TB"
19112
19113
19114def _format_timestamp_simple(ts):
19115 import datetime as _dt
19116 try:
19117 return _dt.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M')

Callers

nothing calls this directly

Calls 4

safe_intFunction · 0.85
errorMethod · 0.80
is_enabledMethod · 0.45

Tested by

no test coverage detected