Skip to content

Commit a9d6590

Browse files
committed
Revert "comments"
This reverts commit 80c3f4d.
1 parent 8253e46 commit a9d6590

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/h3/_cy/cells.pyx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ cpdef int distance(H3int h1, H3int h2) except -1:
6161

6262
check_for_error(
6363
h3lib.gridDistance(h1, h2, &distance)
64-
)
64+
) # todo: should this raise a distance error?
65+
66+
# s = 'Cells are too far apart to compute distance: {} and {}'
6567

6668
return distance
6769

@@ -258,6 +260,8 @@ cpdef H3int[:] uncompact(const H3int[:] hc, int res):
258260
)
259261
)
260262

263+
# todo: again! doesn't work if i have this before the error check!
264+
# why isn't hmm.to_mv() robust to failures before it?
261265
mv = hmm.to_mv()
262266

263267
return mv
@@ -314,7 +318,7 @@ cpdef double cell_area(H3int h, unit='km^2') except -1:
314318
return area
315319

316320

317-
cdef _could_not_find_line(err, start, end):
321+
cdef could_not_find_line(err, start, end):
318322
msg = "Couldn't find line between cells {} and {}"
319323
msg = msg.format(hex(start), hex(end))
320324

@@ -329,12 +333,12 @@ cpdef H3int[:] line(H3int start, H3int end):
329333
# probably applies to all size/work pairs of functions...
330334
err = h3lib.gridPathCellsSize(start, end, &n)
331335

332-
_could_not_find_line(err, start, end)
336+
could_not_find_line(err, start, end)
333337

334338
hmm = H3MemoryManager(n)
335339
err = h3lib.gridPathCells(start, end, hmm.ptr)
336340

337-
_could_not_find_line(err, start, end)
341+
could_not_find_line(err, start, end)
338342

339343
# todo: probably here too?
340344
mv = hmm.to_mv()

src/h3/_cy/edges.pyx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,12 @@ cpdef double edge_length(H3int e, unit='km') except -1:
100100
double length
101101

102102
if unit == 'rads':
103-
err = h3lib.exactEdgeLengthRads(e, &length)
103+
check_for_error(h3lib.exactEdgeLengthRads(e, &length))
104104
elif unit == 'km':
105-
err = h3lib.exactEdgeLengthKm(e, &length)
105+
check_for_error(h3lib.exactEdgeLengthKm(e, &length))
106106
elif unit == 'm':
107-
err = h3lib.exactEdgeLengthM(e, &length)
107+
check_for_error(h3lib.exactEdgeLengthM(e, &length))
108108
else:
109109
raise ValueError('Unknown unit: {}'.format(unit))
110110

111-
check_for_error(err)
112-
113111
return length

0 commit comments

Comments
 (0)