Skip to content

Commit 3ed8ec8

Browse files
committed
python: add stubs
This has been generated by https://github.com/Jij-Inc/pyo3-stub-gen However, there is a chain of dependencies that makes it hard to include the build process in this commit. That is why we offer for now a static file (as suggested in https://pyo3.rs/v0.16.4/python_typing_hints.html) Signed-off-by: Tristram Gräbener <[email protected]>
1 parent ef138d6 commit 3ed8ec8

File tree

1 file changed

+148
-0
lines changed

1 file changed

+148
-0
lines changed

python/liblrs_python.pyi

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# This file is automatically generated by pyo3_stub_gen
2+
# ruff: noqa: E501, F401
3+
4+
import typing
5+
6+
class Anchor:
7+
r"""
8+
An `Anchor` is a reference point for a given [`Curve`].
9+
It can be a milestone, a bridge…
10+
"""
11+
name: str
12+
position: typing.Optional[Point]
13+
curve_position: float
14+
scale_position: float
15+
16+
class AnchorOnLrm:
17+
r"""
18+
The linear position of an anchor doesn’t always match the measured distance
19+
For example if a road was transformed into a bypass, resulting in a longer road,
20+
but measurements are kept the same
21+
The start of the curve might also be different from the `0` of the LRM
22+
"""
23+
def __new__(cls,anchor_index:int, distance_along_lrm:float): ...
24+
...
25+
26+
class Builder:
27+
def __new__(cls,): ...
28+
def add_node(self, id:str, coord:Point, properties:typing.Mapping[str, str]) -> int:
29+
...
30+
31+
def add_anchor(self, id,coord,properties,name = ...) -> int:
32+
...
33+
34+
def add_projected_anchor(self, id,position_on_curve,properties,name = ...) -> int:
35+
...
36+
37+
def add_segment(self, id:str, geometry:typing.Sequence[Point], start_node_index:int, end_node_index:int) -> int:
38+
...
39+
40+
def add_traversal(self, traversal_id:str, segments:typing.Sequence[SegmentOfTraversal]) -> None:
41+
...
42+
43+
def add_lrm_with_distances(self, id:str, traversal_index:int, anchors:typing.Sequence[AnchorOnLrm], properties:typing.Mapping[str, str]) -> None:
44+
...
45+
46+
def add_lrm_with_distances_with_orientation(self, id:str, traversal_index:int, reference_traversal_index:int, anchors:typing.Sequence[AnchorOnLrm], properties:typing.Mapping[str, str]) -> None:
47+
...
48+
49+
def get_traversal_indexes(self) -> dict[str, int]:
50+
...
51+
52+
def read_from_osm(self, input_osm_file:str, lrm_tag:str, required:typing.Sequence[tuple[str, str]], to_reject:typing.Sequence[tuple[str, str]]) -> None:
53+
...
54+
55+
def save(self, out_file:str, properties:typing.Mapping[str, str]) -> None:
56+
...
57+
58+
def euclidean_distance(self, lrm_index_a:int, lrm_index_b:int) -> float:
59+
...
60+
61+
def get_nodes_of_traversal(self, lrm_index:int) -> list[int]:
62+
...
63+
64+
def get_node_coord(self, node_index:int) -> Point:
65+
...
66+
67+
def reverse(self, lrm_index:int) -> None:
68+
...
69+
70+
71+
class LrmScaleMeasure:
72+
r"""
73+
Represent a position on an [`LrmScale`] relative as an `offset` to an [`Anchor`].
74+
"""
75+
anchor_name: str
76+
scale_offset: float
77+
def __new__(cls,anchor_name:str, scale_offset:float): ...
78+
79+
class Lrs:
80+
r"""
81+
Holds the whole Linear Referencing System.
82+
"""
83+
def __new__(cls,data:bytes): ...
84+
def lrm_len(self) -> int:
85+
r"""
86+
How many LRMs compose the LRS.
87+
"""
88+
...
89+
90+
def get_lrm_geom(self, index:int) -> list[Point]:
91+
r"""
92+
Return the geometry of the LRM.
93+
"""
94+
...
95+
96+
def get_lrm_scale_id(self, index:int) -> str:
97+
r"""
98+
 `id` of the [`LrmScale`].
99+
"""
100+
...
101+
102+
def get_anchors(self, lrm_index:int) -> list[Anchor]:
103+
r"""
104+
All the [`Anchor`]s of a LRM.
105+
"""
106+
...
107+
108+
def resolve(self, lrm_index:int, measure:LrmScaleMeasure) -> Point:
109+
r"""
110+
Get the position given a [`LrmScaleMeasure`].
111+
"""
112+
...
113+
114+
def locate_point(self, lrm_index:int, measure:LrmScaleMeasure) -> float:
115+
r"""
116+
Get the positon along the curve given a [`LrmScaleMeasure`]
117+
The value will be between 0.0 and 1.0, both included
118+
"""
119+
...
120+
121+
def resolve_range(self, lrm_index:int, from:LrmScaleMeasure, to:LrmScaleMeasure) -> list[Point]:
122+
r"""
123+
Given two [`LrmScaleMeasure`]s, return a range of [`Point`] that represent a line string.
124+
"""
125+
...
126+
127+
def find_lrm(self, lrm_id:str) -> typing.Optional[int]:
128+
r"""
129+
Given a ID returns the corresponding lrs index (or None if not found)
130+
"""
131+
...
132+
133+
134+
class Point:
135+
r"""
136+
A geographical [`Point`], it can be either a projected or spherical coordinates.
137+
"""
138+
x: float
139+
y: float
140+
def __new__(cls,x:float, y:float): ...
141+
142+
class SegmentOfTraversal:
143+
r"""
144+
A traversal is composed by segments
145+
"""
146+
def __new__(cls,segment_index:int, reversed:bool): ...
147+
...
148+

0 commit comments

Comments
 (0)