Skip to content

Refactor GainsTax function in calcfunctions.py module#3044

Merged
martinholmer merged 1 commit into
PSLmodels:masterfrom
martinholmer:GainsTax-review
May 10, 2026
Merged

Refactor GainsTax function in calcfunctions.py module#3044
martinholmer merged 1 commit into
PSLmodels:masterfrom
martinholmer:GainsTax-review

Conversation

@martinholmer
Copy link
Copy Markdown
Collaborator

Refactor GainsTax: collapse hasqdivltcg flag, drop dead c05100, rename c24510

Three behavior-preserving cleanups in GainsTax:

  • Replace the 9-line hasqdivltcg int-flag pattern (three if-blocks
    setting 1/0 followed by if hasqdivltcg == 1) with a single boolean
    has_qdivltcg = (not CG_nodiff) and (any of the five qual-div / LTCG inputs > 0).

  • Remove dead intermediate local c05100 (= c24580; pure local, never
    returned, never re-read). Foreign-earned-income-exclusion rationale
    moved to a one-line comment; final assembly is now taxbc = c24580.

  • Rename single-use local c24510 → line9_base. c24510 was a relic of
    an old Form 1040 Schedule D line label that no longer matches any
    current IRS line; line9_base signals its role as the input to the
    Sch D TW line-9 dwks9 calculation.

No function signature change, no return-tuple change, no body-formula change.

Sch D TW / QDCGTW logic, banner section comments, and docstring unchanged.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b90305d) to head (6dff19c).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #3044   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines         2721      2721           
=========================================
  Hits          2721      2721           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@martinholmer martinholmer merged commit f48546d into PSLmodels:master May 10, 2026
9 checks passed
@martinholmer martinholmer deleted the GainsTax-review branch May 10, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant