Skip to content

Commit 50b7eeb

Browse files
dshemetovdmytrotsko
authored andcommitted
style: revert one format change and rewrap a few long comments
1 parent ed6ce8a commit 50b7eeb

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

src/common/covidcast_row.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class CovidcastRow:
3636
- converting from and to formats (dict, csv, df, kwargs)
3737
- creating consistent views, with consistent data types (dict, csv, df)
3838
39-
The rows are specified in 'v4_schema.sql'. The datatypes are made to match database. When writing to Pandas, the dtypes match the JIT model.py schema.
39+
The rows are specified in 'v4_schema.sql'. The datatypes are made to match
40+
database. When writing to Pandas, the dtypes match the JIT model.py schema.
4041
"""
4142

4243
# Arguments.
@@ -55,7 +56,8 @@ class CovidcastRow:
5556
missing_sample_size: int
5657
issue: int
5758
lag: int
58-
# The following three fields are only the database, but are not ingested at acquisition and not returned by the API.
59+
# The following three fields are only in the database, but are not ingested at
60+
# acquisition and not returned by the API.
5961
epimetric_id: Optional[int] = None
6062
direction: Optional[int] = None
6163
value_updated_timestamp: Optional[int] = 0
@@ -79,17 +81,20 @@ def as_dict(self, ignore_fields: Optional[List[str]] = None) -> dict:
7981
return d
8082

8183
def as_api_row_dict(self, ignore_fields: Optional[List[str]] = None) -> dict:
82-
"""Returns a dict view into the row with the fields returned by the API server."""
84+
"""Returns a dict view into the row with the fields returned by the API
85+
server."""
8386
return self.as_dict(ignore_fields=self._api_row_ignore_fields + (ignore_fields or []))
8487

8588
def as_api_compatibility_row_dict(self, ignore_fields: Optional[List[str]] = None) -> dict:
86-
"""Returns a dict view into the row with the fields returned by the old API server (the PHP server)."""
89+
"""Returns a dict view into the row with the fields returned by the old
90+
API server (the PHP server)."""
8791
return self.as_dict(
8892
ignore_fields=self._api_row_compatibility_ignore_fields + (ignore_fields or [])
8993
)
9094

9195
def as_db_row_dict(self, ignore_fields: Optional[List[str]] = None) -> dict:
92-
"""Returns a dict view into the row with the fields returned by the database."""
96+
"""Returns a dict view into the row with the fields returned by the
97+
database."""
9398
return self.as_dict(ignore_fields=self._db_row_ignore_fields + (ignore_fields or []))
9499

95100
def as_dataframe(self, ignore_fields: Optional[List[str]] = None) -> pd.DataFrame:
@@ -99,19 +104,22 @@ def as_dataframe(self, ignore_fields: Optional[List[str]] = None) -> pd.DataFram
99104
return df
100105

101106
def as_api_row_df(self, ignore_fields: Optional[List[str]] = None) -> pd.DataFrame:
102-
"""Returns a dataframe view into the row with the fields returned by the API server."""
107+
"""Returns a dataframe view into the row with the fields returned by the
108+
API server."""
103109
return self.as_dataframe(ignore_fields=self._api_row_ignore_fields + (ignore_fields or []))
104110

105-
def as_api_compatibility_row_df(
106-
self, ignore_fields: Optional[List[str]] = None
107-
) -> pd.DataFrame:
108-
"""Returns a dataframe view into the row with the fields returned by the old API server (the PHP server)."""
111+
# fmt: off
112+
def as_api_compatibility_row_df(self, ignore_fields: Optional[List[str]] = None) -> pd.DataFrame:
113+
"""Returns a dataframe view into the row with the fields returned by the
114+
old API server (the PHP server)."""
115+
# fmt: on
109116
return self.as_dataframe(
110117
ignore_fields=self._api_row_compatibility_ignore_fields + (ignore_fields or [])
111118
)
112119

113120
def as_db_row_df(self, ignore_fields: Optional[List[str]] = None) -> pd.DataFrame:
114-
"""Returns a dataframe view into the row with the fields returned by an all-field database query."""
121+
"""Returns a dataframe view into the row with the fields returned by an
122+
all-field database query."""
115123
return self.as_dataframe(ignore_fields=self._db_row_ignore_fields + (ignore_fields or []))
116124

117125
def signal_pair(self):

tests/common/test_covidcast_row.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,17 @@ class TestCovidcastRows(unittest.TestCase):
4343
)
4444

4545
def test_transpose_dict(self):
46-
assert transpose_dict({"a": [2, 4, 6], "b": [3, 5, 7], "c": [10, 20, 30]}) == [
46+
# fmt: off
47+
assert transpose_dict({
48+
"a": [2, 4, 6],
49+
"b": [3, 5, 7],
50+
"c": [10, 20, 30]
51+
}) == [
4752
{"a": 2, "b": 3, "c": 10},
4853
{"a": 4, "b": 5, "c": 20},
4954
{"a": 6, "b": 7, "c": 30},
5055
]
56+
# fmt: on
5157

5258
def test_CovidcastRow(self):
5359
df = CovidcastTestRow.make_default_row(

0 commit comments

Comments
 (0)