Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unwanted breacking change with img_profiles.get not allowing de… #180

Merged
merged 1 commit into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2.0a6 (2020-05-06)
------------------
- fix unwanted breacking change with `img_profiles.get` not allowing default values

2.0a5 (2020-05-06)
------------------
- make `rio_tiler.io.landsat8.tile` return Uint16 data and not float32 (#173)
Expand Down
6 changes: 4 additions & 2 deletions rio_tiler/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ def __init__(self):
}
)

def get(self, key):
def get(self, key, default=None):
"""Like normal item access but return a copy of the key."""
return self.data.get(key, {}).copy()
if key in (self.keys()):
return self.data[key].copy()
return default

def __getitem__(self, key):
"""Like normal item access but return a copy of the key."""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

setup(
name="rio-tiler",
version="2.0a5",
version="2.0a6",
python_requires=">=3",
description=u"""Get mercator tile from CloudOptimized GeoTIFF and other cloud hosted raster such as CBERS-4, Sentinel-2, Sentinel-1 and Landsat-8 AWS PDS""",
long_description=readme,
Expand Down
3 changes: 3 additions & 0 deletions tests/test_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ def test_gdal_profiles():
prof["test"] = True
new_prof = img_profiles["jpeg"]
assert not new_prof.get("test")

prof = img_profiles.get("jpe", {"a": "b"})
assert prof == {"a": "b"}