def _set(es): t = set([]) for e in es: t.add(e) if len(t) > 1: keys = sorted(list(t)) c = min([abs(x - y) for (x, y) in zip_(keys[1:], keys[:-1])])
def _blist(es): t = blist.sortedset() for e in es: t.add(e) if len(t) > 1: keys = list(t) c = min([abs(x - y) for (x, y) in zip_(keys[1:], keys[:-1])])
def _bintrees(es): t = bintrees.FastRBTree() for e in es: t[e] = None if len(t) > 1: keys = list(t) c = min([abs(x - y) for (x, y) in zip_(keys[1:], keys[:-1])])
def _set(es): t = set([]) for e in es: t.add(e) if len(t) > 1: keys = sorted(list(t)) c = min([abs(x - y) for (x, y) in zip_(keys[1: ], keys[: -1])])
def _btrees(es): t = BTrees.OOBTree.OOSet(es) for e in es: t.insert(e) if len(t) > 1: keys = list(t) c = min([abs(x - y) for (x, y) in zip_(keys[1:], keys[:-1])])
def _bintrees(es): t = bintrees.FastRBTree() for e in es: t[e] = None if len(t) > 1: keys = list(t) c = min([abs(x - y) for (x, y) in zip_(keys[1: ], keys[: -1])])
def _blist(es): t = blist.sortedset() for e in es: t.add(e) if len(t) > 1: keys = list(t) c = min([abs(x - y) for (x, y) in zip_(keys[1: ], keys[: -1])])
def _btrees(es): t = BTrees.OOBTree.OOSet(es) for e in es: t.insert(e) if len(t) > 1: keys = list(t) c = min([abs(x - y) for (x, y) in zip_(keys[1: ], keys[: -1])])
def _banyan(es, key_type, alg, updator): t = banyan.SortedSet(key_type=key_type, alg=alg, updator=updator) if updator is None: for e in es: t.add(e) if len(t) > 1: keys = list(t) c = min([abs(x - y) for (x, y) in zip_(keys[1:], keys[:-1])]) else: for e in es: t.add(e) if len(t) > 1: c = t.min_gap()
def _banyan(es, key_type, alg, updator): t = banyan.SortedSet(key_type = key_type, alg = alg, updator = updator) if updator is None: for e in es: t.add(e) if len(t) > 1: keys = list(t) c = min([abs(x - y) for (x, y) in zip_(keys[1: ], keys[: -1])]) else: for e in es: t.add(e) if len(t) > 1: c = t.min_gap()
def bytes_dict_cast(dict_, include_keys=True, include_vals=True, **kwargs): """ Converts any string-like items in input dict to bytes-like values, with respect to python version Parameters ---------- dict_ : dict any string-like objects contained in the dict will be converted to bytes include_keys : bool, default=True if True, cast keys to bytes, else ignore include_values : bool, default=True if True, cast values to bytes, else ignore kwargs: encoding: str, default: 'utf-8' encoding to be used when encoding string """ new_keys = bytes_list_cast(dict_.keys(), ** kwargs) if include_keys else dict_.keys() new_vals = bytes_list_cast(dict_.values(), ** kwargs) if include_vals else dict_.values() new_dict = dict(zip_(new_keys, new_vals)) return new_dict