diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-11 02:14:47 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 02:14:47 +0000 |
commit | 9b251f1139bc15963fe11990606ea801a9642afe (patch) | |
tree | 318a93e2a31878deb943463b5694f8269ba69d40 | |
parent | 5b5b18fbe0b9017dbcb7194bff582d8b15734c86 (diff) |
automatic import of python-placekey
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-placekey.spec | 527 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 529 insertions, 0 deletions
@@ -0,0 +1 @@ +/placekey-0.0.12.tar.gz diff --git a/python-placekey.spec b/python-placekey.spec new file mode 100644 index 0000000..a6a05a6 --- /dev/null +++ b/python-placekey.spec @@ -0,0 +1,527 @@ +%global _empty_manifest_terminate_build 0 +Name: python-placekey +Version: 0.0.12 +Release: 1 +Summary: Utilities for working with Placekeys +License: Apache Software License +URL: https://github.com/Placekey/placekey-py +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c9/10/da10b95a80294c05869aede5917120e91c970c38392391b78cad9bb3f0e5/placekey-0.0.12.tar.gz +BuildArch: noarch + +Requires: python3-h3 +Requires: python3-shapely +Requires: python3-requests +Requires: python3-ratelimit +Requires: python3-backoff + +%description +# Placekey-py + +[](https://badge.fury.io/py/placekey) +[](https://pypistats.org/packages/placekey) +[](LICENSE) + +A Python library for working with [Placekeys](https://placekey.io). Documentation for this package can be found [here](https://placekey.github.io/placekey-py/), and documentation for the Placekey service API can be found [here](https://docs.placekey.io/). The Plackey design specification is available [here](https://docs.placekey.io/Placekey_Technical_White_Paper.pdf). The details in Placekey encoding is [here](https://docs.placekey.io/Placekey_Encoding_Specification%20White_Paper.pdf). We welcome your feedback. + +## Installation + +This package can be installed from [PyPI](https://pypi.org/project/placekey/) by + +```shell script +pip install placekey +``` + +MacOS Big Sur may need to run `brew install geos` if the installation of the `shapely` dependency fails. + +## Usage + +The basic functionality of the Placekey library is conversion between Placekeys and latitude-longitude coordinates. + +```python +>>> import placekey as pk +>>> lat, long = 0.0, 0.0 +>>> pk.geo_to_placekey(lat, long) +'@dvt-smp-tvz' +``` + +```python +>>> pk.placekey_to_geo('@dvt-smp-tvz') +(0.00018033323813810344, -0.00018985758738881587) +``` + +The library also allows for conversion between Placekeys and [H3 indices](https://github.com/uber/h3-py). + +```python +>>> pk.placekey_to_h3('@dvt-smp-tvz') +'8a754e64992ffff' +``` + +```python +>>> pk.h3_to_placekey('8a754e64992ffff') +'@dvt-smp-tvz' +``` + +The distance in meters between two Placekeys can be found with the following function. + +```python +>>> pk.placekey_distance('@dvt-smp-tvz', '@5vg-7gq-tjv') +12795124.895573696 +``` + +An upper bound on the maximal distance in meters between two Placekeys based on the length of their shared prefix is provided by `placekey.get_prefix_distance_dict()`. + +```python +>>> pk.get_prefix_distance_dict() +{0: 20040000.0, + 1: 20040000.0, + 2: 2777000.0, + 3: 1065000.0, + 4: 152400.0, + 5: 21770.0, + 6: 8227.0, + 7: 1176.0, + 8: 444.3, + 9: 63.47} +``` + +Placekeys found in a data set can be partially validated by + +```python +>>> pk.placekey_format_is_valid('222-227@dvt-smp-tvz') +True +``` + +```python +>>> pk.placekey_format_is_valid('@123-456-789') +False +``` + +## API Client + +This package also includes a client for the Placekey API. The methods in the client are automatically rate limited. + +```python +>>> from placekey.api import PlacekeyAPI +>>> placekey_api_key = "..." +>>> pk_api = PlacekeyAPI(placekey_api_key) +``` + +The `PlacekeyAPI.lookup_placekey` method can be used to lookup the Placekey for a single place. + +```python +>>> pk_api.lookup_placekey(latitude=37.7371, longitude=-122.44283) +{'query_id': '0', 'placekey': '@5vg-82n-kzz'} +``` + +```python +>>> place = { +>>> "street_address": "598 Portola Dr", +>>> "city": "San Francisco", +>>> "region": "CA", +>>> "postal_code": "94131", +>>> "iso_country_code": "US" +>>> } +>>> pk_api.lookup_placekey(**place, strict_address_match=True) +{'query_id': '0', 'placekey': '227@5vg-82n-pgk'} +``` + +The `PlacekeyAPI.lookup_placekeys` method can be used to lookup Placekeys for multiple places. + +```python +>>> places = [ +>>> { +>>> "street_address": "1543 Mission Street, Floor 3", +>>> "city": "San Francisco", +>>> "region": "CA", +>>> "postal_code": "94105", +>>> "iso_country_code": "US" +>>> }, +>>> { +>>> "query_id": "thisqueryidaloneiscustom", +>>> "location_name": "Twin Peaks Petroleum", +>>> "street_address": "598 Portola Dr", +>>> "city": "San Francisco", +>>> "region": "CA", +>>> "postal_code": "94131", +>>> "iso_country_code": "US" +>>> }, +>>> { +>>> "latitude": 37.7371, +>>> "longitude": -122.44283 +>>> } +>>> ] +>>> pk_api.lookup_placekeys(places) +[{'query_id': 'place_0', 'placekey': '226@5vg-7gq-5mk'}, + {'query_id': 'thisqueryidaloneiscustom', 'placekey': '227-222@5vg-82n-pgk'}, + {'query_id': 'place_2', 'placekey': '@5vg-82n-kzz'}] +``` + +Full details on how to query the API and how to get an API key can be found [here](https://docs.placekey.io/). + +## Notebooks + +Jupyter notebooks demonstrating various Placekey functionality are contained in the [placekey-notebooks](https://github.com/Placekey/placekey-notebooks) repository. + +## Support + +This package runs on Python 3. + + +%package -n python3-placekey +Summary: Utilities for working with Placekeys +Provides: python-placekey +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-placekey +# Placekey-py + +[](https://badge.fury.io/py/placekey) +[](https://pypistats.org/packages/placekey) +[](LICENSE) + +A Python library for working with [Placekeys](https://placekey.io). Documentation for this package can be found [here](https://placekey.github.io/placekey-py/), and documentation for the Placekey service API can be found [here](https://docs.placekey.io/). The Plackey design specification is available [here](https://docs.placekey.io/Placekey_Technical_White_Paper.pdf). The details in Placekey encoding is [here](https://docs.placekey.io/Placekey_Encoding_Specification%20White_Paper.pdf). We welcome your feedback. + +## Installation + +This package can be installed from [PyPI](https://pypi.org/project/placekey/) by + +```shell script +pip install placekey +``` + +MacOS Big Sur may need to run `brew install geos` if the installation of the `shapely` dependency fails. + +## Usage + +The basic functionality of the Placekey library is conversion between Placekeys and latitude-longitude coordinates. + +```python +>>> import placekey as pk +>>> lat, long = 0.0, 0.0 +>>> pk.geo_to_placekey(lat, long) +'@dvt-smp-tvz' +``` + +```python +>>> pk.placekey_to_geo('@dvt-smp-tvz') +(0.00018033323813810344, -0.00018985758738881587) +``` + +The library also allows for conversion between Placekeys and [H3 indices](https://github.com/uber/h3-py). + +```python +>>> pk.placekey_to_h3('@dvt-smp-tvz') +'8a754e64992ffff' +``` + +```python +>>> pk.h3_to_placekey('8a754e64992ffff') +'@dvt-smp-tvz' +``` + +The distance in meters between two Placekeys can be found with the following function. + +```python +>>> pk.placekey_distance('@dvt-smp-tvz', '@5vg-7gq-tjv') +12795124.895573696 +``` + +An upper bound on the maximal distance in meters between two Placekeys based on the length of their shared prefix is provided by `placekey.get_prefix_distance_dict()`. + +```python +>>> pk.get_prefix_distance_dict() +{0: 20040000.0, + 1: 20040000.0, + 2: 2777000.0, + 3: 1065000.0, + 4: 152400.0, + 5: 21770.0, + 6: 8227.0, + 7: 1176.0, + 8: 444.3, + 9: 63.47} +``` + +Placekeys found in a data set can be partially validated by + +```python +>>> pk.placekey_format_is_valid('222-227@dvt-smp-tvz') +True +``` + +```python +>>> pk.placekey_format_is_valid('@123-456-789') +False +``` + +## API Client + +This package also includes a client for the Placekey API. The methods in the client are automatically rate limited. + +```python +>>> from placekey.api import PlacekeyAPI +>>> placekey_api_key = "..." +>>> pk_api = PlacekeyAPI(placekey_api_key) +``` + +The `PlacekeyAPI.lookup_placekey` method can be used to lookup the Placekey for a single place. + +```python +>>> pk_api.lookup_placekey(latitude=37.7371, longitude=-122.44283) +{'query_id': '0', 'placekey': '@5vg-82n-kzz'} +``` + +```python +>>> place = { +>>> "street_address": "598 Portola Dr", +>>> "city": "San Francisco", +>>> "region": "CA", +>>> "postal_code": "94131", +>>> "iso_country_code": "US" +>>> } +>>> pk_api.lookup_placekey(**place, strict_address_match=True) +{'query_id': '0', 'placekey': '227@5vg-82n-pgk'} +``` + +The `PlacekeyAPI.lookup_placekeys` method can be used to lookup Placekeys for multiple places. + +```python +>>> places = [ +>>> { +>>> "street_address": "1543 Mission Street, Floor 3", +>>> "city": "San Francisco", +>>> "region": "CA", +>>> "postal_code": "94105", +>>> "iso_country_code": "US" +>>> }, +>>> { +>>> "query_id": "thisqueryidaloneiscustom", +>>> "location_name": "Twin Peaks Petroleum", +>>> "street_address": "598 Portola Dr", +>>> "city": "San Francisco", +>>> "region": "CA", +>>> "postal_code": "94131", +>>> "iso_country_code": "US" +>>> }, +>>> { +>>> "latitude": 37.7371, +>>> "longitude": -122.44283 +>>> } +>>> ] +>>> pk_api.lookup_placekeys(places) +[{'query_id': 'place_0', 'placekey': '226@5vg-7gq-5mk'}, + {'query_id': 'thisqueryidaloneiscustom', 'placekey': '227-222@5vg-82n-pgk'}, + {'query_id': 'place_2', 'placekey': '@5vg-82n-kzz'}] +``` + +Full details on how to query the API and how to get an API key can be found [here](https://docs.placekey.io/). + +## Notebooks + +Jupyter notebooks demonstrating various Placekey functionality are contained in the [placekey-notebooks](https://github.com/Placekey/placekey-notebooks) repository. + +## Support + +This package runs on Python 3. + + +%package help +Summary: Development documents and examples for placekey +Provides: python3-placekey-doc +%description help +# Placekey-py + +[](https://badge.fury.io/py/placekey) +[](https://pypistats.org/packages/placekey) +[](LICENSE) + +A Python library for working with [Placekeys](https://placekey.io). Documentation for this package can be found [here](https://placekey.github.io/placekey-py/), and documentation for the Placekey service API can be found [here](https://docs.placekey.io/). The Plackey design specification is available [here](https://docs.placekey.io/Placekey_Technical_White_Paper.pdf). The details in Placekey encoding is [here](https://docs.placekey.io/Placekey_Encoding_Specification%20White_Paper.pdf). We welcome your feedback. + +## Installation + +This package can be installed from [PyPI](https://pypi.org/project/placekey/) by + +```shell script +pip install placekey +``` + +MacOS Big Sur may need to run `brew install geos` if the installation of the `shapely` dependency fails. + +## Usage + +The basic functionality of the Placekey library is conversion between Placekeys and latitude-longitude coordinates. + +```python +>>> import placekey as pk +>>> lat, long = 0.0, 0.0 +>>> pk.geo_to_placekey(lat, long) +'@dvt-smp-tvz' +``` + +```python +>>> pk.placekey_to_geo('@dvt-smp-tvz') +(0.00018033323813810344, -0.00018985758738881587) +``` + +The library also allows for conversion between Placekeys and [H3 indices](https://github.com/uber/h3-py). + +```python +>>> pk.placekey_to_h3('@dvt-smp-tvz') +'8a754e64992ffff' +``` + +```python +>>> pk.h3_to_placekey('8a754e64992ffff') +'@dvt-smp-tvz' +``` + +The distance in meters between two Placekeys can be found with the following function. + +```python +>>> pk.placekey_distance('@dvt-smp-tvz', '@5vg-7gq-tjv') +12795124.895573696 +``` + +An upper bound on the maximal distance in meters between two Placekeys based on the length of their shared prefix is provided by `placekey.get_prefix_distance_dict()`. + +```python +>>> pk.get_prefix_distance_dict() +{0: 20040000.0, + 1: 20040000.0, + 2: 2777000.0, + 3: 1065000.0, + 4: 152400.0, + 5: 21770.0, + 6: 8227.0, + 7: 1176.0, + 8: 444.3, + 9: 63.47} +``` + +Placekeys found in a data set can be partially validated by + +```python +>>> pk.placekey_format_is_valid('222-227@dvt-smp-tvz') +True +``` + +```python +>>> pk.placekey_format_is_valid('@123-456-789') +False +``` + +## API Client + +This package also includes a client for the Placekey API. The methods in the client are automatically rate limited. + +```python +>>> from placekey.api import PlacekeyAPI +>>> placekey_api_key = "..." +>>> pk_api = PlacekeyAPI(placekey_api_key) +``` + +The `PlacekeyAPI.lookup_placekey` method can be used to lookup the Placekey for a single place. + +```python +>>> pk_api.lookup_placekey(latitude=37.7371, longitude=-122.44283) +{'query_id': '0', 'placekey': '@5vg-82n-kzz'} +``` + +```python +>>> place = { +>>> "street_address": "598 Portola Dr", +>>> "city": "San Francisco", +>>> "region": "CA", +>>> "postal_code": "94131", +>>> "iso_country_code": "US" +>>> } +>>> pk_api.lookup_placekey(**place, strict_address_match=True) +{'query_id': '0', 'placekey': '227@5vg-82n-pgk'} +``` + +The `PlacekeyAPI.lookup_placekeys` method can be used to lookup Placekeys for multiple places. + +```python +>>> places = [ +>>> { +>>> "street_address": "1543 Mission Street, Floor 3", +>>> "city": "San Francisco", +>>> "region": "CA", +>>> "postal_code": "94105", +>>> "iso_country_code": "US" +>>> }, +>>> { +>>> "query_id": "thisqueryidaloneiscustom", +>>> "location_name": "Twin Peaks Petroleum", +>>> "street_address": "598 Portola Dr", +>>> "city": "San Francisco", +>>> "region": "CA", +>>> "postal_code": "94131", +>>> "iso_country_code": "US" +>>> }, +>>> { +>>> "latitude": 37.7371, +>>> "longitude": -122.44283 +>>> } +>>> ] +>>> pk_api.lookup_placekeys(places) +[{'query_id': 'place_0', 'placekey': '226@5vg-7gq-5mk'}, + {'query_id': 'thisqueryidaloneiscustom', 'placekey': '227-222@5vg-82n-pgk'}, + {'query_id': 'place_2', 'placekey': '@5vg-82n-kzz'}] +``` + +Full details on how to query the API and how to get an API key can be found [here](https://docs.placekey.io/). + +## Notebooks + +Jupyter notebooks demonstrating various Placekey functionality are contained in the [placekey-notebooks](https://github.com/Placekey/placekey-notebooks) repository. + +## Support + +This package runs on Python 3. + + +%prep +%autosetup -n placekey-0.0.12 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-placekey -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.12-1 +- Package Spec generated @@ -0,0 +1 @@ +f472d57156edc192f69c2a8306aaef95 placekey-0.0.12.tar.gz |