MCPcopy
hub / github.com/alibaba/EasyCV / size

Method size

easycv/file/file_io.py:732–748  ·  view source on GitHub ↗

Get the size of file path, same usage as `os.path.getsize` Example: from easycv.file import io io.access_oss(your oss config) # only oss file need, refer to `IO.access_oss` size = io.size('oss://bucket/file.txt') print(size) A

(self, path: str)

Source from the content-addressed store, hash-verified

730 return bucket.get_object_meta(path).headers['Last-Modified']
731
732 def size(self, path: str) -> int:
733 """
734 Get the size of file path, same usage as `os.path.getsize`
735
736 Example:
737 from easycv.file import io
738 io.access_oss(your oss config) # only oss file need, refer to `IO.access_oss`
739 size = io.size('oss://bucket/file.txt')
740 print(size)
741 Args:
742 path: local or oss path.
743 Return: size of file in bytes
744 """
745 if not is_oss_path(path):
746 return super().size(path)
747 bucket, path = self._get_bucket_obj_and_path(path)
748 return int(bucket.get_object_meta(path).headers['Content-Length'])
749
750
751class OSSFile:

Callers 15

tensor2imgsFunction · 0.45
unmapFunction · 0.45
bninceptionPreFunction · 0.45
randomErasingFunction · 0.45
gaussianBlurDynamicFunction · 0.45
gaussianBlurFunction · 0.45
randomGrayScaleFunction · 0.45
mixUpFunction · 0.45
mixUpClsFunction · 0.45
drawMethod · 0.45
torcacc_all_gatherFunction · 0.45
single_mnn_testFunction · 0.45

Calls 2

is_oss_pathFunction · 0.85

Tested by 15

single_cpu_testFunction · 0.36
single_gpu_testFunction · 0.36
multi_gpu_testFunction · 0.36
mp_mainFunction · 0.36
baseline_mainFunction · 0.36
_all_gatherFunction · 0.36
test_swint_featureMethod · 0.36
test_genet_withfcMethod · 0.36
test_genet_withoutfcMethod · 0.36