This commit is contained in:
Lucas Verney 2017-06-20 13:37:22 +02:00
parent 054c5679bb
commit f1df23dc29
6 changed files with 16 additions and 16 deletions

View File

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

View File

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

View File

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

View File

@ -213,7 +213,7 @@ class WeboobProxy(object):
housing.id = full_flat_id housing.id = full_flat_id
return json.dumps(housing, cls=WeboobEncoder) 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 # If an error occured, just log it
LOGGER.error( LOGGER.error(
"An error occured while fetching housing %s: %s", "An error occured while fetching housing %s: %s",

View File

@ -16,7 +16,7 @@ from flatisfy.filters import metadata
LOGGER = logging.getLogger(__name__) 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. 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) flats_list = metadata.guess_stations(flats_list, constraint, config)
# Remove returned housing posts that do not match criteria # Remove returned housing posts that do not match criteria
flats_list, ignored_list = refine_with_housing_criteria(flats_list, flats_list, ignored_list = refine_with_housing_criteria(flats_list,
constraint, config) constraint)
return { return {
"new": flats_list, "new": flats_list,
@ -155,7 +155,7 @@ def second_pass(flats_list, constraint, config):
# Remove returned housing posts that do not match criteria # Remove returned housing posts that do not match criteria
flats_list, ignored_list = refine_with_housing_criteria(flats_list, flats_list, ignored_list = refine_with_housing_criteria(flats_list,
constraint, config) constraint)
return { return {
"new": flats_list, "new": flats_list,

View File

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