Skip to content

Commit e6cce98

Browse files
author
Ashutosh Tiwari
committed
fixed format
1 parent c04ef35 commit e6cce98

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ repos:
1818
rev: v0.0.291
1919
hooks:
2020
- id: ruff
21+
args: [ --fix ]

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ format:
3030
@echo "formatting..."
3131
@poetry install --only lint
3232
@poetry run black .
33-
@poetry run pre-commit run --all-files
33+
# ruff fix
34+
@poetry run pre-commit run --all-files --config .pre-commit-config.yaml
3435

3536
.PHONY: run_tests
3637
run_tests:

graph_ml/utils/config.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import os, sys
1+
import os
22
import torch
33

44

55
OS = os.name
6-
DEVICE_TYPE = 'cpu'
7-
if OS == 'posix':
6+
DEVICE_TYPE = "cpu"
7+
if OS == "posix":
88
if torch.cuda.is_available():
9-
DEVICE_TYPE = 'cuda'
9+
DEVICE_TYPE = "cuda"
1010
elif torch.backends.mps.is_available():
11-
DEVICE_TYPE = 'mps'
11+
DEVICE_TYPE = "mps"
1212

1313
DEVICE = torch.device(DEVICE_TYPE)
1414

15-
GPU_AVAILABLE = DEVICE_TYPE in ['cuda', 'mps']
16-
15+
GPU_AVAILABLE = DEVICE_TYPE in ["cuda", "mps"]

graph_ml/utils/gpu_utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
import torch
2-
3-
OS =

tests/test_gpu_available.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
from __future__ import annotations
22
import os
33

4-
import pytest
54
from graph_ml.utils import config
65

76
OS = os.name
87

8+
99
def test_target_os():
1010
assert OS == "posix"
1111

1212

1313
def test_device_type():
1414
assert config.DEVICE_TYPE in ["cpu", "cuda", "mps"]
1515

16+
1617
def test_gpu_available():
1718
if config.DEVICE_TYPE == "cuda":
1819
assert config.GPU_AVAILABLE
@@ -22,4 +23,3 @@ def test_gpu_available():
2223
assert not config.GPU_AVAILABLE
2324
else:
2425
assert False
25-

0 commit comments

Comments
 (0)