Skip to content

Commit

Permalink
ENH: Synchronize io/stata with pandas master
Browse files Browse the repository at this point in the history
Sychronize and remvoe classes not part of the public API
  • Loading branch information
bashtage committed Aug 17, 2022
1 parent 30a87ca commit f74e09a
Showing 1 changed file with 35 additions and 57 deletions.
92 changes: 35 additions & 57 deletions pandas-stubs/io/stata.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ from typing import (
Hashable,
Literal,
Sequence,
overload,
)

import numpy as np
Expand All @@ -22,6 +23,7 @@ from pandas._typing import (
WriteBuffer,
)

@overload
def read_stata(
path: FilePath | ReadBuffer[bytes],
convert_dates: bool = ...,
Expand All @@ -32,57 +34,46 @@ def read_stata(
columns: list[HashableT] | None = ...,
order_categoricals: bool = ...,
chunksize: int | None = ...,
iterator: bool = ...,
iterator: Literal[False] = ...,
compression: CompressionOptions = ...,
storage_options: StorageOptions = ...,
) -> DataFrame | StataReader: ...

stata_epoch: datetime.datetime = ...
excessive_string_length_error: str
) -> DataFrame: ...
@overload
def read_stata(
path: FilePath | ReadBuffer[bytes],
convert_dates: bool = ...,
convert_categoricals: bool = ...,
index_col: str | None = ...,
convert_missing: bool = ...,
preserve_dtypes: bool = ...,
columns: list[HashableT] | None = ...,
order_categoricals: bool = ...,
chunksize: int | None = ...,
*,
iterator: Literal[True],
compression: CompressionOptions,
storage_options: StorageOptions,
) -> StataReader: ...
@overload
def read_stata(
path: FilePath | ReadBuffer[bytes],
convert_dates: bool,
convert_categoricals: bool,
index_col: str | None,
convert_missing: bool,
preserve_dtypes: bool,
columns: list[HashableT] | None,
order_categoricals: bool,
chunksize: int | None,
iterator: Literal[True],
compression: CompressionOptions = ...,
storage_options: StorageOptions = ...,
) -> StataReader: ...

class PossiblePrecisionLoss(Warning): ...

precision_loss_doc: str

class ValueLabelTypeMismatch(Warning): ...

value_label_mismatch_doc: str

class InvalidColumnName(Warning): ...

invalid_name_doc: str

class StataValueLabel:
labname: Hashable = ...
value_labels: list[tuple[float, str]] = ...
text_len: int = ...
off: npt.NDArray[np.int32] = ...
val: npt.NDArray[np.int32] = ...
txt: list[bytes] = ...
n: int = ...
len: int = ...
def __init__(
self, catarray: pd.Series, encoding: Literal["latin-1", "utf-8"] = ...
) -> None: ...
def generate_value_label(self, byteorder: str) -> bytes: ...

class StataMissingValue:
MISSING_VALUES: dict[float, str] = ...
bases: tuple[int, int, int] = ...
float32_base: bytes = ...
increment: int = ...
int_value: int = ...
float64_base: bytes = ...
BASE_MISSING_VALUES: dict[str, int] = ...
def __init__(self, value: float) -> None: ...
def __eq__(self, other: object) -> bool: ...
@property
def string(self) -> str: ...
@property
def value(self) -> float: ...
@classmethod
def get_base_missing_value(cls, dtype): ...

class StataParser:
DTYPE_MAP: dict[int, np.dtype] = ...
DTYPE_MAP_XML: dict[int, np.dtype] = ...
Expand Down Expand Up @@ -160,19 +151,6 @@ class StataWriter(StataParser):
) -> None: ...
def write_file(self) -> None: ...

class StataStrLWriter:
df: DataFrame = ...
columns: Sequence[str] = ...
def __init__(
self,
df: DataFrame,
columns: Sequence[str],
version: int = ...,
byteorder: str | None = ...,
) -> None: ...
def generate_table(self) -> tuple[dict[str, tuple[int, int]], DataFrame]: ...
def generate_blob(self, gso_table: dict[str, tuple[int, int]]) -> bytes: ...

class StataWriter117(StataWriter):
def __init__(
self,
Expand Down

0 comments on commit f74e09a

Please sign in to comment.