Skip to main content

Python Branch Statement Analyzer

Documentation Status

The purpose of this library is two-fold:

  1. Detect independent paths through a function and represent all paths as a fully-connected Kripke Structure.
  2. Instrument a function to preserve the states of the conditional variables for an execution of the function and augment the return value of the function with the conditional variable states.

Path detection

TODO

Instrumentation

TODO

Usage

Decomposition of a function into a condition tree is accomplished by calling the BranchTree.from_function static method like so:

def myfunc(x):
   if x <= 10:
      return x**2
   else:
      return x*2


tree = BranchTree.from_function(myfunc)

Conversion of the BranchTree into a Kripke Structure can be accomplished by calling the BranchTree.into_kripke method once the function has been analyzed.

A function can be instrumented using the instrument_function decorator, which will return another function that accepts the same inputs and returns a tuple containing the return value of the function and the states of the conditional variables.

@instrument_function
def myfunc(x):
   if x <= 10:
      return x**2
   else:
      return x*2

states, retval = myfunc(8)

Documentation

Documentation for this project can be found on Read the Docs

Metadata

Release files for branch-statement-analyzer 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for branch-statement-analyzer 1.0.0
File Size Uploaded Provenance Actions
branch_statement_analyzer-1.0.0.tar.gz 11.9 kB Without provenance Details for branch_statement_analyzer-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for branch-statement-analyzer 1.0.0
File Interpreter ABI Platform Actions
branch_statement_analyzer-1.0.0-py3-none-any.whl Python 3 none any Details for branch_statement_analyzer-1.0.0-py3-none-any.whl

Total release size: 24.7 kB

Release files / branch_statement_analyzer-1.0.0.tar.gz

Download URL branch_statement_analyzer-1.0.0.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f770b9d85bb1958a643b5ad579b245b4eec49d1ec0c37966aa60b2e873631288
BLAKE2b-256 checksum
How to use checksums
f82b541204b6e4cad51c1bd6d3654eda17ce91cece60b40597ebeaa7661c4cf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.10.10 Linux/5.15.0-67-generic

Release files / branch_statement_analyzer-1.0.0-py3-none-any.whl

Download URL branch_statement_analyzer-1.0.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d98553c1b9443e790ee5d9f8329ec541d98a3f0011bbe25591afc3dee83daa55
BLAKE2b-256 checksum
How to use checksums
34b596a494a209ec6c314c44f4c30c1642601ea223c3a9bce4d183db913e4ecd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.10.10 Linux/5.15.0-67-generic

Security for branch-statement-analyzer 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page