Skip to content

Commit

Permalink
typing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DeaMariaLeon committed Oct 16, 2024
1 parent a34e714 commit 03d6290
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion docs/api-reference/dtypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
members:
- Array
- List
- Struct
- Int64
- Int32
- Int16
Expand All @@ -15,12 +14,14 @@
- UInt32
- UInt16
- UInt8
- Field
- Float64
- Float32
- Boolean
- Categorical
- Enum
- String
- Struct
- Date
- Datetime
- Duration
Expand Down
24 changes: 15 additions & 9 deletions narwhals/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
from collections import OrderedDict
from datetime import timezone
from typing import TYPE_CHECKING
from typing import Iterator
from typing import Literal
from typing import Mapping
from typing import Sequence

if TYPE_CHECKING:
from typing import Iterator
from typing import Literal
from typing import Sequence

from typing_extensions import Self


Expand Down Expand Up @@ -178,12 +179,10 @@ class Field:
"""
Definition of a single field within a `Struct` DataType.
Parameters
----------
name
The name of the field within its parent `Struct`.
dtype
The `DataType` of the field's values.
Arguments:
name: The name of the field within its parent `Struct`.
dtype: The `DataType` of the field's values.
"""

name: str
Expand All @@ -205,6 +204,13 @@ def __repr__(self) -> str:


class Struct(DType):
"""
Struct composite type.
Arguments:
fields: The fields that make up the struct. Can be either a sequence of Field objects or a mapping of column names to data types.
"""

fields: list[Field]

def __init__(
Expand Down

0 comments on commit 03d6290

Please sign in to comment.