Skip to content

Commit

Permalink
Move julia to own repo [skip ci]
Browse files Browse the repository at this point in the history
py 35+

meta

meta
  • Loading branch information
scivision committed Jan 28, 2019
1 parent 7adfe19 commit cf4f1e5
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 135 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
image:
- Visual Studio 2017
- Ubuntu
- Ubuntu1804

stack: python 3

Expand Down
20 changes: 20 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[run]
cover_pylib = false
omit =
/home/travis/virtualenv/*
*/site-packages/*
*/bin/*

[report]
exclude_lines =
pragma: no cover
def __repr__
except RuntimeError
except NotImplementedError
except ImportError
except FileNotFoundError
except CalledProcessError
logging.warning
logging.error
logging.critical
if __name__ == .__main__.:
38 changes: 24 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
language: python
group: travis_latest
dist: xenial

git:
depth: 3
quiet: true

python:
- 3.7
- 3.6

os:
- linux

- 3.5

matrix:
include:
- os: linux
python: 3.7
install: pip install -e .[tests,cov]
script:
- flake8
- mypy . --ignore-missing-imports
after_success:
- pytest --cov
- coveralls
- os: osx
language: sh
install: pip3 install -e .[tests]
- os: windows
language: sh
before_install:
- choco install python3
- export PATH="/c/Python37:/c/Python37/Scripts:$PATH"

install: pip install -e .[tests]

script:
- pytest -rsv
- flake8
- mypy . --ignore-missing-imports

after_success:
- if [[ $TRAVIS_PYTHON_VERSION == 3.6* ]]; then
pytest --cov --cov-config=setup.cfg;
coveralls;
fi
script: pytest -rsv

2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include LICENSE
include *.py
84 changes: 0 additions & 84 deletions Maidenhead.jl

This file was deleted.

3 changes: 2 additions & 1 deletion Maidenhead.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import maidenhead
from argparse import ArgumentParser
import sys


def main():
Expand All @@ -16,7 +17,7 @@ def main():
loc = maidenhead.toMaiden(p.loc[0], p.loc[1], p.precision)
print(loc)
else:
raise TypeError('specify Maidenhead grid (single string) or lat lon (with space between)')
print('specify Maidenhead grid (single string) or lat lon (with space between)', file=sys.stderr)


if __name__ == '__main__':
Expand Down
19 changes: 8 additions & 11 deletions maidenhead/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def toLoc(maiden: str) -> Tuple[float, float]:
maiden = maiden.strip().upper()

N = len(maiden)
assert 8 >= N >= 2 and N % 2 == 0, 'Maidenhead locator requires 2-8 characters, even number of characters'
if not 8 >= N >= 2 and N % 2 == 0:
raise ValueError('Maidenhead locator requires 2-8 characters, even number of characters')

Oa = ord('A')
lon = -180.
Expand All @@ -43,14 +44,14 @@ def toLoc(maiden: str) -> Tuple[float, float]:


def toMaiden(lat: float, lon: float,
precision: int=3) -> str:
"""Returns a maidenloc for specified lat-lon tuple at specified level.
precision: int = 3) -> str:
"""Returns a maidenhead string for specified lat-lon tuple at specified level.
"""

A = ord('A')
a = divmod(lon+180, 20)
b = divmod(lat+90, 10)
astring: str = chr(A+int(a[0])) + chr(A+int(b[0]))
astring = chr(A+int(a[0])) + chr(A+int(b[0]))
lon = a[1] / 2.
lat = b[1]
i = 1
Expand All @@ -76,15 +77,11 @@ def toMaiden(lat: float, lon: float,
def genGoogleMap(mloc: str) -> str:

gpos = toLoc(mloc)
strout = "http://maps.googleapis.com/maps/api/staticmap?"
strout += "center={}".format(gpos[0])
strout += ",{}".format(gpos[1])
strout += "&zoom=10&size=320x240&sensor=false"

return strout
return "http://maps.googleapis.com/maps/api/staticmap?center={},{}&zoom=10&size=320x240&sensor=false".format(gpos[0], gpos[1])


def genNonSense(lat: float, lon: float, level: int=3) -> str:
def genNonSense(lat: float, lon: float, level: int = 3) -> str:
mloc = toMaiden(lat, lon, level)

return "http://no.nonsense.ee/qthmap/?qth=" + mloc
return "http://no.nonsense.ee/qthmap/?qth={}".format(mloc)
31 changes: 7 additions & 24 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
[metadata]
name = maidenhead
version = 1.2.0
version = 1.2.1
author = Michael Hirsch; Henri Kuiper
description = Maidenhead Locator, Lat Lon coordinate convertor
url = https://github.com/scivision/maidenhead
keywords =
location
maidenhead
classifiers =
Development Status :: 4 - Beta
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: End Users/Desktop
Intended Audience :: Science/Research
Operating System :: OS Independent
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Topic :: Scientific/Engineering :: GIS
Expand All @@ -19,7 +22,7 @@ long_description = file: README.md
long_description_content_type = text/markdown

[options]
python_requires = >= 3.6
python_requires = >= 3.5
setup_requires =
setuptools >= 38.6
pip >= 10
Expand All @@ -31,6 +34,7 @@ install_requires =
[options.extras_require]
tests =
pytest
cov =
pytest-cov
coveralls
flake8
Expand All @@ -43,24 +47,3 @@ console_scripts =
[flake8]
max-line-length = 132
exclude = .git,__pycache__,.eggs/,doc/,docs/,build/,dist/,archive/

[coverage:run]
cover_pylib = false
omit =
/home/travis/virtualenv/*
*/site-packages/*
*/bin/*

[coverage:report]
exclude_lines =
pragma: no cover
def __repr__
except RuntimeError
except NotImplementedError
except ImportError
except FileNotFoundError
except CalledProcessError
logging.warning
logging.error
logging.critical
if __name__ == .__main__.:
1 change: 1 addition & 0 deletions tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_genmap():
"""Test level maps are different"""
m = maidenhead.toMaiden(*casa_henri, 3)
g = maidenhead.genGoogleMap(m)

m1 = maidenhead.toMaiden(*casa_henri, 2)
g1 = maidenhead.genGoogleMap(m1)
assert g != g1
Expand Down

0 comments on commit cf4f1e5

Please sign in to comment.