예제 #1
0
        return result

    def __repr__(self) -> str:
        return 'divide (@{0})'


###############################################################################
###############################################################################

if __name__ == "__main__":
    div = DivCallable(default=[1.0])

    parser = do.get_args_parser({
        'function': div,
        'default': div.default,
        'result': 'div'
    })

    parser.description = \
        """
        """

    parser.epilog = \
        """
        """

    args = do.get_args(parser=parser)
    div.default = args.default

    try:
예제 #2
0
파일: sum.py 프로젝트: hsk81/quotestream
class SumCallable (object):

    def __call__ (self, *args: [numpy.array], last=None) -> numpy.array:
        return numpy.sum (numpy.array (args).flatten ())

    def __repr__ (self) -> str:
        return 'sum (@{0})'

###############################################################################
###############################################################################

if __name__ == "__main__":

    parser = do.get_args_parser ({
        'function': SumCallable (), 'result': 'sum'
    })

    parser.description = \
        """
        """

    parser.epilog = \
        """
        """

    args = do.get_args (parser=parser)

    try: do.loop (args.function, args.parameters, args.default, args.result,
        verbose=args.verbose)
예제 #3
0

class SumCallable(object):
    def __call__(self, *args: [numpy.array], last=None) -> numpy.array:
        return numpy.sum(numpy.array(args).flatten())

    def __repr__(self) -> str:
        return 'sum (@{0})'


###############################################################################
###############################################################################

if __name__ == "__main__":

    parser = do.get_args_parser({'function': SumCallable(), 'result': 'sum'})

    parser.description = \
        """
        """

    parser.epilog = \
        """
        """

    args = do.get_args(parser=parser)

    try:
        do.loop(args.function,
                args.parameters,
                args.default,
예제 #4
0

class ProdCallable(object):
    def __call__(self, *args: [numpy.array], last=None) -> numpy.array:
        return numpy.prod(args)

    def __repr__(self) -> str:
        return 'prod(@{0})'


###############################################################################
###############################################################################

if __name__ == "__main__":

    parser = do.get_args_parser({'function': ProdCallable(), 'result': 'prod'})

    parser.description = \
        """
        """

    parser.epilog = \
        """
        """

    args = do.get_args(parser=parser)

    try:
        do.loop(args.function,
                args.parameters,
                args.default,
예제 #5
0
파일: div.py 프로젝트: hsk81/quotestream
            result = numpy.array (eval (self.default)
                if type (self.default) is str else self.default)

        return result

    def __repr__ (self) -> str:
        return 'divide (@{0})'

###############################################################################
###############################################################################

if __name__ == "__main__":
    div = DivCallable (default=[1.0])

    parser = do.get_args_parser ({
        'function': div, 'default': div.default, 'result': 'div'
    })

    parser.description = \
        """
        """

    parser.epilog = \
        """
        """

    args = do.get_args (parser=parser)
    div.default = args.default

    try: do.loop (args.function, args.parameters, args.default, args.result,
        verbose=args.verbose)
예제 #6
0
파일: diff.py 프로젝트: hsk81/quotestream

class DiffCallable(object):
    def __call__(self, *args: [numpy.array], last=None) -> numpy.array:
        return numpy.diff(numpy.array(args).flatten())

    def __repr__(self) -> str:
        return 'diff(@{0})'


###############################################################################
###############################################################################

if __name__ == "__main__":

    parser = do.get_args_parser({'function': DiffCallable(), 'result': 'diff'})

    parser.description = \
        """
        """

    parser.epilog = \
        """
        """

    args = do.get_args(parser=parser)

    try:
        do.loop(args.function,
                args.parameters,
                args.default,
예제 #7
0
파일: prod.py 프로젝트: hsk81/quotestream
class ProdCallable (object):

    def __call__ (self, *args: [numpy.array], last=None) -> numpy.array:
        return numpy.prod (args)

    def __repr__ (self) -> str:
        return 'prod (@{0})'

###############################################################################
###############################################################################

if __name__ == "__main__":

    parser = do.get_args_parser ({
        'function': ProdCallable (), 'result': 'prod'
    })

    parser.description = \
        """
        """

    parser.epilog = \
        """
        """

    args = do.get_args (parser=parser)

    try: do.loop (args.function, args.parameters, args.default, args.result,
        verbose=args.verbose)
예제 #8
0
파일: diff.py 프로젝트: hsk81/quotestream
class DiffCallable (object):

    def __call__ (self, *args: [numpy.array], last=None) -> numpy.array:
        return numpy.diff (numpy.array (args).flatten ())

    def __repr__ (self) -> str:
        return 'diff (@{0})'

###############################################################################
###############################################################################

if __name__ == "__main__":

    parser = do.get_args_parser ({
        'function': DiffCallable (), 'result': 'diff'
    })

    parser.description = \
        """
        """

    parser.epilog = \
        """
        """

    args = do.get_args (parser=parser)

    try: do.loop (args.function, args.parameters, args.default, args.result,
        verbose=args.verbose)