Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add spell check #1282

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .conda/openfisca-country-template/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ source:
sha256: b2f2ac9945d9ccad467aed0925bd82f7f4d5ce4e96b212324cd071b8bee46914

build:
number: 1
number: 2
noarch: python
script: pip install . -v --no-deps

Expand All @@ -26,7 +26,7 @@ requirements:
run:
- numpy
- python
- openfisca-core >=42,<44
- openfisca-core >=42

about:
summary: OpenFisca Rules as Code model for Country-Template.
Expand Down
4 changes: 2 additions & 2 deletions .conda/openfisca-extension-template/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ source:
sha256: e16ee9cbefdd5e9ddc1c2c0e12bcd74307c8cb1be55353b3b2788d64a90a5df9

build:
number: 1
number: 2
noarch: python
script: pip install . -v --no-deps

Expand All @@ -26,7 +26,7 @@ requirements:
run:
- numpy
- python
- openfisca-country-template >=7.1.5,<8
- openfisca-country-template >=7.1.5

about:
summary: An OpenFisca extension that adds some variables to an already-existing
Expand Down
60 changes: 33 additions & 27 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

### 43.1.1 [#1282](https://github.com/openfisca/openfisca-core/pull/1282)

#### Technical changes

- Add check to spot common spelling mistakes

## 43.1.0 [#1255](https://github.com/openfisca/openfisca-core/pull/1255)

#### New features
Expand Down Expand Up @@ -791,7 +797,7 @@ _Note: this version has been unpublished due to an issue introduced by NumPy upg
#### Bug fix

- Repair expansion of axes on a variable given as input
- When expanding axes, the expected behavour is to override any input value for the requested variable and period
- When expanding axes, the expected behaviour is to override any input value for the requested variable and period
- As longs as we passed some input for a variable on a period, it was not being overrode, creating a NumPy's error (boradcasting)
- By additionally checking that an input was given, now we make that the array has the correct shape by constructing it with NumPy's tile with a shape equal to the number of the axis expansion count requested.

Expand Down Expand Up @@ -860,7 +866,7 @@ _Note: this version has been unpublished due to an issue introduced by NumPy upg

#### Technical changes

- Improve error message when laoding parameters file to detect the problematic file
- Improve error message when loading parameters file to detect the problematic file

### 35.0.3 [#961](https://github.com/openfisca/openfisca-core/pull/961)

Expand All @@ -874,7 +880,7 @@ _Note: this version has been unpublished due to an issue introduced by NumPy upg

#### Technical changes

- Update dependency: `flask-cors` (`Flask` extension for Cross Origin Resouce Sharing)
- Update dependency: `flask-cors` (`Flask` extension for Cross Origin Resource Sharing)

### 35.0.1 [#968](https://github.com/openfisca/openfisca-core/pull/968)

Expand Down Expand Up @@ -1134,7 +1140,7 @@ _Note: this version has been unpublished due to an issue introduced by it. Pleas

### 34.4.4 [#908](https://github.com/openfisca/openfisca-core/pull/908)

- Make parameter cloning return clones that are truly independant from their source
- Make parameter cloning return clones that are truly independent from their source
- Before this PR, editing the clone of a parameter tree would change the initial tree
- Only impacts reforms that edit parameters tree

Expand Down Expand Up @@ -2088,14 +2094,14 @@ Country package maintainers who still want to provide the Web API by default wit

##### Rename development dependencies from `test` to `dev`:

- Developpers should now run `pip install --editable .[dev]` instead of `pip install --editable .[test]` to install them.
- Developers should now run `pip install --editable .[dev]` instead of `pip install --editable .[test]` to install them.

#### New features

- In the `/spec` route:
- Indicate the served country package version as API version (instead of `0.1.0`).
- Infer the host URL from the requests, instead of relying on the undocumented `SERVER_NAME` environnement variable.
- The use of the `SERVER_NAME` environnement variable is therefore deprecated and without effect.
- Infer the host URL from the requests, instead of relying on the undocumented `SERVER_NAME` environment variable.
- The use of the `SERVER_NAME` environment variable is therefore deprecated and without effect.

### 23.5.2 [#710](https://github.com/openfisca/openfisca-core/pull/710)

Expand Down Expand Up @@ -2153,7 +2159,7 @@ HTTP/1.1 300 MULTIPLE CHOICES
(...)

{
"welcome": "Welcome to the OpenFisca-France Web API. To learn how to use it, check our interactive swagger documenation: https://fr.openfisca.org/legislation/swagger"
"welcome": "Welcome to the OpenFisca-France Web API. To learn how to use it, check our interactive swagger documentation: https://fr.openfisca.org/legislation/swagger"
}
```

Expand Down Expand Up @@ -2217,7 +2223,7 @@ Note that this route doesn't _recursively_ explore the node, and only exposes it
### 23.3.2 [#702](https://github.com/openfisca/openfisca-core/pull/702)

Minor Change without any impact for country package developers and users:
- Make code more Python3-like by backporting unicode litterals.
- Make code more Python3-like by backporting unicode literals.
- With this backport, all strings are by default unicodes.
- The `u` prefix for strings should *not* be used anymore.
- Each new module must start by `from __future__ import unicode_literals` for the backport to be effective.
Expand Down Expand Up @@ -2315,7 +2321,7 @@ Start adapting OpenFisca to Python 3
### 23.0.1 [656](https://github.com/openfisca/openfisca-core/pull/656)

* Re-accept `int` values for `instant` in `tax_benefit_system.get_parameter_at_instant(instant)`
* `int` values were accidently rejected since v23
* `int` values were accidentally rejected since v23

# 23.0.0 [643](https://github.com/openfisca/openfisca-core/pull/643)

Expand Down Expand Up @@ -2697,7 +2703,7 @@ class housing_occupancy_status(Variable):
- When using the Python API (`set_input`), the three following inputs are accepted:
- The enum item (e.g. HousingOccupancyStatus.tenant)
- The enum string identifier (e.g. "tenant")
- The enum item index, though this is not recommanded.
- The enum item index, though this is not recommended.
- If you rely on index, make sure to specify an `__order__` attribute to all your enums to make sure each intem has the right index. See the enum34 [doc](https://pypi.python.org/pypi/enum34/1.1.1).

> Example:
Expand All @@ -2706,7 +2712,7 @@ holder = simulation.household.get_holder('housing_occupancy_status')
# Three possibilities
holder.set_input(period, numpy.asarray([HousingOccupancyStatus.owner]))
holder.set_input(period, numpy.asarray(['owner']))
holder.set_input(period, numpy.asarray([0])) # Highly not recommanded
holder.set_input(period, numpy.asarray([0])) # Highly not recommended
```

- When calculating an Enum variable, the output will be an [EnumArray](https://openfisca.org/doc/openfisca-python-api/enum_array.html#module-openfisca_core.indexed_enums).
Expand Down Expand Up @@ -2869,7 +2875,7 @@ column = make_column_from_variable(variable)

- In `Variable`:
* Remove `to_column`
* Variables can now directly be instanciated:
* Variables can now directly be instantiated:

```py
class salary(Variable):
Expand Down Expand Up @@ -2920,7 +2926,7 @@ tax_benefit_system.parameters.benefits.basic_income

- Be more flexible about parameters definitions

The two following expressions are for instance striclty equivalent:
The two following expressions are for instance strictly equivalent:

```
Parameter("taxes.rate", {"2015-01-01": 2000})
Expand Down Expand Up @@ -3141,7 +3147,7 @@ For more information, check the [documentation](https://openfisca.org/doc/coding
reference_parameters.add_child('plf2016_conterfactual', reform_parameters_subtree)
```

- Note that this way of creating parameters is only recommanded when using dynamically computed values (for instance `round(1135 * (1 + inflation))` in the previous example). If the values are static, the new parameters can be directly built from YAML (See New features section).
- Note that this way of creating parameters is only recommended when using dynamically computed values (for instance `round(1135 * (1 + inflation))` in the previous example). If the values are static, the new parameters can be directly built from YAML (See New features section).

##### TaxBenefitSystem

Expand Down Expand Up @@ -3201,8 +3207,8 @@ For more information, check the [documentation](https://openfisca.org/doc/coding
#### Technical changes

* Refactor the internal representation and the interface of legislation parameters
- The parameters of a legislation are wraped into the classes `Node`, `Parameter`, `Scale`, `Bracket`, `ValuesHistory`, `ValueAtInstant` instead of bare python dict.
- The parameters of a legislation at a given instant are wraped into the classes `NodeAtInstant`, `ValueAtInstant` and tax scales instead of bare python objects.
- The parameters of a legislation are wrapped into the classes `Node`, `Parameter`, `Scale`, `Bracket`, `ValuesHistory`, `ValueAtInstant` instead of bare python dict.
- The parameters of a legislation at a given instant are wrapped into the classes `NodeAtInstant`, `ValueAtInstant` and tax scales instead of bare python objects.
- The file `parameters.py` and the classes defined inside are responsible both for loading and accessing the parameters. Before the loading was implemented in `legislationsxml.py` and the other processings were implemented in `legislations.py`
- The validation of the XML files was performed against a XML schema defined in `legislation.xsd`. Now the YAML files are loaded with the library `yaml` and then validated in basic Python.

Expand All @@ -3213,7 +3219,7 @@ For more information, check the [documentation](https://openfisca.org/doc/coding
- `Simulation.get_compact_legislation()` -> `Simulation._get_parameters_at_instant()`
- `Simulation.get_baseline_compact_legislation()` -> `Simulation._get_baseline_parameters_at_instant()`

* The optionnal parameter `traced_simulation` is removed in function `TaxBenefitSystem.get_compact_legislation()` (now `TaxBenefitSystem.get_parameters_at_instant()`). This parameter had no effect.
* The optional parameter `traced_simulation` is removed in function `TaxBenefitSystem.get_compact_legislation()` (now `TaxBenefitSystem.get_parameters_at_instant()`). This parameter had no effect.

* The optional parameter `with_source_file_infos` is removed in functions `TaxBenefitSystem.compute_legislation()` (now `TaxBenefitSystem._compute_parameters()`) and `TaxBenefitSystem.get_legislation()`. This parameter had no effect.

Expand All @@ -3231,7 +3237,7 @@ For more information, check the [documentation](https://openfisca.org/doc/coding
In the preview web API, for variables of type `Enum`:

* Accept and recommend to use strings as simulation inputs, instead of the enum indices.
- For instance, `{"housing_occupancy_status": {"2017-01": "Tenant"}}` is now accepted and prefered to `{"housing_occupancy_status": {"2017-01": 0}}`).
- For instance, `{"housing_occupancy_status": {"2017-01": "Tenant"}}` is now accepted and preferred to `{"housing_occupancy_status": {"2017-01": 0}}`).
- Using the enum indices as inputs is _still accepted_ for backward compatibility, but _should not_ be encouraged.
* Return strings instead of enum indices.
- For instance, is `housing_occupancy_status` is calculated for `2017-01`, `{"housing_occupancy_status": {"2017-01": "Tenant"}}` is now returned, instead of `{"housing_occupancy_status": {"2017-01": 0}}`.
Expand Down Expand Up @@ -3277,7 +3283,7 @@ In the preview web API, for variables of type `Enum`:
- This attribute is the legislative reference of a variable.
- As previously, this attribute can be a string, or a list of strings.
* Rename `Variable` attribute `reference` to `baseline_variable`
- This attibute is, for a variable defined in a reform, the baseline variable the reform variable is replacing.
- This attribute is, for a variable defined in a reform, the baseline variable the reform variable is replacing.
* Remove variable attribute `law_reference`
* Rename `TaxBenefitSystem.reference` to `TaxBenefitSystem.baseline`
* Rename `TaxBenefitSystem.get_reference_compact_legislation` to `TaxBenefitSystem.get_baseline_compact_legislation`
Expand Down Expand Up @@ -3346,7 +3352,7 @@ In the preview web API, for variables of type `Enum`:
- These functionalities are now provided by `entity.get_holder(name)`

- Deprecate constructor `Holder(simulation, column)`
- A `Holder` should now be instanciated with `Holder(entity = entity, column = column)`
- A `Holder` should now be instantiated with `Holder(entity = entity, column = column)`

### 14.0.1 - [#527](https://github.com/openfisca/openfisca-core/pull/527)

Expand Down Expand Up @@ -3555,7 +3561,7 @@ These breaking changes only concern variable and tax and benefit system **metada

# 9.0.0

* Make sure identic periods are stringified the same way
* Make sure identical periods are stringified the same way
* _Breaking changes_:
- Change `periods.period` signature.
- It now only accepts strings.
Expand Down Expand Up @@ -3592,7 +3598,7 @@ These breaking changes only concern variable and tax and benefit system **metada
## 6.1.0

* Move `base.py` content (file usually located in country packages) to core module `formula_toolbox` so that it can be reused by all countries
* Use `AbstractScenario` if no custom scenario is defined for a tax and benefit sytem
* Use `AbstractScenario` if no custom scenario is defined for a tax and benefit system

# 6.0.0

Expand Down Expand Up @@ -3634,7 +3640,7 @@ These breaking changes only concern variable and tax and benefit system **metada
* Improve `openfisca-run-test` script
- Make country package detection more robust (it only worked for packages installed in editable mode)
- Use spaces instead of commas as separator in the script arguments when loading several extensions or reforms (this is more standard)
* Refactor the `scripts` module to seperate the logic specific to yaml test running from the one that can be re-used by any script which needs to build a tax and benefit system.
* Refactor the `scripts` module to separate the logic specific to yaml test running from the one that can be re-used by any script which needs to build a tax and benefit system.

# 5.0.0

Expand Down Expand Up @@ -3711,8 +3717,8 @@ Unlike simple formulas, a `DatedVariable` have several functions. We thus need t
### 4.1.2-Beta

* Enable simulation initialization with only legacy roles
* New roles are in this case automatically infered
* Positions are always infered from persons entity id
* New roles are in this case automatically inferred
* Positions are always inferred from persons entity id

### 4.1.1-Beta

Expand Down Expand Up @@ -3812,7 +3818,7 @@ Unlike simple formulas, a `DatedVariable` have several functions. We thus need t

# 2.0.0 – [diff](https://github.com/openfisca/openfisca-core/compare/1.1.0...2.0.0)

* Variables are not added to the TaxBenefitSystem when the entities class are imported, but explicitely when the TaxBenefitSystem is instanciated.
* Variables are not added to the TaxBenefitSystem when the entities class are imported, but explicitly when the TaxBenefitSystem is instantiated.
* Metaclasses are not used anymore.
* New API for TaxBenefitSystem
* Columns are now stored in the TaxBenefitSystem, not in entities.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def get(self, key: str) -> Any:
* Return None when key is not found.

.. versionadded:: 1.2.3
This will help people to undestand the code evolution.
This will help people to understand the code evolution.

.. deprecated:: 2.3.4
This, to have time to adapt their own codebases before the code is
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ print_warn = $$(tput setaf 3)[!]$$(tput sgr0)
## To let the user know where we are in the task pipeline.
print_work = $$(tput setaf 5)[⚙]$$(tput sgr0)

## To let the user know the task in progress succeded.
## To let the user know the task in progress succeeded.
## The `$1` is a function argument, passed from a task (usually the task name).
print_pass = echo $$(tput setaf 2)[✓]$$(tput sgr0) $$(tput setaf 8)$1$$(tput sgr0)$$(tput setaf 2)passed$$(tput sgr0) $$(tput setaf 1)❤$$(tput sgr0)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ The tracker is activated when these two options are set:

* `--tracker-url`: An URL ending with `piwik.php`. It defines the Piwik instance that will receive the tracking information. To use the main OpenFisca Piwik instance, use `https://stats.data.gouv.fr/piwik.php`.
* `--tracker-idsite`: An integer. It defines the identifier of the tracked site on your Piwik instance. To use the main OpenFisca piwik instance, use `4`.
* `--tracker-token`: A string. It defines the Piwik API Authentification token to differentiate API calls based on the user IP. Otherwise, all API calls will seem to come from your server. The Piwik API Authentification token can be found in your Piwik interface when you are logged in.
* `--tracker-token`: A string. It defines the Piwik API Authentication token to differentiate API calls based on the user IP. Otherwise, all API calls will seem to come from your server. The Piwik API Authentication token can be found in your Piwik interface when you are logged in.

For instance, to run the Web API with the mock country package `openfisca_country_template` and the tracker activated, run:

Expand Down
2 changes: 1 addition & 1 deletion STYLEGUIDE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenFisca's Python Style Guide

Arguments over code style and formatting are the bread and butter of most open-source projets out there, including OpenFisca.
Arguments over code style and formatting are the bread and butter of most open-source projects out there, including OpenFisca.

To avoid this, we have a style guide, that is a set or arbitrary but consistent conventions about how code should be written, for contributors and maintainers alike.

Expand Down
2 changes: 1 addition & 1 deletion openfisca_core/commons/formulas.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def switch(
conditions: t.Array[numpy.float32] | t.ArrayLike[float],
value_by_condition: Mapping[float, float],
) -> t.Array[numpy.float32]:
"""Mimick a switch statement.
"""Mimic a switch statement.

Given an array of conditions, returns an array of the same size,
replacing each condition item with the matching given value.
Expand Down
2 changes: 1 addition & 1 deletion openfisca_core/entities/_core_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_variable(

>>> this.get_variable("tax")
Traceback (most recent call last):
ValueError: You must set 'tax_benefit_system' before calling thi...
ValueError: You must set 'tax_benefit_system' before calling this...

>>> tax_benefit_system = taxbenefitsystems.TaxBenefitSystem([this])
>>> this.set_tax_benefit_system(tax_benefit_system)
Expand Down
2 changes: 1 addition & 1 deletion openfisca_core/parameters/parameter_node_at_instant.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __getattr__(self, key):
def __getitem__(self, key):
# If fancy indexing is used, cast to a vectorial node
if isinstance(key, numpy.ndarray):
# If fancy indexing is used wit a datetime64, cast to a vectorial node supporting datetime64
# If fancy indexing is used with a datetime64, cast to a vectorial node supporting datetime64
if numpy.issubdtype(key.dtype, numpy.datetime64):
return (
parameters.VectorialAsofDateParameterNodeAtInstant.build_from_node(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def check_node_vectorisable(node) -> None:
"""Check that a node can be casted to a vectorial node, in order to be able to use fancy indexing."""
MESSAGE_PART_1 = "Cannot use fancy indexing on parameter node '{}', as"
MESSAGE_PART_3 = (
"To use fancy indexing on parameter node, its children must be homogenous."
"To use fancy indexing on parameter node, its children must be homogeneous."
)
MESSAGE_PART_4 = "See more at <https://openfisca.org/doc/coding-the-legislation/legislation_parameters#computing-a-parameter-that-depends-on-a-variable-fancy-indexing>."

Expand Down
Loading