Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Update precommit config, and reformat code
Browse files Browse the repository at this point in the history
Change language_version from python3.7 to any python
Bump to black 22.3.0.

Reformated all code using black:

    git ls-files | grep "\.py" | xargs touch
    pre-commit  run -v --all-files
  • Loading branch information
f-skold committed Jun 18, 2022
1 parent 78860c4 commit 4b5ec55
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
repos:
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 22.3.0
hooks:
- id: black
language_version: python3.7
language_version: python
args: ["--safe"]

- repo: https://github.com/PyCQA/isort
rev: 5.4.2
hooks:
- id: isort
language_version: python3.7
language_version: python

- repo: https://github.com/PyCQA/flake8
rev: 3.8.3
hooks:
- id: flake8
language_version: python3.7
language_version: python
args: [
# E501 let black handle all line length decisions
# W503 black conflicts with "line break before operator" rule
Expand All @@ -28,7 +28,7 @@ repos:
rev: 5.1.1
hooks:
- id: pydocstyle
language_version: python3.7
language_version: python
args: [
# Check for docstring presence only
"--select=D1",
Expand All @@ -40,5 +40,5 @@ repos:
rev: v0.770
hooks:
- id: mypy
language_version: python3.7
language_version: python
args: ["--no-strict-optional", "--ignore-missing-imports"]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
setup(
name="titiler_pds",
version="0.0.1",
description=u"TiTiler for AWS Public Dataset",
description="TiTiler for AWS Public Dataset",
python_requires=">=3",
classifiers=[
"Intended Audience :: Information Technology",
Expand Down
3 changes: 2 additions & 1 deletion stack/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def __init__(
path=os.path.abspath(code_dir),
bundling=core.BundlingOptions(
image=core.BundlingDockerImage.from_asset(
os.path.abspath(code_dir), file="Dockerfile",
os.path.abspath(code_dir),
file="Dockerfile",
),
command=["bash", "-c", "cp -R /var/task/. /asset-output/."],
),
Expand Down
19 changes: 14 additions & 5 deletions titiler_pds/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class CustomPathParams:
sceneid: str = Query(..., description="Sceneid.")
scene_metadata: Dict = field(init=False)

def __post_init__(self,):
def __post_init__(
self,
):
"""Define dataset URL."""
self.url = self.sceneid
if re.match(
Expand Down Expand Up @@ -49,7 +51,9 @@ def __post_init__(self,):

def BandsParams(
bands: str = Query(
..., title="bands names", description="comma (',') delimited bands names.",
...,
title="bands names",
description="comma (',') delimited bands names.",
)
) -> Sequence[str]:
"""Bands."""
Expand All @@ -61,7 +65,9 @@ class BandsExprParams(DefaultDependency):
"""Band names and Expression parameters."""

bands: Optional[str] = Query(
None, title="bands names", description="comma (',') delimited bands names.",
None,
title="bands names",
description="comma (',') delimited bands names.",
)
expression: Optional[str] = Query(
None,
Expand All @@ -83,14 +89,17 @@ class MosaicParams:

layer: str = Query(..., description="Mosaic Layer name ('{username}.{layer}')")

def __post_init__(self,):
def __post_init__(
self,
):
"""Define mosaic URL."""
pattern = (
r"^(?P<username>[a-zA-Z0-9-_]{1,32})\.(?P<layername>[a-zA-Z0-9-_]{1,32})$"
)
if not re.match(pattern, self.layer):
raise HTTPException(
status_code=400, detail=f"Invalid layer name: `{self.layer}`",
status_code=400,
detail=f"Invalid layer name: `{self.layer}`",
)
if mosaic_config.backend == "dynamodb://":
self.url = f"{mosaic_config.backend}{mosaic_config.host}:{self.layer}"
Expand Down

0 comments on commit 4b5ec55

Please sign in to comment.