MCPcopy Create free account
hub / github.com/celery/celery / df

Class df

celery/utils/sysinfo.py:218–240  ·  view source on GitHub ↗

Disk information.

Source from the content-addressed store, hash-verified

216
217
218class df:
219 """Disk information."""
220
221 def __init__(self, path: str | bytes | os.PathLike) -> None:
222 self.path = path
223
224 @property
225 def total_blocks(self) -> float:
226 return self.stat.f_blocks * self.stat.f_frsize / 1024
227
228 @property
229 def available(self) -> float:
230 return self.stat.f_bavail * self.stat.f_frsize / 1024
231
232 @property
233 def capacity(self) -> int:
234 avail = self.stat.f_bavail
235 used = self.stat.f_blocks - self.stat.f_bfree
236 return int(ceil(used * 100.0 / (used + avail) + 0.5))
237
238 @cached_property
239 def stat(self) -> os.statvfs_result:
240 return os.statvfs(os.path.abspath(self.path))

Callers 1

test_dfFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_dfFunction · 0.72