Inspecting proposals

class pytezos.proto.Proto(proto)[source]
diff(proto, context_size=3)[source]

Calculates file diff between two protocol versions.

Parameters
  • proto – an instance of Protocol

  • context_size – number of context lines before and after the change

Returns

patch in proto format

export_html(output_path=None)[source]

Generates github-like side-by-side diff viewe, powered by diff2html.js

Parameters

output_path – will write to this file if specified

Returns

html string if path is not specified

export_tar(output_path=None)[source]

Creates a tarball and dumps to a file or returns bytes.

Parameters

output_path – Path to the tarball [optional]. You can add .bz2 or .gz extension to make it compressed

Returns

bytes if path is None or nothing

classmethod from_uri(uri)[source]

Loads protocol implementation from various sources and converts it to the RPC-like format.

Parameters

uri – link/path to a tar archive or path to a folder with extracted contents

Returns

Protocol instance

hash()[source]
index() → dict[source]

Generates TEZOS_PROTOCOL file.

Returns

dict with protocol hash and modules

patch(patch)[source]

Applies unified diff and returns full-fledged protocol.

Parameters

patch – an instance of Protocol containing diff of files

Returns

Protocol instance

pytezos.proto.dir_to_files(path) → List[Tuple[str, str]][source]
pytezos.proto.files_to_proto(files: List[Tuple[str, str]]) → dict[source]
pytezos.proto.files_to_tar(files: List[Tuple[str, str]], output_path=None)[source]
pytezos.proto.proto_to_bytes(proto: dict) → bytes[source]
pytezos.proto.proto_to_files(proto: dict) → List[Tuple[str, str]][source]
pytezos.proto.tar_to_files(path=None, raw=None) → List[Tuple[str, str]][source]
pytezos.proto.url_to_files(url) → List[Tuple[str, str]][source]