taxcalc 4.3.1__py3-none-any.whl → 4.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
taxcalc/__init__.py CHANGED
@@ -14,6 +14,6 @@ from taxcalc.taxcalcio import *
14
14
  from taxcalc.utils import *
15
15
  from taxcalc.cli import *
16
16
 
17
- __version__ = '4.3.1'
17
+ __version__ = '4.3.3'
18
18
  __min_python3_version__ = 10
19
19
  __max_python3_version__ = 12
taxcalc/calculator.py CHANGED
@@ -698,7 +698,8 @@ class Calculator():
698
698
  self.policy_param('FICA_ss_trt_employee') +
699
699
  self.policy_param('FICA_mc_trt_employer') +
700
700
  self.policy_param('FICA_mc_trt_employee')),
701
- 0.5 * (self.policy_param('FICA_mc_trt_employer') + self.policy_param('FICA_mc_trt_employee')))
701
+ 0.5 * (self.policy_param('FICA_mc_trt_employer') +
702
+ self.policy_param('FICA_mc_trt_employee')))
702
703
  else:
703
704
  adj = 0.0
704
705
  # compute marginal tax rates
@@ -1189,11 +1190,10 @@ class Calculator():
1189
1190
  for pname in baseline.keys():
1190
1191
  upda_value = getattr(updated, pname)
1191
1192
  base_value = getattr(baseline, pname)
1193
+ is_array = isinstance(upda_value, np.ndarray)
1192
1194
  if (
1193
- (isinstance(upda_value, np.ndarray) and
1194
- np.allclose(upda_value, base_value)) or
1195
- (not isinstance(upda_value, np.ndarray) and
1196
- upda_value != base_value)
1195
+ (is_array and not np.allclose(upda_value, base_value))
1196
+ or (is_array == False and upda_value != base_value)
1197
1197
  ):
1198
1198
  params_with_diff.append(pname)
1199
1199
  if params_with_diff:
@@ -1248,7 +1248,7 @@ class Calculator():
1248
1248
  else: # if baseline is GrowDiff object
1249
1249
  # each GrowDiff parameter has zero as default value
1250
1250
  doc += ' baseline_value: 0.0\n'
1251
- del mdata_base
1251
+ del mdata_base
1252
1252
  return doc
1253
1253
 
1254
1254
  # begin main logic of reform_documentation
taxcalc/growfactors.py CHANGED
@@ -38,7 +38,7 @@ class GrowFactors():
38
38
  which is for use with puf and cps data from the taxdata repository.
39
39
  """
40
40
 
41
- PACKAGE_FILE_NAMES = ['growfactors.csv', 'tmd_growfactors.csv']
41
+ PACKAGE_FILE_NAMES = ['growfactors.csv']
42
42
  FILE_PATH = os.path.abspath(os.path.dirname(__file__))
43
43
 
44
44
  VALID_NAMES = set(['ABOOK', 'ACGNS', 'ACPIM', 'ACPIU',
taxcalc/policy.py CHANGED
@@ -7,6 +7,7 @@ Tax-Calculator federal tax policy Policy class.
7
7
 
8
8
  import os
9
9
  import json
10
+ from pathlib import Path
10
11
  import numpy as np
11
12
  from taxcalc.parameters import Parameters
12
13
  from taxcalc.growfactors import GrowFactors
@@ -37,7 +38,7 @@ class Policy(Parameters):
37
38
  DEFAULTS_FILE_NAME = 'policy_current_law.json'
38
39
  DEFAULTS_FILE_PATH = os.path.abspath(os.path.dirname(__file__))
39
40
  JSON_START_YEAR = 2013 # remains the same unless earlier data added
40
- LAST_KNOWN_YEAR = 2024 # last year for which indexed param vals are known
41
+ LAST_KNOWN_YEAR = 2025 # last year for which indexed param vals are known
41
42
  # should increase LAST_KNOWN_YEAR by one every calendar year
42
43
  LAST_BUDGET_YEAR = 2034 # last extrapolation year
43
44
  # should increase LAST_BUDGET_YEAR by one every calendar year
@@ -80,7 +81,7 @@ class Policy(Parameters):
80
81
  # (3) specify which Policy parameters are wage (rather than price) indexed
81
82
  WAGE_INDEXED_PARAMS = ['SS_Earnings_c', 'SS_Earnings_thd']
82
83
 
83
- def __init__(self, gfactors=None, only_reading_defaults=False, **kwargs):
84
+ def __init__(self, gfactors=None, **kwargs):
84
85
  # put JSON contents of DEFAULTS_FILE_NAME into self._vals dictionary
85
86
  super().__init__()
86
87
  # handle gfactors argument
@@ -92,7 +93,6 @@ class Policy(Parameters):
92
93
  raise ValueError('gfactors is not None or a GrowFactors instance')
93
94
  # read default parameters and initialize
94
95
  syr = Policy.JSON_START_YEAR
95
- lyr = Policy.LAST_BUDGET_YEAR
96
96
  nyrs = Policy.DEFAULT_NUM_YEARS
97
97
  self._inflation_rates = None
98
98
  self._wage_growth_rates = None
@@ -101,6 +101,19 @@ class Policy(Parameters):
101
101
  Policy.REDEFINED_PARAMS,
102
102
  Policy.WAGE_INDEXED_PARAMS, **kwargs)
103
103
 
104
+ @staticmethod
105
+ def tmd_constructor(growfactors_path): # pragma: no cover
106
+ """
107
+ Static method returns a Policy object instantiated with TMD
108
+ input data. This convenience method works in a analogous way
109
+ to Policy(), which returns a Policy object instantiated with
110
+ non-TMD input data.
111
+ """
112
+ assert isinstance(growfactors_path, Path)
113
+ gf_filename = str(growfactors_path)
114
+ tmd_growfactors = GrowFactors(growfactors_filename=gf_filename)
115
+ return Policy(gfactors=tmd_growfactors)
116
+
104
117
  @staticmethod
105
118
  def read_json_reform(obj):
106
119
  """
@@ -129,7 +142,7 @@ class Policy(Parameters):
129
142
  Policy.DEFAULTS_FILE_PATH,
130
143
  Policy.DEFAULTS_FILE_NAME
131
144
  )
132
- with open(path) as f:
145
+ with open(path, 'r', encoding='utf-8') as f:
133
146
  defaults = json.loads(f.read()) # pylint: disable=protected-access
134
147
  return [k for k in defaults if k != "schema"]
135
148