Skip to content

Commit 227cecc

Browse files
author
AGAEV Denis E
committed
Move geo types to extra
1 parent ad12537 commit 227cecc

File tree

6 files changed

+129
-326
lines changed

6 files changed

+129
-326
lines changed

python/psqlpy/_internal/extra_types.pyi

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Union
1+
from typing import Any, Sequence, Union
22

33
from typing_extensions import Self
44

@@ -82,3 +82,119 @@ class PyMacAddr8:
8282
### Parameters:
8383
- `value`: value for MACADDR8 field.
8484
"""
85+
86+
class PyPoint:
87+
"""Represent point field in PostgreSQL and Point in Rust."""
88+
89+
def __init__(
90+
self: Self,
91+
value: Sequence[float],
92+
) -> None:
93+
"""Create new instance of PyPoint.
94+
95+
It accepts any sequence of two float numbers.
96+
97+
### Parameters:
98+
- `value`: sequence of two float numbers.
99+
"""
100+
101+
class PyBox:
102+
"""Represent box field in PostgreSQL and Rect in Rust."""
103+
104+
def __init__(
105+
self: Self,
106+
value: Union[
107+
Sequence[Sequence[float]],
108+
Sequence[float],
109+
],
110+
) -> None:
111+
"""Create new instance of PyBox.
112+
113+
You need to pass any of this structures:
114+
- sequence of two sequences, each with pair of float numbers
115+
- sequence of two pairs of float
116+
117+
### Parameters:
118+
- `value`: any valid sequence with two pairs of float numbers.
119+
"""
120+
121+
class PyPath:
122+
"""Represent path field in PostgreSQL and LineString in Rust."""
123+
124+
def __init__(
125+
self: Self,
126+
value: Union[
127+
Sequence[Sequence[float]],
128+
Sequence[float],
129+
],
130+
) -> None:
131+
"""Create new instance of PyPath.
132+
133+
You need to pass any of this structures:
134+
- sequence of sequences, each with pair of float numbers
135+
- sequence with pairs of float numbers
136+
137+
### Parameters:
138+
- `value`: any valid structure with float numbers.
139+
"""
140+
141+
class PyLine:
142+
"""Represent line field in PostgreSQL and Line in Rust."""
143+
144+
def __init__(
145+
self: Self,
146+
value: Union[
147+
Sequence[Sequence[float]],
148+
Sequence[float],
149+
],
150+
) -> None:
151+
"""Create new instance of PyLine.
152+
153+
You need to pass any of this structures:
154+
- sequence of three float numbers
155+
- sequence of two sequences, each with pair of float numbers
156+
- sequence with two pairs of float numbers
157+
158+
### Parameters:
159+
- `value`: any valid structure with float numbers.
160+
"""
161+
162+
class PyLineSegment:
163+
"""Represent lseg field in PostgreSQL and Line in Rust."""
164+
165+
def __init__(
166+
self: Self,
167+
value: Union[
168+
Sequence[Sequence[float]],
169+
Sequence[float],
170+
],
171+
) -> None:
172+
"""Create new instance of PyLineSegment.
173+
174+
You need to pass any of this structures:
175+
- sequence of two sequences, each with pair of float numbers
176+
- sequence with two pairs of float numbers
177+
178+
### Parameters:
179+
- `value`: any valid structure with float numbers.
180+
"""
181+
182+
class PyPolygon:
183+
"""Represent polygon field in PostgreSQL and Polygon in Rust."""
184+
185+
def __init__(
186+
self: Self,
187+
value: Union[
188+
Sequence[Sequence[float]],
189+
Sequence[float],
190+
],
191+
) -> None:
192+
"""Create new instance of PyPolygon.
193+
194+
You need to pass any of this structures:
195+
- sequence of sequences, each with pair of float numbers
196+
- sequence with pairs of float numbers
197+
198+
### Parameters:
199+
- `value`: any valid structure with float numbers.
200+
"""

python/psqlpy/_internal/geometric_types.pyi

Lines changed: 0 additions & 119 deletions
This file was deleted.

python/psqlpy/extra_types.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
PyMacAddr8,
77
PyUUID,
88
SmallInt,
9+
PyPoint,
10+
PyBox,
11+
PyPath,
12+
PyLine,
13+
PyLineSegment,
14+
PyPolygon,
915
)
1016

1117
__all__ = [
@@ -16,4 +22,10 @@
1622
"PyJSON",
1723
"PyMacAddr6",
1824
"PyMacAddr8",
25+
"PyPoint",
26+
"PyBox",
27+
"PyPath",
28+
"PyLine",
29+
"PyLineSegment",
30+
"PyPolygon",
1931
]

python/psqlpy/geometric_types.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)