Skip to content

Commit

Permalink
Merge 17893ed into bc2705c
Browse files Browse the repository at this point in the history
  • Loading branch information
Duncan Macleod committed Nov 2, 2018
2 parents bc2705c + 17893ed commit ebd7147
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 49 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml → .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
environment:
matrix:
- PYTHON: "C:\\Python27-x64"
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python37-x64"
install:
- "%PYTHON%\\python.exe -m pip install --upgrade pip"
- "%PYTHON%\\python.exe -m pip install setuptools"
Expand Down
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ language: python
sudo: false
dist: trusty
python:
- '2.6'
- '2.7'
- '3.3'
- '3.4'
- '3.5'
- '3.6'
Expand All @@ -14,12 +11,10 @@ before_install:
install:
- pip install .
before_script:
- if [[ ${TRAVIS_PYTHON_VERSION} == '2.6' ]]; then pip install "coverage <= 4.5.1"; fi
- pip install coverage "pytest>=2.8" pytest-runner
script:
- coverage run ./setup.py test
after_success:
- if [[ ${TRAVIS_PYTHON_VERSION} == '2.6' ]]; then pip install "coveralls < 1.3.0"; fi
- pip install "coveralls"
- coveralls
cache: pip
Expand Down
24 changes: 3 additions & 21 deletions ligotimegps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@
except ImportError: # python 2.6
from total_ordering import total_ordering

import six

if six.PY2 and os.name == 'nt': # use numpy for long int on python 2.7
from numpy import long as long_
elif six.PY2: # python 2.7 builtin long
long_ = long
else: # python >= 3 builtin int is long
long_ = int

from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
Expand Down Expand Up @@ -93,8 +84,8 @@ def __init__(self, seconds, nanoseconds=0):
ns, seconds = modf(seconds)
seconds = int(seconds)
nanoseconds += ns * 1e9
elif not isinstance(seconds, six.integer_types):
if isinstance(seconds, (six.binary_type, six.text_type)):
elif not isinstance(seconds, int):
if isinstance(seconds, (str, bytes)):
try:
seconds = str(Decimal(seconds))
except ArithmeticError:
Expand Down Expand Up @@ -157,15 +148,6 @@ def __int__(self):
"""
return self._seconds

if six.PY2:
def __long__(self):
"""Return the integer part (seconds) of a `LIGOTimeGPS` as a long
>>> long(LIGOTimeGPS(100.5))
100L
"""
return long(self._seconds)

def ns(self):
"""Convert a `LIGOTimeGPS` to a count of nanoseconds as an int
Expand All @@ -177,7 +159,7 @@ def ns(self):
>>> LIGOTimeGPS(100.5).ns()
100500000000
"""
return long_(self._seconds) * 1000000000 + self._nanoseconds
return self._seconds * 1000000000 + self._nanoseconds

# -- comparison -----------------------------

Expand Down
16 changes: 2 additions & 14 deletions ligotimegps/test_ligotimegps.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

from numbers import Integral

from six import PY2

import pytest

from ligotimegps import LIGOTimeGPS
Expand Down Expand Up @@ -95,12 +93,6 @@ def test_int():
assert isinstance(i, int)
assert i == 1

if PY2:
def test_long():
l = long(LIGOTimeGPS(123456789, 123456789))
assert isinstance(l, long)
assert l == 123456789


def test_ns():
n = LIGOTimeGPS(12345, 67890).ns()
Expand Down Expand Up @@ -150,19 +142,15 @@ def test_round():
# test round (down) to int
a = LIGOTimeGPS(12345, 67890)
b = round(a)
if PY2:
assert isinstance(b, float)
else:
assert isinstance(b, LIGOTimeGPS)
assert isinstance(b, LIGOTimeGPS)
assert b == 12345

# test round up
assert round(LIGOTimeGPS(12345, 500000000)) == 12346

# test round with decimal point
b = round(a, 1)
if not PY2:
assert isinstance(b, LIGOTimeGPS)
assert isinstance(b, LIGOTimeGPS)
assert b == 12345.0
assert round(a, 7) == LIGOTimeGPS(12345, 67900)

Expand Down
10 changes: 2 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@
setup_requires = []

# runtime dependencies
install_requires = ['six']
if sys.version < '2.7':
install_requires.append('total-ordering')
if os.name == 'nt' and sys.version < '3.0':
install_requires.append('numpy')
install_requires = []

# test dependencies
tests_require = ['pytest>=2.8']
Expand All @@ -61,16 +57,14 @@
url="https://github.com/gwpy/ligotimegps",
license='GPLv3',
cmdclass=versioneer.get_cmdclass(),
python_requires='>=3.4',
setup_requires=setup_requires,
install_requires=install_requires,
tests_require=tests_require,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
Expand Down

0 comments on commit ebd7147

Please sign in to comment.