Skip to content

Commit

Permalink
Merge pull request #18 from PolicyEngine/stocks-and-flows
Browse files Browse the repository at this point in the history
Stocks/flows
  • Loading branch information
nikhilwoodruff committed Jan 17, 2022
2 parents 3e45a9c + 8ee8caf commit ec837d9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.1] - 2022-01-17

### Added

* Optional metadata field for stock/flow type for variables.

## [0.2.0] - 2022-01-16

### Added
Expand Down
14 changes: 13 additions & 1 deletion openfisca_tools/model_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,25 @@

ReformType = Union[Reform, Tuple[Reform]]

allowed_variable_attributes = ("metadata", "quantity_type")

STOCK = "Stock"
FLOW = "Flow"


class Variable(CoreVariable):
quantity_type: str = FLOW

def __init__(self, baseline_variable=None):
try:
CoreVariable.__init__(self, baseline_variable=baseline_variable)
except ValueError as e:
if "metadata" not in str(e):
if all(
[
attribute not in str(e)
for attribute in allowed_variable_attributes
]
):
raise e

self.is_neutralized = False
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="OpenFisca-Tools",
version="0.2.0",
version="0.2.1",
author="PolicyEngine",
license="http://www.fsf.org/licensing/licenses/agpl-3.0.html",
url="https://github.com/policyengine/openfisca-tools",
Expand Down

0 comments on commit ec837d9

Please sign in to comment.