Browse Source

Linting

merge-requests/8/head
Lucas Verney 5 years ago
parent
commit
f1df23dc29
  1. 2
      flatisfy/config.py
  2. 2
      flatisfy/data.py
  3. 6
      flatisfy/data_files/__init__.py
  4. 2
      flatisfy/fetch.py
  5. 6
      flatisfy/filters/__init__.py
  6. 14
      flatisfy/web/js_src/store/getters.js

2
flatisfy/config.py

@ -98,7 +98,7 @@ def validate_config(config): @@ -98,7 +98,7 @@ def validate_config(config):
# pylint: disable=locally-disabled,line-too-long
# Ensure constraints are ok
assert len(config["constraints"]) > 0
assert config["constraints"]
for constraint in config["constraints"].values():
assert "type" in constraint
assert isinstance(constraint["type"], str)

2
flatisfy/data.py

@ -23,7 +23,7 @@ except ImportError: @@ -23,7 +23,7 @@ except ImportError:
try:
from functools32 import lru_cache
except ImportError:
def lru_cache(maxsize=None):
def lru_cache(maxsize=None): # pylint: disable=unused-argument
"""
Identity implementation of ``lru_cache`` for fallback.
"""

6
flatisfy/data_files/__init__.py

@ -26,7 +26,7 @@ def french_postal_codes_to_iso_3166(postal_code): @@ -26,7 +26,7 @@ def french_postal_codes_to_iso_3166(postal_code):
# Mapping between areas (main subdivisions in French, ISO 3166-2) and
# French departements
# Taken from Wikipedia data.
AREA_TO_DEPARTEMENT = {
area_to_departement = {
"FR-ARA": ["01", "03", "07", "15", "26", "38", "42", "43", "63", "69",
"73", "74"],
"FR-BFC": ["21", "25", "39", "58", "70", "71", "89", "90"],
@ -49,8 +49,8 @@ def french_postal_codes_to_iso_3166(postal_code): @@ -49,8 +49,8 @@ def french_postal_codes_to_iso_3166(postal_code):
return next(
(
i
for i in AREA_TO_DEPARTEMENT
if departement in AREA_TO_DEPARTEMENT[i]
for i in area_to_departement
if departement in area_to_departement[i]
),
None
)

2
flatisfy/fetch.py

@ -213,7 +213,7 @@ class WeboobProxy(object): @@ -213,7 +213,7 @@ class WeboobProxy(object):
housing.id = full_flat_id
return json.dumps(housing, cls=WeboobEncoder)
except Exception as exc:
except Exception as exc: # pylint: disable=broad-except
# If an error occured, just log it
LOGGER.error(
"An error occured while fetching housing %s: %s",

6
flatisfy/filters/__init__.py

@ -16,7 +16,7 @@ from flatisfy.filters import metadata @@ -16,7 +16,7 @@ from flatisfy.filters import metadata
LOGGER = logging.getLogger(__name__)
def refine_with_housing_criteria(flats_list, constraint, config):
def refine_with_housing_criteria(flats_list, constraint):
"""
Filter a list of flats according to criteria.
@ -115,7 +115,7 @@ def first_pass(flats_list, constraint, config): @@ -115,7 +115,7 @@ def first_pass(flats_list, constraint, config):
flats_list = metadata.guess_stations(flats_list, constraint, config)
# Remove returned housing posts that do not match criteria
flats_list, ignored_list = refine_with_housing_criteria(flats_list,
constraint, config)
constraint)
return {
"new": flats_list,
@ -155,7 +155,7 @@ def second_pass(flats_list, constraint, config): @@ -155,7 +155,7 @@ def second_pass(flats_list, constraint, config):
# Remove returned housing posts that do not match criteria
flats_list, ignored_list = refine_with_housing_criteria(flats_list,
constraint, config)
constraint)
return {
"new": flats_list,

14
flatisfy/web/js_src/store/getters.js

@ -55,17 +55,17 @@ export default { @@ -55,17 +55,17 @@ export default {
},
allTimeToPlaces: state => {
let places = {}
const places = {}
Object.keys(state.timeToPlaces).forEach(constraint => {
let constraintTimeToPlaces = state.timeToPlaces[constraint]
Object.keys(constraintTimeToPlaces).forEach(name =>
const constraintTimeToPlaces = state.timeToPlaces[constraint]
Object.keys(constraintTimeToPlaces).forEach(name => {
places[name] = constraintTimeToPlaces[name]
)
})
})
return places
},
timeToPlaces: (state, getters) => (constraint_name) => {
return state.timeToPlaces[constraint_name]
},
timeToPlaces: (state, getters) => (constraintName) => {
return state.timeToPlaces[constraintName]
}
}

Loading…
Cancel
Save