diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index d6fc2a6..0000000
--- a/.editorconfig
+++ /dev/null
@@ -1,18 +0,0 @@
-[*]
-charset = utf-8
-end_of_line = lf
-indent_style = space
-insert_final_newline = true
-trim_trailing_whitespace = true
-
-[*.py]
-indent_size = 4
-
-[*.rst]
-indent_size = 3
-
-[*.{json,yml}]
-indent_size = 2
-
-[.api_key]
-insert_final_newline = false
diff --git a/.env b/.env
deleted file mode 100644
index 56a282d..0000000
--- a/.env
+++ /dev/null
@@ -1 +0,0 @@
-PYTHONPATH=src
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index e69de29..0000000
diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml
new file mode 100644
index 0000000..a2ac462
--- /dev/null
+++ b/.github/workflows/go.yaml
@@ -0,0 +1,25 @@
+name: Go
+on:
+ - push
+ - pull_request
+jobs:
+ build:
+ name: Test
+ runs-on: ubuntu-latest
+ # We want to run on external PRs, but not on our own internal PRs as they'll be run by the push to the branch.
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
+ steps:
+ - name: Set up Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: '^1.15'
+ id: go
+ - name: Check out code into the Go module directory
+ uses: actions/checkout@v2
+ - name: Get dependencies
+ run: |
+ go get -v -t -d ./...
+ - name: Build
+ run: go build -v ./cmd/astral/
+ - name: Test
+ run: go test -race ./...
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 969beeb..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-language: python
-python:
- - "3.6"
- - "3.7"
-script:
- - tox -c tox.travis.ini
-install:
- - pip install -r requirements.txt
- - pip install -r requirements-dev.txt
- - pip install tox-travis
-env:
- global:
- secure: YMwnRT0ySBmEq2zFbsd341l+1l6Vm35buq2SqkZozPCkNLnJshfUltb3EevYEz/ICOIKraGkms4iIjTHuBeASlSj976qHzcupY7SupVVMonCqbE44gholPX1/wh/MRR8zKvj8kx+vHIREchQjD7EgTaHbYK77bBztgNl679setKrIWNIk5HxjpiskvD8BGRPl6q8X0GLav5K5Jl/zT0Dgc+XKWsmSIoUZcAE16GFjzqQOB+L5KZcF/eu5slNyUf07Rpun/BWQ/kVEC9h2SEl1XBxGRBYoVnVQuVB5A6NZKPATT4eJm0nFwrEjSHHnCrhbaFz7y0I7NsljKTAnFVoMvFUy7YByrcfid8CIvLgpfqdIVP6asn/rnXSuh+oxQ3qLn3aYzY9lXPsKqX7RnWdgmJhqEocHRj2TE6/8lMw3ucAb6HIs2Ol48lULP2RA1oaak6Mhu0ZZ71wcIhDF+e/vGKaUdikaP9ZBPfb9Vzr6CS/uarL9kFBOU2mX8/wKpMjv4PtESjOxv6/y/XziO4Jju6xMVxc1a66zoToJBTUM6UjJXmyMEDVulAEQ9NsUUSWc3zSd+jpGoBQF6Q0B2m/IWiYBZtCoPQX41LN7jEH99Co/5D2P5Y/BpNeWDVgaRMIwiF4jT/IrDp1ZeJCddHPGkgF6GGniP5WLh5yLnhSahE=
diff --git a/AUTHORS b/AUTHORS
index d53c163..606dbc4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -5,3 +5,4 @@ Simon Kennedy
Wojciech Pietruszeski
Zachary Priddy
Michael Marx
+Simon Jürgensmeyer
diff --git a/ChangeLog.md b/ChangeLog.md
deleted file mode 100644
index 96ba809..0000000
--- a/ChangeLog.md
+++ /dev/null
@@ -1,106 +0,0 @@
-# CHANGELOG
-
-## 2.2 - 2020-05-20
-
-### Changed
-
-- Fix for [bug #48](https://github.com/sffjunkie/astral/issues/48). As per the bug report the angle to adjust for the effect of elevation should have been θ (not α).
-- The sun functions can now also be passed the timezone as a string. Previously only a pytz timezone was accepted.
-
-## 2.1 - 2020-02-12
-
-### Bug Fix
-
-- Fix for bug #44 - Incorrectly raised exception when UTC sun times were on the day previous to the day asked for. This only manifested itself for timezones with a large positive offset.
-
-## 2.0 - 2020-02-11
-
-### Refactor
-
-- This is a code refactor as well as an update so it is highly likely that you will need to adapt your code to suit.
-- Astral, AstralGeocoder & GoogleGeocoder classes removed
-- Requires python 3.6+ due to the use of dataclasses
-- New LocationInfo class to store a location name, region, timezone, latitude & longitude
-- New Observer class to store a latitude, longitude & elevation
-- Geocoder database now returns a LocationInfo instead of a Location
-
-## 1.10.1 - 2019-02-06
-
-### Changed
-
-Keywords arguments to Astral **init** are now passed to the geocoder to allow for passing
-the `api_key` to GoogleGeocoder.
-
-## 1.10 - 2019-02-04
-
-### Added
-
-Added method to AstralGeocoder to add locations to the database
-
-## 1.9.2 - 2019-01-31
-
-### Changed
-
-Version 1.9 broke the sun_utc method. Sun UTC calculation passed incorrect
-parameter to more specific methods e.g. sunrise, sunset etc.
-
-## 1.9.1 - 2019-01-28
-
-### Changed
-
-Corrected version number in module source code.
-
-## 1.9 - 2019-01-28
-
-### Added
-
-Sun calculations now take into account the elevation of the location.
-
-## 1.8 - 2018-12-06
-
-### Added
-
-Added command line interface to return sun information as json.
-Added support for no timezone in Location methods.
-
-## 1.7.1 - 2018-10-25
-
-### Changed
-
-Changed GoogleGeocoder test to not use raise...from as this is not valid for Python 2
-
-## 1.7 - 2018-10-24
-
-### Changed
-
-- Requests is now only needed when using GoogleGeocoder
-- GoogleGeocoder now requires the `api_key` parameter to be passed to the constructor
-
-## 1.6.1 - 2018-05-02
-
-### Changed
-
-- Updated Travis CI configuration
-
-### Added
-
-- requirements-dev.txt
-
-## 1.6 - 2018-02-22
-
-### Changed
-
-- Added api_key parameter to GoogleGeocoder **init** method. Idea from
- wpietruszewski https://github.com/sffjunkie/astral/pull/12
-
-## 1.5 - 2017-12-07
-
-### Added
-
-- this file
-
-### Changed
-
-- dawn_utc, sunrise_utc, sunset_utc and dusk_utc now only raise AstralError for a math domain
- exception all other exceptions are passed through.
-- moon_phase now takes another parameter if the type to return either int (the default) or float
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index 23f12a8..0000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,6 +0,0 @@
-global-exclude *.pyc
-include setup.cfg
-include monkeypatch.py
-include LICENSE
-recursive-include docs *
-recursive-include src/test *.py
diff --git a/Makefile b/Makefile
deleted file mode 100644
index c2d4b52..0000000
--- a/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-.PHONY: clean test test-docs test-all html report build-docs repl show-docs show-cov typecheck
-
-all: clean test report html
-
-BUILDDIR=$(DEV_HOME)/build/astral
-
-clean:
- @COVERAGE_FILE=$(BUILDDIR)/.coverage coverage erase
- @rm -rf $(BUILDDIR)/doctrees
-
-test:
- tox
-
-test-docs:
- tox -e doc
-
-test-all:
- tox -e py36,py37,nopytz,doc
-
-html:
- @COVERAGE_FILE=$(BUILDDIR)/.coverage coverage html -d $(BUILDDIR)/htmlcov/
-
-report:
- @COVERAGE_FILE=$(BUILDDIR)/.coverage coverage report
-
-build-docs:
- sphinx-build -a -b html -d $(BUILDDIR)/doctrees ./src/docs ./docs
-
-repl:
- @PYTHONPATH=src python
-
-show-docs:
- /usr/bin/start ./doc/index.html
-
-publish-docs:
- git subtree push --prefix docs origin gh-pages
-
-show-cov:
- /usr/bin/start $(BUILDDIR)/htmlcov/index.html
-
-typecheck:
- @cd src
- mypy astral
- @cd ..
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b1a1666
--- /dev/null
+++ b/README.md
@@ -0,0 +1,75 @@
+# Astral
+
+![Action](https://github.com/sj14/astral/workflows/Go/badge.svg)
+[![GoDoc](https://godoc.org/github.com/sj14/astral?status.png)](https://godoc.org/github.com/sj14/astral)
+
+Calculations for the position of the sun and moon.
+
+This is a Go port of the Python [astral](https://github.com/sffjunkie/astral) package.
+
+The `astral` package provides the means to calculate the following times of the sun:
+
+* dawn
+* sunrise
+* noon
+* midnight
+* sunset
+* dusk
+* daylight
+* night
+* twilight
+* blue hour
+* golden hour
+* ~~rahukaalam~~ TODO
+
+plus solar azimuth and elevation at a specific latitude/longitude.
+It can also calculate the moon phase for a specific date.
+
+## CLI
+
+Besides the package for usage in you own programs, we also provide a tool for showing the data.
+
+### Installation
+
+```text
+go get github.com/sj14/astral/cmd/astral
+```
+
+### Usage
+
+```text
+Usage of astral:
+ -elev float
+ elevation of the observer
+ -format string
+ time output format according to Go parsing (default "Jan _2 15:04:05")
+ -lat float
+ latitude of the observer
+ -long float
+ longitude of the observer
+ -time string
+ day/time used for the calculation (defaults to current time)
+```
+
+### Example
+
+```text
+$ astral -lat 51.58 -long 6.52
+Sun Apr 18 11:12:45 CEST 2021
+Latitude 51.58 Longitude 6.52 Elevation 0
+Apr 18 05:55:07 Dawn
+Apr 18 05:55:07 Blue Hour Start
+Apr 18 06:09:04 Blue Hour End
+Apr 18 06:09:04 Golden Hour Start
+Apr 18 06:31:44 Sunrise
+Apr 18 07:15:56 Golden Hour End
+Apr 18 13:33:18 Noon
+Apr 18 19:51:24 Golden Hour Start
+Apr 18 20:35:45 Sunset
+Apr 18 20:58:33 Golden Hour End
+Apr 18 20:58:33 Blue Hour Start
+Apr 18 21:12:35 Blue Hour End
+Apr 18 21:12:35 Dusk
+Apr 19 01:33:13 Midnight
+Moon Phase: New Moon (5.47788888888889)
+```
diff --git a/README.rst b/README.rst
deleted file mode 100644
index 2f77fdf..0000000
--- a/README.rst
+++ /dev/null
@@ -1,18 +0,0 @@
-Astral
-======
-
-|travis_status| |pypi_ver|
-
-.. |travis_status| image:: https://travis-ci.org/sffjunkie/astral.svg?branch=master
- :target: https://travis-ci.org/sffjunkie/astral
-
-.. |pypi_ver| image:: https://img.shields.io/pypi/v/astral.svg
- :target: https://pypi.org/project/astral/
-
-This is 'astral' a Python module which calculates
-
- * Times for various positions of the sun: dawn, sunrise, solar noon,
- sunset, dusk, solar elevation, solar azimuth and rahukaalam.
- * The phase of the moon.
-
-For documentation see the https://astral.readthedocs.io/en/latest/index.html
diff --git a/cmd/astral/main.go b/cmd/astral/main.go
new file mode 100644
index 0000000..3004001
--- /dev/null
+++ b/cmd/astral/main.go
@@ -0,0 +1,132 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+ "log"
+ "time"
+
+ "github.com/sj14/astral"
+)
+
+func main() {
+ var (
+ timeFlag = flag.String("time", time.Now().Format(time.RFC3339), "day/time used for the calculation")
+ formatFlag = flag.String("format", "Jan _2 15:04:05", "time output format according to Go parsing")
+ latFlag = flag.Float64("lat", 0, "latitude of the observer")
+ longFlag = flag.Float64("long", 0, "longitude of the observer")
+ elevationFlag = flag.Float64("elev", 0, "elevation of the observer")
+ )
+ flag.Parse()
+
+ observer := astral.Observer{Latitude: *latFlag, Longitude: *longFlag, Elevation: *elevationFlag}
+
+ t, err := time.Parse(time.RFC3339, *timeFlag)
+ if err != nil {
+ log.Fatalf("failed parsing time: %v\n", err)
+ }
+
+ fmt.Printf("%v\n", t.Format(time.UnixDate))
+ fmt.Printf("Latitude %v Longitude %v Elevation %v\n", *latFlag, *longFlag, *elevationFlag)
+
+ // sun := astral.Sun(observer, now, astral.DepressionCivil)
+ // fmt.Printf("sun at %+v\n", sun)
+
+ dawn, err := astral.Dawn(observer, t, astral.DepressionCivil)
+ if err != nil {
+ log.Println(err)
+ }
+ fmt.Printf("%v Dawn\n", dawn.Format(*formatFlag))
+
+ blueStart, blueEnd, err := astral.BlueHour(observer, t, astral.SunDirectionRising)
+ if err != nil {
+ log.Println(err)
+ }
+ fmt.Printf("%v Blue Hour Start\n", blueStart.Format(*formatFlag))
+ fmt.Printf("%v Blue Hour End\n", blueEnd.Format(*formatFlag))
+
+ goldenRisingStart, goldenRisingEnd, err := astral.GoldenHour(observer, t, astral.SunDirectionRising)
+ if err != nil {
+ log.Println(err)
+ }
+
+ sunrise, err := astral.Sunrise(observer, t)
+ if err != nil {
+ log.Println(err)
+ }
+
+ fmt.Printf("%v Golden Hour Start\n", goldenRisingStart.Format(*formatFlag))
+ fmt.Printf("%v Sunrise\n", sunrise.Format(*formatFlag))
+ fmt.Printf("%v Golden Hour End\n", goldenRisingEnd.Format(*formatFlag))
+
+ noon := astral.Noon(observer, t)
+ fmt.Printf("%v Noon\n", noon.Format(*formatFlag))
+
+ goldenSettingStart, goldenSettingEnd, err := astral.GoldenHour(observer, t, astral.SunDirectionSetting)
+ if err != nil {
+ log.Println(err)
+ }
+
+ sunset, err := astral.Sunset(observer, t)
+ if err != nil {
+ log.Println(err)
+ }
+
+ fmt.Printf("%v Golden Hour Start\n", goldenSettingStart.Format(*formatFlag))
+ fmt.Printf("%v Sunset\n", sunset.Format(*formatFlag))
+ fmt.Printf("%v Golden Hour End\n", goldenSettingEnd.Format(*formatFlag))
+
+ blueSettingStart, blueSettingEnd, err := astral.BlueHour(observer, t, astral.SunDirectionSetting)
+ if err != nil {
+ log.Println(err)
+ }
+ fmt.Printf("%v Blue Hour Start\n", blueSettingStart.Format(*formatFlag))
+ fmt.Printf("%v Blue Hour End\n", blueSettingEnd.Format(*formatFlag))
+
+ dusk, err := astral.Dusk(observer, t, astral.DepressionCivil)
+ if err != nil {
+ log.Println(err)
+ }
+ fmt.Printf("%v Dusk\n", dusk.Format(*formatFlag))
+
+ // daylightStart, daylightEnd, err := astral.Daylight(observer, now)
+ // if err != nil {
+ // log.Println(err)
+ // }
+ // fmt.Printf("daylight start: %v daylight end: %v\n", daylightStart, daylightEnd)
+
+ // nightStart, nightEnd, err := astral.Night(observer, now)
+ // if err != nil {
+ // log.Println(err)
+ // }
+ // fmt.Printf("night start: %v night end: %v\n", nightStart, nightEnd)
+
+ // rahukaalamStart, rahukaalamEnd := astral.Rahukaalam(observer, now, true)
+ // fmt.Printf("rahukaalam start: %v rahukaalam end: %v\n", rahukaalamStart, rahukaalamEnd)
+
+ // elevation := astral.Elevation(observer, t, true)
+ // elevationTime, err := astral.TimeAtElevation(observer, elevation, t, astral.SunDirectionSetting)
+ // if err != nil {
+ // log.Println(err)
+ // }
+ // fmt.Printf("%v Elevation\n", elevationTime.Format(*formatFlag))
+
+ midnight := astral.Midnight(observer, t)
+ fmt.Printf("%v Midnight\n", midnight.Format(*formatFlag))
+
+ // twilightStart, twilightEnd, err := astral.Twilight(observer, now, astral.SunDirectionSetting) // same as sunset and dusk
+ // if err != nil {
+ // log.Println(err)
+ // }
+ // fmt.Printf("twilight start: %v twilight end: %v\n", twilightStart, twilightEnd)
+
+ // zenith, azimuth := astral.ZenithAndAzimuth(observer, now, true)
+ // fmt.Printf("zenith: %v azimuth: %v\n", zenith, azimuth)
+
+ moonPhase := astral.MoonPhase(t)
+ moonDesc, err := astral.MoonPhaseDescription(moonPhase)
+ if err != nil {
+ log.Fatalf("failed parsing moon phase: %v", err)
+ }
+ fmt.Printf("Moon Phase: %v (%v)\n", moonDesc, moonPhase)
+}
diff --git a/docs/.buildinfo b/docs/.buildinfo
deleted file mode 100644
index bc8c01a..0000000
--- a/docs/.buildinfo
+++ /dev/null
@@ -1,4 +0,0 @@
-# Sphinx build info version 1
-# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: bea1f8fadef5270aa54650c3d653dd1d
-tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/docs/.nojekyll b/docs/.nojekyll
deleted file mode 100644
index e69de29..0000000
diff --git a/docs/_images/elevation_horizon.svg b/docs/_images/elevation_horizon.svg
deleted file mode 100644
index 256a4a1..0000000
--- a/docs/_images/elevation_horizon.svg
+++ /dev/null
@@ -1,275 +0,0 @@
-
-
-
-
diff --git a/docs/_images/elevation_sun.svg b/docs/_images/elevation_sun.svg
deleted file mode 100644
index 9fbb8bd..0000000
--- a/docs/_images/elevation_sun.svg
+++ /dev/null
@@ -1,354 +0,0 @@
-
-
-
-
diff --git a/docs/_sources/astral.rst.txt b/docs/_sources/astral.rst.txt
deleted file mode 100644
index e285750..0000000
--- a/docs/_sources/astral.rst.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-astral
-======
-
-.. automodule:: astral
- :members:
diff --git a/docs/_sources/examples.rst.txt b/docs/_sources/examples.rst.txt
deleted file mode 100644
index e69de29..0000000
diff --git a/docs/_sources/geocoder.rst.txt b/docs/_sources/geocoder.rst.txt
deleted file mode 100644
index 0116184..0000000
--- a/docs/_sources/geocoder.rst.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-astral.geocoder
-===============
-
-.. automodule:: astral.geocoder
- :members:
diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt
deleted file mode 100644
index 89be5f1..0000000
--- a/docs/_sources/index.rst.txt
+++ /dev/null
@@ -1,735 +0,0 @@
-.. Copyright 2009-2019, Simon Kennedy, sffjunkie+code@gmail.com
-
-.. Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-.. http://www.apache.org/licenses/LICENSE-2.0
-
-.. Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-.. TODO: Spatial reference system - WGS-84?
-
-.. TODO: Add note about accuracy
-
-.. TODO: Add note that 0.833 is half sun's disc + refraction adjustment
-
-Astral v\ |release|
-===================
-
-| |travis_status| |pypi_ver|
-
-Astral is a python package for calculating the times of various aspects of
-the sun and phases of the moon.
-
-It can calculate the following
-
-Dawn
- The time in the morning when the sun is a specific number of degrees
- below the horizon.
-
-Sunrise
- The time in the morning when the top of the sun breaks the horizon
- (asuming a location with no obscuring features.)
-
-Noon
- The time when the sun is at its highest point directly above the observer.
-
-Midnight
- The time when the sun is at its lowest point.
-
-Sunset
- The time in the evening when the sun is about to disappear below the
- horizon (asuming a location with no obscuring features.)
-
-Dusk
- The time in the evening when the sun is a specific number of degrees
- below the horizon.
-
-Daylight
- The time when the sun is up i.e. between sunrise and sunset
-
-Night
- The time between astronomical dusk of one day and astronomical dawn of the
- next
-
-Twilight
- The time between dawn and sunrise or between sunset and dusk
-
-The Golden Hour
- The time when the sun is between 4 degrees below the horizon and 6 degrees
- above.
-
-The Blue Hour
- The time when the sun is between 6 and 4 degrees below the horizon.
-
-Time At Elevation
- the time when the sun is at a specific elevation for either a rising or a
- setting sun.
-
-Solar Azimuth
- The number of degrees clockwise from North at which the sun can be seen
-
-Solar Zenith
- The angle of the sun down from directly above the observer
-
-Solar Elevation
- The number of degrees up from the horizon at which the sun can be seen
-
-`Rahukaalam`_
- "Rahukaalam or the period of Rahu is a certain amount of time every day
- that is considered inauspicious for any new venture according to Indian
- Vedic astrology".
-
-Moon Phase
- The phase of the moon for a specified date.
-
-Astral also comes with a geocoder containing a local database that allows you
-to look up information for a small set of locations (`new locations can be
-added `__).
-
-.. note::
-
- The Google Geocoder has been removed. Instead you should use the
- Google Client for Google Maps Services
- https://github.com/googlemaps/google-maps-services-python
-
-Examples
-========
-
-The following examples demonstrates some of the functionality available in the
-module
-
-Sun
-----
-
-.. code-block:: python
-
- >>> from astral import LocationInfo
- >>> city = LocationInfo("London", "England", "Europe/London", 51.5, -0.116)
- >>> print((
- f"Information for {city.name}/{city.region}\n"
- f"Timezone: {city.timezone}\n"
- f"Latitude: {city.latitude:.02f}; Longitude: {city.longitude:.02f}\n"
- ))
-
- Information for London/England
- Timezone: Europe/London
- Latitude: 51.50; Longitude: -0.12
-
- >>> import datetime
- >>> from astral.sun import sun
- >>> s = sun(city.observer, date=datetime.date(2009, 4, 22))
- >>> print((
- f'Dawn: {s["dawn"]}\n'
- f'Sunrise: {s["sunrise"]}\n'
- f'Noon: {s["noon"]}\n'
- f'Sunset: {s["sunset"]}\n'
- f'Dusk: {s["dusk"]}\n'
- ))
- Dawn: 2009-04-22 04:13:04.923309+00:00
- Sunrise: 2009-04-22 04:50:16.515411+00:00
- Noon: 2009-04-22 11:59:02+00:00
- Sunset: 2009-04-22 19:08:41.215821+00:00
- Dusk: 2009-04-22 19:46:06.362457+00:00
-
-.. note::
-
- The example above calculates the times of the sun in the UTC timezone.
- If you want to return times in a different timezone you can pass the
- tzinfo parameter to the function.
-
- .. code-block:: python
-
- s = sun(city.observer, date=datetime.date(2009, 4, 22), tzinfo=city.timezone)
-
- In versions prior to 2.2 you'll need to pass a pytz timezone as tzinfo e.g.
-
- .. code-block:: python
-
- s = sun(city.observer,
- date=datetime.date(2009, 4, 22),
- tzinfo=pytz.timezone(city.timezone))
-
-Moon
-----
-
-.. code-block:: python
-
- >>> import datetime
- >>> from astral import moon
- >>> moon.phase(datetime.date(2018, 1, 1))
- 13.255666666666668
-
-The moon phase method returns an number describing the phase, where the value
-is between 0 and 27.99. The following lists the mapping of various values to
-the description of the phase of the moon.
-
-============ ==============
-0 .. 6.99 New moon
-7 .. 13.99 First quarter
-14 .. 20.99 Full moon
-21 .. 27.99 Last quarter
-============ ==============
-
-If for example the number returned was 27.99 then the moon would be almost at
-the New Moon phase, and if it was 24.00 it would be half way between the Last
-Quarter and a New Moon.
-
-.. note ::
-
- The moon phase does not depend on your location. However what the moon
- actually looks like to you does depend on your location. If you're in the
- southern hemisphere it looks different than if you were in the northern
- hemisphere.
-
- See http://moongazer.x10.mx/website/astronomy/moon-phases/ for an example.
-
- For an example of using this library to generate moon phases including the
- names in various languages and the correct Unicode glyphs see the
- `project by PanderMusubi `_
- on Github.
-
-Geocoder
---------
-
-.. code-block:: python
-
- >>> from astral.geocoder import database, lookup
- >>> lookup("London", database())
- LocationInfo(name='London', region='England', timezone='Europe/London',
- latitude=51.473333333333336, longitude=-0.0008333333333333334)
-
-.. note::
-
- Location elevations have been removed from the database. These were added
- due to a misunderstanding of the affect of elevation on the times of the
- sun. These are not required for the calculations, only the elevation of the
- observer above/below the location is needed.
-
- See `Effect of Elevation`_ below.
-
-Custom Location
-~~~~~~~~~~~~~~~
-
-If you only need a single location that is not in the database then you can
-construct a :class:`~astral.LocationInfo` and fill in the values, either on
-initialization
-
-.. code-block:: python
-
- from astral import LocationInfo
- l = LocationInfo('name', 'region', 'timezone/name', 0.1, 1.2)
-
-or set the attributes after initialization::
-
- from astral import LocationInfo
- l = LocationInfo()
- l.name = 'name'
- l.region = 'region'
- l.timezone = 'US/Central'
- l.latitude = 0.1
- l.longitude = 1.2
-
-.. note::
-
- `name` and `region` can be anything you like.
-
-.. _additional_locations:
-
-Additional Locations
-~~~~~~~~~~~~~~~~~~~~
-
-You can add to the list of available locations using the
-:func:`~astral.geocoder.add_locations` function and passing either a string
-with one line per location or by passing a list containing strings, lists or
-tuples (lists and tuples are passed directly to the LocationInfo constructor).
-
-.. code-block:: python
-
- >>> from astral.geocoder import add_locations, database, lookup
- >>> db = database()
- >>> try:
- ... lookup("Somewhere", db)
- ... except KeyError:
- ... print("Somewhere not found")
- ...
- Somewhere not found
- >>> add_locations("Somewhere,Secret Location,UTC,24°28'N,39°36'E", db)
- >>> lookup("Somewhere", db)
- LocationInfo(name='Somewhere', region='Secret Location', timezone='UTC',
- latitude=24.466666666666665, longitude=39.6)
-
-Timezone Groups
-~~~~~~~~~~~~~~~
-
-Timezone groups such as Europe can be accessed via the :func:`group` function
-in the :mod:`~astral.geocoder` module
-
-.. code-block:: python
-
- >>> from astral.geocoder import group
- >>> europe = group("europe")
- >>> sorted(europe.keys())
- ['aberdeen', 'amsterdam', 'andorra_la_vella', 'ankara', 'athens', ...]
-
-
-Effect of Elevation
-===================
-
-Times Of The Sun
-----------------
-
-The times of the sun that you experience depend on what obscurs your view of
-it. It may either be obscured by the horizon or some other geographical
-feature (e.g. mountains)
-
-1. If what obscures you at ground level is the horizon and you are at a
- elevation above ground level then the times of the sun depends on how far
- further round the earth you can see due to your elevation (the sun rises
- earlier and sets later).
-
- The extra angle you can see round the earth is determined by calculating the
- angle α in the image below based on your elevation above ground level,
- and adding this to the depression angle for the sun calculations.
-
- .. image:: static/elevation_horizon.svg
- :class: adjustment
-
-2. If your view is obscured by some other geographical feature than the
- horizon, then the adjustment angle is based on how far you are above or
- below the feature and your distance to it.
-
-For the first case i.e. obscured by the horizon you need to pass a single float
-to the Observer as its elevation. For the second case pass a tuple of 2
-floats. The first being the vertical distance to the top of the feature and
-the second the horizontal distance to the feature.
-
-Elevation Of The Sun
---------------------
-
-Even though an observer's elevation can significantly affect the times of the
-sun the same is not true for the elevation angle from the observer to the sun.
-
-As an example the diagram below shows the difference in angle between an
-observer at ground level and one on the ISS orbiting 408 km above the earth.
-
-.. image:: static/elevation_sun.svg
- :class: adjustment
-
-The largest difference between the two angles is when the angle at ground
-level is 1 degree. The difference then is approximately 0.15 degrees.
-
-At the summit of mount Everest (8,848 m) the maximum difference is
-0.00338821 degrees.
-
-Due to the very small difference the astral package does not currently adjust
-the solar elevation for changes in observer elevation.
-
-Effect of Refraction
-====================
-
-When viewing the sun the position you see it at is different from its actual
-position due to the effect of atmospheric `refraction`_ which
-makes the sun appear to be higher in the sky. The calculations in the
-package take this refraction into account.
-
-The :func:`~astral.sun.sunrise` and :func:`~astral.sun.sunset` functions
-use the refraction at an angle when the sun is half of its apparent diameter
-below the horizon. This is between about 30 and 32 arcminutes and for the
-astral package a value of 32" is used.
-
-.. note::
-
- The refraction calculation does not take into account
- temperature and pressure which can affect the angle of refraction.
-
-Note on Localized Timezones
-===========================
-
-When creating a datetime object in a specific timezone do not use the
-`tzinfo` parameter to the datetime constructor. Instead use the
-:meth:`~pytz.tzinfo.localize` method provided by pytz on the correct pytz
-timezone::
-
- >>> dt = datetime.datetime(2015, 1, 1, 9, 0, 0)
- >>> pytz.timezone('Europe/London').localize(dt)
- datetime.datetime(2015, 1, 1, 9, 0, tzinfo=)
-
-
-License
-=======
-
-This module is licensed under the terms of the `Apache`_ V2.0 license.
-
-Dependencies
-============
-
-Astral has one required external Python dependency on `pytz`.
-
-Installation
-============
-
-To install Astral you should use the `pip`_ tool::
-
- pip3 install astral
-
-.. note::
-
- Now that we are Python 3 only and pip provides a versioned executable on
- Windows you should use the `pip3` command on all operating systems
- to ensure you are targetting the right Python version.
-
-Cities
-======
-
-The module includes location and time zone data for the following cities.
-The list includes all capital cities plus some from the UK. The list also
-includes the US state capitals and some other US cities.
-
-Aberdeen, Abu Dhabi, Abu Dhabi, Abuja, Accra, Addis Ababa, Adelaide, Al Jubail,
-Albany, Albuquerque, Algiers, Amman, Amsterdam, Anchorage, Andorra la Vella,
-Ankara, Annapolis, Antananarivo, Apia, Ashgabat, Asmara, Astana, Asuncion,
-Athens, Atlanta, Augusta, Austin, Avarua, Baghdad, Baku, Baltimore, Bamako,
-Bandar Seri Begawan, Bangkok, Bangui, Banjul, Barrow-In-Furness, Basse-Terre,
-Basseterre, Baton Rouge, Beijing, Beirut, Belfast, Belgrade, Belmopan, Berlin,
-Bern, Billings, Birmingham, Birmingham, Bishkek, Bismarck, Bissau,
-Bloemfontein, Bogota, Boise, Bolton, Boston, Bradford, Brasilia, Bratislava,
-Brazzaville, Bridgeport, Bridgetown, Brisbane, Bristol, Brussels, Bucharest,
-Bucuresti, Budapest, Buenos Aires, Buffalo, Bujumbura, Burlington, Cairo,
-Canberra, Cape Town, Caracas, Cardiff, Carson City, Castries, Cayenne,
-Charleston, Charlotte, Charlotte Amalie, Cheyenne, Chicago, Chisinau,
-Cleveland, Columbia, Columbus, Conakry, Concord, Copenhagen, Cotonou, Crawley,
-Dakar, Dallas, Damascus, Dammam, Denver, Des Moines, Detroit, Dhaka, Dili,
-Djibouti, Dodoma, Doha, Douglas, Dover, Dublin, Dushanbe, Edinburgh, El Aaiun,
-Fargo, Fort-de-France, Frankfort, Freetown, Funafuti, Gaborone, George Town,
-Georgetown, Gibraltar, Glasgow, Greenwich, Guatemala, Hanoi, Harare,
-Harrisburg, Hartford, Havana, Helena, Helsinki, Hobart, Hong Kong, Honiara,
-Honolulu, Houston, Indianapolis, Islamabad, Jackson, Jacksonville, Jakarta,
-Jefferson City, Jerusalem, Juba, Jubail, Juneau, Kabul, Kampala, Kansas City,
-Kathmandu, Khartoum, Kiev, Kigali, Kingston, Kingston, Kingstown, Kinshasa,
-Koror, Kuala Lumpur, Kuwait, La Paz, Lansing, Las Vegas, Leeds, Leicester,
-Libreville, Lilongwe, Lima, Lincoln, Lisbon, Little Rock, Liverpool, Ljubljana,
-Lome, London, Los Angeles, Louisville, Luanda, Lusaka, Luxembourg, Macau,
-Madinah, Madison, Madrid, Majuro, Makkah, Malabo, Male, Mamoudzou, Managua,
-Manama, Manchester, Manchester, Manila, Maputo, Maseru, Masqat, Mbabane, Mecca,
-Medina, Melbourne, Memphis, Mexico, Miami, Milwaukee, Minneapolis, Minsk,
-Mogadishu, Monaco, Monrovia, Montevideo, Montgomery, Montpelier, Moroni,
-Moscow, Moskva, Mumbai, Muscat, N'Djamena, Nairobi, Nashville, Nassau,
-Naypyidaw, New Delhi, New Orleans, New York, Newark, Newcastle, Newcastle Upon
-Tyne, Ngerulmud, Niamey, Nicosia, Norwich, Nouakchott, Noumea, Nuku'alofa,
-Nuuk, Oklahoma City, Olympia, Omaha, Oranjestad, Orlando, Oslo, Ottawa,
-Ouagadougou, Oxford, P'yongyang, Pago Pago, Palikir, Panama, Papeete,
-Paramaribo, Paris, Perth, Philadelphia, Phnom Penh, Phoenix, Pierre, Plymouth,
-Podgorica, Port Louis, Port Moresby, Port of Spain, Port-Vila, Port-au-Prince,
-Portland, Portland, Porto-Novo, Portsmouth, Prague, Praia, Pretoria, Pristina,
-Providence, Quito, Rabat, Raleigh, Reading, Reykjavik, Richmond, Riga, Riyadh,
-Road Town, Rome, Roseau, Sacramento, Saint Helier, Saint Paul, Saint Pierre,
-Saipan, Salem, Salt Lake City, San Diego, San Francisco, San Jose, San Juan,
-San Marino, San Salvador, Sana, Sana'a, Santa Fe, Santiago, Santo Domingo, Sao
-Tome, Sarajevo, Seattle, Seoul, Sheffield, Singapore, Sioux Falls, Skopje,
-Sofia, Southampton, Springfield, Sri Jayawardenapura Kotte, St. George's, St.
-John's, St. Peter Port, Stanley, Stockholm, Sucre, Suva, Swansea, Swindon,
-Sydney, T'bilisi, Taipei, Tallahassee, Tallinn, Tarawa, Tashkent, Tbilisi,
-Tegucigalpa, Tehran, Thimphu, Tirana, Tirane, Tokyo, Toledo, Topeka, Torshavn,
-Trenton, Tripoli, Tunis, Ulaanbaatar, Ulan Bator, Vaduz, Valletta, Vienna,
-Vientiane, Vilnius, Virginia Beach, W. Indies, Warsaw, Washington DC,
-Wellington, Wichita, Willemstad, Wilmington, Windhoek, Wolverhampton,
-Yamoussoukro, Yangon, Yaounde, Yaren, Yerevan, Zagreb
-
-US Cities
----------
-
-Albany, Albuquerque, Anchorage, Annapolis, Atlanta, Augusta, Austin, Baltimore,
-Baton Rouge, Billings, Birmingham, Bismarck, Boise, Boston, Bridgeport,
-Buffalo, Burlington, Carson City, Charleston, Charlotte, Cheyenne, Chicago,
-Cleveland, Columbia, Columbus, Concord, Dallas, Denver, Des Moines, Detroit,
-Dover, Fargo, Frankfort, Harrisburg, Hartford, Helena, Honolulu, Houston,
-Indianapolis, Jackson, Jacksonville, Jefferson City, Juneau, Kansas City,
-Lansing, Las Vegas, Lincoln, Little Rock, Los Angeles, Louisville, Madison,
-Manchester, Memphis, Miami, Milwaukee, Minneapolis, Montgomery, Montpelier,
-Nashville, New Orleans, New York, Newark, Oklahoma City, Olympia, Omaha,
-Orlando, Philadelphia, Phoenix, Pierre, Portland, Portland, Providence,
-Raleigh, Richmond, Sacramento, Saint Paul, Salem, Salt Lake City, San Diego,
-San Francisco, Santa Fe, Seattle, Sioux Falls, Springfield, Tallahassee,
-Toledo, Topeka, Trenton, Virginia Beach, Wichita, Wilmington
-
-Thanks
-======
-
-The sun calculations in this module were adapted, for Python, from the
-spreadsheets on the following page.
-
- | https://www.esrl.noaa.gov/gmd/grad/solcalc/calcdetails.html
-
-Refraction calculation is taken from
-
- | Sun-Pointing Programs and Their Accuracy
- | John C. Zimmerman Of Sandia National Laboratones
- | https://www.osti.gov/servlets/purl/6377969
-
-Which cites the following as the original source
-
- | In Solar Energy Vol 20 No.5-C
- | Robert Walraven Of The University Of California, Davis
-
-The moon phase calculation is based on some javascript code
-from Sky and Telescope magazine
-
- | Moon-phase calculation
- | Roger W. Sinnott, Sky & Telescope, June 16, 2006.
- | http://www.skyandtelescope.com/wp-content/observing-tools/moonphase/moon.html
-
-Also to `Sphinx`_ for making doc generation an easy thing (not that the writing
-of the docs is any easier.)
-
-Contact
-=======
-
-Simon Kennedy
-
-Version History
-===============
-
-========== ====================================================================
-Version Description
-========== ====================================================================
-2.2 Fix for `bug #48`_ - As per the bug report the angle to adjust for
- the effect of elevation should have been θ (not α).
-
- The sun functions can now also be passed a timezone name as a
- string. Previously only a pytz timezone was accepted.
----------- --------------------------------------------------------------------
-2.1 Fix for bug #44 - Incorrectly raised exception when UTC sun times
- were on the day previous to the day asked for. Only manifested for
- timezones with a large positive offset.
----------- --------------------------------------------------------------------
-2.0 This is a code refactor as well as an update so it is highly likely
- that you will need to adapt your code to suit.
-
- Astral, AstralGeocoder & GoogleGeocoder classes removed
-
- Now only compatible with Python 3.6 and greater due to the
- use of data classes
-
- New :class:`~astral.Observer` data class to store a latitude,
- longitude & elevation
-
- New :class:`~astral.LocationInfo` data class to store a location
- name, region, timezone, latitude & longitude
-
- Geocoder functions return a :class:`~astral.LocationInfo` instead
- of a :class:`~astral.location.Location`
-
- All calculations now automatically adjust for refraction.
- For elevation you can return the true angle by setting the
- `with_refraction` parameter to False.
-
- The solar_noon and solar_midnight functions have been renamed to
- :func:`~astral.sun.noon` and :func:`~astral.sun.midnight`
- respectively.
-
- Rahukaalam can now be calculated for night times.
----------- --------------------------------------------------------------------
-1.10.1 Keyword args are now passed to the geocoder class from Astral
- __init__ in order to allow the Google Maps API key to be passed to
- the GoogleGeocoder.
----------- --------------------------------------------------------------------
-1.10 Added support to AstralGeocoder to add
- `additional locations `__
- to the database.
----------- --------------------------------------------------------------------
-1.9.2 1.9 broke the sun_utc method. Sun UTC calculation passed incorrect
- parameter to more specific methods e.g. sunrise, sunset etc.
----------- --------------------------------------------------------------------
-1.9.1 Correct version number in astral.py
----------- --------------------------------------------------------------------
-1.9 Now takes elevation into account.
----------- --------------------------------------------------------------------
-1.8 Location methods now allow the timezone to be None which returns all
- times as UTC.
-
- Added command line interface to return 'sun' values
----------- --------------------------------------------------------------------
-1.7.1 Changed GoogleGeocoder test to not use raise...from as this is not
- valid for Python 2
----------- --------------------------------------------------------------------
-1.7 Requests is now only needed when using GoogleGeocoder
-
- GoogleGeocoder now requires the `api_key` parameter to be passed to
- the constructor as Google now require it for their API calls.
----------- --------------------------------------------------------------------
-1.6.1 Updates for Travis CI integration / Github signed release.
----------- --------------------------------------------------------------------
-1.6 Added api_key parameter to the GoogleGeocoder :meth:`__init__`
- method
----------- --------------------------------------------------------------------
-1.5 Added parameter `rtype` to :meth:`moon_phase` to determine the
- return type of the method.
-
- Added example for calculating the phase of the moon.
----------- --------------------------------------------------------------------
-1.4.1 Using versioneer to manage version numbers
----------- --------------------------------------------------------------------
-1.4 Changed to use calculations from NOAA spreadsheets
-
- Changed some exception error messages for when sun does not reach
- a requested elevation.
-
- Added more tests
----------- --------------------------------------------------------------------
-1.3.4 Changes to project configuration files. No user facing changes.
----------- --------------------------------------------------------------------
-1.3.3 Fixed call to twilight_utc as date and direction parameters
- were reversed.
----------- --------------------------------------------------------------------
-1.3.2 Updated URL to point to gitgub.com
-
- Added Apache 2.0 boilerplate to source file
----------- --------------------------------------------------------------------
-1.3.1 Added LICENSE file to sdist
----------- --------------------------------------------------------------------
-1.3 Corrected solar zenith to return the angle from the vertical.
-
- Added solar midnight calculation.
----------- --------------------------------------------------------------------
-1.2 Added handling for when unicode literals are used. This may possibly
- affect your code if you're using Python 2 (there are tests for this
- but they may not catch all uses.) (Bug `1588198`_\)
-
- Changed timezone for Phoenix, AZ to America/Phoenix
- (Bug `1561258`_\)
----------- --------------------------------------------------------------------
-1.1 Added methods to calculate Twilight, the Golden Hour and the Blue
- Hour.
----------- --------------------------------------------------------------------
-1.0 It's time for a version 1.0
-
- Added examples where the location you want is not in the Astral
- geocoder.
----------- --------------------------------------------------------------------
-0.9 Added a method to calculate the date and time when the sun is at a
- specific elevation, for either a rising or a setting sun.
-
- Added daylight and night methods to Location and Astral classes.
-
- Rahukaalam methods now return a tuple.
----------- --------------------------------------------------------------------
-0.8.2 Fix for moon phase calcualtions which were off by 1.
-
- Use pytz.timezone().localize method instead of passing tzinfo
- parameter to datetime.datetime. See the `pytz docs`_ for info
----------- --------------------------------------------------------------------
-0.8.1 Fix for bug `1417641`_\: :meth:`~astral.Astral.solar_elevation` and
- :meth:`~astral.Astral.solar_azimuth` fail when a naive
- :class:`~datetime.datetime` object is used.
-
- Added :meth:`solar_zenith` methods to :class:`~astral.Astral`
- and :class:`~astral.Location` as an
- alias for :meth:`solar_elevation`
-
- Added `tzinfo` as an alias for `tz`
----------- --------------------------------------------------------------------
-0.8 Fix for bug `1407773`_\: Moon phase calculation changed to remove
- time zone parameter (tz) as it is not required for the calculation.
----------- --------------------------------------------------------------------
-0.7.5 Fix for bug `1402103`_\: Buenos Aires incorrect timezone
----------- --------------------------------------------------------------------
-0.7.4 Added Canadian cities from Yip Shing Ho
----------- --------------------------------------------------------------------
-0.7.3 Fix for bug `1239387`_ submitted by Torbjörn Lönnemark
----------- --------------------------------------------------------------------
-0.7.2 Minor bug fix in :class:`~astral.GoogleGeocoder`. location name and
- region are now stripped of whitespace
----------- --------------------------------------------------------------------
-0.7.1 Bug fix. Missed a vital return statement in the
- :class:`~astral.GoogleGeocoder`
----------- --------------------------------------------------------------------
-0.7 Added ability to lookup location information from
- Google's mapping APIs (see :class:`~astral.GoogleGeocoder`)
-
- Renamed :class:`City` class to :class:`~astral.Location`
-
- Renamed :class:`CityDB` to :class:`~astral.AstralGeocoder`
-
- Added elevations of cities to database and property to
- obtain elevation from :class:`~astral.Location` class
----------- --------------------------------------------------------------------
-0.6.2 Added various cities to database as per
- https://bugs.launchpad.net/astral/+bug/1040936
----------- --------------------------------------------------------------------
-0.6.1 Docstrings were not updated to match changes to code.
-
- Other minor docstring changes made
----------- --------------------------------------------------------------------
-0.6 Fix for bug `884716`_ submitted by Martin Heemskerk
- regarding moon phase calculations
-
- Fixes for bug report `944754`_ submitted by Hajo Werder
-
- - Changed co-ordinate system so that eastern longitudes
- are now positive
- - Added solar_depression property to City class
----------- --------------------------------------------------------------------
-0.5 Changed :class:`City` to accept unicode name and country.
-
- Moved city information into a database class :class:`CityDB`
-
- Added attribute access to database for timezone groups
----------- --------------------------------------------------------------------
-0.4 Duplicate city names could not be accessed.
-
- Sun calculations for some cities failed with times
- outside valid ranges.
-
- Fixes for city data.
-
- Added calculation for moon phase.
----------- --------------------------------------------------------------------
-0.3 Changed to `Apache`_ V2.0 license.
-
- Fix for bug `555508`_ submitted by me.
-
- US state capitals and other cities added.
----------- --------------------------------------------------------------------
-0.2 Fix for bug `554041`_ submitted by Derek\_ / John Dimatos
----------- --------------------------------------------------------------------
-0.1 First release
-========== ====================================================================
-
-.. _Rahukaalam: http://en.wikipedia.org/wiki/Rahukaalam
-.. _Sourceforge: http://pytz.sourceforge.net/
-.. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall
-.. _Apache: http://www.opensource.org/licenses/apache2.0.php
-.. _Sphinx: http://sphinx.pocoo.org/
-.. _554041: https://bugs.launchpad.net/astral/+bug/554041
-.. _555508: https://bugs.launchpad.net/astral/+bug/555508
-.. _884716: https://bugs.launchpad.net/astral/+bug/884716
-.. _944754: https://bugs.launchpad.net/astral/+bug/944754
-.. _1239387: https://bugs.launchpad.net/astral/+bug/1239387
-.. _1402103: https://bugs.launchpad.net/astral/+bug/1402103
-.. _1407773: https://bugs.launchpad.net/astral/+bug/1407773
-.. _1417641: https://bugs.launchpad.net/astral/+bug/1417641
-.. _1561258: https://bugs.launchpad.net/astral/+bug/1561258
-.. _1588198: https://bugs.launchpad.net/astral/+bug/1588198
-.. _pytz docs: http://pytz.sourceforge.net/#localized-times-and-date-arithmetic
-.. _issue: https://github.com/sffjunkie/astral/issues
-.. _refraction: https://en.wikipedia.org/wiki/Refraction
-.. _pip: https://pip.pypa.io/en/stable/
-.. _bug #48: https://github.com/sffjunkie/astral/issues/48
-
-.. |travis_status| image:: https://travis-ci.org/sffjunkie/astral.svg?branch=master
- :target: https://travis-ci.org/sffjunkie/astral
-
-.. |pypi_ver| image:: https://img.shields.io/pypi/v/astral.svg
- :target: https://pypi.org/project/astral/
-
-.. toctree::
- :maxdepth: 2
- :hidden:
-
- package
diff --git a/docs/_sources/location.rst.txt b/docs/_sources/location.rst.txt
deleted file mode 100644
index c650d58..0000000
--- a/docs/_sources/location.rst.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-astral.location
-===============
-
-.. autoclass:: astral.location.Location
- :members:
diff --git a/docs/_sources/moon.rst.txt b/docs/_sources/moon.rst.txt
deleted file mode 100644
index 973a50f..0000000
--- a/docs/_sources/moon.rst.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-astral.moon
-===========
-
-.. automodule:: astral.moon
- :members:
diff --git a/docs/_sources/package.rst.txt b/docs/_sources/package.rst.txt
deleted file mode 100644
index 269a5ca..0000000
--- a/docs/_sources/package.rst.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-.. Copyright 2009-2019, Simon Kennedy, sffjunkie+code@gmail.com
-
-.. Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-.. http://www.apache.org/licenses/LICENSE-2.0
-
-.. Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-The :mod:`astral` Package
-=========================
-
-.. automodule:: astral
- :members:
-
-astral.sun
-~~~~~~~~~~~
-
-.. automodule:: astral.sun
- :members:
-
-astral.moon
-~~~~~~~~~~~
-
-.. automodule:: astral.moon
- :members:
-
-astral.geocoder
-~~~~~~~~~~~~~~~
-
-.. automodule:: astral.geocoder
- :members:
-
-astral.location
-~~~~~~~~~~~~~~~
-
-.. autoclass:: astral.location.Location
- :members:
diff --git a/docs/_sources/sun.rst.txt b/docs/_sources/sun.rst.txt
deleted file mode 100644
index c09b8bb..0000000
--- a/docs/_sources/sun.rst.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-astral.sun
-==========
-
-.. automodule:: astral.sun
- :members:
-
diff --git a/docs/_static/astral.css b/docs/_static/astral.css
deleted file mode 100644
index 80bfbb0..0000000
--- a/docs/_static/astral.css
+++ /dev/null
@@ -1,3 +0,0 @@
-img.adjustment {
- margin: 1rem 1.5rem;
-}
diff --git a/docs/_static/basic.css b/docs/_static/basic.css
deleted file mode 100644
index 0eacf21..0000000
--- a/docs/_static/basic.css
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * basic.css
- * ~~~~~~~~~
- *
- * Sphinx stylesheet -- basic theme.
- *
- * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
- * :license: BSD, see LICENSE for details.
- *
- */
-
-/* -- main layout ----------------------------------------------------------- */
-
-div.clearer {
- clear: both;
-}
-
-/* -- relbar ---------------------------------------------------------------- */
-
-div.related {
- width: 100%;
- font-size: 90%;
-}
-
-div.related h3 {
- display: none;
-}
-
-div.related ul {
- margin: 0;
- padding: 0 0 0 10px;
- list-style: none;
-}
-
-div.related li {
- display: inline;
-}
-
-div.related li.right {
- float: right;
- margin-right: 5px;
-}
-
-/* -- sidebar --------------------------------------------------------------- */
-
-div.sphinxsidebarwrapper {
- padding: 10px 5px 0 10px;
-}
-
-div.sphinxsidebar {
- float: left;
- width: 230px;
- margin-left: -100%;
- font-size: 90%;
-}
-
-div.sphinxsidebar ul {
- list-style: none;
-}
-
-div.sphinxsidebar ul ul,
-div.sphinxsidebar ul.want-points {
- margin-left: 20px;
- list-style: square;
-}
-
-div.sphinxsidebar ul ul {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-div.sphinxsidebar form {
- margin-top: 10px;
-}
-
-div.sphinxsidebar input {
- border: 1px solid #98dbcc;
- font-family: sans-serif;
- font-size: 1em;
-}
-
-div.sphinxsidebar #searchbox input[type="text"] {
- width: 170px;
-}
-
-div.sphinxsidebar #searchbox input[type="submit"] {
- width: 30px;
-}
-
-img {
- border: 0;
- max-width: 100%;
-}
-
-/* -- search page ----------------------------------------------------------- */
-
-ul.search {
- margin: 10px 0 0 20px;
- padding: 0;
-}
-
-ul.search li {
- padding: 5px 0 5px 20px;
- background-image: url(file.png);
- background-repeat: no-repeat;
- background-position: 0 7px;
-}
-
-ul.search li a {
- font-weight: bold;
-}
-
-ul.search li div.context {
- color: #888;
- margin: 2px 0 0 30px;
- text-align: left;
-}
-
-ul.keywordmatches li.goodmatch a {
- font-weight: bold;
-}
-
-/* -- index page ------------------------------------------------------------ */
-
-table.contentstable {
- width: 90%;
-}
-
-table.contentstable p.biglink {
- line-height: 150%;
-}
-
-a.biglink {
- font-size: 1.3em;
-}
-
-span.linkdescr {
- font-style: italic;
- padding-top: 5px;
- font-size: 90%;
-}
-
-/* -- general index --------------------------------------------------------- */
-
-table.indextable {
- width: 100%;
-}
-
-table.indextable td {
- text-align: left;
- vertical-align: top;
-}
-
-table.indextable dl, table.indextable dd {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-table.indextable tr.pcap {
- height: 10px;
-}
-
-table.indextable tr.cap {
- margin-top: 10px;
- background-color: #f2f2f2;
-}
-
-img.toggler {
- margin-right: 3px;
- margin-top: 3px;
- cursor: pointer;
-}
-
-div.modindex-jumpbox {
- border-top: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
- margin: 1em 0 1em 0;
- padding: 0.4em;
-}
-
-div.genindex-jumpbox {
- border-top: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
- margin: 1em 0 1em 0;
- padding: 0.4em;
-}
-
-/* -- general body styles --------------------------------------------------- */
-
-a.headerlink {
- visibility: hidden;
-}
-
-h1:hover > a.headerlink,
-h2:hover > a.headerlink,
-h3:hover > a.headerlink,
-h4:hover > a.headerlink,
-h5:hover > a.headerlink,
-h6:hover > a.headerlink,
-dt:hover > a.headerlink {
- visibility: visible;
-}
-
-div.body p.caption {
- text-align: inherit;
-}
-
-div.body td {
- text-align: left;
-}
-
-.field-list ul {
- padding-left: 1em;
-}
-
-.first {
- margin-top: 0 !important;
-}
-
-p.rubric {
- margin-top: 30px;
- font-weight: bold;
-}
-
-img.align-left, .figure.align-left, object.align-left {
- clear: left;
- float: left;
- margin-right: 1em;
-}
-
-img.align-right, .figure.align-right, object.align-right {
- clear: right;
- float: right;
- margin-left: 1em;
-}
-
-img.align-center, .figure.align-center, object.align-center {
- display: block;
- margin-left: auto;
- margin-right: auto;
-}
-
-.align-left {
- text-align: left;
-}
-
-.align-center {
- text-align: center;
-}
-
-.align-right {
- text-align: right;
-}
-
-/* -- sidebars -------------------------------------------------------------- */
-
-div.sidebar {
- margin: 0 0 0.5em 1em;
- border: 1px solid #ddb;
- padding: 7px 7px 0 7px;
- background-color: #ffe;
- width: 40%;
- float: right;
-}
-
-p.sidebar-title {
- font-weight: bold;
-}
-
-/* -- topics ---------------------------------------------------------------- */
-
-div.topic {
- border: 1px solid #ccc;
- padding: 7px 7px 0 7px;
- margin: 10px 0 10px 0;
-}
-
-p.topic-title {
- font-size: 1.1em;
- font-weight: bold;
- margin-top: 10px;
-}
-
-/* -- admonitions ----------------------------------------------------------- */
-
-div.admonition {
- margin-top: 10px;
- margin-bottom: 10px;
- padding: 7px;
-}
-
-div.admonition dt {
- font-weight: bold;
-}
-
-div.admonition dl {
- margin-bottom: 0;
-}
-
-p.admonition-title {
- margin: 0px 10px 5px 0px;
- font-weight: bold;
-}
-
-div.body p.centered {
- text-align: center;
- margin-top: 25px;
-}
-
-/* -- tables ---------------------------------------------------------------- */
-
-table.docutils {
- border: 0;
- border-collapse: collapse;
-}
-
-table.docutils td, table.docutils th {
- padding: 1px 8px 1px 5px;
- border-top: 0;
- border-left: 0;
- border-right: 0;
- border-bottom: 1px solid #aaa;
-}
-
-table.field-list td, table.field-list th {
- border: 0 !important;
-}
-
-table.footnote td, table.footnote th {
- border: 0 !important;
-}
-
-th {
- text-align: left;
- padding-right: 5px;
-}
-
-table.citation {
- border-left: solid 1px gray;
- margin-left: 1px;
-}
-
-table.citation td {
- border-bottom: none;
-}
-
-/* -- other body styles ----------------------------------------------------- */
-
-ol.arabic {
- list-style: decimal;
-}
-
-ol.loweralpha {
- list-style: lower-alpha;
-}
-
-ol.upperalpha {
- list-style: upper-alpha;
-}
-
-ol.lowerroman {
- list-style: lower-roman;
-}
-
-ol.upperroman {
- list-style: upper-roman;
-}
-
-dl {
- margin-bottom: 15px;
-}
-
-dd p {
- margin-top: 0px;
-}
-
-dd ul, dd table {
- margin-bottom: 10px;
-}
-
-dd {
- margin-top: 3px;
- margin-bottom: 10px;
- margin-left: 30px;
-}
-
-dt:target, .highlighted {
- background-color: #fbe54e;
-}
-
-dl.glossary dt {
- font-weight: bold;
- font-size: 1.1em;
-}
-
-.field-list ul {
- margin: 0;
- padding-left: 1em;
-}
-
-.field-list p {
- margin: 0;
-}
-
-.optional {
- font-size: 1.3em;
-}
-
-.versionmodified {
- font-style: italic;
-}
-
-.system-message {
- background-color: #fda;
- padding: 5px;
- border: 3px solid red;
-}
-
-.footnote:target {
- background-color: #ffa;
-}
-
-.line-block {
- display: block;
- margin-top: 1em;
- margin-bottom: 1em;
-}
-
-.line-block .line-block {
- margin-top: 0;
- margin-bottom: 0;
- margin-left: 1.5em;
-}
-
-.guilabel, .menuselection {
- font-family: sans-serif;
-}
-
-.accelerator {
- text-decoration: underline;
-}
-
-.classifier {
- font-style: oblique;
-}
-
-abbr, acronym {
- border-bottom: dotted 1px;
- cursor: help;
-}
-
-/* -- code displays --------------------------------------------------------- */
-
-pre {
- overflow: auto;
- overflow-y: hidden; /* fixes display issues on Chrome browsers */
-}
-
-td.linenos pre {
- padding: 5px 0px;
- border: 0;
- background-color: transparent;
- color: #aaa;
-}
-
-table.highlighttable {
- margin-left: 0.5em;
-}
-
-table.highlighttable td {
- padding: 0 0.5em 0 0.5em;
-}
-
-tt.descname {
- background-color: transparent;
-}
-
-tt.descclassname {
- background-color: transparent;
-}
-
-tt.xref, a tt {
- background-color: transparent;
- font-weight: bold;
-}
-
-h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
- background-color: transparent;
-}
-
-.viewcode-link {
- float: right;
-}
-
-.viewcode-back {
- float: right;
- font-family: sans-serif;
-}
-
-div.viewcode-block:target {
- margin: -1px -10px;
- padding: 0 10px;
-}
-
-/* -- math display ---------------------------------------------------------- */
-
-img.math {
- vertical-align: middle;
-}
-
-div.body div.math p {
- text-align: center;
-}
-
-span.eqno {
- float: right;
-}
-
-/* -- printout stylesheet --------------------------------------------------- */
-
-@media print {
- div.document,
- div.documentwrapper,
- div.bodywrapper {
- margin: 0 !important;
- width: 100%;
- }
-
- div.sphinxsidebar,
- div.related,
- div.footer,
- #top-link {
- display: none;
- }
-}
\ No newline at end of file
diff --git a/docs/_static/bootstrap-scrollspy.js b/docs/_static/bootstrap-scrollspy.js
deleted file mode 100644
index dce3718..0000000
--- a/docs/_static/bootstrap-scrollspy.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/* =============================================================
- * bootstrap-scrollspy.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#scrollspy
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* SCROLLSPY CLASS DEFINITION
- * ========================== */
-
- function ScrollSpy( element, options) {
- var process = $.proxy(this.process, this)
- , $element = $(element).is('body') ? $(window) : $(element)
- , href
- this.options = $.extend({}, $.fn.scrollspy.defaults, options)
- this.$scrollElement = $element.on('scroll.scroll.data-api', process)
- this.selector = (this.options.target
- || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- || '') + ' .nav li > a'
- this.$body = $('body')
- this.refresh()
- this.process()
- }
-
- ScrollSpy.prototype = {
-
- constructor: ScrollSpy
-
- , refresh: function () {
- var self = this
- , $targets
-
- this.offsets = $([])
- this.targets = $([])
-
- $targets = this.$body
- .find(this.selector)
- .map(function () {
- var $el = $(this)
- , href = $el.data('target') || $el.attr('href')
- , $href = /^#\w/.test(href) && $(href)
- return ( $href
- && href.length
- && [[ $href.position().top, href ]] ) || null
- })
- .sort(function (a, b) { return a[0] - b[0] })
- .each(function () {
- self.offsets.push(this[0])
- self.targets.push(this[1])
- })
- }
-
- , process: function () {
- var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
- , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
- , maxScroll = scrollHeight - this.$scrollElement.height()
- , offsets = this.offsets
- , targets = this.targets
- , activeTarget = this.activeTarget
- , i
-
- if (scrollTop >= maxScroll) {
- return activeTarget != (i = targets.last()[0])
- && this.activate ( i )
- }
-
- for (i = offsets.length; i--;) {
- activeTarget != targets[i]
- && scrollTop >= offsets[i]
- && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
- && this.activate( targets[i] )
- }
- }
-
- , activate: function (target) {
- var active
- , selector
-
- this.activeTarget = target
-
- $(this.selector)
- .parent('.active')
- .removeClass('active')
-
- selector = this.selector
- + '[data-target="' + target + '"],'
- + this.selector + '[href="' + target + '"]'
-
- active = $(selector)
- .parent('li')
- .addClass('active')
-
- if (active.parent('.dropdown-menu')) {
- active = active.closest('li.dropdown').addClass('active')
- }
-
- active.trigger('activate')
- }
-
- }
-
-
- /* SCROLLSPY PLUGIN DEFINITION
- * =========================== */
-
- $.fn.scrollspy = function ( option ) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('scrollspy')
- , options = typeof option == 'object' && option
- if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.scrollspy.Constructor = ScrollSpy
-
- $.fn.scrollspy.defaults = {
- offset: 10
- }
-
-
- /* SCROLLSPY DATA-API
- * ================== */
-
- $(function () {
- $('[data-spy="scroll"]').each(function () {
- var $spy = $(this)
- $spy.scrollspy($spy.data())
- })
- })
-
-}(window.jQuery);
\ No newline at end of file
diff --git a/docs/_static/classic.css b/docs/_static/classic.css
deleted file mode 100644
index b4fd80f..0000000
--- a/docs/_static/classic.css
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * classic.css_t
- * ~~~~~~~~~~~~~
- *
- * Sphinx stylesheet -- classic theme.
- *
- * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
- * :license: BSD, see LICENSE for details.
- *
- */
-
-@import url("basic.css");
-
-/* -- page layout ----------------------------------------------------------- */
-
-html {
- /* CSS hack for macOS's scrollbar (see #1125) */
- background-color: #FFFFFF;
-}
-
-body {
- font-family: sans-serif;
- font-size: 100%;
- background-color: #11303d;
- color: #000;
- margin: 0;
- padding: 0;
-}
-
-div.document {
- background-color: #1c4e63;
-}
-
-div.documentwrapper {
- float: left;
- width: 100%;
-}
-
-div.bodywrapper {
- margin: 0 0 0 230px;
-}
-
-div.body {
- background-color: #ffffff;
- color: #000000;
- padding: 0 20px 30px 20px;
-}
-
-div.footer {
- color: #ffffff;
- width: 100%;
- padding: 9px 0 9px 0;
- text-align: center;
- font-size: 75%;
-}
-
-div.footer a {
- color: #ffffff;
- text-decoration: underline;
-}
-
-div.related {
- background-color: #133f52;
- line-height: 30px;
- color: #ffffff;
-}
-
-div.related a {
- color: #ffffff;
-}
-
-div.sphinxsidebar {
-}
-
-div.sphinxsidebar h3 {
- font-family: 'Trebuchet MS', sans-serif;
- color: #ffffff;
- font-size: 1.4em;
- font-weight: normal;
- margin: 0;
- padding: 0;
-}
-
-div.sphinxsidebar h3 a {
- color: #ffffff;
-}
-
-div.sphinxsidebar h4 {
- font-family: 'Trebuchet MS', sans-serif;
- color: #ffffff;
- font-size: 1.3em;
- font-weight: normal;
- margin: 5px 0 0 0;
- padding: 0;
-}
-
-div.sphinxsidebar p {
- color: #ffffff;
-}
-
-div.sphinxsidebar p.topless {
- margin: 5px 10px 10px 10px;
-}
-
-div.sphinxsidebar ul {
- margin: 10px;
- padding: 0;
- color: #ffffff;
-}
-
-div.sphinxsidebar a {
- color: #98dbcc;
-}
-
-div.sphinxsidebar input {
- border: 1px solid #98dbcc;
- font-family: sans-serif;
- font-size: 1em;
-}
-
-
-
-/* -- hyperlink styles ------------------------------------------------------ */
-
-a {
- color: #355f7c;
- text-decoration: none;
-}
-
-a:visited {
- color: #355f7c;
- text-decoration: none;
-}
-
-a:hover {
- text-decoration: underline;
-}
-
-
-
-/* -- body styles ----------------------------------------------------------- */
-
-div.body h1,
-div.body h2,
-div.body h3,
-div.body h4,
-div.body h5,
-div.body h6 {
- font-family: 'Trebuchet MS', sans-serif;
- background-color: #f2f2f2;
- font-weight: normal;
- color: #20435c;
- border-bottom: 1px solid #ccc;
- margin: 20px -20px 10px -20px;
- padding: 3px 0 3px 10px;
-}
-
-div.body h1 { margin-top: 0; font-size: 200%; }
-div.body h2 { font-size: 160%; }
-div.body h3 { font-size: 140%; }
-div.body h4 { font-size: 120%; }
-div.body h5 { font-size: 110%; }
-div.body h6 { font-size: 100%; }
-
-a.headerlink {
- color: #c60f0f;
- font-size: 0.8em;
- padding: 0 4px 0 4px;
- text-decoration: none;
-}
-
-a.headerlink:hover {
- background-color: #c60f0f;
- color: white;
-}
-
-div.body p, div.body dd, div.body li, div.body blockquote {
- text-align: justify;
- line-height: 130%;
-}
-
-div.admonition p.admonition-title + p {
- display: inline;
-}
-
-div.admonition p {
- margin-bottom: 5px;
-}
-
-div.admonition pre {
- margin-bottom: 5px;
-}
-
-div.admonition ul, div.admonition ol {
- margin-bottom: 5px;
-}
-
-div.note {
- background-color: #eee;
- border: 1px solid #ccc;
-}
-
-div.seealso {
- background-color: #ffc;
- border: 1px solid #ff6;
-}
-
-div.topic {
- background-color: #eee;
-}
-
-div.warning {
- background-color: #ffe4e4;
- border: 1px solid #f66;
-}
-
-p.admonition-title {
- display: inline;
-}
-
-p.admonition-title:after {
- content: ":";
-}
-
-pre {
- padding: 5px;
- background-color: #eeffcc;
- color: #333333;
- line-height: 120%;
- border: 1px solid #ac9;
- border-left: none;
- border-right: none;
-}
-
-code {
- background-color: #ecf0f3;
- padding: 0 1px 0 1px;
- font-size: 0.95em;
-}
-
-th, dl.field-list > dt {
- background-color: #ede;
-}
-
-.warning code {
- background: #efc2c2;
-}
-
-.note code {
- background: #d6d6d6;
-}
-
-.viewcode-back {
- font-family: sans-serif;
-}
-
-div.viewcode-block:target {
- background-color: #f4debf;
- border-top: 1px solid #ac9;
- border-bottom: 1px solid #ac9;
-}
-
-div.code-block-caption {
- color: #efefef;
- background-color: #1c4e63;
-}
\ No newline at end of file
diff --git a/docs/_static/default.css b/docs/_static/default.css
deleted file mode 100644
index 81b9363..0000000
--- a/docs/_static/default.css
+++ /dev/null
@@ -1 +0,0 @@
-@import url("classic.css");
diff --git a/docs/_static/doctools.js b/docs/_static/doctools.js
deleted file mode 100644
index daccd20..0000000
--- a/docs/_static/doctools.js
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * doctools.js
- * ~~~~~~~~~~~
- *
- * Sphinx JavaScript utilities for all documentation.
- *
- * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
- * :license: BSD, see LICENSE for details.
- *
- */
-
-/**
- * select a different prefix for underscore
- */
-$u = _.noConflict();
-
-/**
- * make the code below compatible with browsers without
- * an installed firebug like debugger
-if (!window.console || !console.firebug) {
- var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
- "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
- "profile", "profileEnd"];
- window.console = {};
- for (var i = 0; i < names.length; ++i)
- window.console[names[i]] = function() {};
-}
- */
-
-/**
- * small helper function to urldecode strings
- */
-jQuery.urldecode = function(x) {
- return decodeURIComponent(x).replace(/\+/g, ' ');
-};
-
-/**
- * small helper function to urlencode strings
- */
-jQuery.urlencode = encodeURIComponent;
-
-/**
- * This function returns the parsed url parameters of the
- * current request. Multiple values per key are supported,
- * it will always return arrays of strings for the value parts.
- */
-jQuery.getQueryParameters = function(s) {
- if (typeof s === 'undefined')
- s = document.location.search;
- var parts = s.substr(s.indexOf('?') + 1).split('&');
- var result = {};
- for (var i = 0; i < parts.length; i++) {
- var tmp = parts[i].split('=', 2);
- var key = jQuery.urldecode(tmp[0]);
- var value = jQuery.urldecode(tmp[1]);
- if (key in result)
- result[key].push(value);
- else
- result[key] = [value];
- }
- return result;
-};
-
-/**
- * highlight a given string on a jquery object by wrapping it in
- * span elements with the given class name.
- */
-jQuery.fn.highlightText = function(text, className) {
- function highlight(node, addItems) {
- if (node.nodeType === 3) {
- var val = node.nodeValue;
- var pos = val.toLowerCase().indexOf(text);
- if (pos >= 0 &&
- !jQuery(node.parentNode).hasClass(className) &&
- !jQuery(node.parentNode).hasClass("nohighlight")) {
- var span;
- var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
- if (isInSVG) {
- span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
- } else {
- span = document.createElement("span");
- span.className = className;
- }
- span.appendChild(document.createTextNode(val.substr(pos, text.length)));
- node.parentNode.insertBefore(span, node.parentNode.insertBefore(
- document.createTextNode(val.substr(pos + text.length)),
- node.nextSibling));
- node.nodeValue = val.substr(0, pos);
- if (isInSVG) {
- var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
- var bbox = node.parentElement.getBBox();
- rect.x.baseVal.value = bbox.x;
- rect.y.baseVal.value = bbox.y;
- rect.width.baseVal.value = bbox.width;
- rect.height.baseVal.value = bbox.height;
- rect.setAttribute('class', className);
- addItems.push({
- "parent": node.parentNode,
- "target": rect});
- }
- }
- }
- else if (!jQuery(node).is("button, select, textarea")) {
- jQuery.each(node.childNodes, function() {
- highlight(this, addItems);
- });
- }
- }
- var addItems = [];
- var result = this.each(function() {
- highlight(this, addItems);
- });
- for (var i = 0; i < addItems.length; ++i) {
- jQuery(addItems[i].parent).before(addItems[i].target);
- }
- return result;
-};
-
-/*
- * backward compatibility for jQuery.browser
- * This will be supported until firefox bug is fixed.
- */
-if (!jQuery.browser) {
- jQuery.uaMatch = function(ua) {
- ua = ua.toLowerCase();
-
- var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
- /(webkit)[ \/]([\w.]+)/.exec(ua) ||
- /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
- /(msie) ([\w.]+)/.exec(ua) ||
- ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
- [];
-
- return {
- browser: match[ 1 ] || "",
- version: match[ 2 ] || "0"
- };
- };
- jQuery.browser = {};
- jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
-}
-
-/**
- * Small JavaScript module for the documentation.
- */
-var Documentation = {
-
- init : function() {
- this.fixFirefoxAnchorBug();
- this.highlightSearchWords();
- this.initIndexTable();
- if (DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) {
- this.initOnKeyListeners();
- }
- },
-
- /**
- * i18n support
- */
- TRANSLATIONS : {},
- PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; },
- LOCALE : 'unknown',
-
- // gettext and ngettext don't access this so that the functions
- // can safely bound to a different name (_ = Documentation.gettext)
- gettext : function(string) {
- var translated = Documentation.TRANSLATIONS[string];
- if (typeof translated === 'undefined')
- return string;
- return (typeof translated === 'string') ? translated : translated[0];
- },
-
- ngettext : function(singular, plural, n) {
- var translated = Documentation.TRANSLATIONS[singular];
- if (typeof translated === 'undefined')
- return (n == 1) ? singular : plural;
- return translated[Documentation.PLURALEXPR(n)];
- },
-
- addTranslations : function(catalog) {
- for (var key in catalog.messages)
- this.TRANSLATIONS[key] = catalog.messages[key];
- this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
- this.LOCALE = catalog.locale;
- },
-
- /**
- * add context elements like header anchor links
- */
- addContextElements : function() {
- $('div[id] > :header:first').each(function() {
- $('\u00B6').
- attr('href', '#' + this.id).
- attr('title', _('Permalink to this headline')).
- appendTo(this);
- });
- $('dt[id]').each(function() {
- $('\u00B6').
- attr('href', '#' + this.id).
- attr('title', _('Permalink to this definition')).
- appendTo(this);
- });
- },
-
- /**
- * workaround a firefox stupidity
- * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
- */
- fixFirefoxAnchorBug : function() {
- if (document.location.hash && $.browser.mozilla)
- window.setTimeout(function() {
- document.location.href += '';
- }, 10);
- },
-
- /**
- * highlight the search words provided in the url in the text
- */
- highlightSearchWords : function() {
- var params = $.getQueryParameters();
- var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
- if (terms.length) {
- var body = $('div.body');
- if (!body.length) {
- body = $('body');
- }
- window.setTimeout(function() {
- $.each(terms, function() {
- body.highlightText(this.toLowerCase(), 'highlighted');
- });
- }, 10);
- $('