Compare commits

..

No commits in common. "c54661d39eef26d75f52713ce55e6adb8ac5f105" and "d94cf08719bf3a996117badfbd24bff2a2656ee9" have entirely different histories.

4 changed files with 18 additions and 57 deletions

View File

@ -1,6 +1,5 @@
- 0.1.16 - 0.1.16
* Queue list cli tool * Queue list cli tool
* State parser cli tool
* Provide pluggable renderer capability for queue list cli tool * Provide pluggable renderer capability for queue list cli tool
* Move path and state query parsing to settings module * Move path and state query parsing to settings module
* Add queue path and digest parameters to base config * Add queue path and digest parameters to base config

View File

@ -0,0 +1,14 @@
# standard imports
import logging
# local imports
from chainqueue.db.models.base import SessionBase
from chainqueue.db import dsn_from_config
logg = logging.getLogger(__name__)
def setup_backend(config, debug=False):
dsn = dsn_from_config(config)
logg.debug('dsn {}'.format(dsn))
SessionBase.connect(dsn, debug=debug)

View File

@ -1,51 +0,0 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# standard imports
import os
import logging
import argparse
# local imports
from chainqueue.state import Status
argparser = argparse.ArgumentParser()
argparser.add_argument('-r', '--raw', dest='r', action='store_true', help='Always print pure state element strings')
argparser.add_argument('state', type=str, help='State to interpret')
args = argparser.parse_args()
status_interpreter = Status(None, allow_invalid=True)
def handle_numeric(v, elements=False):
if elements:
if not status_interpreter.is_pure(v):
return status_interpreter.elements(v)
return status_interpreter.name(v)
def handle_string(v):
try:
return status_interpreter.from_name(v)
except AttributeError:
return status_interpreter.from_elements(v)
def main():
v = None
numeric = False
try:
v = int(args.state)
numeric = True
except:
v = args.state
r = None
if numeric:
r = handle_numeric(v, elements=args.r)
else:
r = handle_string(v)
print(r)
if __name__ == '__main__':
main()

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = chainqueue name = chainqueue
version = 0.1.16rc1 version = 0.1.16
description = Generic blockchain transaction queue control description = Generic blockchain transaction queue control
author = Louis Holbrook author = Louis Holbrook
author_email = dev@holbrook.no author_email = dev@holbrook.no
@ -35,7 +35,6 @@ packages =
chainqueue.runnable chainqueue.runnable
chainqueue.cli chainqueue.cli
[options.entry_points] #[options.entry_points]
console_scripts = #console_scripts =
chainqueue-list = chainqueue.runnable.list:main # chainqueue-list = chainqueue.runnable.list:main
chainqueue-state = chainqueue.runnable.state:main