Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
benjello committed Aug 6, 2024
1 parent ac925fc commit d680a69
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
5 changes: 2 additions & 3 deletions .github/get_minimal_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# dependencies in order to ensure their compatibility during CI testing
with open('./setup.py') as file:
for line in file:
version = re.search(r'(Core|France-Pension)\s*>=\s*([\d\.]*)', line) # Use when proper core version will be used
# version = re.search(r'(France-Pension)\s*>=\s*([\d\.]*)', line)
version = re.search(r'(Core|France-Pension)\s*>=\s*([\d\.]*)', line)
if version:
print(f'Openfisca-{version[1]}=={version[2]}') # noqa: T201 <- This is to avoid flake8 print detection.
print(f'Openfisca-{version[1]}=={version[2]}') # noqa analysis:ignore T201 <- This is to avoid flake8 print detection.
8 changes: 4 additions & 4 deletions .github/get_pypi_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@


def get_info(package_name: str = '') -> dict:
'''
"""
Get minimal informations needed by .conda/meta.yaml from PyPi JSON API.
::package_name:: Name of package to get infos from.
::return:: A dict with last_version, url and sha256
'''
"""
if package_name == '':
raise ValueError('Package name not provided.')
resp = requests.get(f'https://pypi.org/pypi/{package_name}/json').json()
Expand All @@ -26,10 +26,10 @@ def get_info(package_name: str = '') -> dict:


def replace_in_file(filepath: str, info: dict):
'''
"""
::filepath:: Path to meta.yaml, with filename
::info:: Dict with information to populate
'''
"""
with open(filepath, 'rt') as fin:
meta = fin.read()
# Replace with info from PyPi
Expand Down
8 changes: 4 additions & 4 deletions openfisca_france_pension/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
key = "household",
plural = "households",
label = 'All the people in a family or group who live together in the same place.',
doc = '''
doc = """
Household is an example of a group entity.
A group entity contains one or more individual·s.
Each individual in a group entity has a role (e.g. parent or children). Some roles can only be held by a limited number of individuals (e.g. a 'first_parent' can only be held by one individual), while others can have an unlimited number of individuals (e.g. 'children').
Expand All @@ -18,7 +18,7 @@
Calculate a variable applied to each individual of the group entity (e.g. calculate the 'salary' of each member of the 'Household' with salaries = household.members('salary', period = MONTH); sum_salaries = household.sum(salaries)).
For more information, see: https://openfisca.org/doc/coding-the-legislation/50_entities.html
''',
""",
roles = [
{
'key': 'parent',
Expand All @@ -41,7 +41,7 @@
key = "person",
plural = "persons",
label = 'An individual. The minimal legal entity on which a legislation might be applied.',
doc = '''
doc = """
Variables like 'salary' and 'income_tax' are usually defined for the entity 'Person'.
Expand All @@ -50,7 +50,7 @@
Check the role of a 'Person' in a group entity (e.g. check if a the 'Person' is a 'first_parent' in a 'Household' entity with person.has_role(Household.FIRST_PARENT)).
For more information, see: https://openfisca.org/doc/coding-the-legislation/50_entities.html
''',
""",
is_person = True,
)

Expand Down
2 changes: 1 addition & 1 deletion openfisca_france_pension/regimes/fonction_publique.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ def formula(individu, period):
)

# def cotisations(self, data):
# ''' Calcul des cotisations passées par année'''
# """ Calcul des cotisations passées par année"""
# sali = data.sali * data.workstate.isin(self.code_regime).astype(int)
# Pcot_regime = reduce(getattr, self.param_name.split('.'), self.P_cot)
# # getattr(self.P_longit.prive.complementaire, self.name)
Expand Down
2 changes: 1 addition & 1 deletion openfisca_france_pension/regimes/regime_general_cnav.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ class pension_maximale(Variable):
label = "Pension maximale"

def formula(individu, period, parameters):
# TODO: gérer les plus de 65 ans au 1er janvier 1983'''
# TODO: gérer les plus de 65 ans au 1er janvier 1983
plafond_securite_sociale = parameters(period).prelevements_sociaux.pss.plafond_securite_sociale_annuel * conversion_parametre_en_euros(period.start.year)
taux_plein = parameters(period).regime_name.taux_plein.taux_plein
pension_plafond_hors_surcote = taux_plein * plafond_securite_sociale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ class points_enfants(Variable):

def formula(individu, period):
"""
Deux types de majorations pour enfants peuvent s'appliquer :
- pour enfant à charge au moment du départ en retraite
- pour enfant nés et élevés en cours de carrière (majoration sur la totalité des droits acquis)
C'est la plus avantageuse qui s'applique.
Deux types de majorations pour enfants peuvent s'appliquer:
- pour enfant à charge au moment du départ en retraite
- pour enfant nés et élevés en cours de carrière (majoration sur la totalité des droits acquis)
C'est la plus avantageuse qui s'applique.
"""
points_enfants_a_charge = individu('regime_name_points_enfants_a_charge', period)
points_enfants_nes_et_eleves = individu('regime_name_points_enfants_nes_et_eleves', period)
Expand Down Expand Up @@ -195,8 +195,8 @@ def formula_1962(individu, period, parameters):

# def pension(self, data, coefficient_age, pension_brute_b,
# majoration_pension, trim_decote):
# ''' le régime Arrco ne tient pas compte du coefficient de
# minoration pour le calcul des majorations pour enfants '''
# """ le régime Arrco ne tient pas compte du coefficient de
# minoration pour le calcul des majorations pour enfants """

class points_emploi_annuels(Variable):
value_type = float
Expand Down
4 changes: 2 additions & 2 deletions openfisca_france_pension/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def mean_over_k_largest(vector, k):
'''Return the mean over the k largest values of a vector'''
"""Return the mean over the k largest values of a vector"""
if k == 0:
return 0

Expand All @@ -21,7 +21,7 @@ def mean_over_k_largest(vector, k):

@jit(float32(float32[:], int64), nopython=True)
def mean_over_k_nonzero_largest(vector, k):
'''Return the mean over the k largest values of a vector'''
"""Return the mean over the k largest values of a vector"""
if k == 0:
return 0
nonzeros = (vector > 0.0).sum()
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

[flake8]
hang-closing = true
ignore = E128,E251,F403,F405,E501,I100,I201,W503,W504
ignore = E128,E251,F403,F405,E501,I100,I201,W503,W504,D
docstring-quotes = single
inline-quotes = single
multiline-quotes = single
exclude = openfisca_france_pension/variables/
exclude = openfisca_france_pension/variables/*.py

[pep8]
hang-closing = true
ignore = E128,E251,E501,I100,I201,W503,W504
ignore = E128,E251,E501,I100,I201,W503,W504,D
in-place = true

[tool:pytest]
Expand Down

0 comments on commit d680a69

Please sign in to comment.