2525 "value_updated_timestamp" : "Int64" ,
2626}
2727
28+
2829@dataclass
2930class CovidcastRow :
3031 """A container for the values of a single covidcast database row.
@@ -62,7 +63,11 @@ class CovidcastRow:
6263 # Classvars.
6364 _db_row_ignore_fields : ClassVar = []
6465 _api_row_ignore_fields : ClassVar = ["epimetric_id" , "value_updated_timestamp" ]
65- _api_row_compatibility_ignore_fields : ClassVar = _api_row_ignore_fields + ["source" , "time_type" , "geo_type" ]
66+ _api_row_compatibility_ignore_fields : ClassVar = _api_row_ignore_fields + [
67+ "source" ,
68+ "time_type" ,
69+ "geo_type" ,
70+ ]
6671
6772 _pandas_dtypes : ClassVar = PANDAS_DTYPES
6873
@@ -72,14 +77,16 @@ def as_dict(self, ignore_fields: Optional[List[str]] = None) -> dict:
7277 for key in ignore_fields :
7378 del d [key ]
7479 return d
75-
80+
7681 def as_api_row_dict (self , ignore_fields : Optional [List [str ]] = None ) -> dict :
7782 """Returns a dict view into the row with the fields returned by the API server."""
7883 return self .as_dict (ignore_fields = self ._api_row_ignore_fields + (ignore_fields or []))
7984
8085 def as_api_compatibility_row_dict (self , ignore_fields : Optional [List [str ]] = None ) -> dict :
8186 """Returns a dict view into the row with the fields returned by the old API server (the PHP server)."""
82- return self .as_dict (ignore_fields = self ._api_row_compatibility_ignore_fields + (ignore_fields or []))
87+ return self .as_dict (
88+ ignore_fields = self ._api_row_compatibility_ignore_fields + (ignore_fields or [])
89+ )
8390
8491 def as_db_row_dict (self , ignore_fields : Optional [List [str ]] = None ) -> dict :
8592 """Returns a dict view into the row with the fields returned by the database."""
@@ -95,9 +102,13 @@ def as_api_row_df(self, ignore_fields: Optional[List[str]] = None) -> pd.DataFra
95102 """Returns a dataframe view into the row with the fields returned by the API server."""
96103 return self .as_dataframe (ignore_fields = self ._api_row_ignore_fields + (ignore_fields or []))
97104
98- def as_api_compatibility_row_df (self , ignore_fields : Optional [List [str ]] = None ) -> pd .DataFrame :
105+ def as_api_compatibility_row_df (
106+ self , ignore_fields : Optional [List [str ]] = None
107+ ) -> pd .DataFrame :
99108 """Returns a dataframe view into the row with the fields returned by the old API server (the PHP server)."""
100- return self .as_dataframe (ignore_fields = self ._api_row_compatibility_ignore_fields + (ignore_fields or []))
109+ return self .as_dataframe (
110+ ignore_fields = self ._api_row_compatibility_ignore_fields + (ignore_fields or [])
111+ )
101112
102113 def as_db_row_df (self , ignore_fields : Optional [List [str ]] = None ) -> pd .DataFrame :
103114 """Returns a dataframe view into the row with the fields returned by an all-field database query."""
@@ -113,7 +124,6 @@ def time_pair(self):
113124 return f"{ self .time_type } :{ self .time_value } "
114125
115126
116-
117127def check_valid_dtype (dtype ):
118128 try :
119129 pd .api .types .pandas_dtype (dtype )
0 commit comments