# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/02_sign.ipynb.

# %% auto 0
__all__ = ['P', 'N', 'Z', 'sign']

# %% ../nbs/02_sign.ipynb 3
from numbers import Number
from typing import Any, Optional, NamedTuple

# %% ../nbs/02_sign.ipynb 4
from .types import SignInt, SignIntQ, NumStr, NumStrQ, SignChr, SignSym
from .guard import ispos, isneg, iszer, isstr, isnum, isnumstr

# %% ../nbs/02_sign.ipynb 6
class sign(NamedTuple):
    '''Represent the numerical and symbolic information of a sign.'''
    int: SignInt = 0
    chr: SignChr = ''
    sym: SignSym = ''
    syn: set = set()

    @property
    def set(self) -> set: return set({str(self.int), self.chr, self.sym}) | self.syn
    def issyn(self, s: str) -> bool: return s in self.set


P = sign( 1, 'P', '+', set({'+', 'pos', 'positive'}))
N = sign(-1, 'N', '-', set({'-', 'neg', 'negative'}))
Z = sign( 0, '',   '', set())

sign.P = P
sign.N = N
sign.Z = Z
