@@ -33,37 +33,41 @@ def from_orm_gtfs(cls, feed_search_row: t_feedsearch):
3333 feed_contact_email = feed_search_row .feed_contact_email ,
3434 source_info = SourceInfo (
3535 producer_url = feed_search_row .producer_url ,
36- authentication_type = int ( feed_search_row . authentication_type )
37- if feed_search_row .authentication_type
38- else None ,
36+ authentication_type = (
37+ int ( feed_search_row . authentication_type ) if feed_search_row .authentication_type else None
38+ ) ,
3939 authentication_info_url = feed_search_row .authentication_info_url ,
4040 api_key_parameter_name = feed_search_row .api_key_parameter_name ,
4141 license_url = feed_search_row .license_url ,
4242 ),
4343 redirects = feed_search_row .redirect_ids ,
4444 locations = cls .resolve_locations (feed_search_row .locations ),
45- latest_dataset = LatestDataset (
46- id = feed_search_row .latest_dataset_id ,
47- hosted_url = feed_search_row .latest_dataset_hosted_url ,
48- downloaded_at = feed_search_row .latest_dataset_downloaded_at ,
49- hash = feed_search_row .latest_dataset_hash ,
50- service_date_range_start = feed_search_row .latest_dataset_service_date_range_start ,
51- service_date_range_end = feed_search_row .latest_dataset_service_date_range_end ,
52- agency_timezone = feed_search_row .latest_dataset_agency_timezone ,
53- validation_report = LatestDatasetValidationReport (
54- total_error = feed_search_row .latest_total_error ,
55- total_warning = feed_search_row .latest_total_warning ,
56- total_info = feed_search_row .latest_total_info ,
57- unique_error_count = feed_search_row .latest_unique_error_count ,
58- unique_warning_count = feed_search_row .latest_unique_warning_count ,
59- unique_info_count = feed_search_row .latest_unique_info_count ,
60- features = sorted ([feature for feature in feed_search_row .latest_dataset_features ])
61- if feed_search_row .latest_dataset_features
62- else [],
63- ),
64- )
65- if feed_search_row .latest_dataset_id
66- else None ,
45+ latest_dataset = (
46+ LatestDataset (
47+ id = feed_search_row .latest_dataset_id ,
48+ hosted_url = feed_search_row .latest_dataset_hosted_url ,
49+ downloaded_at = feed_search_row .latest_dataset_downloaded_at ,
50+ hash = feed_search_row .latest_dataset_hash ,
51+ service_date_range_start = feed_search_row .latest_dataset_service_date_range_start ,
52+ service_date_range_end = feed_search_row .latest_dataset_service_date_range_end ,
53+ agency_timezone = feed_search_row .latest_dataset_agency_timezone ,
54+ validation_report = LatestDatasetValidationReport (
55+ total_error = feed_search_row .latest_total_error ,
56+ total_warning = feed_search_row .latest_total_warning ,
57+ total_info = feed_search_row .latest_total_info ,
58+ unique_error_count = feed_search_row .latest_unique_error_count ,
59+ unique_warning_count = feed_search_row .latest_unique_warning_count ,
60+ unique_info_count = feed_search_row .latest_unique_info_count ,
61+ features = (
62+ sorted ([feature for feature in feed_search_row .latest_dataset_features ])
63+ if feed_search_row .latest_dataset_features
64+ else []
65+ ),
66+ ),
67+ )
68+ if feed_search_row .latest_dataset_id
69+ else None
70+ ),
6771 )
6872
6973 @classmethod
@@ -78,9 +82,9 @@ def from_orm_gbfs(cls, feed_search_row):
7882 feed_contact_email = feed_search_row .feed_contact_email ,
7983 source_info = SourceInfo (
8084 producer_url = feed_search_row .producer_url ,
81- authentication_type = int ( feed_search_row . authentication_type )
82- if feed_search_row .authentication_type
83- else None ,
85+ authentication_type = (
86+ int ( feed_search_row . authentication_type ) if feed_search_row .authentication_type else None
87+ ) ,
8488 authentication_info_url = feed_search_row .authentication_info_url ,
8589 api_key_parameter_name = feed_search_row .api_key_parameter_name ,
8690 license_url = feed_search_row .license_url ,
@@ -104,9 +108,9 @@ def from_orm_gtfs_rt(cls, feed_search_row):
104108 feed_contact_email = feed_search_row .feed_contact_email ,
105109 source_info = SourceInfo (
106110 producer_url = feed_search_row .producer_url ,
107- authentication_type = int ( feed_search_row . authentication_type )
108- if feed_search_row .authentication_type
109- else None ,
111+ authentication_type = (
112+ int ( feed_search_row . authentication_type ) if feed_search_row .authentication_type else None
113+ ) ,
110114 authentication_info_url = feed_search_row .authentication_info_url ,
111115 api_key_parameter_name = feed_search_row .api_key_parameter_name ,
112116 license_url = feed_search_row .license_url ,
@@ -125,9 +129,9 @@ def resolve_locations(cls, locations):
125129 return [
126130 {
127131 ** location ,
128- "country" : location . get ( "country" )
129- if location .get ("country" )
130- else cls . resolve_country_by_code ( location ),
132+ "country" : (
133+ location . get ( "country" ) if location .get ("country" ) else cls . resolve_country_by_code ( location )
134+ ),
131135 }
132136 for location in locations
133137 ]
0 commit comments