duniterpy.grammars package

Submodules

duniterpy.grammars.output module

class duniterpy.grammars.output.CLTV(value: str = '')

Bases: object

CLTV function in transaction output condition

compose(parser: Any = None, grammar: Any = None, attr_of: str | None = None) str

Return the CLTV(timestamp) expression as string format

Parameters:
  • parser – Parser instance

  • grammar – Grammar

  • attr_of – Attribute of…

grammar = ('CLTV(', Attribute(name='timestamp', thing=<class 'duniterpy.grammars.output.Int'>, subtype=None), ')')
classmethod token(timestamp: int) CLTVType

Return CLTV instance from timestamp

Parameters:

timestamp – Timestamp

Returns:

class duniterpy.grammars.output.CSV(value: str = '')

Bases: object

CSV function in transaction output condition

compose(parser: Any = None, grammar: Any = None, attr_of: str | None = None) str

Return the CSV(time) expression as string format

Parameters:
  • parser – Parser instance

  • grammar – Grammar

  • attr_of – Attribute of…

grammar = ('CSV(', Attribute(name='time', thing=<class 'duniterpy.grammars.output.Int'>, subtype=None), ')')
classmethod token(time: int) CSVType

Return CSV instance from time

Parameters:

time – Timestamp

Returns:

class duniterpy.grammars.output.Condition(value: str = '')

Bases: object

Condition expression in transaction output

compose(parser: Any, grammar: Any = None, attr_of: str | None = None) str

Return the Condition as string format

Parameters:
  • parser – Parser instance

  • grammar – Grammar

  • attr_of – Attribute of…

grammar = (-4, (Attribute(name='left', thing=[<class 'duniterpy.grammars.output.SIG'>, <class 'duniterpy.grammars.output.XHX'>, <class 'duniterpy.grammars.output.CSV'>, <class 'duniterpy.grammars.output.CLTV'>, ('(', <class 'duniterpy.grammars.output.Condition'>, ')')], subtype=None), (-1, (re.compile('(?m)\\s+', re.MULTILINE), Attribute(name='op', thing=<class 'duniterpy.grammars.output.Operator'>, subtype=None), re.compile('(?m)\\s+', re.MULTILINE), Attribute(name='right', thing=[<class 'duniterpy.grammars.output.SIG'>, <class 'duniterpy.grammars.output.XHX'>, <class 'duniterpy.grammars.output.CSV'>, <class 'duniterpy.grammars.output.CLTV'>, ('(', <class 'duniterpy.grammars.output.Condition'>, ')')], subtype=None)))))
classmethod token(left: Any, op: Any | None = None, right: Any | None = None) ConditionType

Return Condition instance from arguments and Operator

Parameters:
  • left – Left argument

  • op – Operator

  • right – Right argument

Returns:

class duniterpy.grammars.output.Hash

Bases: str

Hash in transaction output condition

regex = re.compile('[A-F0-9]{64}')
class duniterpy.grammars.output.Int

Bases: str

Integer in transaction output condition

regex = re.compile('[0-9]+')
class duniterpy.grammars.output.Operator(keyword)

Bases: Keyword

Operator in transaction output condition

compose(parser: Any = None, grammar: Any = None, attr_of: str | None = None) str

Return the Operator keyword as string format

Parameters:
  • parser – Parser instance

  • grammar – Grammar

  • attr_of – Attribute of…

grammar = Enum([Keyword('&&'), Keyword('||'), Keyword('AND'), Keyword('OR')])
regex = re.compile('[&&|\\|\\||\\w]+')
classmethod token(keyword: str) OperatorType

Return Operator instance from keyword

Parameters:

keyword – Operator keyword in expression

Returns:

class duniterpy.grammars.output.Pubkey

Bases: str

Pubkey in transaction output condition

regex = re.compile('(?![OIl])[1-9A-Za-z]{42,45}')
class duniterpy.grammars.output.SIG(value: str = '')

Bases: object

SIGnature function in transaction output condition

compose(parser: Any = None, grammar: Any = None, attr_of: Any = None) str

Return the SIG(pubkey) expression as string format

Parameters:
  • parser – Parser instance

  • grammar – Grammar

  • attr_of – Attribute of…

Returns:

grammar = ('SIG(', Attribute(name='pubkey', thing=<class 'duniterpy.grammars.output.Pubkey'>, subtype=None), ')')
classmethod token(pubkey: str) SIGType

Return SIG instance from pubkey

Parameters:

pubkey – Public key of the signature issuer

Returns:

class duniterpy.grammars.output.XHX(value: str = '')

Bases: object

XHX function in transaction output condition

compose(parser: Any = None, grammar: Any = None, attr_of: str | None = None) str

Return the XHX(sha_hash) expression as string format

Parameters:
  • parser – Parser instance

  • grammar – Grammar

  • attr_of – Attribute of…

grammar = ('XHX(', Attribute(name='sha_hash', thing=<class 'duniterpy.grammars.output.Hash'>, subtype=None), ')')
classmethod token(sha_hash: str) XHXType

Return XHX instance from sha_hash

Parameters:

sha_hash – SHA256 hash

Returns:

Module contents