Exemplo n.º 1
0
def _icing(item: str) -> Icing:
    """
    Convert reported icing to an Icing object
    """
    items, ret = _find_floor_ceiling(item.split())
    ret["severity"] = items.pop(0)
    ret["type"] = items[0] if items else None
    return Icing(**ret)
Exemplo n.º 2
0
def _icing(item: str) -> Icing:
    """
    Convert reported icing to an Icing object
    """
    items = item.split()
    ret = {
        'severity': items.pop(0),
        'type': None,
        'floor': None,
        'ceiling': None
    }
    for item in items:
        if '-' in item:
            for key, val in zip(('floor', 'ceiling'), item.split('-')):
                ret[key] = core.make_number(val)
        else:
            ret['type'] = item
    return Icing(**ret)
Exemplo n.º 3
0
def _icing(item: str) -> Icing:
    """
    Convert reported icing to an Icing object
    """
    items = item.split()
    ret = {
        "severity": items.pop(0),
        "type": None,
        "floor": None,
        "ceiling": None
    }
    for i, item in enumerate(items):
        hloc = item.find("-")
        if hloc > -1 and item[:hloc].isdigit() and item[hloc + 1:].isdigit():
            for key, val in zip(("floor", "ceiling"), items.pop(i).split("-")):
                ret[key] = _core.make_number(val)
            break
    if items:
        ret["type"] = items[0]
    return Icing(**ret)