Skip to content

Commit

Permalink
build(deps-dev): bump ruff from 0.7.1 to 0.8.6 (#398)
Browse files Browse the repository at this point in the history
* build(deps-dev): bump ruff from 0.7.1 to 0.8.6

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.7.1 to 0.8.6.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.7.1...0.8.6)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* style(precommit): bump ruff to 0.8.6

* style(ruff): fix lint errors

* style: update ruff and mypy python version reference

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: F-G Fernandez <[email protected]>
  • Loading branch information
dependabot[bot] and frgfm authored Jan 9, 2025
1 parent ab5acdd commit a3e525f
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: debug-statements
language_version: python3
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.7.1'
rev: 'v0.8.6'
hooks:
- id: ruff
args:
Expand Down
3 changes: 3 additions & 0 deletions client/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries :: Python Modules",
]
Expand Down Expand Up @@ -77,6 +79,7 @@ zip-safe = true
exclude = ["docs*", "tests*"]

[tool.mypy]
python_version = "3.8"
files = "pyroclient/"
show_error_codes = true
pretty = true
Expand Down
42 changes: 21 additions & 21 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ httpx = "^0.24.0"
optional = true

[tool.poetry.group.quality.dependencies]
ruff = "==0.7.1"
ruff = "==0.8.6"
mypy = "==1.10.0"
types-requests = ">=2.0.0"
types-python-dateutil = "^2.8.0"
Expand Down Expand Up @@ -104,8 +104,6 @@ ignore = [
"F403", # star imports
"E731", # lambda assignment
"C416", # list comprehension to list()
"ANN101", # missing type annotations on self
"ANN102", # missing type annotations on cls
"ANN002", # missing type annotations on *args
"ANN003", # missing type annotations on **kwargs
"COM812", # trailing comma missing
Expand Down Expand Up @@ -139,7 +137,7 @@ quote-style = "double"
indent-style = "space"

[tool.mypy]
python_version = "3.9"
python_version = "3.11"
mypy_path = "src/"
files = "src/app"
show_error_codes = true
Expand Down
14 changes: 7 additions & 7 deletions src/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@


class UserRole(str, Enum):
ADMIN: str = "admin"
AGENT: str = "agent"
USER: str = "user"
ADMIN = "admin"
AGENT = "agent"
USER = "user"


class Role(str, Enum):
ADMIN: str = "admin"
AGENT: str = "agent"
CAMERA: str = "camera"
USER: str = "user"
ADMIN = "admin"
AGENT = "agent"
CAMERA = "camera"
USER = "user"


class User(SQLModel, table=True):
Expand Down
6 changes: 3 additions & 3 deletions src/app/services/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class S3Service:
def __init__(
self, region: str, endpoint_url: str, access_key: str, secret_key: str, proxy_url: Union[str, None] = None
) -> None:
_session = boto3.Session(access_key, secret_key, region_name=region)
self._s3 = _session.client("s3", endpoint_url=endpoint_url)
session_ = boto3.Session(access_key, secret_key, region_name=region)
self._s3 = session_.client("s3", endpoint_url=endpoint_url)
# Ensure S3 is connected
try:
self._s3.list_buckets()
Expand Down Expand Up @@ -169,7 +169,7 @@ async def upload_file(file: UploadFile, organization_id: int, camera_id: int) ->
# Upload the file
if not bucket.upload_file(bucket_key, file.file): # type: ignore[arg-type]
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="Failed upload")
logging.info(f"File uploaded to bucket {bucket_name} with key {bucket_key}.")
logger.info(f"File uploaded to bucket {bucket_name} with key {bucket_key}.")

# Data integrity check
file_meta = bucket.get_file_metadata(bucket_key)
Expand Down
12 changes: 6 additions & 6 deletions src/tests/services/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ async def test_s3_service(region, endpoint_url, access_key, secret_key, proxy_ur
)
@pytest.mark.asyncio
async def test_s3_bucket(bucket_name, proxy_url, expected_error, mock_img):
_session = boto3.Session(settings.S3_ACCESS_KEY, settings.S3_SECRET_KEY, region_name=settings.S3_REGION)
_s3 = _session.client("s3", endpoint_url=settings.S3_ENDPOINT_URL)
session = boto3.Session(settings.S3_ACCESS_KEY, settings.S3_SECRET_KEY, region_name=settings.S3_REGION)
s3 = session.client("s3", endpoint_url=settings.S3_ENDPOINT_URL)
if expected_error is None:
_s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": settings.S3_REGION})
bucket = S3Bucket(_s3, bucket_name, proxy_url)
s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": settings.S3_REGION})
bucket = S3Bucket(s3, bucket_name, proxy_url)
bucket_key = "logo.png"
# Create file
assert not bucket.check_file_existence(bucket_key)
Expand All @@ -90,7 +90,7 @@ async def test_s3_bucket(bucket_name, proxy_url, expected_error, mock_img):
await bucket.delete_items()
assert not bucket.check_file_existence(bucket_key)
# Delete the bucket
_s3.delete_bucket(Bucket=bucket_name)
s3.delete_bucket(Bucket=bucket_name)
else:
with pytest.raises(expected_error):
S3Bucket(_s3, bucket_name, proxy_url)
S3Bucket(s3, bucket_name, proxy_url)
6 changes: 3 additions & 3 deletions src/tests/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
],
)
def test_get_jwt(scopes, token, expires_minutes, error_code, expected_payload):
_token = create_access_token(token, expires_minutes) if isinstance(token, dict) else token
token_ = create_access_token(token, expires_minutes) if isinstance(token, dict) else token
if isinstance(error_code, int):
with pytest.raises(HTTPException):
get_jwt(SecurityScopes(scopes), _token)
get_jwt(SecurityScopes(scopes), token_)
else:
payload = get_jwt(SecurityScopes(scopes), _token)
payload = get_jwt(SecurityScopes(scopes), token_)
if expected_payload is not None:
assert payload.model_dump() == expected_payload

0 comments on commit a3e525f

Please sign in to comment.