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
# 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)

View File

@ -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.
"""

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
# 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
)

View File

@ -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",

View File

@ -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,

View File

@ -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]
}
}