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

update pre-commit and use ruff for linting/formating #105

Merged
merged 5 commits into from
Apr 25, 2024

Conversation

vincentsarago
Copy link
Member

This PR updates pre-commit and switch to ruff for formatting/linting (as we did in stac-fastapi)

@@ -57,7 +56,7 @@
api = StacApi(
settings=settings,
extensions=extensions,
client=CoreCrudClient(post_request_model=post_request_model),
client=CoreCrudClient(post_request_model=post_request_model), # type: ignore
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why I was getting a Mypy error here 🤷

collection_id=collection_id,
item_id=item_id,
collection_id=collection_id, # type: ignore
item_id=item_id, # type: ignore
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collection_id and item_id should always be define but for some reason mypy thinks it can be None

with translate_pgstac_errors():
async with pool.acquire() as conn:
yield conn


async def dbfunc(conn: Connection, func: str, arg: Union[str, Dict]):
async def dbfunc(conn: Connection, func: str, arg: Union[str, Dict, List]):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

"rel": Relations.self.value,
"type": MimeTypes.json.value,
"href": self.url,
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: using dict() is slower than constructing a dict using {}

@@ -28,7 +28,7 @@
class TransactionsClient(AsyncBaseTransactionsClient):
"""Transactions extension specific CRUD operations."""

def _validate_id(self, id: str, settings: Settings) -> bool:
def _validate_id(self, id: str, settings: Settings):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no return on this function

@@ -153,7 +151,8 @@ async def test_returns_valid_links_in_collections(app_client, load_test_data):
# Find collection in list by ID
single_coll = next(coll for coll in collections if coll["id"] == in_json["id"])
is_coll_from_list_valid = False
single_coll_mocked_link = dict()

single_coll_mocked_link: Optional[pystac.Collection] = None
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

single_coll_mocked_link can't be a dict but has to be a Collection object

@vincentsarago vincentsarago requested a review from jonhealy1 April 23, 2024 15:55
@jonhealy1
Copy link
Collaborator

@vincentsarago changelog?

@vincentsarago
Copy link
Member Author

@jonhealy1 I'll wait for #101 to get merged

then I'll merge this one to main and then we can do #106

@vincentsarago vincentsarago merged commit 46a28ee into main Apr 25, 2024
7 checks passed
@vincentsarago vincentsarago deleted the feature/update-linter branch April 25, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants