From f1df23dc293b8db01b5a8257c06e7ae897bd5d0c Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Tue, 20 Jun 2017 13:37:22 +0200 Subject: [PATCH] Linting --- flatisfy/config.py | 2 +- flatisfy/data.py | 2 +- flatisfy/data_files/__init__.py | 6 +++--- flatisfy/fetch.py | 2 +- flatisfy/filters/__init__.py | 6 +++--- flatisfy/web/js_src/store/getters.js | 14 +++++++------- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/flatisfy/config.py b/flatisfy/config.py index d995552..84c7a77 100644 --- a/flatisfy/config.py +++ b/flatisfy/config.py @@ -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) diff --git a/flatisfy/data.py b/flatisfy/data.py index 20de512..9786248 100644 --- a/flatisfy/data.py +++ b/flatisfy/data.py @@ -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. """ diff --git a/flatisfy/data_files/__init__.py b/flatisfy/data_files/__init__.py index c23d5f6..2ccf15f 100644 --- a/flatisfy/data_files/__init__.py +++ b/flatisfy/data_files/__init__.py @@ -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): 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 ) diff --git a/flatisfy/fetch.py b/flatisfy/fetch.py index dcf0a0e..3fea009 100644 --- a/flatisfy/fetch.py +++ b/flatisfy/fetch.py @@ -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", diff --git a/flatisfy/filters/__init__.py b/flatisfy/filters/__init__.py index 1b9ac44..f11e5a5 100644 --- a/flatisfy/filters/__init__.py +++ b/flatisfy/filters/__init__.py @@ -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): 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): # 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, diff --git a/flatisfy/web/js_src/store/getters.js b/flatisfy/web/js_src/store/getters.js index 3a8691e..7e67088 100644 --- a/flatisfy/web/js_src/store/getters.js +++ b/flatisfy/web/js_src/store/getters.js @@ -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] + } }