G-Cubed
Python G-Cubed 5.0.2.0 · build 1
Generation details
Source revision
4c4a95aded1b5ca5e8f9c292ad8250440cd9c18b (modified inputs)
Source fingerprint
e2c719b38e03c6b1748f10e26bc1caf1ead5674dd1beee6628a6ccf7b90fd39b
Generated (UTC)
2026-11-11T03:06:22.844261+00:00
Generator
pdoc 16.0.0, CPython 3.14.8
Generation metadata

gcubed.data.fiscal_accounts

Coordinate-explicit fiscal arithmetic shared by generation and conditioning.

Country source selection belongs to msgdata; this module has no data-package dependency.

FISCAL_CONTRACT_VERSION: int = 2
FISCAL_STORED_HALF_ROUNDING_UNIT: float = 5e-08
def stored_fiscal_rounding_bound(terms: list[float] | tuple[float, ...]) -> float:

Overview

Bound an additive stored-unit residual by seven-decimal and floating rounding.

Arguments

  • terms: Finite signed operands in the same stored units, with one possible seven-decimal rounding contribution per operand.

    Returns

An absolute residual bound; an empty sum has a zero bound.

Exceptions

Raises ValueError when any operand or the resulting bound is nonfinite.

def fiscal_equations(sym_input_file: pathlib.Path) -> dict[str, str]:

Overview

Read selected fiscal equations, rejecting unsupported or ambiguous closures. Includes resolve from the model's SYM root, as they do in the SYM processor.

Arguments

  • sym_input_file: Selected native source and its included closure files.

    Returns

Eight canonical standard equations. The supported paired permit closure adds DEFI(USA) and retains its non-USA expression under DEFI.

Exceptions

Raises ValueError for invalid includes or unsupported, partial or ambiguous fiscal equations. No files are changed.

def reconcile_fiscal_accounts(accounts: pandas.DataFrame) -> pandas.DataFrame:

Overview

Return TAXS/TAXL/TAXT/DEFN from accepted unlogged decimal working levels. Rows are unique region/year coordinates; all eleven required inputs must be finite. Rates are decimals, and all fiscal levels share the same GDP basis. This pure calculation neither changes source anchors nor clips signed remainders. Callers must validate the active closure before applying its result.

Arguments

  • accounts: Required fiscal inputs and optional decimal GOVERNMENT_PERMIT_RECEIPTS, positive for government receipts.

    Returns

A new derived-account frame, deducting supplied permits from the TAXS residual.

Exceptions

Raises ValueError for invalid labels or nonfinite fiscal inputs/results.

def stored_government_permit_receipts( data: pandas.DataFrame, regions: list[str] | tuple[str, ...], years: list[str], equations: dict[str, str]) -> pandas.DataFrame:

Overview

Read the native government permit receipts in unlogged stored GDP units.

Arguments

  • data: Stored CSV values with units and region labels.
  • regions, years: Receipt coordinates; years are stored string labels.
  • equations: Validated standard or paired USA/non-USA fiscal equations.

    Returns

Region/year receipts. Standard budgets receive zeros; permit budgets use supplied PBGU for USA and PBG divided by real FX for every other region. No regional aggregation or firm-permit receipts participate.

Exceptions

Raises ValueError for unsupported equations, malformed domains, nonfinite values, invalid units or nonpositive real exchange rates.

def reconcile_stored_fiscal_accounts( data: pandas.DataFrame, regions: list[str] | tuple[str, ...], years: list[str], *, preserve_taxs: bool = False, permit_receipts: pandas.DataFrame | None = None, reference_permit_receipts: pandas.DataFrame | None = None) -> pandas.DataFrame:

Overview

Reconcile fiscal components and native savings in unlogged stored coordinates. GDP-unit levels and rates are stored in percent; price/real-FX indices are stored with 100 as unity. Optional TAXM/TAXX/TAXE terms and the entire foreign account block may be structurally absent. Partial blocks, units/domain drift and nonfinite inputs fail before mutation. The input is never changed.

Arguments

  • data: Labelled stored values, including units and regional identifiers.
  • regions, years: Required calculation coordinates.
  • preserve_taxs: Check the supplied non-interest remainder against the stored rounding bound and use it in TAXL/TAXT. The default retains generation's calculated remainder. Callers project optional tax rows to their selected native revenue terms before requesting preservation.
  • permit_receipts: Current stored-GDP government receipts, labelled by region/year; None retains budgets without government permit receipts.
  • reference_permit_receipts: Original receipts used to validate preserved TAXS before applying only the receipt change; defaults to current receipts.

    Returns

A new frame of derived fiscal and applicable native savings values.

Exceptions

Raises ValueError for invalid labels, units, nonfinite inputs/results or an inconsistent preserved TAXS, identifying its region/year.