Skip to content

Commit c38c927

Browse files
authored
Merge pull request #42 from loicgasser/py2_legacy
Drop py 2 support
2 parents 750125d + 9523c51 commit c38c927

22 files changed

Lines changed: 241 additions & 218 deletions

.flake8

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

.github/workflows/main.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags:
7+
- "*"
8+
pull_request:
9+
10+
jobs:
11+
tests:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
16+
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
architecture: x64
27+
28+
- name: Display Python version
29+
run: python -c "import sys; print(sys.version)"
30+
31+
- name: Install dependencies
32+
run: |
33+
sudo apt-get update -y
34+
sudo apt-get install -y python-dev libgeos-dev
35+
pip install -U pip setuptools
36+
pip install -r dev-requirements.txt
37+
38+
- name: Lint
39+
run: flake8
40+
41+
- name: Isort
42+
run: isort --check-only --diff .
43+
44+
- name: Test
45+
run: coverage run --source=quantized_mesh_tile setup.py test
46+
47+
- name: Coveralls
48+
uses: AndreMiras/coveralls-python-action@develop
49+
with:
50+
github-token: ${{ secrets.github_token }}
51+
flag-name: run-${{ matrix.python-version }}
52+
parallel: true
53+
54+
coveralls:
55+
needs: tests
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Coveralls Finished
59+
uses: AndreMiras/coveralls-python-action@develop
60+
with:
61+
github-token: ${{ secrets.github_token }}
62+
parallel-finished: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ doc/build/
99
.idea/
1010
.coverage
1111
.vscode
12+
.eggs

.travis.yml

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

LICENSE renamed to LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 Gasser Loïc
3+
Copyright (c) 2021 Gasser Loïc
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
quantized-mesh-tile
22
===================
33

4-
[![Build Status](https://travis-ci.org/loicgasser/quantized-mesh-tile.svg?branch=master)](https://travis-ci.org/loicgasser/quantized-mesh-tile)
4+
![Build Status](https://github.com/loicgasser/quantized-mesh-tile/workflows/CI/badge.svg?branch=master)
55
[![Coverage Status](https://coveralls.io/repos/github/loicgasser/quantized-mesh-tile/badge.svg?branch=master)](https://coveralls.io/github/loicgasser/quantized-mesh-tile?branch=master)
66
[![Doc Status](https://readthedocs.org/projects/quantized-mesh-tile/badge/?version=latest)](http://quantized-mesh-tile.readthedocs.io/en/latest/?badge=latest)
77

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
coveralls
22
flake8
3-
future
3+
isort
44
mock==1.0.1
55
nose
66
sphinx

doc/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Reference Documentation
1717
Requirements
1818
------------
1919

20-
Quantized mesh tile requires Python >=2.7 (not including Python 3.x) and GEOS >= 3.3.
20+
Quantized mesh tile requires Python >= 3.5 and GEOS >= 3.3.
2121

2222
Installation
2323
------------

quantized_mesh_tile/bbsphere.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from __future__ import absolute_import, division
4-
53
import math
6-
from builtins import map, object
7-
8-
from past.builtins import xrange
9-
from past.utils import old_div
104

115
from . import cartesian3d as c3d
126

@@ -15,8 +9,9 @@ class BoundingSphere(object):
159
def __init__(self, *args, **kwargs):
1610
MAX = float('infinity')
1711
MIN = float('-infinity')
18-
self.center = list(map(float, kwargs.get('center', [])))
19-
self.radius = float(kwargs.get('radius', 0))
12+
13+
self.center = kwargs.get('center', [])
14+
self.radius = kwargs.get('radius', 0)
2015
self.minPointX = [MAX, MAX, MAX]
2116
self.minPointY = [MAX, MAX, MAX]
2217
self.minPointZ = [MAX, MAX, MAX]
@@ -31,7 +26,7 @@ def fromPoints(self, points):
3126
if nbPositions < 2:
3227
raise Exception('Your list of points must contain at least 2 points')
3328

34-
for i in xrange(0, nbPositions):
29+
for i in range(0, nbPositions):
3530
point = points[i]
3631

3732
# Store the points containing the smallest and largest component
@@ -86,7 +81,7 @@ def fromPoints(self, points):
8681
naiveCenter = c3d.multiplyByScalar(c3d.add(minBoxPt, maxBoxPt), 0.5)
8782
naiveRadius = 0.0
8883

89-
for i in xrange(0, nbPositions):
84+
for i in range(0, nbPositions):
9085
currentP = points[i]
9186

9287
# Find the furthest point from the naive center to calculate the naive radius.
@@ -104,12 +99,12 @@ def fromPoints(self, points):
10499
# Calculate center of new Ritter sphere
105100
oldToNew = oldCenterToPoint - ritterRadius
106101
ritterCenter = [
107-
old_div((ritterRadius * ritterCenter[0] + oldToNew * currentP[0]),
108-
oldCenterToPoint),
109-
old_div((ritterRadius * ritterCenter[1] + oldToNew * currentP[1]),
110-
oldCenterToPoint),
111-
old_div((ritterRadius * ritterCenter[2] + oldToNew * currentP[2]),
112-
oldCenterToPoint)
102+
(ritterRadius * ritterCenter[0] +
103+
oldToNew * currentP[0]) / oldCenterToPoint,
104+
(ritterRadius * ritterCenter[1] +
105+
oldToNew * currentP[1]) / oldCenterToPoint,
106+
(ritterRadius * ritterCenter[2] +
107+
oldToNew * currentP[2]) / oldCenterToPoint
113108
]
114109

115110
# Keep the naive sphere if smaller

quantized_mesh_tile/cartesian3d.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# -*- coding: utf-8 -*-
22

3-
from __future__ import division
4-
53
import math
64

7-
from past.utils import old_div
8-
95

106
def magnitudeSquared(p):
117
return p[0] ** 2 + p[1] ** 2 + p[2] ** 2
@@ -37,4 +33,4 @@ def multiplyByScalar(p, scalar):
3733

3834
def normalize(p):
3935
mgn = magnitude(p)
40-
return [old_div(p[0], mgn), old_div(p[1], mgn), old_div(p[2], mgn)]
36+
return [p[0] / mgn, p[1] / mgn, p[2] / mgn]

0 commit comments

Comments
 (0)