Skip to content

Commit

Permalink
FORM: black isort
Browse files Browse the repository at this point in the history
  • Loading branch information
davemlz committed Dec 20, 2021
1 parent a64e273 commit 87ce5f3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 38 deletions.
15 changes: 2 additions & 13 deletions eemont/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@

__version__ = "0.3.0"

from . import (
app,
dataframe,
eeDictionary,
eeList,
extra,
feature,
featurecollection,
geometry,
image,
imagecollection,
number,
)
from . import (app, dataframe, eeDictionary, eeList, extra, feature,
featurecollection, geometry, image, imagecollection, number)
from .common import *
25 changes: 14 additions & 11 deletions eemont/app.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import webbrowser
import requests
import json
import ee
import webbrowser

import ee
import requests
from box import Box
from bs4 import BeautifulSoup
from ee_extra.Apps.core import apps as extra_apps

from .extending import extend


@extend(ee)
class App():
class App:
"""Google Earth Engine App Manager and Descriptor.
Inspect, open and download Google Earth Engine apps.
Expand All @@ -36,7 +37,9 @@ def __init__(self, url):
if "users.earthengine.app" not in url:
raise Exception("Not a valid Earth Engine App! Check the url again!")
if "users.earthengine.app/view/" not in url:
raise Exception("This seems to be an Earth Engine App Collection! Please use the url of an app!")
raise Exception(
"This seems to be an Earth Engine App Collection! Please use the url of an app!"
)

self.url = url
"""URL of the App."""
Expand Down Expand Up @@ -68,7 +71,7 @@ def open(self):
"""
webbrowser.open(self.url)

def download(self, file = None):
def download(self, file=None):
"""Downloads the current app to a JS file.
Parameters
Expand All @@ -89,7 +92,7 @@ def download(self, file = None):
r = requests.get(self.url)
r = BeautifulSoup(r.text)
r = r.find_all("main")[0].find("script").string
app_url = re.findall(r'init\((.*?)\)',r)[0].replace('"','').replace("'","")
app_url = re.findall(r"init\((.*?)\)", r)[0].replace('"', "").replace("'", "")
r = requests.get(app_url).json()
path = r["path"]
r = r["dependencies"][path]
Expand All @@ -100,13 +103,13 @@ def download(self, file = None):


@extend(ee)
def listApps(online = False):
def listApps(online=False):
"""Gets the dictionary of available Google Earth Engine Apps from ee-appshot [1]_.
Parameters
----------
online : boolean
Whether to retrieve the most recent list of apps directly from the GitHub
Whether to retrieve the most recent list of apps directly from the GitHub
repository and not from the local copy.
Returns
Expand Down Expand Up @@ -144,5 +147,5 @@ def __repr__(self):
if "users.earthengine.app/view/" in app:
the_app = App(app)
apps_extra[user][the_app.name] = the_app
return GoogleEarthEngineApps(apps_extra,frozen_box = True)

return GoogleEarthEngineApps(apps_extra, frozen_box=True)
2 changes: 1 addition & 1 deletion eemont/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import ee_extra.Spectral.core
import ee_extra.STAC.core
import ee_extra.STAC.utils
from ee_extra.STAC.utils import _get_platform_STAC
import pkg_resources
import requests
from box import Box
from ee_extra.STAC.utils import _get_platform_STAC
from geopy.geocoders import get_geocoder_for_service

from .extending import extend
Expand Down
9 changes: 3 additions & 6 deletions eemont/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
import geopy
from geopy.geocoders import get_geocoder_for_service

from .common import (
_convert_lnglats_to_pluscodes,
_convert_pluscodes_to_lnglats,
_lnglat_from_location,
_retrieve_location,
)
from .common import (_convert_lnglats_to_pluscodes,
_convert_pluscodes_to_lnglats, _lnglat_from_location,
_retrieve_location)
from .extending import extend


Expand Down
5 changes: 1 addition & 4 deletions eemont/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import ee_extra.Spectral.core
import requests

from .common import (
_matchHistogram,
_panSharpen,
)
from .common import _matchHistogram, _panSharpen
from .extending import extend


Expand Down
4 changes: 1 addition & 3 deletions eemont/imagecollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
import numpy as np
import requests

from .common import (
_panSharpen,
)
from .common import _panSharpen
from .extending import extend


Expand Down

0 comments on commit 87ce5f3

Please sign in to comment.