Skip to content

Commit

Permalink
Merge pull request #127 from jdebacker/file_org
Browse files Browse the repository at this point in the history
Rename files
  • Loading branch information
jdebacker committed Feb 20, 2017
2 parents fb5cce3 + 91a420b commit 3f02d38
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions btax/run_btax.py → btax/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from btax import format_output
from btax import visuals
from btax import visuals_plotly
from btax.front_end_util import (run_btax_to_json_tables,
from btax.front_end_util import (runner_json_tables,
replace_unicode_spaces)
from btax.util import DEFAULT_START_YEAR

Expand Down Expand Up @@ -95,7 +95,7 @@ def run_btax(test_run,baseline=False,start_year=DEFAULT_START_YEAR,iit_reform=No
return output_by_asset, output_by_industry


def run_btax_with_baseline_delta(test_run,start_year,iit_reform,**user_params):
def runner(test_run,start_year,iit_reform,**user_params):
econ_params = filter_user_params_for_econ(**user_params)
base_output_by_asset, base_output_by_industry = run_btax(test_run,True,start_year,{},**econ_params)
asset_row_grouping = {}
Expand Down
6 changes: 3 additions & 3 deletions btax/front_end_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

DO_ASSERTIONS = int(os.environ.get('BTAX_TABLE_ASSERTIONS', False))

def run_btax_to_json_tables(test_run=False,start_year=2016,iit_reform=None,**user_params):
from btax.run_btax import run_btax_with_baseline_delta, TABLE_ORDER
out = run_btax_with_baseline_delta(test_run,start_year,iit_reform,**user_params)
def runner_json_tables(test_run=False,start_year=2016,iit_reform=None,**user_params):
from btax.execute import runner, TABLE_ORDER
out = runner(test_run,start_year,iit_reform,**user_params)

tables = {'row_grouping': out.row_grouping}
for label, table in zip(TABLE_ORDER, out[:-1]):
Expand Down
9 changes: 1 addition & 8 deletions btax/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,15 @@ def translate_param_names(start_year=DEFAULT_START_YEAR,**user_mods):
"""Takes parameters names from UI and turns them into names used in btax
"""

# btax_betr_entity_Switch # If this parameter =True, then u_nc default to corp rate

year = start_year-PARAMETER_START_YEAR
defaults = dict(DEFAULTS)

# Handle depreciation system first since can only have one True for each
# asset class, so don't want to have this after the replace missing
# user defined params with defauls that is next.
class_list = [3, 5, 7, 10, 15, 20, 25, 27.5, 39]
class_list_str = [(str(i) if i != 27.5 else '27_5') for i in class_list]
user_deprec_system = {}
print('btax user_mods', user_mods)
for cl in class_list_str:
state = 'GDS'
if user_mods.get('btax_depr_{}yr_gds_Switch'.format(cl)):
Expand All @@ -54,9 +50,6 @@ def translate_param_names(start_year=DEFAULT_START_YEAR,**user_mods):

user_bonus_deprec = {cl: user_mods['btax_depr_{}yr_exp'.format(cl)]/100.
for cl in class_list_str}
# user_bonus_deprec = {cl: user_mods['btax_depr_{}yr_exp'.format(cl)]/100.
# for cl in class_list_str}


# Flag for expensing of inventories
expense_inventory = user_mods['btax_depr_expense_inventory']
Expand Down
5 changes: 3 additions & 2 deletions btax/tests/test_params_have_effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import pytest

from btax.parameters import DEFAULTS, get_params, translate_param_names
from btax.run_btax import run_btax_to_json_tables
from btax.execute import runner
import btax.front_end_util as front_end
from btax.front_end_util import runner_json_tables

front_end.DO_ASSERTIONS = True # Override env var
# Always assert table format okay
Expand All @@ -14,7 +15,7 @@ def tst_once(fast_or_slow, **user_params):
if fast_or_slow == 'slow':
# actually run the model
# and look at the "changed" tables
tables = run_btax_to_json_tables(**user_params)
tables = runner_json_tables(**user_params)
assert isinstance(tables, dict)
for k, v in tables.items():
if k in ('row_grouping', 'result_years',):
Expand Down

0 comments on commit 3f02d38

Please sign in to comment.