def type_q_sort_by_q(darr): darr1 = elel.cond_select_values_all(darr, cond_func=lambda ele: (ele['q'] == None)) darr2 = elel.cond_select_values_all(darr, cond_func=lambda ele: (ele['q'] != None)) ndarr1 = elel.sortDictList(darr1, cond_keys=['q', 'type'], reverse=True) idarr2 = elel.array_map(darr2, type_q_floatize) ndarr2 = elel.sortDictList(darr2, cond_keys=['q', 'type'], reverse=True) ndarr = elel.concat(ndarr1, ndarr2) return (ndarr)
def language_locale_q_cond_slct_not(sarr, key, match_value): darr = language_locale_q_sarr2darr(sarr) darr = elel.cond_select_values_all(darr, cond_func=lambda ele: (ele[key] != match_value)) sarr = language_locale_q_darr2sarr(darr) return (sarr)
def type_q_cond_slct(sarr, key, match_value): darr = type_q_sarr2darr(sarr) darr = elel.cond_select_values_all(darr, cond_func=lambda ele: (ele[key] == match_value)) sarr = type_q_darr2sarr(darr) return (sarr)
def get_all_builtin_attrs(obj): ''' >>> a = 5 >>> get_all_builtin_attrs(a) ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__'] ''' attrs = dir(obj) return (elel.cond_select_values_all( attrs, cond_func=lambda ele: ele.startswith("__")))
def get_all_visible_attrs(obj): ''' >>> a = 5 >>> get_all_visible_attrs(a) ['bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes'] >>> ''' attrs = dir(obj) return (elel.cond_select_values_all( attrs, cond_func=lambda ele: not (ele.startswith("_"))))
def get_all_valid_attr_noninit_char(s): chs = elel.cond_select_values_all(s, cond_func=is_valid_attr_noninit_char) try: chs.remove("\t") chs.remove(" ") chs.remove("\x0c") except: pass else: pass rslt = elel.join(chs, '') return (rslt)
def rm_q(self, cond_func): indexes = elel.cond_select_indexes_all(self.darr, cond_func=lambda ele: (ele['q'] == None)) idarr = elel.array_map(self.darr, language_locale_q_floatize) orig_indexes = elel.cond_select_indexes_all(idarr, cond_func=cond_func) idarr = elel.cond_select_values_all(idarr, cond_func=cond_func) for index in indexes: curr_index = orig_indexes.index(index) idarr[curr_index]['q'] = None self.darr = idarr self.sarr = language_locale_q_darr2sarr(self.darr) pobj(self.sarr)
def sdfstree(o, *args): lngth = len(args) wfsm = o._wfsm depth = len(wfsm) start = elel.uniform_index(args[0], depth + 1) if (lngth > 0) else 0 end = elel.uniform_index(args[1], depth + 1) if (lngth > 1) else (depth + 1) sdfsel = wfsmat.m2sdfsel(wfsm) sdfsel = elel.cond_select_values_all(sdfsel, cond_func=lambda ele: (len(ele.fapl) >= start) and (len(ele.fapl) < end)) sdfs = elel.mapv(sdfsel, lambda ele: ele.dotpath) for dotpath in sdfs: print(dotpath)
def edfs_brackets(o, *args): lngth = len(args) wfsm = o._wfsm depth = len(wfsm) start = elel.uniform_index(args[0], depth + 1) if (lngth > 0) else 0 end = elel.uniform_index(args[1], depth + 1) if (lngth > 1) else (depth + 1) edfsel = wfsmat.m2edfsel(wfsm) edfsel = elel.cond_select_values_all(edfsel, cond_func=lambda ele: (len(ele.fapl) >= start) and (len(ele.fapl) < end)) edfs = elel.mapv(edfsel, lambda ele: ele.dotpath) for each in edfs: print(each)
def get_all_priv_attrs(obj): ''' class tst(): def __init__(self): self._u = "_u" self.u = "u" t = tst() >>> get_all_priv_attrs(t) ['_u'] >>> ''' attrs = dir(obj) return (elel.cond_select_values_all( attrs, cond_func=lambda ele: (ele[0:2] != "__") and (ele.startswith("_"))))
def get_own_visible_attrs(obj): ''' >>> class tst(): ... def __init__(self): ... self._u = "_u" ... self.u = "u" ... >>> t = tst() >>> >>> get_own_visible_attrs(t) ['u'] >>> ''' attrs = get_own_attrs(obj) attrs = elel.cond_select_values_all( attrs, cond_func=lambda ele: not (ele.startswith("_"))) return (attrs)
def get_inherited_visible_attrs(obj, *whiches): ''' >>> class tst(): ... def __init__(self): ... self._u = "_u" ... self.u = "u" ... >>> t = tst() >>> >>> get_inherited_visible_attrs(t,1) [] >>> ''' attrs = get_inherited_attrs(obj, *whiches) attrs = elel.cond_select_values_all( attrs, cond_func=lambda ele: not (ele.startswith("_"))) return (attrs)
def split_words_repo(): ARRS[0] = nvft.read_json(fn='granada_es.all.arr', op='r+') ARRS[1] = elel.array_map(ARRS[0], lambda ele: str.strip(ele, " ")) ARRS[2] = elel.cond_select_values_all( ARRS[1], cond_func=lambda ele: not (" " in ele)) ARRS[3] = elel.cond_select_values_all( ARRS[2], cond_func=lambda ele: not ("!" in ele)) ARRS[4] = elel.cond_select_values_all( ARRS[3], cond_func=lambda ele: not (R_EXCM in ele)) ARRS[5] = elel.cond_select_values_all( ARRS[4], cond_func=lambda ele: not ("?" in ele)) ARRS[6] = elel.cond_select_values_all( ARRS[5], cond_func=lambda ele: not (R_QM in ele)) ARRS[7] = elel.cond_select_values_all( ARRS[6], cond_func=lambda ele: not ("-" in ele)) ARRS[8] = elel.cond_select_values_all( ARRS[7], cond_func=lambda ele: not ("," in ele)) ARRS[9] = elel.cond_select_values_all( ARRS[8], cond_func=lambda ele: not ("_" in ele)) ARRS[10] = elel.cond_select_values_all(ARRS[9], cond_func=no_num_cond_func) nvft.write_json(fn='granada_es.all.single.nomark.arr', json=ARRS[10], op='w+')
def get_inherited_builtin_attrs(obj, *whiches): ''' >>> class tst(): ... def __init__(self): ... self._u = "_u" ... self.u = "u" ... >>> t = tst() >>> >>> get_inherited_buildin_attrs(t,1) ['__dict__', '__module__', '__weakref__'] >>> >>> get_inherited_builtin_attrs(t,2) ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__'] >>> ''' attrs = get_inherited_attrs(obj, *whiches) attrs = elel.cond_select_values_all( attrs, cond_func=lambda ele: ele.startswith("__")) return (attrs)
def fpl2pl(fpl): ''' 选取非数字的key ''' pl = elel.cond_select_values_all(fpl,eftl.not_wrapper(is_int_str)) return(pl)
def get_nonleaf_unhandled(layer): nonleaf_unhandled = elel.cond_select_values_all( layer, cond_func=lambda plnd: is_non_leaf(plnd.jobj)) return (nonleaf_unhandled)
def main(): srch = sys.argv[1] arr = elel.cond_select_values_all(words, cond_func=lambda ele: (srch in ele)) for each in arr: print(each)
def get_all_valid_attr_init_char(s): chs = elel.cond_select_values_all(s, cond_func=is_valid_attr_init_char) return (elel.join(chs, ''))