Skip to content

Commit

Permalink
V0 à zéro
Browse files Browse the repository at this point in the history
  • Loading branch information
guillett committed Nov 15, 2024
1 parent 414d481 commit 53aceb8
Show file tree
Hide file tree
Showing 45 changed files with 67 additions and 32 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OpenFisca Country-Template
# OpenFisca Nouvelle Calédonie

This repository helps you quickly set up and use your own OpenFisca country
package.
Expand Down
4 changes: 2 additions & 2 deletions first-time-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ then
echo 'It seems you cloned this repository, or already initialised it.'
echo 'Refusing to go further as you might lose work.'
echo "If you are certain this is a new repository, run 'cd $(dirname $0) && rm -rf .git' to erase the history."
exit 2
#exit 2
fi

while [[ ! "$JURISDICTION_NAME" ]]
Expand Down Expand Up @@ -81,7 +81,7 @@ all_module_files=`find openfisca_country_template -type f ! -name "*.DS_Store"`
echo -e "${PURPLE}* ${PURPLE}Replace default country_template references\033[0m"
# Use intermediate backup files (`-i`) with a weird syntax due to lack of portable 'no backup' option. See https://stackoverflow.com/q/5694228/594053.
sed -i.template "s|openfisca-country_template|openfisca-$NO_SPACES_JURISDICTION_LABEL|g" README.md Makefile pyproject.toml CONTRIBUTING.md
sed -i.template "s|country_template|$SNAKE_CASE_JURISDICTION|g" README.md pyproject.toml .flake8 Makefile MANIFEST.in $all_module_files
sed -i.template "s|country_template|$SNAKE_CASE_JURISDICTION|g" README.md pyproject.toml Makefile MANIFEST.in $all_module_files
sed -i.template "s|Country-Template|$JURISDICTION_NAME|g" README.md pyproject.toml .github/PULL_REQUEST_TEMPLATE.md CONTRIBUTING.md

echo -e "${PURPLE}* ${PURPLE}Remove bootstrap instructions\033[0m"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

from openfisca_core.taxbenefitsystems import TaxBenefitSystem

from openfisca_country_template import entities
from openfisca_country_template.situation_examples import couple
from openfisca_nouvelle_caledonie import entities
from openfisca_nouvelle_caledonie.situation_examples import couple

COUNTRY_DIR = os.path.dirname(os.path.abspath(__file__))

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ values:
# This parameter is only defined from the 1st of Jan 2010 to the 3Oth of Nov 2016.
2010-01-01:
value: 0.25
2016-12-01:
value: null
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from openfisca_core.variables import Variable

# Import the Entities specifically defined for this tax and benefit system
from openfisca_country_template.entities import Person
from openfisca_nouvelle_caledonie.entities import Person


def create_dynamic_variable(name, **variable):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from openfisca_core.variables import Variable

# Import the Entities specifically defined for this tax and benefit system
from openfisca_country_template.entities import Person
from openfisca_nouvelle_caledonie.entities import Person


class has_car(Variable):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Note the `reforms: ` key in the below YAML blocks.

- name: We will dynamically add a new variable "goes_to_school" thanks to a reform
reforms: openfisca_country_template.reforms.add_dynamic_variable.add_dynamic_variable
reforms: openfisca_nouvelle_caledonie.reforms.add_dynamic_variable.add_dynamic_variable
period: 2017-01
output:
goes_to_school: true
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Note the `reforms: ` key in the below YAML blocks.

- name: The new tax applies to car-holding people
reforms: openfisca_country_template.reforms.add_new_tax.add_new_tax
reforms: openfisca_nouvelle_caledonie.reforms.add_new_tax.add_new_tax
period: 2017-01
input:
salary: 2000
Expand All @@ -16,7 +16,7 @@
new_tax: 400

- name: The new tax does not apply otherwise
reforms: openfisca_country_template.reforms.add_new_tax.add_new_tax
reforms: openfisca_nouvelle_caledonie.reforms.add_new_tax.add_new_tax
period: 2017-01
input:
salary: 2000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
# Note the `reforms: ` key in the below YAML blocks.

- name: No social security contribution on small salaries
reforms: openfisca_country_template.reforms.modify_social_security_taxation.modify_social_security_taxation
reforms: openfisca_nouvelle_caledonie.reforms.modify_social_security_taxation.modify_social_security_taxation
period: 2017-01
input:
salary: 2000
output:
social_security_contribution: 0

- name: Increased social security contribution on medium salaries
reforms: openfisca_country_template.reforms.modify_social_security_taxation.modify_social_security_taxation
reforms: openfisca_nouvelle_caledonie.reforms.modify_social_security_taxation.modify_social_security_taxation
period: 2017-01
input:
salary: 15000
output:
social_security_contribution: 1336

- name: High social security contribution on high salaries
reforms: openfisca_country_template.reforms.modify_social_security_taxation.modify_social_security_taxation
reforms: openfisca_nouvelle_caledonie.reforms.modify_social_security_taxation.modify_social_security_taxation
period: 2017-01
input:
salary: 50000
Expand Down
38 changes: 38 additions & 0 deletions openfisca_nouvelle_caledonie/variables/aide_logement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from openfisca_core.indexed_enums import Enum
from openfisca_core.periods import MONTH
from openfisca_core.variables import Variable
from openfisca_nouvelle_caledonie.entities import Household


class TypologieLogement(Enum):
__order__ = "chambre f1 f2 f3 f4 f5p maisonderetraite"
chambre = "Chambre"
f1 = "F1"
f2 = "F2"
f3 = "F3"
f4 = "F4"
f5p = "F5 et plus"
maisonderetraite = "Maison de retraite"


class typologie_logement(Variable):
value_type = Enum
possible_values = TypologieLogement
default_value = TypologieLogement.chambre
entity = Household
definition_period = MONTH
label = "Legal housing situation of the household concerning their main residence"


class aide_logement(Variable):
value_type = float
entity = Household
definition_period = MONTH
label = "Aide au logement"


class loyer(Variable):
value_type = float
entity = Household
definition_period = MONTH
label = "Aide au sogement"
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from openfisca_core.variables import Variable

# Import the Entities specifically defined for this tax and benefit system
from openfisca_country_template.entities import Household, Person
from openfisca_nouvelle_caledonie.entities import Household, Person


class basic_income(Variable):
Expand Down Expand Up @@ -62,7 +62,6 @@ class housing_allowance(Variable):
reference = "https://law.gov.example/housing_allowance"
# This allowance was removed on the 1st of Dec 2016. Calculating it before
# this date will always return the variable default value, 0.
end = "2016-11-30"
unit = "currency-EUR"
documentation = """
This allowance was introduced on the 1st of Jan 1980.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from openfisca_core.variables import Variable

# Import the Entities specifically defined for this tax and benefit system
from openfisca_country_template.entities import Person
from openfisca_nouvelle_caledonie.entities import Person


# This variable is a pure input: it doesn't have a formula
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from openfisca_core.variables import Variable

# Import the Entities specifically defined for this tax and benefit system
from openfisca_country_template.entities import Household
from openfisca_nouvelle_caledonie.entities import Household


# This variable is a pure input: it doesn't have a formula
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from openfisca_core.variables import Variable

# Import the Entities specifically defined for this tax and benefit system
from openfisca_country_template.entities import Person
from openfisca_nouvelle_caledonie.entities import Person


# This variable is a pure input: it doesn't have a formula
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from openfisca_core.variables import Variable

# Import the Entities specifically defined for this tax and benefit system
from openfisca_country_template.entities import Household
from openfisca_nouvelle_caledonie.entities import Household


class total_benefits(Variable):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from openfisca_core.variables import Variable

# Import the Entities specifically defined for this tax and benefit system
from openfisca_country_template.entities import Household, Person
from openfisca_nouvelle_caledonie.entities import Household, Person


class income_tax(Variable):
Expand Down
20 changes: 10 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ build-backend = "setuptools.build_meta"
requires = [ "setuptools>=61" ]

[project]
name = "openfisca-country_template"
name = "openfisca-nouvelle_caledonie"
version = "7.1.8"
description = "OpenFisca Rules as Code model for Country-Template."
description = "OpenFisca Rules as Code model for Nouvelle Calédonie."
readme = "README.md"
keywords = [ "benefit", "microsimulation", "rac", "rules-as-code", "tax" ]
maintainers = [ ]
Expand All @@ -32,11 +32,11 @@ optional-dependencies.dev = [
"ruff-lsp>=0.0.57,<1",
"yamllint>=1.35.1",
]
urls.Changelog = "https://github.com/openfisca/country-template/blob/main/CHANGELOG.md"
urls.Changelog = "https://github.com/openfisca/openfisca-nouvelle_caledonie/blob/main/CHANGELOG.md"
urls.Documentation = "https://openfisca.org/doc"
urls.Homepage = "https://github.com/openfisca/country-template"
urls.Issues = "https://github.com/openfisca/country-template/issues"
urls.Repository = "https://github.com/openfisca/country-template"
urls.Homepage = "https://github.com/openfisca/openfisca-nouvelle_caledonie"
urls.Issues = "https://github.com/openfisca/openfisca-nouvelle_caledonie/issues"
urls.Repository = "https://github.com/openfisca/openfisca-nouvelle_caledonie"

[tool.ruff]
target-version = "py39"
Expand Down Expand Up @@ -68,7 +68,7 @@ force_alphabetical_sort_within_sections = false
group_by_package = true
honor_noqa = true
include_trailing_comma = true
known_first_party = [ "openfisca_country_template" ]
known_first_party = [ "openfisca-nouvelle_caledonie" ]
known_openfisca = [ "openfisca_core", "openfisca_extension_template" ]
known_typing = [ "*collections.abc*", "*typing*", "*typing_extensions*" ]
known_types = [ "*types*" ]
Expand All @@ -93,7 +93,7 @@ max_supported_python = "3.11"

[tool.pytest.ini_options]
addopts = "--exitfirst --showlocals --doctest-modules --disable-warnings --import-mode importlib"
testpaths = [ "openfisca_country_template/tests" ]
testpaths = [ "openfisca_nouvelle_caledonie/tests" ]
python_files = "**/*.py"

[tool.tox]
Expand All @@ -109,7 +109,7 @@ commands_pre = [
"install",
"--find-links",
".",
"openfisca-country_template",
"openfisca-nouvelle_caledonie",
],
]

Expand All @@ -123,7 +123,7 @@ commands_pre = [
"install",
"--find-links",
".",
"openfisca-country_template[dev]",
"openfisca-nouvelle_caledonie[dev]",
],
]

Expand Down

0 comments on commit 53aceb8

Please sign in to comment.