bug: Fix documentation compile and config dumps #2
@ -57,7 +57,7 @@ class ArgumentParser(argparse.ArgumentParser):
 | 
				
			|||||||
        self.pos_args = []
 | 
					        self.pos_args = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def add_positional(self, name, type=str, help=None, required=True):
 | 
					    def add_positional(self, name, type=str, help=None, append=False, required=True):
 | 
				
			||||||
        """Add a positional argument.
 | 
					        """Add a positional argument.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Stdin piping will only be possible in the event a single positional argument is defined.
 | 
					        Stdin piping will only be possible in the event a single positional argument is defined.
 | 
				
			||||||
@ -73,7 +73,7 @@ class ArgumentParser(argparse.ArgumentParser):
 | 
				
			|||||||
        :param required: If true, argument will be set to required
 | 
					        :param required: If true, argument will be set to required
 | 
				
			||||||
        :type required: bool
 | 
					        :type required: bool
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        self.pos_args.append((name, type, help, required,))
 | 
					        self.pos_args.append((name, type, help, required, append,))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def parse_args(self, argv=sys.argv[1:]):
 | 
					    def parse_args(self, argv=sys.argv[1:]):
 | 
				
			||||||
@ -88,13 +88,23 @@ class ArgumentParser(argparse.ArgumentParser):
 | 
				
			|||||||
        """
 | 
					        """
 | 
				
			||||||
        if len(self.pos_args) == 1:
 | 
					        if len(self.pos_args) == 1:
 | 
				
			||||||
            arg = self.pos_args[0]
 | 
					            arg = self.pos_args[0]
 | 
				
			||||||
            self.add_argument(arg[0], nargs='?', type=arg[1], default=stdin_arg(), help=arg[2])
 | 
					            if arg[4]:
 | 
				
			||||||
 | 
					                self.add_argument(arg[0], nargs='*', type=arg[1], default=stdin_arg(), help=arg[2])
 | 
				
			||||||
 | 
					            else:
 | 
				
			||||||
 | 
					                self.add_argument(arg[0], nargs='?', type=arg[1], default=stdin_arg(), help=arg[2])
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            for arg in self.pos_args:
 | 
					            for arg in self.pos_args:
 | 
				
			||||||
                if arg[3]:
 | 
					                if arg[3]:
 | 
				
			||||||
                    self.add_argument(arg[0], type=arg[1], help=arg[2])
 | 
					                    if arg[4]:
 | 
				
			||||||
 | 
					                        logg.debug('argumen')
 | 
				
			||||||
 | 
					                        self.add_argument(arg[0], nargs='+', type=arg[1], help=arg[2])
 | 
				
			||||||
 | 
					                    else:
 | 
				
			||||||
 | 
					                        self.add_argument(arg[0], type=arg[1], help=arg[2])
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    self.add_argument(arg[0], nargs='?', type=arg[1], help=arg[2])
 | 
					                    if arg[4]:
 | 
				
			||||||
 | 
					                        self.add_argument(arg[0], nargs='*', type=arg[1], help=arg[2])
 | 
				
			||||||
 | 
					                    else:
 | 
				
			||||||
 | 
					                        self.add_argument(arg[0], type=arg[1], help=arg[2])
 | 
				
			||||||
        args = super(ArgumentParser, self).parse_args(args=argv)
 | 
					        args = super(ArgumentParser, self).parse_args(args=argv)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if args.dumpconfig:
 | 
					        if args.dumpconfig:
 | 
				
			||||||
 | 
				
			|||||||
@ -23,7 +23,10 @@ from .jsonrpc import (
 | 
				
			|||||||
        ErrorParser,
 | 
					        ErrorParser,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
from .http import PreemptiveBasicAuthHandler
 | 
					from .http import PreemptiveBasicAuthHandler
 | 
				
			||||||
from .error import JSONRPCException
 | 
					from .error import (
 | 
				
			||||||
 | 
					        JSONRPCException,
 | 
				
			||||||
 | 
					        RPCException,
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
from .auth import Auth
 | 
					from .auth import Auth
 | 
				
			||||||
 | 
					
 | 
				
			||||||
logg = logging.getLogger(__name__)
 | 
					logg = logging.getLogger(__name__)
 | 
				
			||||||
@ -308,8 +311,11 @@ class JSONRPCHTTPConnection(HTTPConnection):
 | 
				
			|||||||
                    )
 | 
					                    )
 | 
				
			||||||
            ho = build_opener(handler)
 | 
					            ho = build_opener(handler)
 | 
				
			||||||
            install_opener(ho)
 | 
					            install_opener(ho)
 | 
				
			||||||
       
 | 
					
 | 
				
			||||||
        r = urlopen(req, data=data.encode('utf-8'))
 | 
					        try: 
 | 
				
			||||||
 | 
					            r = urlopen(req, data=data.encode('utf-8'))
 | 
				
			||||||
 | 
					        except urllib.error.URLError as e:
 | 
				
			||||||
 | 
					            raise RPCException(e)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        result = json.load(r)
 | 
					        result = json.load(r)
 | 
				
			||||||
        logg.debug('(HTTP) recv {}'.format(result))
 | 
					        logg.debug('(HTTP) recv {}'.format(result))
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
[metadata]
 | 
					[metadata]
 | 
				
			||||||
name = chainlib
 | 
					name = chainlib
 | 
				
			||||||
version = 0.0.10a3
 | 
					version = 0.0.10a5
 | 
				
			||||||
description = Generic blockchain access library and tooling
 | 
					description = Generic blockchain access library and tooling
 | 
				
			||||||
author = Louis Holbrook
 | 
					author = Louis Holbrook
 | 
				
			||||||
author_email = dev@holbrook.no
 | 
					author_email = dev@holbrook.no
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user