python-taxes 0.5.0__py3-none-any.whl → 0.6.0a3__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.
- python_taxes/__init__.py +7 -7
- python_taxes/__main__.py +4 -0
- python_taxes/cli.py +147 -0
- python_taxes/federal/__init__.py +19 -19
- python_taxes/federal/income/__init__.py +4 -4
- python_taxes/federal/income/payroll/automated.py +184 -174
- python_taxes/federal/income/tables/percentage/__init__.py +15 -15
- python_taxes/federal/income/tables/percentage/automated/hoh.py +309 -309
- python_taxes/federal/income/tables/percentage/automated/married.py +309 -309
- python_taxes/federal/income/tables/percentage/automated/single.py +309 -309
- python_taxes/federal/medicare.py +91 -89
- python_taxes/federal/social_security.py +55 -57
- {python_taxes-0.5.0.dist-info → python_taxes-0.6.0a3.dist-info}/LICENSE +21 -21
- {python_taxes-0.5.0.dist-info → python_taxes-0.6.0a3.dist-info}/METADATA +11 -9
- python_taxes-0.6.0a3.dist-info/RECORD +19 -0
- {python_taxes-0.5.0.dist-info → python_taxes-0.6.0a3.dist-info}/WHEEL +1 -1
- python_taxes-0.6.0a3.dist-info/entry_points.txt +3 -0
- python_taxes-0.5.0.dist-info/RECORD +0 -16
python_taxes/__init__.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
from decimal import Decimal
|
2
|
-
|
3
|
-
from pydantic import Field
|
4
|
-
|
5
|
-
CURRENT_TAX_YEAR = 2024
|
6
|
-
|
7
|
-
currency_field = Field(ge=Decimal("0.
|
1
|
+
from decimal import Decimal
|
2
|
+
|
3
|
+
from pydantic import Field
|
4
|
+
|
5
|
+
CURRENT_TAX_YEAR = 2024
|
6
|
+
|
7
|
+
currency_field = Field(ge=Decimal("0.00"), decimal_places=2)
|
python_taxes/__main__.py
ADDED
python_taxes/cli.py
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
import sys
|
2
|
+
from decimal import Decimal
|
3
|
+
from enum import Enum
|
4
|
+
from typing import Annotated
|
5
|
+
|
6
|
+
from pydantic import StrictBool, validate_call
|
7
|
+
|
8
|
+
from python_taxes import CURRENT_TAX_YEAR, currency_field
|
9
|
+
from python_taxes.federal.income import employer_withholding as income_withholding
|
10
|
+
from python_taxes.federal.medicare import required_withholding as med_withholding
|
11
|
+
from python_taxes.federal.social_security import withholding as ss_withholding
|
12
|
+
|
13
|
+
try:
|
14
|
+
import typer
|
15
|
+
except ImportError: # pragma: no cover
|
16
|
+
print("Error: typer not found. Command-line (cli) not available.")
|
17
|
+
sys.exit(1)
|
18
|
+
|
19
|
+
app = typer.Typer()
|
20
|
+
|
21
|
+
|
22
|
+
class PayFrequency(str, Enum):
|
23
|
+
semiannual = "semiannual"
|
24
|
+
quarterly = "quarterly"
|
25
|
+
monthly = "monthly"
|
26
|
+
semimonthly = "semimonthly"
|
27
|
+
biweekly = "biweekly"
|
28
|
+
weekly = "weekly"
|
29
|
+
daily = "daily"
|
30
|
+
|
31
|
+
|
32
|
+
class FilingStatus(str, Enum):
|
33
|
+
single = "single"
|
34
|
+
married = "married"
|
35
|
+
separate = "separate"
|
36
|
+
hoh = "hoh"
|
37
|
+
|
38
|
+
|
39
|
+
@validate_call
|
40
|
+
def currency(value: Annotated[Decimal, currency_field]) -> Decimal:
|
41
|
+
return value
|
42
|
+
|
43
|
+
|
44
|
+
@app.callback()
|
45
|
+
def callback():
|
46
|
+
"""
|
47
|
+
Calculate federal income related taxes with python-taxes CLI app: pytax
|
48
|
+
"""
|
49
|
+
|
50
|
+
|
51
|
+
@app.command()
|
52
|
+
def med(
|
53
|
+
wages: Annotated[
|
54
|
+
Decimal, typer.Argument(parser=currency, help="Taxable wages this period")
|
55
|
+
],
|
56
|
+
ytd: Annotated[
|
57
|
+
Decimal,
|
58
|
+
typer.Option(
|
59
|
+
parser=currency,
|
60
|
+
help="Total taxable wages paid year-to-date",
|
61
|
+
),
|
62
|
+
] = Decimal("0.00"),
|
63
|
+
selfemp: Annotated[
|
64
|
+
StrictBool,
|
65
|
+
typer.Option(help="Whether to calculate as self-employed"),
|
66
|
+
] = False,
|
67
|
+
round: Annotated[
|
68
|
+
StrictBool,
|
69
|
+
typer.Option(help="Whether to round the final value"),
|
70
|
+
] = False,
|
71
|
+
):
|
72
|
+
value = med_withholding(wages, ytd, selfemp, round)
|
73
|
+
print(value)
|
74
|
+
|
75
|
+
|
76
|
+
@app.command()
|
77
|
+
def ss(
|
78
|
+
wages: Annotated[
|
79
|
+
Decimal,
|
80
|
+
typer.Argument(parser=currency, help="Taxable wages this period"),
|
81
|
+
],
|
82
|
+
ytd: Annotated[
|
83
|
+
Decimal,
|
84
|
+
typer.Option(parser=currency, help="Total taxable wages paid year-to-date"),
|
85
|
+
] = Decimal("0.00"),
|
86
|
+
selfemp: Annotated[
|
87
|
+
StrictBool,
|
88
|
+
typer.Option(help="Whether to calculate as self-employed"),
|
89
|
+
] = False,
|
90
|
+
year: Annotated[int, typer.Option(help="Enter the tax year")] = CURRENT_TAX_YEAR,
|
91
|
+
round: Annotated[
|
92
|
+
StrictBool,
|
93
|
+
typer.Option(help="Whether to round the final value"),
|
94
|
+
] = False,
|
95
|
+
):
|
96
|
+
value = ss_withholding(wages, ytd, selfemp, year, round)
|
97
|
+
print(value)
|
98
|
+
|
99
|
+
|
100
|
+
@app.command()
|
101
|
+
def income(
|
102
|
+
wages: Annotated[
|
103
|
+
Decimal,
|
104
|
+
typer.Argument(parser=currency, help="Taxable wages this period"),
|
105
|
+
],
|
106
|
+
freq: Annotated[
|
107
|
+
PayFrequency, typer.Option(help="Pay frequency", case_sensitive=False)
|
108
|
+
] = PayFrequency.biweekly,
|
109
|
+
status: Annotated[
|
110
|
+
FilingStatus, typer.Option(help="Filing status", case_sensitive=False)
|
111
|
+
] = FilingStatus.single,
|
112
|
+
mjobs: Annotated[
|
113
|
+
StrictBool,
|
114
|
+
typer.Option(help="Multiple jobs: Select True if box in Step 2 on W-4 checked"),
|
115
|
+
] = False,
|
116
|
+
credits: Annotated[
|
117
|
+
Decimal,
|
118
|
+
typer.Option(
|
119
|
+
parser=currency, help="Amount to claim for dependents and credits"
|
120
|
+
),
|
121
|
+
] = Decimal("0.00"),
|
122
|
+
other: Annotated[
|
123
|
+
Decimal,
|
124
|
+
typer.Option(parser=currency, help="Income not from jobs"),
|
125
|
+
] = Decimal("0.00"),
|
126
|
+
deduct: Annotated[
|
127
|
+
Decimal,
|
128
|
+
typer.Option(parser=currency, help="Deductions other than standard"),
|
129
|
+
] = Decimal("0.00"),
|
130
|
+
extra: Annotated[
|
131
|
+
Decimal,
|
132
|
+
typer.Option(parser=currency, help="Extra to withhold each period"),
|
133
|
+
] = Decimal("0.00"),
|
134
|
+
year: Annotated[int, typer.Option(help="Enter the tax year")] = CURRENT_TAX_YEAR,
|
135
|
+
round: Annotated[
|
136
|
+
StrictBool,
|
137
|
+
typer.Option(help="Whether to round the final value"),
|
138
|
+
] = False,
|
139
|
+
):
|
140
|
+
value = income_withholding(
|
141
|
+
wages, freq, status, mjobs, credits, other, deduct, extra, year, round
|
142
|
+
)
|
143
|
+
print(value)
|
144
|
+
|
145
|
+
|
146
|
+
if __name__ == "__main__":
|
147
|
+
app() # pragma: no cover
|
python_taxes/federal/__init__.py
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
from decimal import ROUND_HALF_UP, Decimal, getcontext
|
2
|
-
|
3
|
-
getcontext().rounding = ROUND_HALF_UP
|
4
|
-
|
5
|
-
ROUNDED = Decimal("1.")
|
6
|
-
|
7
|
-
NOT_ROUNDED = Decimal("0.01")
|
8
|
-
|
9
|
-
rounding = {
|
10
|
-
True: ROUNDED,
|
11
|
-
False: NOT_ROUNDED,
|
12
|
-
}
|
13
|
-
|
14
|
-
|
15
|
-
# AfterValidator for tax_year
|
16
|
-
def is_valid_tax_year(value: int) -> int:
|
17
|
-
if value in [2023, 2024, 2025]:
|
18
|
-
return value
|
19
|
-
raise ValueError("Invalid tax year. Valid tax years are 2023, 2024, and 2025.")
|
1
|
+
from decimal import ROUND_HALF_UP, Decimal, getcontext
|
2
|
+
|
3
|
+
getcontext().rounding = ROUND_HALF_UP
|
4
|
+
|
5
|
+
ROUNDED = Decimal("1.")
|
6
|
+
|
7
|
+
NOT_ROUNDED = Decimal("0.01")
|
8
|
+
|
9
|
+
rounding = {
|
10
|
+
True: ROUNDED,
|
11
|
+
False: NOT_ROUNDED,
|
12
|
+
}
|
13
|
+
|
14
|
+
|
15
|
+
# AfterValidator for tax_year
|
16
|
+
def is_valid_tax_year(value: int) -> int:
|
17
|
+
if value in [2023, 2024, 2025]:
|
18
|
+
return value
|
19
|
+
raise ValueError("Invalid tax year. Valid tax years are 2023, 2024, and 2025.")
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from .payroll.automated import (
|
2
|
-
employer_withholding,
|
3
|
-
employer_withholding_pre_2020,
|
4
|
-
)
|
1
|
+
from .payroll.automated import (
|
2
|
+
employer_withholding,
|
3
|
+
employer_withholding_pre_2020,
|
4
|
+
)
|
@@ -1,174 +1,184 @@
|
|
1
|
-
from decimal import Decimal
|
2
|
-
from typing import Annotated, Literal
|
3
|
-
|
4
|
-
from pydantic import StrictBool, validate_call
|
5
|
-
|
6
|
-
from python_taxes import CURRENT_TAX_YEAR, currency_field
|
7
|
-
from python_taxes.federal import rounding
|
8
|
-
|
9
|
-
from ..tables.percentage.automated import hoh, married, single
|
10
|
-
|
11
|
-
PAY_FREQUENCY = {
|
12
|
-
"semiannual": 2,
|
13
|
-
"quarterly": 4,
|
14
|
-
"monthly": 12,
|
15
|
-
"semimonthly": 24,
|
16
|
-
"biweekly": 26,
|
17
|
-
"weekly": 52,
|
18
|
-
"daily": 260,
|
19
|
-
}
|
20
|
-
|
21
|
-
|
22
|
-
@validate_call
|
23
|
-
def employer_withholding(
|
24
|
-
taxable_wages: Annotated[Decimal, currency_field],
|
25
|
-
pay_frequency:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
case "
|
69
|
-
withholding_schedule =
|
70
|
-
case "
|
71
|
-
withholding_schedule =
|
72
|
-
deductions = deductions + Decimal("
|
73
|
-
case "
|
74
|
-
withholding_schedule =
|
75
|
-
case "
|
76
|
-
withholding_schedule =
|
77
|
-
deductions = deductions + Decimal("
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
withholding_rate
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
"""
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
)
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
1
|
+
from decimal import Decimal
|
2
|
+
from typing import Annotated, Literal
|
3
|
+
|
4
|
+
from pydantic import StrictBool, validate_call
|
5
|
+
|
6
|
+
from python_taxes import CURRENT_TAX_YEAR, currency_field
|
7
|
+
from python_taxes.federal import rounding
|
8
|
+
|
9
|
+
from ..tables.percentage.automated import hoh, married, single
|
10
|
+
|
11
|
+
PAY_FREQUENCY = {
|
12
|
+
"semiannual": 2,
|
13
|
+
"quarterly": 4,
|
14
|
+
"monthly": 12,
|
15
|
+
"semimonthly": 24,
|
16
|
+
"biweekly": 26,
|
17
|
+
"weekly": 52,
|
18
|
+
"daily": 260,
|
19
|
+
}
|
20
|
+
|
21
|
+
|
22
|
+
@validate_call
|
23
|
+
def employer_withholding(
|
24
|
+
taxable_wages: Annotated[Decimal, currency_field],
|
25
|
+
pay_frequency: Annotated[
|
26
|
+
str,
|
27
|
+
Literal[
|
28
|
+
"semiannual",
|
29
|
+
"quarterly",
|
30
|
+
"monthly",
|
31
|
+
"semimonthly",
|
32
|
+
"biweekly",
|
33
|
+
"weekly",
|
34
|
+
"daily",
|
35
|
+
],
|
36
|
+
] = "biweekly",
|
37
|
+
filing_status: Annotated[
|
38
|
+
str, Literal["single", "married", "separate", "hoh"]
|
39
|
+
] = "single",
|
40
|
+
multiple_jobs: StrictBool = False,
|
41
|
+
tax_credits: Annotated[Decimal, currency_field] = Decimal("0.00"),
|
42
|
+
other_income: Annotated[Decimal, currency_field] = Decimal("0.00"),
|
43
|
+
deductions: Annotated[Decimal, currency_field] = Decimal("0.00"),
|
44
|
+
extra_withholding: Annotated[Decimal, currency_field] = Decimal("0.00"),
|
45
|
+
tax_year: int = CURRENT_TAX_YEAR,
|
46
|
+
rounded: StrictBool = False,
|
47
|
+
) -> Decimal:
|
48
|
+
"""Calculate income tax withholding.
|
49
|
+
|
50
|
+
Formula used if Form W-4 is 2020 or later.
|
51
|
+
If W-4 is 2019 or earlier, use employer_withholding_pre_2020 instead.
|
52
|
+
|
53
|
+
Parameters:
|
54
|
+
taxable_wages -- Wages earned this year
|
55
|
+
pay_frequency -- Number of pay periods per year (default 'biweekly')
|
56
|
+
filing_status -- Filing status (default 'single')
|
57
|
+
multiple_jobs -- Indicates if box in Step 2 on W-4 is checked (default False)
|
58
|
+
tax_credits -- Dependant claims and other credits from Step 3 (default 0)
|
59
|
+
other_income -- Income not from jobs - Step 4 (default 0)
|
60
|
+
deductions -- If claiming deductions other than standard - Step 4 (default 0)
|
61
|
+
extra_withholding -- Extra amount to withhold each pay period - Step 4 (default 0)
|
62
|
+
tax_year -- Year for which you are filing (default CURRENT_TAX_YEAR)
|
63
|
+
rounded -- Round to nearest whole dollar amount (default False)
|
64
|
+
"""
|
65
|
+
|
66
|
+
# Steps 1a-1i
|
67
|
+
match filing_status:
|
68
|
+
case "single" | "separate" if multiple_jobs:
|
69
|
+
withholding_schedule = single.multiple_jobs
|
70
|
+
case "single" | "separate":
|
71
|
+
withholding_schedule = single.standard_schedule
|
72
|
+
deductions = deductions + Decimal("8600.00")
|
73
|
+
case "married" if multiple_jobs:
|
74
|
+
withholding_schedule = married.multiple_jobs
|
75
|
+
case "married":
|
76
|
+
withholding_schedule = married.standard_schedule
|
77
|
+
deductions = deductions + Decimal("12900.00")
|
78
|
+
case "hoh" if multiple_jobs:
|
79
|
+
withholding_schedule = hoh.multiple_jobs
|
80
|
+
case "hoh":
|
81
|
+
withholding_schedule = hoh.standard_schedule
|
82
|
+
deductions = deductions + Decimal("8600.00")
|
83
|
+
|
84
|
+
pay_freq = PAY_FREQUENCY[pay_frequency]
|
85
|
+
|
86
|
+
adjusted_wage = ((taxable_wages * pay_freq) + other_income) - deductions
|
87
|
+
|
88
|
+
# Step 2
|
89
|
+
if adjusted_wage < 0:
|
90
|
+
withholding_rate = withholding_schedule[tax_year][0]
|
91
|
+
for row in withholding_schedule[tax_year]:
|
92
|
+
if adjusted_wage >= row.min and adjusted_wage < row.max:
|
93
|
+
withholding_rate = row
|
94
|
+
break
|
95
|
+
|
96
|
+
tax_withholding = (adjusted_wage - withholding_rate.min) * Decimal(
|
97
|
+
withholding_rate.percent / 100
|
98
|
+
) + withholding_rate.withhold_amount
|
99
|
+
|
100
|
+
withheld_this_period = tax_withholding / pay_freq
|
101
|
+
|
102
|
+
# Step 3
|
103
|
+
if tax_credits:
|
104
|
+
withheld_this_period = withheld_this_period - (tax_credits / pay_freq)
|
105
|
+
|
106
|
+
# Step 4
|
107
|
+
if extra_withholding:
|
108
|
+
withheld_this_period = withheld_this_period + extra_withholding
|
109
|
+
|
110
|
+
return (
|
111
|
+
Decimal(withheld_this_period).quantize(rounding[rounded])
|
112
|
+
if withheld_this_period > 0
|
113
|
+
else Decimal("0.00")
|
114
|
+
)
|
115
|
+
|
116
|
+
|
117
|
+
@validate_call
|
118
|
+
def employer_withholding_pre_2020(
|
119
|
+
taxable_wages: Annotated[Decimal, currency_field],
|
120
|
+
pay_frequency: Annotated[
|
121
|
+
str,
|
122
|
+
Literal[
|
123
|
+
"semiannual",
|
124
|
+
"quarterly",
|
125
|
+
"monthly",
|
126
|
+
"semimonthly",
|
127
|
+
"biweekly",
|
128
|
+
"weekly",
|
129
|
+
"daily",
|
130
|
+
],
|
131
|
+
] = "biweekly",
|
132
|
+
marital_status: Annotated[str, Literal["single", "married", "separate"]] = "single",
|
133
|
+
allowances_claimed: int = 0,
|
134
|
+
extra_withholding: Annotated[Decimal, currency_field] = Decimal("0.00"),
|
135
|
+
tax_year: int = CURRENT_TAX_YEAR,
|
136
|
+
rounded: StrictBool = False,
|
137
|
+
) -> Decimal:
|
138
|
+
"""Calculate income tax withholding - only if Form W-4 is 2019 or earlier.
|
139
|
+
|
140
|
+
Parameters:
|
141
|
+
taxable_wages -- Wages earned this year
|
142
|
+
pay_frequency -- Number of pay periods per year (default 'biweekly')
|
143
|
+
marital_status -- Marital status (default 'single')
|
144
|
+
allowances_claimed -- Number of allowances claimed - Step 5 (default 0)
|
145
|
+
extra_withholding -- Extra amount to withhold each pay period - Step 6 (default 0)
|
146
|
+
tax_year -- Year for which you are filing (default CURRENT_TAX_YEAR)
|
147
|
+
rounded -- Round to nearest whole dollar amount (default False)
|
148
|
+
"""
|
149
|
+
|
150
|
+
# Steps 1a-1c and 1j-1l
|
151
|
+
match marital_status:
|
152
|
+
case "single" | "separate":
|
153
|
+
withholding_schedule = single.standard_schedule
|
154
|
+
case "married":
|
155
|
+
withholding_schedule = married.standard_schedule
|
156
|
+
|
157
|
+
pay_freq = PAY_FREQUENCY[pay_frequency]
|
158
|
+
|
159
|
+
allowances = allowances_claimed * Decimal("4300.00")
|
160
|
+
|
161
|
+
adjusted_wage = (taxable_wages * pay_freq) - allowances
|
162
|
+
|
163
|
+
# Step 2
|
164
|
+
for row in withholding_schedule[tax_year]:
|
165
|
+
if adjusted_wage >= row.min and adjusted_wage < row.max:
|
166
|
+
withholding_rate = row
|
167
|
+
break
|
168
|
+
|
169
|
+
tax_withholding = (adjusted_wage - withholding_rate.min) * Decimal(
|
170
|
+
withholding_rate.percent / 100
|
171
|
+
) + withholding_rate.withhold_amount
|
172
|
+
|
173
|
+
withheld_this_period = tax_withholding / pay_freq
|
174
|
+
|
175
|
+
# Step 3 skipped if W4 is from 2019 or earlier
|
176
|
+
# Step 4
|
177
|
+
if extra_withholding:
|
178
|
+
withheld_this_period = withheld_this_period + extra_withholding
|
179
|
+
|
180
|
+
return (
|
181
|
+
Decimal(withheld_this_period).quantize(rounding[rounded])
|
182
|
+
if withheld_this_period > 0
|
183
|
+
else Decimal("0.00")
|
184
|
+
)
|
@@ -1,15 +1,15 @@
|
|
1
|
-
from decimal import Decimal
|
2
|
-
from typing import NamedTuple
|
3
|
-
|
4
|
-
from pydantic import Field, PositiveInt
|
5
|
-
|
6
|
-
MAX = Decimal("999999999999.99")
|
7
|
-
|
8
|
-
|
9
|
-
class RateRow(NamedTuple):
|
10
|
-
"""Tax withholding rate schedule."""
|
11
|
-
|
12
|
-
min: Decimal = Field(ge=Decimal("0.00"), le=MAX, decimal_places=2)
|
13
|
-
max: Decimal = Field(ge=Decimal("0.00"), le=MAX, decimal_places=2)
|
14
|
-
withhold_amount: Decimal = Field(ge=Decimal("0.00"), le=MAX, decimal_places=2)
|
15
|
-
percent: PositiveInt = Field(le=100)
|
1
|
+
from decimal import Decimal
|
2
|
+
from typing import NamedTuple
|
3
|
+
|
4
|
+
from pydantic import Field, PositiveInt
|
5
|
+
|
6
|
+
MAX = Decimal("999999999999.99")
|
7
|
+
|
8
|
+
|
9
|
+
class RateRow(NamedTuple):
|
10
|
+
"""Tax withholding rate schedule."""
|
11
|
+
|
12
|
+
min: Decimal = Field(ge=Decimal("0.00"), le=MAX, decimal_places=2)
|
13
|
+
max: Decimal = Field(ge=Decimal("0.00"), le=MAX, decimal_places=2)
|
14
|
+
withhold_amount: Decimal = Field(ge=Decimal("0.00"), le=MAX, decimal_places=2)
|
15
|
+
percent: PositiveInt = Field(le=100)
|