def __init__(self, val, human=False): if human: val = _uni(val) else: val = _dec(val) for name in ("str", "value", "exact"): self.__dict__[name] = val
def parse_tag(self, spec, comparison=False): spec = _uni(spec) if not spec: return None if spec[0] in u"~-!": prefix = spec[0] spec = spec[1:] else: prefix = u"" if u" " not in spec: tag = self.find_tag(spec) else: tag = None if tag: if comparison: return (prefix + tag, None, None) else: return (prefix + tag, None) if comparison: ppos = _rfindany(spec, u"=<>", spec.find(u" ")) else: ppos = spec.rfind(u"=") return self._parse_tag(prefix, spec, ppos, comparison)
def __init__(self, val, human=False): if " " in val: raise ValueError(val) val = _uni(val) for name in ("str", "value", "exact"): self.__dict__[name] = val