Skip to content

Commit 478223c

Browse files
authored
Merge pull request #97 from KelvinLinBU/precommit-update
Switch to Ruff from Black for formatting and linting
2 parents da09958 + 906f014 commit 478223c

6 files changed

Lines changed: 8 additions & 10 deletions

File tree

.pre-commit-config.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ repos:
1010
- id: detect-private-key
1111
- id: check-yaml
1212

13-
- repo: https://github.com/psf/black
14-
rev: 24.4.0
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.11.10
1515
hooks:
16-
- id: black
16+
- id: ruff
17+
- id: ruff-format

src/openstack_billing_db/billing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from datetime import datetime
44
from dataclasses import dataclass
55
from decimal import Decimal, ROUND_HALF_UP
6-
import json
76
import math
87
import os
98

src/openstack_billing_db/fetch.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import subprocess
55

66
import boto3
7-
import requests
8-
from requests.auth import HTTPBasicAuth
97

108
logger = logging.getLogger(__name__)
119

src/openstack_billing_db/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def main():
168168

169169
if not dump_file:
170170
raise Exception(
171-
"Must provide either --sql_dump_file" "or --download_dump_from_s3."
171+
"Must provide either --sql_dump_fileor --download_dump_from_s3."
172172
)
173173

174174
if args.use_nerc_rates:

src/openstack_billing_db/tests/unit/test_billing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from openstack_billing_db import billing
66
from openstack_billing_db.model import Instance, InstanceEvent
7-
from openstack_billing_db.tests.unit.utils import FLAVORS, MINUTE, HOUR, DAY, MONTH
7+
from openstack_billing_db.tests.unit.utils import FLAVORS, HOUR, DAY
88

99

1010
def test_instance_simple_runtime():
@@ -46,5 +46,5 @@ def test_billing_add_su_hours():
4646
invoice = billing.set_invoice_su_hours(invoice, "gpu_a100", 48)
4747
assert invoice.gpu_a100_su_hours == 48
4848

49-
with pytest.raises(Exception) as e:
49+
with pytest.raises(Exception):
5050
invoice = billing.set_invoice_su_hours(invoice, "gpu_fake", 72)

src/openstack_billing_db/tests/unit/test_instance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from datetime import datetime, timedelta
33

44
from openstack_billing_db.model import Instance, InstanceEvent, Database
5-
from openstack_billing_db.tests.unit.utils import FLAVORS, MINUTE, HOUR, DAY, MONTH
5+
from openstack_billing_db.tests.unit.utils import FLAVORS, MINUTE, DAY, MONTH
66

77

88
def test_instance_simple_runtime():

0 commit comments

Comments
 (0)