""" Module for querying information about users. This mostly asks plugins for the extra information, and falls back to using a default that should work on most systems (but by no means all systems.) """ import pkg_resources import os def quota(dir=None): """ Returns a tuple (quota usage, quota limit). Returns ``(0, None)`` if the quota usage is unknown. If ``dir`` is omitted, the current working directory is assumed. Value returned is in bytes. """ if dir is None: dir = os.getcwd() unknown = (0, None) for func in pkg_resources.iter_entry_points("wizard.user.quota"): r = func(dir) if r != unknown: return r return unknown