MCPcopy Index your code
hub / github.com/WebODM/WebODM / get_size_bytes

Function get_size_bytes

coreplugins/lightning/api.py:57–73  ·  view source on GitHub ↗
(resources)

Source from the content-addressed store, hash-verified

55 return resources, base_path
56
57def get_size_bytes(resources):
58 total_bytes = 0
59
60 for res in resources:
61 try:
62 if os.path.isdir(res):
63 for dirpath, _, filenames in os.walk(res):
64 for f in filenames:
65 fp = os.path.join(dirpath, f)
66 if not os.path.islink(fp):
67 total_bytes += os.path.getsize(fp)
68 elif os.path.isfile(res):
69 total_bytes += os.path.getsize(res)
70 except Exception as e:
71 logger.warn("Cannot get size: {}".format(str(e)))
72
73 return total_bytes
74
75class TaskSizeSerializer(serializers.Serializer):
76 assets = serializers.CharField(help_text="One of: [all,backup,custom]")

Callers 1

postMethod · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected