<jupyter_start><jupyter_text>W(import)<jupyter_code>import copy, os, shutil, sys
from mod.MVVlStd import (glSep_s, mInP_FltAVali_fefi, mMenu_c, mSupportsWrite_ca,
    mChe_ExsPath_ff, mCre_AbsPath_ff)
import mod.victory, mod.MyBankAcc
# from __future__ import annotations
# from typing import Ty
# sorted() SupportsRichComparison
import itertools as itts
# import operator as op
# import functools as futs # Upd

mod.MVVlStd.mInP_FltAVali_fefi('Ts', laInPTypeFlt_cll=None)
teCurDir_s = os.path.realpath(os.curdir)
print(teCurDir_s, f'{teCurDir_s!r}')

# mStt_d = dict(kStkDir_llist[str]=[], kDirEntry_t:tuple[os.DirEntry]=None,
# kTSum_t:tuple(Fi_i, Dir_i, !(Fi|Di)_i, SLnk_i)=None,
# kPreSrtByTyT_t:tuple[tuple[Na_s, Ty_s2:'[DF~][L ]]]=None)
mStt_d = dict(kStkDir_l=[], kDirEntry_t=None, kTSum_t=None, kPreSrtByTyT_t=None)

def mFll_Stt_fe(laNewDir_s=None, laSortKey_cll=lambda _el: _el.name.upper(),
                     laScan_b:bool=True):
  if laNewDir_s is None: laNewDir_s = os.curdir # Init|RScan
  loDir_s = os.path.realpath(laNewDir_s)
  if not os.path.exists(loDir_s):
    raise FileNotFoundError(2, f'Dir:({loDir_s}) not exist.')
    # raise FileNotFoundError(2, f'Dir:({loDir_s}) not exist.', 3)
  if not os.path.isdir(loDir_s):
    raise NotADirectoryError(f'On path:({loDir_s}) exist not directory.')

  if (not bool(mStt_d['kStkDir_l'])) or (mStt_d['kStkDir_l'][-1] != loDir_s):
    mStt_d['kStkDir_l'].append(loDir_s)
    laScan_b = laScan_b or True
  else: pass # SameDir

  if (laScan_b or mStt_d['kDirEntry_t'] is None or mStt_d['kTSum_t'] is None
      or mStt_d['kPreSrtByTyT_t'] is None):
    if callable(laSortKey_cll):
      mStt_d['kDirEntry_t'] = tuple(sorted(os.scandir(loDir_s), key=laSortKey_cll))
    else:
      mStt_d['kDirEntry_t'] = tuple(os.scandir(loDir_s))

    loTIt_t = itts.tee(((_el.name, _el.is_file(), _el.is_dir(), _el.is_symlink())
                        for _el in mStt_d['kDirEntry_t']), 5)
    mStt_d['kTSum_t'] = (sum(_el[1] for _el in loTIt_t[0]), sum(_el[2] for _el in loTIt_t[1]),
        sum((not _el[1] and not _el[2]) for _el in loTIt_t[2]), sum(_el[3] for _el in loTIt_t[3]))
    lo_it = ((_el[0], (('F' if _el[1] else '') or ('D' if _el[2] else '') or "~"), # Srt:DF~, LsPrintableSbl(ASCII):~
                   ('L' if _el[3] else ' ')) for _el in loTIt_t[4])
    mStt_d['kPreSrtByTyT_t'] = tuple((_el[0], (_el[1] + _el[2])) for _el in sorted(lo_it, key=lambda _el: _el[1]))

def mOuP_Stt_fmp(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
  lo_s = "ТекДиректория:({}), "
  if mStt_d['kDirEntry_t'] is None: lo_s = lo_s.format('')
  else: lo_s = lo_s.format(mStt_d['kStkDir_l'][-1])
  if mStt_d['kDirEntry_t'] is None:
    lo_s += f"All:0"
  elif mStt_d['kTSum_t'] is None:
    lo_s += f"All:{len(mStt_d['kDirEntry_t'])}"
  else:
    lo_s += (f"(All,File,Dir,Oth,+SLink):({len(mStt_d['kDirEntry_t'])}," +
       ','.join(str(_el) for _el in mStt_d['kTSum_t']) + ')')
       
  print(lo_s, file=file)
  # if mStt_d['kPreSrtByTyT_t'] is not None:
  #   print(mStt_d['kPreSrtByTyT_t'])
  # print(f"kRtDir_s={mStt_d['kRtDir_s']}, kCurRelDir_s={mStt_d['kCurRelDir_s']}",
  #     lo_s, sep=', ', file=file)""
  # tNL_s = '\n'
  # print(f"{tNL_s.join((str(_el) for _el in mStt_d['kDirEntry_t']))}")
  # print(tNL_s.join((str(_el) for _el in mStt_d['kDirEntry_t'])))
mOuP_Stt_fmp(None)

t_it = iter(range(16))
tuple(itts.islice(t_it, 2, 7, 2))
tTsDir_s, tTsFi_s = r'ts', r'ts.txt'
# tTsDir_s, tTsFi_s = r'ts', r'ts'
mOuP_Stt_fmp(None)
print('', *(mStt_d.items()), os.path.realpath(os.curdir), f'{os.path.realpath(os.curdir)!r}', '', sep='\n')
mFll_Stt_fe()
mOuP_Stt_fmp(None)
print('', *(mStt_d.items()), os.path.realpath(os.curdir), f'{os.path.realpath(os.curdir)!r}', '', sep='\n')
mFll_Stt_fe(tTsDir_s)
mOuP_Stt_fmp(None)
print('', *(mStt_d.items()), os.path.realpath(os.curdir), f'{os.path.realpath(os.curdir)!r}', '', sep='\n')
mFll_Stt_fe(tTsDir_s, laScan_b=[])
mOuP_Stt_fmp(None)
print('', *(mStt_d.items()), os.path.realpath(os.curdir), f'{os.path.realpath(os.curdir)!r}', '', sep='\n')
mFll_Stt_fe(os.path.join(tTsDir_s, tTsFi_s))
mOuP_Stt_fmp(None)
print('', *(mStt_d.items()), os.path.realpath(os.curdir), f'{os.path.realpath(os.curdir)!r}', '', sep='\n')

'{2!s:>2}. ({1}) <{0}>'.format(*mStt_d['kPreSrtByTyT_t'][-1], 2)

print(*(f'{_ix!s:>2}. ({_el[1]}) <{_el[0]}>' for _ix, _el
     in enumerate(mStt_d['kPreSrtByTyT_t'], 0) if _el[1][0] in 'F~'), '-' *32,
     *(f'{_ix!s:>2}. {_s}' for _ix, _s in enumerate(f'({_el[1]}) <{_el[0]}>' for _el
     in mStt_d['kPreSrtByTyT_t'] if _el[1][0] == 'F')), sep='\n')
mOuP_Stt_fmp(None)
'({1}) <{0}>'.format(*mStt_d['kPreSrtByTyT_t'][0])
sum(mStt_d['kTSum_t'])
if (loCo_i:=mStt_d['kTSum_t'][0]) != 0:
  print(loCo_i, *(_el.name for _el in mStt_d['kDirEntry_t']
   if _el.is_file(follow_symlinks=False)), sep='\n')
# mFll_Stt_fe(mStt_d['kStkDir_l'][-2])
tCur_ix = 0
t_t = tuple(f'{_ix!s:>2}. <{_el.name}>' for _ix, _el in enumerate((_el for _el in mStt_d['kDirEntry_t'] if _el.is_symlink()), tCur_ix))
t_t, tCur_ix + len(t_t)
t_t = tuple((_el.name, (('Ф' if _el.is_file(follow_symlinks=True) else '') +
        ('Д' if _el.is_dir(follow_symlinks=True) else '')),
        ('Л' if _el.is_symlink() else '')) for _el in mStt_d['kDirEntry_t'])
t_t = tuple((_el.name, (('Ф' if _el.is_file(follow_symlinks=True) else '') +
        ('Д' if _el.is_dir(follow_symlinks=True) else '')),
        ('Л' if _el.is_symlink() else '')) for _el in mStt_d['kDirEntry_t'])
print(t_t)
# t_it = ((_el[0], (_el[1] if _el[1] else "-"), _el[2]) for _el in t_t)
t_it = ((_el[0], (_el[1] if _el[1] else "я"), _el[2]) for _el in t_t)
mStt_d['kTSum_t'], mStt_d['kTSum_t'][1],\
   print(*((_el.name, _el.is_file(follow_symlinks=False), _el.is_file(follow_symlinks=True), _el.is_dir(follow_symlinks=False),
    _el.is_dir(follow_symlinks=True)) for _el in (_el for _el in mStt_d['kDirEntry_t'] if _el.is_symlink())), 
    *sorted(t_it, key=lambda _el: _el[1]), sep='\n')
t_t = tuple((_el.name, (('F' if _el.is_file(follow_symlinks=True) else '') +
        ('D' if _el.is_dir(follow_symlinks=True) else '')),
        ('L' if _el.is_symlink() else ' ')) for _el in mStt_d['kDirEntry_t'])
# t_t = tuple((_el.name, (('Ф' if _el.is_file(follow_symlinks=True) else '') +
#         ('Д' if _el.is_dir(follow_symlinks=True) else '')),
#         ('Л' if _el.is_symlink() else '')) for _el in mStt_d['kDirEntry_t'])
print(t_t)
t_it = ((_el.name, (('F' if _el.is_file(follow_symlinks=True) else '') or
        ('D' if _el.is_dir(follow_symlinks=True) else '') or "z"),
        ('L' if _el.is_symlink() else ' ')) for _el in mStt_d['kDirEntry_t'])
# t_it = ((_el[0], (_el[1] if _el[1] else "-"), _el[2]) for _el in t_t)
# t_it = ((_el[0], (_el[1] if _el[1] else "z"), _el[2]) for _el in t_t)
# t_it = ((_el[0], (_el[1] if _el[1] else "ЯЯ"), _el[2]) for _el in t_t)
mStt_d['kTSum_t'], mStt_d['kTSum_t'][1],\
   print(*((_el.name, _el.is_file(follow_symlinks=False), _el.is_file(follow_symlinks=True), _el.is_dir(follow_symlinks=False),
    _el.is_dir(follow_symlinks=True)) for _el in (_el for _el in mStt_d['kDirEntry_t'] if _el.is_symlink())), 
    *(f'{_ix!s:>2}. ({(_el[1] if _el[1] != "z" else "-") + _el[2]}) <{_el[0]}>' for _ix, _el
     in enumerate(sorted(t_it, key=lambda _el: _el[1]), 0)), sep='\n')
[(k, tuple(g)) for k, g in itts.groupby('AAAABBBCCDAABBB')]
# def mA_Dvl_fm(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
#   raise OSError('ts')

def mOuP_Vie_fmpt(laCo_i, laTDesc1OrM_t, laEl_it, laHea_s=None,
    file:mSupportsWrite_ca=sys.stdout):
  if laCo_i != 0:
    if laHea_s is not None: print(laHea_s)
    print('\t' + (laTDesc1OrM_t[0] if laCo_i == 1 else laTDesc1OrM_t[1]) + ":", file=file)
    print(*laEl_it, sep='\n', file=file)
    return True
  else: return False

def mA_VieAll_fm(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
  loSepOuPSwi_b, loAll_i = None, sum(mStt_d['kTSum_t'])
  lo_s = f" in Dir:({mStt_d['kStkDir_l'][-1]})"
  if loAll_i == 0:
    print("No files, directories or softlinks" + lo_s + '.', file=file)
  else:
    print("I" + lo_s[2:] + ':', '=' *32, sep='\n', file=file)
    # lo_it = (_el for _el in mStt_d['kDirEntry_t'] if _el.is_file(follow_symlinks=False))
    # lo_it = (f'<{_el.name}>' for _el in lo_it)
    loCur_ix, loHea_s, loCo_i = 0, "Fmt(<name>)", mStt_d['kTSum_t'][0]
    lo_it = (_el for _el in mStt_d['kDirEntry_t'] if _el.is_file(follow_symlinks=True))
    lo_b = mOuP_Vie_fmpt(loCo_i, ('File', 'Files'),
        (f'{_ix!s:>2}. <{_el.name}>' for _ix, _el in enumerate(lo_it, loCur_ix)), loHea_s, file=file)

    loSepOuPSwi_b = bool(loSepOuPSwi_b) or lo_b
    loCur_ix += loCo_i
    loHea_s, loCo_i = ('-' *32 if loSepOuPSwi_b else None), mStt_d['kTSum_t'][1]

    lo_it = (_el for _el in mStt_d['kDirEntry_t'] if _el.is_dir(follow_symlinks=True))
    # loSepOuPSwi_b = loSepOuPSwi_b or 
    lo_b = mOuP_Vie_fmpt(loCo_i, ('Directory', 'Directories'),
        (f'{_ix!s:>2}. <{_el.name}>' for _ix, _el in enumerate(lo_it, loCur_ix)), loHea_s, file=file)

    loSepOuPSwi_b = bool(loSepOuPSwi_b) or lo_b
    loCur_ix += loCo_i
    loCur_ix = 0
    loHea_s, loCo_i = ('-' *32 if loSepOuPSwi_b else None), mStt_d['kTSum_t'][2]
    lo_it = ((_el.name, (('F' if _el.is_file(follow_symlinks=True) else '') +
        ('D' if _el.is_dir(follow_symlinks=True) else '')),
        ('L' if _el.is_symlink() else '')) for _el in mStt_d['kDirEntry_t'])
    lo_b = mOuP_Vie_fmpt(loCo_i, ('Softlink', 'Softlinks'),
        (f'{_ix!s:>2}. ({(_el[1] if _el[1] else "-") + _el[2]}) <{_el[0]}>' for _ix, _el in enumerate(lo_it, loCur_ix)), loHea_s, file=file)
    
    loSepOuPSwi_b = bool(loSepOuPSwi_b) or lo_b
    loCur_ix += loCo_i
    print('=' *32, file=file)
  return

mA_VieAll_fm(None)
mOuPSep_s = '=' *32

def mOuP_Vie_fpt(laVie_t, laTDesc1OrMOrNo_t, laHea_s='Fmt:([DF~][L ]) <name>',
    file:mSupportsWrite_ca=sys.stdout):
  print(f"In Dir:({mStt_d['kStkDir_l'][-1]}):\n" + mOuPSep_s)
  loCo_i = len(laVie_t)
  if loCo_i == 0:
    print(laTDesc1OrMOrNo_t[-1] + '.' + mOuPSep_s, file=file)
  else:
    lo_s = (laTDesc1OrMOrNo_t[0] if loCo_i == 1 else laTDesc1OrMOrNo_t[1])
    if laHea_s is not None: lo_s += f'({laHea_s})'
    print(lo_s + ":", file=file)
    print(*laVie_t, mOuPSep_s, sep='\n', file=file)
    return True


def mA_VieAll_fmf(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
  lo_t = tuple(f'({_el[1]}) <{_el[0]}>' for _el in mStt_d['kPreSrtByTyT_t'])
  mOuP_Vie_fpt(lo_t, ('One', 'All', 'No files, directories or others'), file=file) 
  return lo_t
mA_VieAll_fmf(None)
'''
.name------------------------------
LICENSE
mod
README.md
tmp
ts.txt
Ts1
ts1.py
ts_SL

.is_file(follow_symlinks=False)------------------------------
LICENSE
README.md
ts1.py

.is_dir(follow_symlinks=False)------------------------------
tmp
Ts1

is_symlink()------------------------------
mod
ts.txt
ts_SL

.is_file(follow_symlinks=True)------------------------------
LICENSE
README.md
ts.txt
ts1.py

.is_dir(follow_symlinks=True)------------------------------
mod
tmp
Ts1
'''
# ts_SL:RelSL(->'.'), mod:DL, ts.txt:AbsSL, tmp:AbsSL, ts1.py:HL
tNL_s = '\n'
print('.name'+'-' *30,
    *(_el.name for _el in mStt_d['kDirEntry_t']), '', sep='\n')
print('.is_file(follow_symlinks=False)'+'-' *30,
    *(_el.name for _el in mStt_d['kDirEntry_t'] if _el.is_file(follow_symlinks=False)), '', sep='\n')
print('.is_dir(follow_symlinks=False)'+'-' *30,
    *(_el.name for _el in mStt_d['kDirEntry_t'] if _el.is_dir(follow_symlinks=False)), '', sep='\n')
print('is_symlink()'+'-' *30, *(_el.name for _el in mStt_d['kDirEntry_t'] if _el.is_symlink()), '', sep='\n')
print('.is_file(follow_symlinks=True)'+'-' *30, *(_el.name for _el in mStt_d['kDirEntry_t'] if _el.is_file(follow_symlinks=True)), '', sep='\n')
print('.is_dir(follow_symlinks=True)'+'-' *30, *(_el.name for _el in mStt_d['kDirEntry_t'] if _el.is_dir(follow_symlinks=True)), '', sep='\n')
print(f"(All,File,Dir,SLink):({len(mStt_d['kDirEntry_t'])},", ','.join(str(_el) for _el in mStt_d['kTSum_t']), ')',sep='')
float('1_000.33')
t_t = tuple((_el.name, _el.is_file(follow_symlinks=False), _el.is_dir(follow_symlinks=False), _el.is_symlink())
 for _el in mStt_d['kDirEntry_t'])
print(t_t, sum(_el[1] for _el in t_t), sum(_el[2] for _el in t_t), sum(_el[3] for _el in t_t))
mStt_d['kDirEntry_t'][-1].stat(follow_symlinks=False)
print(*(mStt_d.items()), os.path.realpath(os.curdir), f'{os.path.realpath(os.curdir)!r}', '', sep='\n')

set(mStt_d['kStkDir_l'])
print(teCurDir_s, f'{teCurDir_s!r}')

teCurDir_s = os.path.realpath(os.curdir)
print(teCurDir_s, f'{teCurDir_s!r}')

('файл (каталог\n или любой другой объект файл.системы) '
    'с введеным именем\n не должен существовать)')
os.path.abspath(os.path.normpath(r'ts\mod<')),\
  os.path.normpath(os.path.join(teCurDir_s, r'ts\..\mod'))<jupyter_output><empty_output><jupyter_text>CuW<jupyter_code>mStt_d['kDirEntry_t'][-1]
mOuPSep_s = '=' *32

def mOuP_Vie_fpt(laVie_t, laTDesc1OrMOrNo_t, laHea_s='Fmt:([DF~][L ]) <name>',
    file:mSupportsWrite_ca=sys.stdout):
  print(f"In Dir:({mStt_d['kStkDir_l'][-1]}):\n" + mOuPSep_s)
  loCo_i = len(laVie_t)
  if loCo_i == 0:
    print(laTDesc1OrMOrNo_t[-1] + '.\n' + mOuPSep_s, file=file)
  else:
    lo_s = (laTDesc1OrMOrNo_t[0] if loCo_i == 1 else laTDesc1OrMOrNo_t[1])
    if laHea_s is not None: lo_s += f'({laHea_s})'
    print(lo_s + ":", file=file)
    print(*laVie_t, mOuPSep_s, sep='\n', file=file)


def mA_VieAll_fmf(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
  lo_t = tuple(f'({_el[1]}) <{_el[0]}>' for _el in mStt_d['kPreSrtByTyT_t'])
  mOuP_Vie_fpt(lo_t, ('One', 'All', 'No files, directories or others'), file=file) 
  if laSf_o is not None:
    input('Пожалуйста, нажмите Enter для возврата в меню.')
  return lo_t

def mA_CreFi_fm(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
  mA_VieAll_fmf(laSf_o, file)
  lo_cll = lambda _s: str(_s).strip() != '' and not mChe_ExsPath_ff(_s, laCurDir_s=mStt_d['kStkDir_l'][-1])
  # lo_cll = futs.partial(mChe_ExsPath_ff, laCurDir_s=mStt_d['kDirEntry_t'][-1])
  lo_s = ('файл (каталог\n или любой другой объект файл.системы) '
    + 'с введеным (не пустым) именем\n не должен существовать')
  loRes_s = mInP_FltAVali_fefi(' имя нового файла (абсол. или относит.)\n',
      laInPTypeFlt_cll=None, laValiInPMsg_s=lo_s, laVali_cll=lo_cll,
      file=file)[0]
  print(loRes_s)
  loAbsPth_s = mCre_AbsPath_ff(loRes_s, mStt_d['kStkDir_l'][-1])
  # with open(os.path.join(loAbsPth_s), mode='x') as lw_o:
  #   ...
  try:
    loFi_o = open(loAbsPth_s, mode='x')
  except OSError as loExc_o:
    print(f"\tERR: You input:'{loRes_s}' INVALID with exception:({loExc_o}), try again next time.", file=file)
    if laSf_o is not None:
      input('Пожалуйста, нажмите Enter для возврата в меню.')
    return str(loExc_o)
  else:
    mOuP_Stt_fmp(None)
    return loAbsPth_s
  # finally:
  #   loFi_o.close()
mA_CreFi_fm(None)

mStt_d['kStkDir_l'][-5:]
# mFll_Stt_fe(mStt_d['kStkDir_l'][-2])
mA_VieAll_fmf(None)

def mOuP_Vie_fpt(laVie_t, laTDesc1OrMOrNo_t, laHea_s='Fmt:([DF~][L ]) <name>',
    laPau_b=True, file:mSupportsWrite_ca=sys.stdout):
  print(f"In Dir:({mStt_d['kStkDir_l'][-1]}):\n" + mOuPSep_s)
  loCo_i = len(laVie_t)
  if loCo_i == 0:
    print(laTDesc1OrMOrNo_t[-1] + '.\n' + mOuPSep_s, file=file)
  else:
    lo_s = (laTDesc1OrMOrNo_t[0] if loCo_i == 1 else laTDesc1OrMOrNo_t[1])
    if laHea_s is not None: lo_s += f'({laHea_s})'
    print(lo_s + ":", file=file)
    print(*laVie_t, mOuPSep_s, sep='\n', file=file)
  if laPau_b: mInP_Wai_fp(file=file)


def mA_VieAll_fmf(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
  lo_t = tuple(f'({_el[1]}) <{_el[0]}>' for _el in mStt_d['kPreSrtByTyT_t'])
  mOuP_Vie_fpt(lo_t, ('One', 'All', 'No files, directories or others'),
      laPau_b=False, file=file) 
  if laSf_o is not None: mInP_Wai_fp(file=file)
  return lo_t

def mA_VieFi_fmf(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
  lo_t = tuple(f'({_el[1]}) <{_el[0]}>' for _el in mStt_d['kPreSrtByTyT_t']
               if _el[1][0] == 'F')
  mOuP_Vie_fpt(lo_t, ('File', 'Files', 'No files'), 
      laPau_b=False, file=file) 
  if laSf_o is not None: mInP_Wai_fp(file=file)
  return lo_t

def mA_VieDir_fmf(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
  lo_t = tuple(f'({_el[1]}) <{_el[0]}>' for _el in mStt_d['kPreSrtByTyT_t']
               if _el[1][0] == 'D')
  mOuP_Vie_fpt(lo_t, ('Directory', 'Directories', 'No directories'),
      laPau_b=(laSf_o is not None), file=file) 
  if laSf_o is not None: mInP_Wai_fp(file=file)
  return lo_t

def mA_VieSLnk_fmf(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
  lo_t = tuple(f'({_el[1]}) <{_el[0]}>' for _el in mStt_d['kPreSrtByTyT_t']
               if _el[1][-1] == 'L')
  mOuP_Vie_fpt(lo_t, ('Softlink', 'Softlinks', 'No softlinks'),
      laPau_b=False, file=file) 
  if laSf_o is not None: mInP_Wai_fp(file=file)
  return lo_t
mWaiMsg_s = 'Пожалуйста, нажмите Enter для возврата в меню.'
def mInP_Wai_fp(laMsg_s=None, file:mSupportsWrite_ca=sys.stdout):
    input((laMsg_s if laMsg_s is not None else mWaiMsg_s))

def mA_ChaCurDi_fm(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
  mA_VieDir_fmf(None, file)
  lo_cll = lambda _s: str(_s).strip() != ''\
      and os.path.isdir(mCre_AbsPath_ff(_s, laCurDir_s=mStt_d['kStkDir_l'][-1]))
      # and mChe_ExsPath_ff(_s, laCurDir_s=mStt_d['kStkDir_l'][-1])\
  # lo_cll = futs.partial(mChe_ExsPath_ff, laCurDir_s=mStt_d['kDirEntry_t'][-1])
  lo_s = ('каталог с введеным (не пустым) именем\n должен существовать')
  loRes_s = mInP_FltAVali_fefi(' имя нового каталога (абсол. или относит.)\n',
      laInPTypeFlt_cll=None, laValiInPMsg_s=lo_s, laVali_cll=lo_cll,
      file=file)[0]
  loAbsPth_s = mCre_AbsPath_ff(loRes_s, mStt_d['kStkDir_l'][-1])
  # with open(os.path.join(loAbsPth_s), mode='x') as lw_o:
  #   ...
  try:
    mFll_Stt_fe(loAbsPth_s)
  except OSError as loExc_o:
    print((f"\tERR: You input:'{loRes_s}' INVALID "
        + f"with exception:({loExc_o}), try again next time."), file=file)
    if laSf_o is not None: mInP_Wai_fp(file=file)
    return str(loExc_o)
  else:
    print(f"\tMSG: You input:'{loRes_s}' and change current directory:({loAbsPth_s})", file=file)
    return loAbsPth_s
  # finally:
  #   loFi_o.close()
mA_ChaCurDi_fm(None)
mOuP_Stt_fmp(None)
def mA_CreDi_fm(laSf_o:mMenu_c, file:mSupportsWrite_ca=sys.stdout):
  mA_VieAll_fmf(None, file)
  lo_cll = lambda _s: str(_s).strip() != '' and not mChe_ExsPath_ff(_s, laCurDir_s=mStt_d['kStkDir_l'][-1])
  # lo_cll = futs.partial(mChe_ExsPath_ff, laCurDir_s=mStt_d['kDirEntry_t'][-1])
  lo_s = ('каталог (файл\n или любой другой объект файл.системы) '
    + 'с введеным (не пустым) именем\n не должен существовать')
  loRes_s = mInP_FltAVali_fefi(' имя нового каталога (абсол. или относит.)\n',
      laInPTypeFlt_cll=None, laValiInPMsg_s=lo_s, laVali_cll=lo_cll,
      file=file)[0]
  loAbsPth_s = mCre_AbsPath_ff(loRes_s, mStt_d['kStkDir_l'][-1])
  # with open(os.path.join(loAbsPth_s), mode='x') as lw_o:
  #   ...
  try:
    os.makedirs(loAbsPth_s)
  except OSError as loExc_o:
    print((f"\tERR: You input:'{loRes_s}' INVALID "
        + f"with exception:({loExc_o}), try again next time."), file=file)
    if laSf_o is not None: mInP_Wai_fp(file=file)
    return str(loExc_o)
  else:
    print(f"\tMSG: You input:'{loRes_s}' and create directory:({loAbsPth_s})", file=file)
    mFll_Stt_fe(mStt_d['kStkDir_l'][-1])
    return loAbsPth_s
  # finally:
  #   loFi_o.close()
mA_CreDi_fm(None)

def mCre_Path_ff(laPth4Cre_s, laCurDir_s=None):
  if not os.path.isabs(laPth4Cre_s):
    if laCurDir_s is None: laCurDir_s = os.path.realpath(os.curdir)
    return os.path.abspath(os.path.normpath(
        os.path.join(laCurDir_s, laPth4Cre_s)))
  else: return os.path.normpath(laPth4Cre_s)

# !!!(os.path.exists): path refers to an existing path or an open file descriptor.
#  Returns False for broken symbolic links. On some platforms, this function
#  may return False if permission is not granted to execute os.stat()
#  on the requested file, even if the path physically exists
def mChe_ExsPath_ff(laPth4Che_s, laCurDir_s=None, laCheBroLnk_b=True):
  if str(laPth4Che_s).strip() == '': return False
  loAbsPht_s = mCre_Path_ff(laPth4Che_s, laCurDir_s=laCurDir_s)
  # print(loAbsPht_s)
  return os.path.exists(loAbsPht_s) or (laCheBroLnk_b and os.path.lexists(loAbsPht_s))
mChe_ExsPath_ff(r'ts\ts.txt', teCurDir_s), mChe_ExsPath_ff(r'ts\ts.txt'),\
mChe_ExsPath_ff(r'ts\ts.txt', laCheBroLnk_b=False), mChe_ExsPath_ff(''),\
mChe_ExsPath_ff(r'ts\ts.txt', teCurDir_s, False), mChe_ExsPath_ff(' \n\t '),\
mChe_ExsPath_ff(r'd:\doc\dvl\prj\py\stu\pydev\05\hw\ts\ts.txt', teCurDir_s),\
mChe_ExsPath_ff(r'd:\doc\dvl\prj\py\stu\pydev\05\hw\ts\ts.txt', teCurDir_s, False)

os.path.isabs(os.path.join(teCurDir_s,''))
def mChe_ExsPath_ff(laPth4Che_s, laCurDir_s=None, laCheBroLnk_b=True):
  if not os.path.isabs(laPth4Che_s):
    if laCurDir_s is None: laCurDir_s = os.path.realpath(os.curdir)
    loAbsPht_s = os.path.normcase(os.path.abspath(os.path.normpath(
      os.path.join(laCurDir_s, laPth4Che_s))))
  else: loAbsPht_s = os.path.normcase(os.path.normpath(laPth4Che_s))
  print(loAbsPht_s)
  return os.path.exists(loAbsPht_s) or (laCheBroLnk_b and os.path.lexists(loAbsPht_s))
# !!!(os.path.exists): path refers to an existing path or an open file descriptor.
#  Returns False for broken symbolic links. On some platforms, this function
#  may return False if permission is not granted to execute os.stat()
#  on the requested file, even if the path physically exists
mChe_ExsPath_ff(r'ts\ts.txt', teCurDir_s), mChe_ExsPath_ff(r'ts\ts.txt'),\
mChe_ExsPath_ff(r'ts\ts.txt', laCheBroLnk_b=False),\
mChe_ExsPath_ff(r'ts\ts.txt', teCurDir_s, False),\
mChe_ExsPath_ff(r'd:\doc\dvl\prj\py\stu\pydev\05\hw\ts\ts.txt', teCurDir_s),\
mChe_ExsPath_ff(r'd:\doc\dvl\prj\py\stu\pydev\05\hw\ts\ts.txt', teCurDir_s, False)

tTsDir_s, tTsFi_s = r'ts', r'tsz.txt'
mStt_d['kStkDir_l'][-1], os.path.join(tTsDir_s, tTsFi_s), os.path.join(mStt_d['kStkDir_l'][-1], tTsFi_s)
if tTsFi_s in [_el.name for _el in mStt_d['kDirEntry_t']]:
  print('FileExistsError')
else: 
  with open(os.path.join(mStt_d['kStkDir_l'][-1], tTsFi_s), mode='x') as lw_o:
    ...

tTsDir_s, tTsFi_s = r'ts', r'ts.txt'
# os.path.join(tTsDir_s, tTsFi_s)
print(os.path.realpath(os.curdir), os.path.join(teCurDir_s, tTsDir_s, tTsFi_s))
os.chdir(teCurDir_s)

if os.path.exists(tTsDir_s):
  if os.path.isdir(tTsDir_s): os.chdir(tTsDir_s)
    # try:
    #   os.chdir(os.path.join(tTsFi_s,tTsDir_s))
    # except FileNotFoundError as tExc_o:
    #   print(tExc_o, f'{tExc_o!r}',
    #       *(f'{_s}:{getattr(tExc_o, _s, None)}'
    #         for _s in dir(tExc_o) if not _s.startswith('__')), sep='\n')
    #   raise tExc_o
  else: print('NotADirectoryError')
else: 
  os.mkdir(tTsDir_s) # os.(remove rmdir removedirs)
  os.chdir(tTsDir_s)
  
print(os.path.realpath(os.curdir))
teScan_t = tuple(sorted(os.scandir('.'), key=lambda _el: _el.name.upper()))
print(*teScan_t, sep='\n') # os.DirEntry 
if tTsFi_s in [_el.name for _el in teScan_t]:
  print('FileExistsError')
else: 
  with open(os.path.join(tTsFi_s), mode='x') as lw_o:
    ...
tuple(_el.name for _el in sorted(os.scandir('.'), key=lambda _el: _el.name.upper()))
tTsFi_s in [_el.name for _el in teScan_t]
try:
  raise FileNotFoundError(2,'loDir_s non exist', tTsFi_s, 3, tTsFi_s +'222')
except FileNotFoundError as tExc_o:
  print(f'DVL:Exc: {tExc_o}({tExc_o!r}):',
   *(f'{_s}:{getattr(tExc_o, _s, None)}' for _s in dir(tExc_o) if not _s.startswith('__')), sep='\n')
  raise
finally:
  # print('Fin', tExc_o)
  print('\nFin')
   
FileNotFoundError()
print(os.path.realpath(os.curdir))
os.chdir('mod')
print(os.path.realpath(os.curdir))
os.chdir(os.pardir)
print(os.path.realpath(os.curdir))
os.chdir(r'//rty') # FileNotFoundError: [WinError 161] Указан недопустимый путь: '//rty'
os.chdir(r'<>rty') # OSError: [WinError 123] Синтаксическая ошибка в имени файла, имени папки или метке тома: '<>rty'
os.chdir(r'rty') # FileNotFoundError: [WinError 2] Не удается найти указанный файл: 'rty'
os.chdir(r'README.md') # NotADirectoryError: [WinError 267] Неверно задано имя папки: 'README.md'
print(os.path.realpath(os.curdir))<jupyter_output>D:\Doc\Dvl\Prj\Py\Stu\PyDev\05\HW
D:\Doc\Dvl\Prj\Py\Stu\PyDev\05\HW\mod
D:\Doc\Dvl\Prj\Py\Stu\PyDev\05\HW<jupyter_text>Nte:FileOpErrorexception FileExistsErrorRaised when trying to create a file or directory which already exists. Corresponds to errno EEXIST.exception FileNotFoundErrorRaised when a file or directory is requested but doesn’t exist. Corresponds to errno ENOENT.exception InterruptedErrorRaised when a system call is interrupted by an incoming signal. Corresponds to errno EINTR.>Changed in version 3.5: Python now retries system calls when a syscall is interrupted by a signal, except if the signal handler raises an exception (see PEP 475 for the rationale), instead of raising InterruptedError.exception IsADirectoryErrorRaised when a file operation (such as os.remove()) is requested on a directory. Corresponds to errno EISDIR.exception NotADirectoryErrorRaised when a directory operation (such as os.listdir()) is requested on something which is not a directory. On most POSIX platforms, it may also be raised if an operation attempts to open or traverse a non-directory file as if it were a directory. Corresponds to errno ENOTDIR.exception PermissionErrorRaised when trying to run an operation without the adequate access rights - for example filesystem permissions. Corresponds to errno EACCES and EPERM.exception OSError([arg])exception OSError(errno, strerror[, filename[, winerror[, filename2]]])>Name:All functions in this module -os - raise OSError (or subclasses thereof) in the case of invalid or inaccessible file names and paths, or other arguments that have the correct type, but are not accepted by the operating system.<jupyter_code>print(os.path.realpath(os.curdir))
os.chdir('mod') # FileNotFoundError: [WinError 2] Не удается найти указанный файл: 'rty'
print(os.path.realpath(os.curdir))

# mod.MVVlStd.inp_FltAVali_fefi()
print(mod.MVVlStd.inp_FltAVali_fefi(laWhatInPMsg_s=' Any Float', laInPValues_co=2, laInPTypeFlt_cll=float, laMaxInPTry_co=1),
 mod.MVVlStd.inp_FltAVali_fefi(' x', laValiInPMsg_s='x in (1,2,3)',
  laVali_cll=lambda x: x in (1,2,3))
  )

mInP_FltAVali_fefi(f' сумму на сколько пополнить счет\n',
      laInPTypeFlt_cll=lambda _s: float(_s.replace(',', '.', 1)), laDfV_s='100,00',
      # laInPTypeFlt_cll=float, laDfV_s='100.00',
      laAcceptEmptyInPAsDf_b=True, laValiInPMsg_s=f'положительное число (1_?000([,.]33)?)\n',
      # laAcceptEmptyInPAsDf_b=True, laValiInPMsg_s=f'положительное число с возм.десят.точкой\n',
      laVali_cll=lambda _n: 0 <= _n)[0]
t_s = "12345678901"
# t_s = "12"
# tuple((t_s[(0+_i)*3:(1+_i)*3], _i) for _i in range(len(t_s)//3 +1) if t_s[(0+_i)*3:(1+_i)*3])
'_'.join(t_s[(0+_i)*3:(1+_i)*3] for _i in range(len(t_s)//3 +1) if t_s[(0+_i)*3:(1+_i)*3])
(" сумму покупки (на Вашем счету:" +
      f"{mCre_SFrFloat_ff(1000)})\n")
float('1_000,33'.replace(',', '.', 1)), (f'{min(10000.00, 1222.444):_f}').replace('.', ',', 1).rstrip('0'),\
  f"{1000:_d}", 0.159_8
  # , float('0.159,8'), float('0.159 8')
def mCre_SFrFloat_ff(laSrc_n:float, laReg_s:str='RU', la1kSep_s:str='_',
                     la1kSep4Frac_b:bool=True, laFracSepSv_b:bool=False, laLf0Sv_b:bool=True):
  if len(la1kSep_s) > 1 or la1kSep_s not in '.,_ ': la1kSep_s = '_'
  loRes_s, lo1kSepRPl_b = (f"{laSrc_n:_f}").rstrip('0'), None
  if la1kSep4Frac_b and loRes_s[-1] != '.':
    lo_l = loRes_s.split('.')
    lo_l[1] = '_'.join(lo_l[1][(0+_i)*3:(1+_i)*3] for _i in range(len(lo_l[1])//3 +1)
        if lo_l[1][(0+_i)*3:(1+_i)*3])
    loRes_s = '.'.join(lo_l)
  if laReg_s.lower() =='RU'.lower():
    loRes_s = loRes_s.replace('.', ',')
    if not laFracSepSv_b: loRes_s = loRes_s.rstrip(',')
    if la1kSep_s not in ',_' or la1kSep_s == '': lo1kSepRPl_b = True
  else:
    if not laFracSepSv_b: loRes_s = loRes_s.rstrip('.')
    if la1kSep_s not in '._' or la1kSep_s == '': lo1kSepRPl_b = True
    # return (f"{laSrc_n:{la1kSep_s}f}").rstrip('0').rstrip('.')
  if laLf0Sv_b and len(loRes_s) > 2 and loRes_s[0] == '0' and not loRes_s[1].isdecimal():
    loRes_s =loRes_s[1:]
  if lo1kSepRPl_b: return loRes_s.replace('_', la1kSep_s)
  else: return loRes_s

tTs_t = tuple((_n, _Reg_s, _sep_s, _4Frac_b, _SepSv_b, _Lf0Sv_b, 
  mCre_SFrFloat_ff(_n, laReg_s=_Reg_s, la1kSep_s=_sep_s, la1kSep4Frac_b=_4Frac_b,
                   laFracSepSv_b=_SepSv_b, laLf0Sv_b=_Lf0Sv_b))
  for _n in (1000.00, -122.444, 0.1598, 0, .5)
  for _Reg_s in ('Ru', '') 
  for _4Frac_b in (True, False) 
  for _SepSv_b in (True, False) 
  for _Lf0Sv_b in (True, False) 
  for _sep_s in ('_', ' ', '', '.', ','))
print(tuple(_el[-1] for _el in tTs_t))
lo_s = (f"{min(1000.00, -1222.444):_f}").replace('.', ',', 1).rstrip('0').rstrip(',')
print(f"На Вашем счету:({lo_s}) <= 0.",
    ' Пополните счет, пожалуйста.', sep='\n')
'_' not in ',_', ' ' not in ',_ ', ',' not in ',_', 'ygiy' not in ',_', len(',_') != 1 or ',_' not in ',_',\
   'w' not in ',_', ',_' not in ',_'<jupyter_output>На Вашем счету:(-1_222,444) <= 0.
 Пополните счет, пожалуйста.<jupyter_text>W/o(import)<jupyter_code>import copy, sys, time
from dataclasses import dataclass, field
from collections.abc import Callable

glScrWid_s = 80
glSep_s = '_' *glScrWid_s

glStdMsg4InP_l = [' Please, Input', ' and press Enter',
    'Your value will be validated as', 'on default ',
    # ' and {} attempt{} left'
    ' and {} attem. left',
    ' It remains to input {} more val.{}.']
glStdMsg4InP_l = [' Пожалуйста, введите', ' и нажмите Enter',
    'Ваш ввод должен соответствовать усл.', 'по умолчанию ',
    ' и осталось {} попыт.',
    ' Нужно ввести еще {} знач.{}.']

def inp_FltAVali_fefi(laWhatInPMsg_s, laInPValues_co=1, laValiInPMsg_s='',
    laVali_cll=None, laInPTypeFlt_cll=int, laMaxInPTry_co=11,
    laAcceptEmptyInPAsDf_b=False, laDfV_s=None, laMsg4InP_l=glStdMsg4InP_l,
    laVerbose_i=None, file=sys.stdout) -> tuple:

  if laInPValues_co < 1: raise ValueError(f'laInPValues_co must be > 0, now:{laInPValues_co}')
  loTypeAValiFlsCo_l, loRes_l, loMaxTry_co = [0, 0], [], int(max(laInPValues_co, laMaxInPTry_co))
  if laValiInPMsg_s and laVali_cll:
    lo_s = f' - {laMsg4InP_l[2]}({laValiInPMsg_s}'
    if lo_s[-1] == '\n': lo_s = lo_s[:-1] + ') -\n'
    else: lo_s += ') -'
  else: lo_s = ''
  lo_s = laMsg4InP_l[0] + f"{laWhatInPMsg_s}{lo_s}" + laMsg4InP_l[1]
  if laAcceptEmptyInPAsDf_b and laDfV_s is not None:
    lo_s += f"({laMsg4InP_l[3]}'{laDfV_s}')"
  loInPMsg_s = f"{lo_s}: "

  for l_co in range(loMaxTry_co):
    li_s = input(loInPMsg_s)
    if li_s == '' and laAcceptEmptyInPAsDf_b and laDfV_s is not None:
      li_s = laDfV_s # 2Do: Che: laDfV_s is str OR UpLi
    # if not li_s: ??User(Exit|Bre) ??laAcceptEmpty(As(Df|Bre))InP_b=False
    try:
      if laInPTypeFlt_cll is not None:
        liChe_i = laInPTypeFlt_cll(li_s)
      else: liChe_i = li_s
    except ValueError as leExc_o:
      loTypeAValiFlsCo_l[0] +=1; liChe_i = None
      print(f"\tERR: You input:'{li_s}' NOT pass check type w/func({laInPTypeFlt_cll}",
          f'- Exception:{type(leExc_o).__name__}({leExc_o}) raised.', file=file)
    else:
      if laVali_cll is not None:
        if laVali_cll(liChe_i):
          loRes_l.append(liChe_i)
          # print(f"\tMSG: You input:'{liChe_i}' valid.", file=file)
        else:
          loTypeAValiFlsCo_l[1] +=1
          lo_s = f' because of NOT {laValiInPMsg_s}' if laValiInPMsg_s else ''
          print(f"\tERR: You input:'{liChe_i}' INVALID{lo_s}.", file=file)
      else:
        loRes_l.append(liChe_i)
        # print(f"\tMSG: You input:'{liChe_i}'.", file=file)
        # if liChe_i == tPtt_i: tOk_co +=1
    # print(f'DBG: {loRes_l=}')
    if len(loRes_l) == laInPValues_co: break  
    if laMaxInPTry_co:
      if l_co == (loMaxTry_co -1): # RFa:Rm(NNe int)
        if loRes_l:
          print(f"\tWRN: Rich max(laInPValues_co, laMaxInPTry_co):{loMaxTry_co}, return {tuple(loRes_l)} as User input.", file=file)
        else:
          raise ValueError(f'Rich max(laInPValues_co, laMaxInPTry_co):{loMaxTry_co} but loRes_l is Empty - nothing return as User input.')
      else:
        # lo_s = '' if l_co == (loMaxTry_co -2) else 's'
        # lo_s = f' and {loMaxTry_co - l_co -1} attempt{lo_s} left'
        if laMsg4InP_l[-2]:
          lo_s = laMsg4InP_l[-2].format(loMaxTry_co - l_co -1)
        else: lo_s = ''
    else: lo_s = '' #RFa:Rm:NNe(.rstrip('.'))
    if laMsg4InP_l[-1]:
      lo_s = laMsg4InP_l[-1].format(laInPValues_co - len(loRes_l), lo_s)
      print(lo_s.rstrip('.') + '.', file=file)
    # print(f'MSG: It remains to input {laInPValues_co - len(loRes_l)} more value{lo_s}.', file=file)
  return tuple(loRes_l)

print(inp_FltAVali_fefi(laWhatInPMsg_s=' Any Float', laInPValues_co=2, laInPTypeFlt_cll=float,
    laMaxInPTry_co=1))
print(inp_FltAVali_fefi(' x', laValiInPMsg_s='x in (1,2,3)',
  laVali_cll=lambda x: x in (1,2,3))
  )

callable('None')
@dataclass
class Menu_c():

  fOutMenuItm_d: dict = field(default_factory=dict) # OutVar: ItmFmt(_k=Key, _v=[Desc_s, _cll, ??Type_en:(AlwOut, ...)])
  # fOutStt_d: dict = None # OutVar
  fAppTtl_s: str = ''
  fPrnOutStt_cll: Callable = None # OutVar # [self, file]; ??(Slv:NN)Df: IF fOutStt_d is !None -> print(fOutStt_d)
  fIterSortKey_cll: Callable = None # [key] ??(Prop4Set): AsIn2fOutMenuItm_d OR (lambda _el: str(_el))|int
  fHeaFmt_s: str = None
  fFooFmt_s: str = None
  fItmFmt_s: str = '{_k!s:>2}. {_v[0]}'
  fActHst_l: list = field(default_factory=list)
  # 2Do: PP(Max(Col|Row)) 4 prn_fmp
  fAFile4Prn_o: object = sys.stdout

  def __post_init__(self):
    if self.fHeaFmt_s is not None: self.fHeaFmt_s = str(self.fHeaFmt_s)
    else:
      self.fHeaFmt_s = glSep_s
      if self.fAppTtl_s: self.fHeaFmt_s += f'\n{self.fAppTtl_s}:'
    if self.fFooFmt_s is not None: self.fFooFmt_s = str(self.fFooFmt_s)
    else: self.fFooFmt_s = glSep_s[:len(glSep_s)//3 *2]
    
    self.fRunLoop_b = bool(self.fOutMenuItm_d)
    self.fInP_s, self.fInP_k = None, None
    if self.fActHst_l is not None:
      self.fActHst_l.append((time.time_ns(), 'Inn', '__post_init__', True))

  def __iter__(self): # 2Do: MaB Onl WhiUse(prn_fmp)
    if self.fIterSortKey_cll is None:
      return (_k for _k in self.fOutMenuItm_d.keys())
    return (_k for _k in sorted(self.fOutMenuItm_d.keys(), key=self.fIterSortKey_cll))

  def __getitem__(self, key): # BOf:KISS
    return self.fOutMenuItm_d[key]

  def __len__(self): # BOf:KISS
    return len(self.fOutMenuItm_d)

  def __contains__(self, key): # BOf:KISS
    return key in self.fOutMenuItm_d

  # 2Do: MaB: oup_fmp(self, file=fAFile4Prn_o)
  # 2Do: MaB Onl(9+KeyExit OR Fit2Scr+KeyExit) w/Set(sf.WhiVieItmKey_l)
  def prn_fmp(self, file=fAFile4Prn_o):
    if bool(self.fOutMenuItm_d):
      if self.fHeaFmt_s != '': print(self.fHeaFmt_s, file=file)
      print(*(self.fItmFmt_s.format(_k=_k, _v=self[_k]) for _k in self),
          sep='\n', file=file)
      self.prn_Info_fmp(file=file)
      if self.fFooFmt_s != '': print(self.fFooFmt_s, file=file)

  # 2Do: __str__(self), __format__, tVieHst_fmp
  def prn_Info_fmp(self, file=fAFile4Prn_o):
    if self.fPrnOutStt_cll and callable(self.fPrnOutStt_cll):
      self.fPrnOutStt_cll(self, file=file)

  # 2Do: add_Itms?_ffm(self), del_Itms?_ffpm(self), def get_Keys?_ffpm(self):
  # ??run_ffpm(self):
  def __call__(self, file=fAFile4Prn_o): # MainLoop
    if self.fActHst_l is not None:
      self.fActHst_l.append((time.time_ns(), 'Inn', 'Beg:MainLoop', True))
    while self.fRunLoop_b:
      self.prn_fmp(file=file)
      self.fInP_s, self.fInP_k = None, None # ??&| In2__post_init__
      self.fInP_s = inp_FltAVali_fefi(f' пункт меню', laInPTypeFlt_cll=None,
          file=file)[0].strip()
      if self.fInP_s in self:
        self.fInP_k = self.fInP_s
      else:
        try: self.fInP_k = int(self.fInP_s)
        except ValueError as le_o: self.fInP_k = None
        else:
          if self.fInP_k not in self: self.fInP_k = None
      if self.fInP_k is not None:
        lo_cll = self[self.fInP_k][1]
        if lo_cll is None: # 2Do:??AddHst
          print(f'DVL: None 4 calling Fu() пункт меню({self.fInP_k})', file=file)
          continue
        else:
          loRes_a = lo_cll(self, file=file)
          if self.fActHst_l is not None:
            self.fActHst_l.append((time.time_ns(), 'InP',
                f'({self.fInP_s})' + self[self.fInP_k][0], loRes_a))
      else:
          print(f'MSG: Неверный пункт меню({self.fInP_s})', file=file) # 2Do:??AddHst
    else:
      if self.fHeaFmt_s != '': print(self.fHeaFmt_s, file=file)
      print('До свидания!', file=file)
      if self.fActHst_l is not None:
        self.fActHst_l.append((time.time_ns(), 'Inn', 'End:MainLoop', True))
      if self.fFooFmt_s != '': print(self.fFooFmt_s, file=file)

    return self.fActHst_l

print(*[(1655977149789138500, 'Inn', '__post_init__', True), (1655977149789138500, 'Inn', 'Beg:MainLoop', True), (1655977622240934900, 'InP', '(Б)Мой банковский счет', [(1655977154499235200, 'Inn', '__post_init__', True), (1655977154499235200, 'Inn', 'Beg:MainLoop', True), (1655977161600854500, 'InP', '(1)Пополнение счета', 100.0), (1655977228192579300, 'InP', '(2)Покупка', ('Еда', 55.5)), (1655977248709705300, 'InP', '(2)Покупка', (None, 55.5)), (1655977256206115300, 'InP', '(2)Покупка', ('Еда', 44.5)), (1655977258495373500, 'InP', '(3)История покупок', (0.0, 2)), (1655977622238932600, 'InP', '(4)Выход', None), (1655977622239938800, 'Inn', 'End:MainLoop', True)]), (1655977705911594500, 'InP', '(Ы)Выход', None), (1655977705912593100, 'Inn', 'End:MainLoop', True)], sep='\n')<jupyter_output>(1655977149789138500, 'Inn', '__post_init__', True)
(1655977149789138500, 'Inn', 'Beg:MainLoop', True)
(1655977622240934900, 'InP', '(Б)Мой банковский счет', [(1655977154499235200, 'Inn', '__post_init__', True), (1655977154499235200, 'Inn', 'Beg:MainLoop', True), (1655977161600854500, 'InP', '(1)Пополнение счета', 100.0), (1655977228192579300, 'InP', '(2)Покупка', ('Еда', 55.5)), (1655977248709705300, 'InP', '(2)Покупка', (None, 55.5)), (1655977256206115300, 'InP', '(2)Покупка', ('Еда', 44.5)), (1655977258495373500, 'InP', '(3)История покупок', (0.0, 2)), (1655977622238932600, 'InP', '(4)Выход', None), (1655977622239938800, 'Inn', 'End:MainLoop', True)])
(1655977705911594500, 'InP', '(Ы)Выход', None)
(1655977705912593100, 'Inn', 'End:MainLoop', True)
{'fraction_non_alphanumeric': 0.1784201086532713, 'fraction_numerical': 0.029164825452938577, 'mean_word_length': 4.56194882174353, 'pattern_counts': {'":': 4, '<': 41, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '661021', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 18788, 'n_tokens_neox': 18183, 'n_words': 3168, 'path': 'ts.ipynb', 'repo_name': 'dev-mikevvl-ms/PyDev.05.HW', 'size': '38471'}