Skip to content

Commit

Permalink
DOC: Update references to NDJSON to JSON lines
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen committed Jan 22, 2025
1 parent d7c1200 commit 36b8b5a
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions databento/common/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,14 @@ def convert_datetime_columns(df: pd.DataFrame, columns: list[str]) -> None:
df[column] = df[column].apply(convert_to_datetime)


def convert_ndjson_to_df(data: bytes, compressed: bool) -> pd.DataFrame:
def convert_jsonl_to_df(data: bytes, compressed: bool) -> pd.DataFrame:
"""
Convert the given NDJSON bytes `data` to a pandas DataFrame.
Convert the given JSON lines bytes `data` to a pandas DataFrame.
Parameters
----------
data : bytes
The NDJSON data as bytes to be converted.
The JSON lines data as bytes to be converted.
compressed : bool
If the content is zstd compressed.
Expand Down
4 changes: 2 additions & 2 deletions databento/reference/api/adjustment.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from databento.common.http import BentoHttpAPI
from databento.common.parsing import convert_date_columns
from databento.common.parsing import convert_datetime_columns
from databento.common.parsing import convert_ndjson_to_df
from databento.common.parsing import convert_jsonl_to_df
from databento.common.parsing import datetime_to_string
from databento.common.parsing import optional_datetime_to_string
from databento.common.parsing import optional_string_to_list
Expand Down Expand Up @@ -100,7 +100,7 @@ def get_range(
basic_auth=True,
)

df = convert_ndjson_to_df(response.content, compressed=True)
df = convert_jsonl_to_df(response.content, compressed=True)
if df.empty:
return df

Expand Down
4 changes: 2 additions & 2 deletions databento/reference/api/corporate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from databento.common.http import BentoHttpAPI
from databento.common.parsing import convert_date_columns
from databento.common.parsing import convert_datetime_columns
from databento.common.parsing import convert_ndjson_to_df
from databento.common.parsing import convert_jsonl_to_df
from databento.common.parsing import datetime_to_string
from databento.common.parsing import optional_datetime_to_string
from databento.common.parsing import optional_string_to_list
Expand Down Expand Up @@ -126,7 +126,7 @@ def get_range(
basic_auth=True,
)

df = convert_ndjson_to_df(response.content, compressed=True)
df = convert_jsonl_to_df(response.content, compressed=True)
if df.empty:
return df

Expand Down
6 changes: 3 additions & 3 deletions databento/reference/api/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from databento.common.http import BentoHttpAPI
from databento.common.parsing import convert_date_columns
from databento.common.parsing import convert_datetime_columns
from databento.common.parsing import convert_ndjson_to_df
from databento.common.parsing import convert_jsonl_to_df
from databento.common.parsing import datetime_to_string
from databento.common.parsing import optional_datetime_to_string
from databento.common.parsing import optional_string_to_list
Expand Down Expand Up @@ -107,7 +107,7 @@ def get_range(
basic_auth=True,
)

df = convert_ndjson_to_df(response.content, compressed=True)
df = convert_jsonl_to_df(response.content, compressed=True)
if df.empty:
return df

Expand Down Expand Up @@ -178,7 +178,7 @@ def get_last(
basic_auth=True,
)

df = convert_ndjson_to_df(response.content, compressed=True)
df = convert_jsonl_to_df(response.content, compressed=True)
if df.empty:
return df

Expand Down
2 changes: 1 addition & 1 deletion tests/test_reference_adjustment.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_adjustment_factors_get_range_response(
) -> None:
# Arrange
mock_response = MagicMock()
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.adjustment-factors.ndjson"
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.adjustment-factors.jsonl"
mock_response.content = zstandard.compress(data_path.read_bytes())
mock_response.__enter__.return_value = mock_response
mock_response.__exit__ = MagicMock()
Expand Down
8 changes: 4 additions & 4 deletions tests/test_reference_corporate.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_corporate_actions_get_range_response_parsing_as_pit(
reference_client: Reference,
) -> None:
# Arrange
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.corporate-actions.ndjson"
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.corporate-actions.jsonl"
mock_response = MagicMock()
mock_response.content = zstandard.compress(data_path.read_bytes())
mock_response.__enter__.return_value = mock_response
Expand Down Expand Up @@ -176,7 +176,7 @@ def test_corporate_actions_get_range_response(
reference_client: Reference,
) -> None:
# Arrange
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.corporate-actions-pit.ndjson"
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.corporate-actions-pit.jsonl"
mock_response = MagicMock()
mock_response.content = zstandard.compress(data_path.read_bytes())
mock_response.__enter__.return_value = mock_response
Expand All @@ -202,7 +202,7 @@ def test_corporate_actions_get_range_with_ts_record_index(
reference_client: Reference,
) -> None:
# Arrange
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.corporate-actions.ndjson"
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.corporate-actions.jsonl"
mock_response = MagicMock()
mock_response.content = zstandard.compress(data_path.read_bytes())
mock_response.__enter__.return_value = mock_response
Expand Down Expand Up @@ -236,7 +236,7 @@ def test_corporate_actions_get_range_without_flattening(
reference_client: Reference,
) -> None:
# Arrange
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.corporate-actions.ndjson"
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.corporate-actions.jsonl"
mock_response = MagicMock()
mock_response.content = zstandard.compress(data_path.read_bytes())
mock_response.__enter__.return_value = mock_response
Expand Down
4 changes: 2 additions & 2 deletions tests/test_reference_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def test_security_master_get_last_response(
reference_client: Reference,
) -> None:
# Arrange
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.security-master.ndjson"
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.security-master.jsonl"
mock_response = MagicMock()
mock_response.content = zstandard.compress(data_path.read_bytes())
mock_response.__enter__.return_value = mock_response
Expand Down Expand Up @@ -255,7 +255,7 @@ def test_security_master_get_range_response(
index: str,
) -> None:
# Arrange
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.security-master.ndjson"
data_path = Path(TESTS_ROOT) / "data" / "REFERENCE" / "test_data.security-master.jsonl"
mock_response = MagicMock()
mock_response.content = zstandard.compress(data_path.read_bytes())
mock_response.__enter__.return_value = mock_response
Expand Down

0 comments on commit 36b8b5a

Please sign in to comment.