Exemplo n.º 1
0
 def __repr__(self):
     res = [
         super(OperationGroup, self).__repr__(), '\nPayload',
         pformat(self.json_payload()), '\nHelpers',
         get_class_docstring(self.__class__)
     ]
     return '\n'.join(res)
Exemplo n.º 2
0
 def __repr__(self):
     res = [
         super(Key, self).__repr__(), f'\nPublic key hash',
         self.public_key_hash(), '\nHelpers',
         get_class_docstring(self.__class__)
     ]
     return '\n'.join(res)
Exemplo n.º 3
0
 def __repr__(self):
     res = [
         super(PyTezosClient, self).__repr__(),
         '\nHelpers',
         get_class_docstring(self.__class__)
     ]
     return '\n'.join(res)
Exemplo n.º 4
0
 def __repr__(self):
     res = [
         super(Protocol, self).__repr__(),
         '\nHelpers',
         get_class_docstring(self.__class__)
     ]
     return '\n'.join(res)
Exemplo n.º 5
0
 def __repr__(self):
     res = [
         super(ContractCall, self).__repr__(), f'.amount  # {self.amount}',
         '\nParameters',
         pformat(self.parameters), '\nHelpers',
         get_class_docstring(self.__class__)
     ]
     return '\n'.join(res)
Exemplo n.º 6
0
 def __repr__(self) -> str:
     res = [
         super().__repr__(),
         '\nPayload',
         pformat(self.json_payload()),
         '\nHelpers',
         get_class_docstring(self.__class__),
     ]
     return '\n'.join(res)
Exemplo n.º 7
0
 def __repr__(self):
     res = [
         super(ContractEntrypoint,
               self).__repr__(), f'.entrypoint\t{self.entrypoint}',
         f'\nBuiltin\n(*args, **kwargs)\t# build transaction parameters (see typedef)',
         f'\nTypedef\n{self.__doc__}', '\nHelpers',
         get_class_docstring(self.__class__)
     ]
     return '\n'.join(res)
Exemplo n.º 8
0
 def __repr__(self):
     res = [
         super(ContractData, self).__repr__(), f'.path  # {self.path}',
         f'\nBuiltin\n()  # get as Python object',
         f'[key]  # access child elements by name or index',
         f'\nTypedef\n{self.__doc__}', '\nHelpers',
         get_class_docstring(self.__class__)
     ]
     return '\n'.join(res)
Exemplo n.º 9
0
 def __repr__(self) -> str:
     res = [
         super().__repr__(),
         f'.name\t{self.name}',
         f'\nBuiltin\n(*args, **kwargs)  # build view parameters (see typedef)',
         f'\nTypedef\n{self.__doc__}',
         '\nHelpers',
         get_class_docstring(self.__class__),
     ]
     return '\n'.join(res)
Exemplo n.º 10
0
 def __repr__(self) -> str:
     res = [
         super().__repr__(),
         f'.amount\t{self.amount}',
         '\nParameters',
         pformat(self.parameters),
         '\nHelpers',
         get_class_docstring(self.__class__),
     ]
     return '\n'.join(res)
Exemplo n.º 11
0
 def __repr__(self):
     res = [
         super(ContractInterface, self).__repr__(),
         '.storage  # access storage data at block `block_id`',
         '.parameter  # root entrypoint', '\nEntrypoints',
         *list(map(lambda x: f'.{x}()', self.entrypoints)), '\nHelpers',
         get_class_docstring(
             self.__class__,
             attr_filter=lambda x: x not in self.entrypoints)
     ]
     return '\n'.join(res)
Exemplo n.º 12
0
def format_docstring(class_type, query_path):
    res = ['']
    methods = {
        'GET': '()',
        'POST': '.post()',
        'PUT': '.put()',
        'DELETE': '.delete()'
    }
    rpc_doc = rpc_docs.get(query_path, {})

    for method, func in methods.items():
        if method in rpc_doc:
            docstring = get_attr_docstring(class_type, method.lower())
            if not docstring:
                docstring = f'\n{rpc_doc[method]["descr"]}\n'
                for arg in rpc_doc[method]['args']:
                    docstring += f':param {arg["name"]}: {arg["descr"]}\n'
                docstring += f':returns: {rpc_doc[method]["ret"]}\n'

            res.append(f'{func}{docstring}')

    if 'item' in rpc_doc:
        docstring = get_attr_docstring(class_type, '__getitem__')
        if not docstring:
            item = rpc_doc["item"]
            docstring = f'\n:param {item["name"]}: {item["descr"]}\n:returns: Child element\n'

        res.append(f'[]{docstring}')

    if 'props' in rpc_doc:
        properties = rpc_doc['props']
        docstring = '\n'.join(map(lambda x: f'.{x}', properties))
        res.append(f'RPC endpoints\n{docstring}\n')
    else:
        properties = list()

    helpers = get_class_docstring(
        class_type=class_type,
        attr_filter=lambda x: not x.startswith('_')
                              and x not in properties
                              and x.upper() not in methods
                              and x != 'path'
    )
    if helpers:
        res.append(f'Helpers\n{helpers}')

    return '\n'.join(res)
Exemplo n.º 13
0
 def __repr__(self) -> str:
     res = [
         super().__repr__(),
         '\nHeader',
         pformat({
             **self.shell_header,
             'protocol_data': {
                 **self.protocol_data,
                 'signature': self.signature,
             },
         }),
         '\nOperations',
         pformat(self.operations),
         '\nHelpers',
         get_class_docstring(self.__class__),
     ]
     return '\n'.join(res)