Skip to content

Commit

Permalink
feat: add static type information (#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
leso-kn authored and bgiraudo committed Oct 10, 2023
1 parent a2998d0 commit 6397c07
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 6 deletions.
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
except ImportError: # pragma: no cover
# for python < 3.8
from importlib_metadata import metadata # type: ignore
from typing import Dict

# -- General configuration ------------------------------------------------

Expand Down Expand Up @@ -188,7 +189,7 @@

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
latex_elements: Dict[str, str] = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
Expand Down
3 changes: 2 additions & 1 deletion eodag/plugins/authentication/keycloak.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
from typing import Optional

import requests

Expand Down Expand Up @@ -71,7 +72,7 @@ class KeycloakOIDCPasswordAuth(Authentication):
TOKEN_URL_TEMPLATE = "{auth_base_uri}/realms/{realm}/protocol/openid-connect/token"
REQUIRED_PARAMS = ["auth_base_uri", "client_id", "client_secret", "token_provision"]
# already retrieved token store, to be used if authenticate() fails (OTP use-case)
retrieved_token = None
retrieved_token: Optional[str] = None

def __init__(self, provider, config):
super(KeycloakOIDCPasswordAuth, self).__init__(provider, config)
Expand Down
Empty file added eodag/py.typed
Empty file.
5 changes: 3 additions & 2 deletions eodag/rest/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def eodag_openapi():
return app.openapi_schema


app.openapi = eodag_openapi
app.__setattr__("openapi", eodag_openapi)

# Cross-Origin Resource Sharing
allowed_origins = os.getenv("EODAG_CORS_ALLOWED_ORIGINS")
Expand Down Expand Up @@ -616,7 +616,8 @@ def list_queryables(request: Request) -> Queryables:
tags=["STAC"],
include_in_schema=False,
)
def stac_search(request: Request, search_body: SearchBody = None):

def stac_search(request: Request, search_body: Optional[SearchBody] = None):
"""STAC collections items"""
logger.debug(f"URL: {request.url}")
logger.debug(f"Body: {search_body}")
Expand Down
7 changes: 5 additions & 2 deletions eodag/utils/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
# limitations under the License.


from typing import Any


def check_ipython():
"""Check if called from ipython"""
try:
Expand Down Expand Up @@ -44,9 +47,9 @@ class NotebookWidgets(object):
"""Display / handle ipython widgets"""

is_notebook = False
html_box = None
html_box: Any = None
html_box_shown = False
display = None
display: Any = None

def __init__(self):
self.is_notebook = check_notebook()
Expand Down
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,30 @@ build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
fallback_version = "2.11.0b2.dev0"

[[tool.mypy.overrides]]
module = [
"boto3",
"botocore.*",
"cdsapi",
"click",
"click.*",
"ecmwfapi",
"ecmwfapi.*",
"eodag_cube.*",
"geojson",
"IPython.display",
"owslib.*",
"requests_ftp",
"shapefile",
"shapely",
"shapely.*",
"stream_zip",
"jsonpath_ng",
"jsonpath_ng.*",
"usgs",
"usgs.*",
"whoosh",
"whoosh.*"
]
ignore_missing_imports = true
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ exclude =
* =
LICENSE
NOTICE
py.typed

[options.entry_points]
console_scripts =
Expand Down

0 comments on commit 6397c07

Please sign in to comment.