def _mode_local_aware_key_looper(self, local: bool) -> Iterable[KeyType]: """Generate keys for iteration with dict update safety ensured. Parameters ---------- local : bool True if keys should be returned which only exist on the local machine. Fale if remote sample keys should be excluded. Returns ------- Iterable[KeyType] Sample keys conforming to the `local` argument spec. """ _islocal_func = op_attrgetter('islocal') if local: if self._mode == 'r': yield from valfilter(_islocal_func, self._samples).keys() else: yield from tuple(valfilter(_islocal_func, self._samples).keys()) else: if self._mode == 'r': yield from self._samples.keys() else: yield from tuple(self._samples.keys())
def remote_reference_keys(self) -> Tuple[KeyType]: """Compute sample names whose data is stored in a remote server reference. Returns ------- Tuple[KeyType] list of sample keys in the column whose data references indicate they are stored on a remote server. """ _islocal_func = op_attrgetter('islocal') return tuple(valfilterfalse(_islocal_func, self._samples).keys())
def contains_remote_references(self) -> bool: """Bool indicating if all samples in column exist on local disk. The data associated with samples referencing some remote server will need to be downloaded (``fetched`` in the hangar vocabulary) before they can be read into memory. Returns ------- bool False if at least one sample in the column references data stored on some remote server. True if all sample data is available on the machine's local disk. """ _islocal_func = op_attrgetter('islocal') return not all(map(_islocal_func, self._samples.values()))