diff --git a/Makefile b/Makefile index 077e18a..9f5987c 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,8 @@ TODAY = $(shell date +"%Y-%m-%dT%H:%M:%S.%N%:z") PPREFIX = $(shell pwd) BASE_DIR = $(shell echo $${PWD\#\#*/}) -TEST_TAG = # Define the rc -PACKAGE_DIR = $(BASE_DIR)-$(VERSION)$(TEST_TAG) +PR_TAG = # Define the rc +PACKAGE_DIR = $(BASE_DIR)-$(VERSION)$(PR_TAG) APP_NAME = sunrisesunset DOCS = $(PREFIX)/docs RM_REGEX = '(^.*.pyc$$)|(^.*.wsgic$$)|(^.*~$$)|(.*\#$$)|(^.*,cover$$)' @@ -44,8 +44,8 @@ sphinx : clean # To add a pre-release candidate such as 'rc1' to a test package name an # environment variable needs to be set that setup.py can read. # -# make build TEST_TAG=rc1 -# make upload-test TEST_TAG=rc1 +# make build PR_TAG=rc1 +# make upload-test PR_TAG=rc1 # # The tarball could then be named sunrisesunset-2.0.0rc1.tar.gz # diff --git a/README.rst b/README.rst index ef1bae2..d603cb8 100644 --- a/README.rst +++ b/README.rst @@ -93,5 +93,5 @@ month, and day needs to be entered. Sunset: 2023-12-16 19:00:39.782789-05:00 Is night: False - Test 24 hours + Test 24 hours for every 20 minutes. ... diff --git a/include.mk b/include.mk index 0ee4d60..dbcb1cb 100644 --- a/include.mk +++ b/include.mk @@ -5,5 +5,5 @@ # Django Dynamic Column version info. MAJORVERSION = 1 MINORVERSION = 0 -PATCHLEVEL = 1 +PATCHLEVEL = 2 VERSION = ${MAJORVERSION}.${MINORVERSION}.${PATCHLEVEL} diff --git a/setup.py b/setup.py index 3e3b7a0..fefec26 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,15 @@ # -*- coding: utf-8 -*- +""" +Setup a pip environment. +""" +__docformat__ = "restructuredtext en" import os import re from setuptools import setup +filepath = os.path.dirname(__file__) + def version(): """ Find the version. @@ -13,7 +19,7 @@ def version(): """ regex = r'(?m)(^{}[\s]*=[\s]*(?P\d*)$)' - with open(os.path.join(os.path.dirname(__file__), 'include.mk')) as f: + with open(os.path.join(filepath, 'include.mk')) as f: ver = f.read() major = re.search(regex.format('MAJORVERSION'), ver).group('ver') @@ -23,7 +29,9 @@ def version(): env_value = os.environ.get('PR_TAG', '') return f"{major}.{minor}.{patch}{env_value}" -with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: +filename = os.path.join(filepath, 'README.rst') + +with open(filename, mode='r', encoding='UTF-8') as readme: README = readme.read() # Allow setup.py to be run from any path. diff --git a/sunrisesunset/__init__.py b/sunrisesunset/__init__.py index 3f53189..7e7e008 100644 --- a/sunrisesunset/__init__.py +++ b/sunrisesunset/__init__.py @@ -2,6 +2,10 @@ # # sunrisesunset/__init__.py # +""" +Alow the import of SunriseSunset without having to import the actual file. +""" +__docformat__ = "restructuredtext en" from .sunrisesunset import SunriseSunset diff --git a/sunrisesunset/sunrisesunset.py b/sunrisesunset/sunrisesunset.py index 390f8b0..7cff1c0 100644 --- a/sunrisesunset/sunrisesunset.py +++ b/sunrisesunset/sunrisesunset.py @@ -2,18 +2,20 @@ # # sunrisesunset.py # -# This code is valid for dates from 1901 to 2099, and will not calculate -# sunrise/sunset times for latitudes above/below 63/-63 degrees. -# -# No external packages are used when using the class SunriseSunset. If you -# run the tests you will need to install pytz as shown below or use your -# package installer if it's available. -# -#---------------------------------- -# -# Contributions by: -# Darryl Smith -- Noticed a bug with atan fixed with atan2. -# +""" +This code is valid for dates from 1901 to 2099, and will not calculate +sunrise/sunset times for latitudes above/below 63/-63 degrees. + +No external packages are used when using the class SunriseSunset. If you +run the tests you will need to install pytz, geopy, and timezonefinder as +shown below or use your package installer if it's available. +---------------------------------- + +Contributions by: + Darryl Smith -- Noticed a bug with atan fixed with atan2. +""" +__docformat__ = "restructuredtext en" + import datetime from math import degrees, radians, atan2, cos, sin, pi, sqrt, fabs @@ -270,11 +272,12 @@ def __get_rise_set(date, lat=35.9513, lon=-83.9142, zenith='official'): # Get sunrise sunset for every hour of the day using the # default zenith. - print("\nTest 24 hours") + minutes = 20 + print(f"\nTest 24 hours for every {minutes} minutes.") for hour in range(24): # Every 20 minutes for an hour. - for minute in range(0, 60, 20): + for minute in range(0, 60, minutes): date = dt.replace(hour=hour, minute=minute, second=0, microsecond=0) __get_rise_set(date, lat=lat, lon=lon)