|
207 | 207 | "from policyengine_uk import Simulation\n", |
208 | 208 | "\n", |
209 | 209 | "\n", |
210 | | - "def calculate_taxes(employment_income, dividend_income, savings_interest_income):\n", |
| 210 | + "def calculate_taxes(\n", |
| 211 | + " employment_income, dividend_income, savings_interest_income\n", |
| 212 | + "):\n", |
211 | 213 | " simulation = Simulation(\n", |
212 | 214 | " situation={\n", |
213 | 215 | " \"people\": {\n", |
|
220 | 222 | " }\n", |
221 | 223 | " )\n", |
222 | 224 | " income_tax = simulation.calculate(\"income_tax\")[0]\n", |
223 | | - " dividend_income_tax = simulation.calculate(\"dividend_income_tax\")[0] # Added\n", |
| 225 | + " dividend_income_tax = simulation.calculate(\"dividend_income_tax\")[\n", |
| 226 | + " 0\n", |
| 227 | + " ] # Added\n", |
224 | 228 | " savings_income_tax = simulation.calculate(\"savings_income_tax\")[0] # Added\n", |
225 | 229 | "\n", |
226 | 230 | " return income_tax, dividend_income_tax, savings_income_tax\n", |
|
241 | 245 | " data[\"Dividend Income (£)\"],\n", |
242 | 246 | " data[\"Savings Interest Income (£)\"],\n", |
243 | 247 | "):\n", |
244 | | - " income_tax, div_tax, sav_tax = calculate_taxes(emp_income, div_income, sav_income)\n", |
| 248 | + " income_tax, div_tax, sav_tax = calculate_taxes(\n", |
| 249 | + " emp_income, div_income, sav_income\n", |
| 250 | + " )\n", |
245 | 251 | " data[\"Income Tax (£)\"].append(income_tax)\n", |
246 | 252 | " data[\"Dividend Income Tax (£)\"].append(div_tax)\n", |
247 | 253 | " data[\"Savings Income Tax (£)\"].append(sav_tax)\n", |
|
518 | 524 | "from policyengine_uk.system import system\n", |
519 | 525 | "import pandas as pd\n", |
520 | 526 | "\n", |
521 | | - "default = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.default\n", |
522 | | - "minimum = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.minimum\n", |
| 527 | + "default = (\n", |
| 528 | + " system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.default\n", |
| 529 | + ")\n", |
| 530 | + "minimum = (\n", |
| 531 | + " system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.minimum\n", |
| 532 | + ")\n", |
523 | 533 | "reduction_rate = (\n", |
524 | 534 | " system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.reduction_rate\n", |
525 | 535 | ")\n", |
|
549 | 559 | "\n", |
550 | 560 | "\n", |
551 | 561 | "max = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.max\n", |
552 | | - "rounding_increment = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.rounding_increment\n", |
| 562 | + "rounding_increment = (\n", |
| 563 | + " system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.rounding_increment\n", |
| 564 | + ")\n", |
553 | 565 | "takeup_rate = (\n", |
554 | 566 | " system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.takeup_rate\n", |
555 | 567 | ")\n", |
|
574 | 586 | "}\n", |
575 | 587 | "\n", |
576 | 588 | "\n", |
577 | | - "deduction_rate = system.parameters.gov.hmrc.income_tax.allowances.married_couples_allowance.deduction_rate\n", |
| 589 | + "deduction_rate = (\n", |
| 590 | + " system.parameters.gov.hmrc.income_tax.allowances.married_couples_allowance.deduction_rate\n", |
| 591 | + ")\n", |
578 | 592 | "married_couples_allowance_data = {\n", |
579 | 593 | " \"Attribute\": [\"Married Couples Allowance\"],\n", |
580 | 594 | " \"Type\": [\"Deduction Rate\"],\n", |
|
584 | 598 | "}\n", |
585 | 599 | "\n", |
586 | 600 | "\n", |
587 | | - "amount = system.parameters.gov.hmrc.income_tax.allowances.personal_allowance.amount\n", |
| 601 | + "amount = (\n", |
| 602 | + " system.parameters.gov.hmrc.income_tax.allowances.personal_allowance.amount\n", |
| 603 | + ")\n", |
588 | 604 | "values = [item.value for item in amount.values_list]\n", |
589 | 605 | "dates = [item.instant_str for item in amount.values_list]\n", |
590 | 606 | "personal_allowance_data = {\n", |
|
596 | 612 | "}\n", |
597 | 613 | "\n", |
598 | 614 | "\n", |
599 | | - "addtional_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.additional\n", |
| 615 | + "addtional_threshold = (\n", |
| 616 | + " system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.additional\n", |
| 617 | + ")\n", |
600 | 618 | "basic_threshold = (\n", |
601 | 619 | " system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.basic\n", |
602 | 620 | ")\n", |
|
624 | 642 | "}\n", |
625 | 643 | "\n", |
626 | 644 | "\n", |
627 | | - "dividend_allowance = system.parameters.gov.hmrc.income_tax.allowances.dividend_allowance\n", |
| 645 | + "dividend_allowance = (\n", |
| 646 | + " system.parameters.gov.hmrc.income_tax.allowances.dividend_allowance\n", |
| 647 | + ")\n", |
628 | 648 | "dividend_allowance_data = {\n", |
629 | 649 | " \"Attribute\": [\"Dividend Allowance\"],\n", |
630 | 650 | " \"Type\": [\"Dividend Allowance\"],\n", |
|
634 | 654 | "}\n", |
635 | 655 | "\n", |
636 | 656 | "\n", |
637 | | - "property_allowance = system.parameters.gov.hmrc.income_tax.allowances.property_allowance\n", |
| 657 | + "property_allowance = (\n", |
| 658 | + " system.parameters.gov.hmrc.income_tax.allowances.property_allowance\n", |
| 659 | + ")\n", |
638 | 660 | "property_allowance_data = {\n", |
639 | 661 | " \"Attribute\": [\"Property Allowance\"],\n", |
640 | 662 | " \"Type\": [\"Property Allowance\"],\n", |
|
644 | 666 | "}\n", |
645 | 667 | "\n", |
646 | 668 | "\n", |
647 | | - "trading_allowance = system.parameters.gov.hmrc.income_tax.allowances.trading_allowance\n", |
| 669 | + "trading_allowance = (\n", |
| 670 | + " system.parameters.gov.hmrc.income_tax.allowances.trading_allowance\n", |
| 671 | + ")\n", |
648 | 672 | "trading_allowance_data = {\n", |
649 | 673 | " \"Attribute\": [\"Trading Allowance\"],\n", |
650 | 674 | " \"Type\": [\"Trading Allowance\"],\n", |
|
0 commit comments