Skip to content

Commit d11e47f

Browse files
committed
Simple annotations for to_json
1 parent 5c0e8a3 commit d11e47f

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

pandas/io/json/_json.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from io import StringIO
22
from itertools import islice
33
import os
4+
from typing import Any, Callable, Dict, List, Optional, Type, Union
45

56
import numpy as np
67

@@ -36,16 +37,16 @@
3637
def to_json(
3738
path_or_buf,
3839
obj,
39-
orient=None,
40-
date_format="epoch",
41-
double_precision=10,
42-
force_ascii=True,
43-
date_unit="ms",
44-
default_handler=None,
45-
lines=False,
46-
compression="infer",
47-
index=True,
48-
indent=0,
40+
orient: Optional[str] = None,
41+
date_format: str = "epoch",
42+
double_precision: int = 10,
43+
force_ascii: bool =True,
44+
date_unit: str = "ms",
45+
default_handler: Optional[Callable[[Any], Union[int, str, List, Dict]]]=None,
46+
lines: bool =False,
47+
compression: Optional[str] = "infer",
48+
index: bool = True,
49+
indent: int = 0,
4950
):
5051

5152
if not index and orient not in ["split", "table"]:
@@ -60,7 +61,7 @@ def to_json(
6061
if orient == "table" and isinstance(obj, Series):
6162
obj = obj.to_frame(name=obj.name or "values")
6263
if orient == "table" and isinstance(obj, DataFrame):
63-
writer = JSONTableWriter
64+
writer = JSONTableWriter # type: Type["Writer"]
6465
elif isinstance(obj, Series):
6566
writer = SeriesWriter
6667
elif isinstance(obj, DataFrame):

0 commit comments

Comments
 (0)