src/prost/prost.py
def preprocess_meta(fn: Callable):
  """ Preprocess meta dicts -> IntEnum objects"""
  @wraps(fn)
  @T.curry
  def _preprocess_meta(ex, meta, ev, **kwargs):
    # enumerate meta
    meta = enum_meta(meta, ev)

    # get options
    options = []
    for i, k in enumerate('ABCD'):
      option_meta = T.valfilter(lambda x: x['text'] == ex[k], meta)
      option_meta = list(option_meta.values())
      if len(option_meta) == 0:
        continue
      assert len(option_meta) == 1, (option_meta, meta)
      # get the enum for that obj
      options.append({'key': k, 'idx': i, **option_meta[0]})
    meta['options'] = options
    return fn(ex, meta, **kwargs)

  return _preprocess_meta
 Preprocess meta dicts -> IntEnum objects
Preprocess meta dicts -> IntEnum objects
Preprocess meta dicts - > IntEnum objects
def preprocess_meta(fn: Callable):
  @wraps(fn)
  @T.curry
  def _preprocess_meta(ex, meta, ev, **kwargs):
    meta = enum_meta(meta, ev)
    options = []
    for i, k in enumerate('ABCD'):
      option_meta = T.valfilter(lambda x: x['text'] == ex[k], meta)
      option_meta = list(option_meta.values())
      if len(option_meta) == 0:
        continue
      assert len(option_meta) == 1, (option_meta, meta)
      options.append({'key': k, 'idx': i, **option_meta[0]})
    meta['options'] = options
    return fn(ex, meta, **kwargs)
  return _preprocess_meta
def preprocess_meta ( fn : Callable ) : @ wraps ( fn ) @ T . curry def _preprocess_meta ( ex , meta , ev , ** kwargs ) : meta = enum_meta ( meta , ev ) options = [ ] for i , k in enumerate ( 'ABCD' ) : option_meta = T . valfilter ( lambda x : x [ 'text' ] == ex [ k ] , meta ) option_meta = list ( option_meta . values ( ) ) if len ( option_meta ) == 0 : continue assert len ( option_meta ) == 1 , ( option_meta , meta ) options . append ( { 'key' : k , 'idx' : i , ** option_meta [ 0 ] } ) meta [ 'options' ] = options return fn ( ex , meta , ** kwargs ) return _preprocess_meta
Preprocess meta dicts -> IntEnum objects
Preprocess meta dicts - > IntEnum objects
""" Preprocess meta dicts -> IntEnum objects""" # enumerate meta # get options # get the enum for that obj
fn
Callable