44
55import pandas as pd
66
7- from activitysim .core import config
8- from activitysim .core import inject
7+ from activitysim .core import config , inject
98
109# FIXME
1110# warnings.filterwarnings('ignore', category=pd.io.pytables.PerformanceWarning)
1817def households_sample_size (settings , override_hh_ids ):
1918
2019 if override_hh_ids is None :
21- return settings .get (' households_sample_size' , 0 )
20+ return settings .get (" households_sample_size" , 0 )
2221 else :
2322 return 0 if override_hh_ids is None else len (override_hh_ids )
2423
2524
2625@inject .injectable (cache = True )
2726def override_hh_ids (settings ):
2827
29- hh_ids_filename = settings .get (' hh_ids' , None )
28+ hh_ids_filename = settings .get (" hh_ids" , None )
3029 if hh_ids_filename is None :
3130 return None
3231
3332 file_path = config .data_file_path (hh_ids_filename , mandatory = False )
3433 if not file_path :
35- logger .error ("hh_ids file name '%s' specified in settings not found" % hh_ids_filename )
34+ logger .error (
35+ "hh_ids file name '%s' specified in settings not found" % hh_ids_filename
36+ )
3637 return None
3738
38- df = pd .read_csv (file_path , comment = '#' )
39+ df = pd .read_csv (file_path , comment = "#" )
3940
40- if ' household_id' not in df .columns :
41+ if " household_id" not in df .columns :
4142 logger .error ("No 'household_id' column in hh_ids file %s" % hh_ids_filename )
4243 return None
4344
@@ -47,19 +48,23 @@ def override_hh_ids(settings):
4748 logger .error ("No households in hh_ids file %s" % hh_ids_filename )
4849 return None
4950
50- logger .info ("Using hh_ids list with %s households from file %s" %
51- (len (household_ids ), hh_ids_filename ))
51+ logger .info (
52+ "Using hh_ids list with %s households from file %s"
53+ % (len (household_ids ), hh_ids_filename )
54+ )
5255
5356 return household_ids
5457
5558
5659@inject .injectable (cache = True )
5760def trace_hh_id (settings ):
5861
59- id = settings .get (' trace_hh_id' , None )
62+ id = settings .get (" trace_hh_id" , None )
6063
6164 if id and not isinstance (id , int ):
62- logger .warning ("setting trace_hh_id is wrong type, should be an int, but was %s" % type (id ))
65+ logger .warning (
66+ "setting trace_hh_id is wrong type, should be an int, but was %s" % type (id )
67+ )
6368 id = None
6469
6570 return id
@@ -68,9 +73,11 @@ def trace_hh_id(settings):
6873@inject .injectable (cache = True )
6974def trace_od (settings ):
7075
71- od = settings .get (' trace_od' , None )
76+ od = settings .get (" trace_od" , None )
7277
73- if od and not (isinstance (od , list ) and len (od ) == 2 and all (isinstance (x , int ) for x in od )):
78+ if od and not (
79+ isinstance (od , list ) and len (od ) == 2 and all (isinstance (x , int ) for x in od )
80+ ):
7481 logger .warning ("setting trace_od should be a list of length 2, but was %s" % od )
7582 od = None
7683
@@ -79,11 +86,11 @@ def trace_od(settings):
7986
8087@inject .injectable (cache = True )
8188def chunk_size (settings ):
82- _chunk_size = int (settings .get (' chunk_size' , 0 ) or 0 )
89+ _chunk_size = int (settings .get (" chunk_size" , 0 ) or 0 )
8390
8491 return _chunk_size
8592
8693
8794@inject .injectable (cache = True )
8895def check_for_variability (settings ):
89- return bool (settings .get (' check_for_variability' , False ))
96+ return bool (settings .get (" check_for_variability" , False ))
0 commit comments