Skip to content

Commit e9b352e

Browse files
committed
refactor code with running pre-commit
1 parent fa5c508 commit e9b352e

File tree

8 files changed

+21
-11
lines changed

8 files changed

+21
-11
lines changed

clang_tools/install.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import os
2+
import shutil
13
import string
24
import subprocess
3-
import shutil
4-
import os
55
import sys
66
from posixpath import basename
7+
78
from clang_tools.util import check_install_os
89
from clang_tools.util import download_file
910

@@ -67,8 +68,8 @@ def move_and_chmod_binary(old_file_name, new_file_name, directory) -> None:
6768
if directory:
6869
install_dir = directory
6970
else:
70-
os = check_install_os()
71-
if os == "windows":
71+
install_os = check_install_os()
72+
if install_os == "windows":
7273
install_dir = os.path.dirname(sys.executable)
7374
else:
7475
install_dir = os.path.expanduser('~/.local/bin/')
@@ -79,7 +80,8 @@ def move_and_chmod_binary(old_file_name, new_file_name, directory) -> None:
7980
os.chmod(os.path.join(install_dir, new_file_name), 0o755)
8081
except PermissionError:
8182
raise SystemExit(
82-
f"Don't have permission to install {new_file_name} to {install_dir}. Try to run with the appropriate permissions."
83+
f"Don't have permission to install {new_file_name} to {install_dir}. \
84+
Try to run with the appropriate permissions."
8385
)
8486

8587

clang_tools/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import sys
21
import argparse
2+
import sys
3+
34
from clang_tools.install import install_clang_tools
45

56

clang_tools/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import platform
12
import string
23
import subprocess
34
import urllib.request
4-
import platform
55

66

77
def check_install_os() -> string:

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pytest
21
coverage
32
flake8
3+
pytest

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from setuptools import setup, find_packages
1+
from setuptools import find_packages
2+
from setuptools import setup
23

34
with open("README.md", "r", encoding='utf-8') as file:
45
long_description = file.read()

tests/test_install.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
23
from clang_tools.install import check_install_os
34
from clang_tools.install import clang_format_exist
45
from clang_tools.install import clang_tidy_exist

tests/test_main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import pytest
21
from unittest import mock
2+
3+
import pytest
4+
35
from clang_tools.main import main
46

57

tests/test_util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from unittest import mock
2-
from clang_tools.util import check_install_os, download_file, unpack_file
2+
3+
from clang_tools.util import check_install_os
4+
from clang_tools.util import download_file
5+
from clang_tools.util import unpack_file
36

47

58
def test_check_install_os():

0 commit comments

Comments
 (0)