Skip to content

Commit ed0b664

Browse files
author
David Marteau
committed
Update/fix documentation
1 parent 45df421 commit ed0b664

File tree

9 files changed

+36
-33
lines changed

9 files changed

+36
-33
lines changed

pylr/binary.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
'''
3-
Created on 4 déc. 2013
4-
5-
@author: Mappy S.A.
2+
''' Support definition and intermediate parsing of binary encoded locations
63
'''
74

85
from collections import namedtuple

pylr/constants.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# -*- coding: utf-8 -*-
2+
''' Constante definitions
23
'''
3-
Created on 4 déc. 2013
44

5-
@author: Mappy S.A.
6-
7-
'''
85

96
from .utils import enum
107

pylr/decoder.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# -*- coding: utf-8 -*-
2-
'''
3-
Created on 2 janv. 2014
2+
''' OpenLR decoder and database interfaces
43
5-
@author: Mappy S.A.
4+
Pylr use an abstract mapdatabase interface for accessing grapth data.
5+
The map database is passed to the decoder for calculating route and shortest path between
6+
location reference points.
67
'''
78
from __future__ import print_function
89

@@ -138,12 +139,15 @@ class RouteConstructionFailed(RouteSearchException):
138139

139140

140141
class MapDatabase(object):
141-
142+
""" The map database is an abstract interface used by the decoder object.
143+
Implementor of database should inherit from this abstract class.
144+
"""
145+
142146
""" Node interface
143147
distance: the distance from the search location
144148
"""
145149
Node = namedtuple('Node', ('distance',))
146-
150+
147151
""" Line interface
148152
distance: the distance from the search location
149153
@@ -196,7 +200,7 @@ def find_closeby_lines(self, coords, max_node_dist, frc_max, beardir):
196200
raise NotImplementedError("MapDatabase:find_closeby_lines")
197201

198202
def calculate_route(self, l1, l2, maxdist, lfrc, islastrp):
199-
""" Calculate the shortest path between two lines
203+
""" Calculate the shortest paths between two lines
200204
201205
:param l1: the first candidate line to begin the search from
202206
:param l2: the second candidate line to stop the search to

pylr/fow.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
'''
3-
Created on 5 déc. 2013
4-
5-
@author: Mappy S.A
2+
''' Fow constants
63
'''
74

85
UNDEFINED = 0

pylr/parser.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
'''
3-
Created on 4 déc. 2013
4-
5-
@author: Mappy S.A.
2+
''' Location parser
63
'''
74

85
from collections import namedtuple

pylr/rating.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# -*- coding: utf-8 -*-
2+
''' Handle Form Of Way (fow) rating
23
'''
3-
Created on 2 janv. 2014
44

5-
@author: Mappy S.A.
6-
'''
75

86
import fow
97

pylr/tests/units/test_decoder.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
DecoderError,
2020
MapDatabase,
2121
AGAINST_LINE_DIRECTION,
22-
WITH_LINE_DIRECTION, )
22+
WITH_LINE_DIRECTION,
23+
fow )
24+
from pylr.rating import get_fow_rating_category
2325
import pyproj
2426
except:
2527
import traceback
@@ -170,3 +172,19 @@ def test_21_find_candidate_lines(self):
170172
lines = self.decoder.find_candidate_lines(lrp)
171173
self.assertGreaterEqual(len(lines), 1)
172174
self.assertEquals(lines[0][0].id, 'Line1', lines)
175+
176+
def test_fow_rating(self):
177+
""" OpenLR decoder: test fow rating symmetry """
178+
fows = [fow.UNDEFINED,
179+
fow.MOTORWAY,
180+
fow.MULTIPLE_CARRIAGEWAY,
181+
fow.SINGLE_CARRIAGEWAY,
182+
fow.ROUNDABOUT,
183+
fow.TRAFFICSQUARE,
184+
fow.SLIPROAD,
185+
fow.OTHER]
186+
187+
for fow1 in fows:
188+
for fow2 in fows:
189+
self.assertEquals(get_fow_rating_category(fow1,fow2),
190+
get_fow_rating_category(fow2,fow1))

pylr/utils.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
'''
3-
Created on 4 déc. 2013
4-
5-
@author: Mappy S.A
2+
''' Some utilities
63
'''
74

85

pylr/values.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# -*- coding: utf-8 -*-
2+
''' Define functions for transforming encoded values
23
'''
3-
Created on 5 déc. 2013
44

5-
@author: Mappy S.A.
6-
'''
75
from .utils import signum
86
from .constants import (BIT24FACTOR_REVERSED,
97
DECA_MICRO_DEG_FACTOR,

0 commit comments

Comments
 (0)