Skip to content

Commit

Permalink
Reformatting with black
Browse files Browse the repository at this point in the history
  • Loading branch information
vahid-ahmadi committed Jan 13, 2025
1 parent 12d24be commit 235fd08
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ class child_age_eligible(Variable):
value_type = bool
entity = Person
label = "Child age eligibility requirements"
documentation = (
"Whether this person meets the age and disability requirements for eligibility"
)
documentation = "Whether this person meets the age and disability requirements for eligibility"
definition_period = YEAR

def formula(person, period, parameters):
Expand All @@ -17,16 +15,11 @@ def formula(person, period, parameters):
Returns:
bool: True if eligible (under standard age limit, or under disability age limit with disability), False otherwise
"""
# Get the benefit unit the person belongs to
benunit = person.benunit

# Get person's characteristics
age = person("age", period)

# Get age thresholds from parameters
age_limits = parameters(
period
).gov.hmrc.childcare_subsidies.tax_free_childcare.age_limits
age_limits = parameters(period).gov.hmrc.childcare_subsidies.tax_free_childcare.age_limits
standard_age_limit = age_limits.standard_age_limit
disability_age_limit = age_limits.disability_age_limit

Expand All @@ -47,4 +40,4 @@ def formula(person, period, parameters):
# Combine conditions
eligible = basic_age_condition | (age_under_disability_limit & is_disabled)

return eligible
return eligible
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class meets_income_requirements(Variable):
definition_period = YEAR

def formula(person, period, parameters):
"""
Calculate if a person meets income requirements based on their age and income.
"""Calculate if a person meets income requirements based on their age and income.
Returns:
bool: True if they meet the income conditions for their age group
Expand All @@ -35,9 +34,7 @@ def formula(person, period, parameters):
yearly_eligible_income = total_income - investment_income

# Get income thresholds from parameters
income_limits = parameters(
period
).gov.hmrc.childcare_subsidies.tax_free_childcare.income_thresholds
income_limits = parameters(period).gov.hmrc.childcare_subsidies.tax_free_childcare.income_thresholds
quarterly_income = yearly_eligible_income / 4

# Age >= 21
Expand All @@ -58,6 +55,4 @@ def formula(person, period, parameters):
)

# Combine all conditions
return (
meets_adult_condition | meets_young_adult_condition | meets_youth_condition
)
return meets_adult_condition | meets_young_adult_condition | meets_youth_condition
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ class childcare_work_condition(Variable):
value_type = bool
entity = Person
label = "Work conditions for tax-free childcare"
documentation = (
"Whether the person/couple meets work requirements for tax-free childcare"
)
documentation = "Whether the person/couple meets work requirements for tax-free childcare"
definition_period = YEAR

def formula(person, period, parameters):
"""
Calculate if person meets work conditions for:
"""Calculate if person meets work conditions for:
- Single working adult
- Couple where either both work or one works and other has disability/incapacity
"""
Expand Down Expand Up @@ -48,13 +45,11 @@ def formula(person, period, parameters):
is_partner_working_with_disabled_person = (
is_couple & partner_in_work & (is_disabled | has_incapacity)
)
is_person_working_with_disabled_partner = (
is_couple & in_work & partner_has_condition
)
is_person_working_with_disabled_partner = is_couple & in_work & partner_has_condition

return (
single_working
| couple_both_working
| is_person_working_with_disabled_partner
| is_partner_working_with_disabled_person
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class tax_free_childcare(Variable):
unit = GBP

def formula(benunit, period, parameters):
"""
Calculate the government contribution for tax-free childcare.
"""Calculate the government contribution for tax-free childcare.
Args:
benunit: The benefit unit
Expand All @@ -25,9 +24,7 @@ def formula(benunit, period, parameters):
parents_contribution = benunit("childcare_cost", period)

# Get parameters from the parameter tree
p = parameters(
period
).gov.hmrc.childcare_subsidies.tax_free_childcare.contribution_parameters
p = parameters(period).gov.hmrc.childcare_subsidies.tax_free_childcare.contribution_parameters

# Check eligibility conditions
meets_age_condition = benunit("child_age_eligible", period)
Expand Down Expand Up @@ -55,4 +52,4 @@ def formula(benunit, period, parameters):
max_amount,
)

return where(is_eligible, government_contribution, 0)
return where(is_eligible, government_contribution, 0)

0 comments on commit 235fd08

Please sign in to comment.