Skip to content

Commit

Permalink
Ruff import sorting (#518)
Browse files Browse the repository at this point in the history
* enable ruff import sorting

* ruff-update import order

* change(pre-commit): ruff --fix before black

* update CHANGELOG.md
  • Loading branch information
ircwaves authored May 25, 2023
1 parent 1191654 commit 871c41f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# Please run `pre-commit run --all-files` when adding or changing entries.

repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.257'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
Expand All @@ -19,10 +24,6 @@ repos:
args: [--ignore=D004]
additional_dependencies:
- importlib_metadata < 5; python_version == "3.7"
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.257'
hooks:
- id: ruff
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
hooks:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Move to `FutureWarning` from `DeprecationWarning` for item search interface functions that are to be removed [#464](https://github.com/stac-utils/pystac-client/pull/464)
- Consolidate contributing docs into one place [#478](https://github.com/stac-utils/pystac-client/issues/478)
- Use `pyproject.toml` instead of `setup.py` [#501](https://github.com/stac-utils/pystac-client/pull/501)
- Enable Ruff import sorting [#518](https://github.com/stac-utils/pystac-client/pull/518)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ max-line-length = 130
[tool.ruff]
ignore = ["E722", "E731"]
line-length = 88
select = ["E", "F", "W"]
select = ["E", "F", "W", "I"]

[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"]
Expand Down
8 changes: 4 additions & 4 deletions pystac_client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
import os
import re
import sys
from typing import Any, Dict, List, Optional
import warnings
from typing import Any, Dict, List, Optional

from .client import Client
from .conformance import ConformanceClasses
from .item_search import OPS
from .version import __version__
from .warnings import (
PystacClientWarning,
NoConformsTo,
DoesNotConformTo,
MissingLink,
FallbackToPystac,
MissingLink,
NoConformsTo,
PystacClientWarning,
)

logger = logging.getLogger(__name__)
Expand Down
3 changes: 2 additions & 1 deletion pystac_client/collection_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import warnings
from typing import (
TYPE_CHECKING,
Any,
Expand All @@ -11,7 +12,6 @@
Union,
cast,
)
import warnings

import pystac

Expand All @@ -25,6 +25,7 @@

if TYPE_CHECKING:
from pystac.item import Item as Item_Type

from pystac_client import Client


Expand Down
4 changes: 2 additions & 2 deletions pystac_client/stac_api_io.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import warnings
from copy import deepcopy
from typing import (
TYPE_CHECKING,
Expand All @@ -12,9 +13,7 @@
Tuple,
Union,
)
from typing_extensions import TypeAlias
from urllib.parse import urlparse
import warnings

import pystac
from pystac.link import Link
Expand All @@ -26,6 +25,7 @@
)
from pystac.stac_io import DefaultStacIO
from requests import Request, Session
from typing_extensions import TypeAlias

import pystac_client

Expand Down
2 changes: 1 addition & 1 deletion pystac_client/warnings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import warnings
from contextlib import contextmanager
from typing import Iterator
import warnings


class PystacClientWarning(UserWarning):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import pytest
from dateutil.tz import tzutc
from pystac import MediaType
from requests_mock import Mocker

from pystac_client import Client, CollectionClient
from pystac_client._utils import Modifiable
from pystac_client.conformance import ConformanceClasses
Expand All @@ -23,7 +25,6 @@
NoConformsTo,
strict,
)
from requests_mock import Mocker

from .helpers import STAC_URLS, TEST_DATA, read_data_file

Expand Down

0 comments on commit 871c41f

Please sign in to comment.