Skip to content

Commit 701c946

Browse files
committed
fix ruff
1 parent 2ec2801 commit 701c946

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ ignore = [
101101
"PLC0206",
102102
"UP031",
103103
"INP001",
104-
"SIM108"
104+
"SIM108",
105105
]
106106
extend-select = []
107107
preview = true

setup.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
"""Python setup information."""
22

3-
import codecs
43
import os
54
import re
5+
from pathlib import Path
66

77
from setuptools import find_packages, setup
88

9-
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
10-
REQUIREMENTS_FILE = os.path.join(PROJECT_ROOT, "requirements.txt")
11-
README_FILE = os.path.join(PROJECT_ROOT, "README.md")
12-
VERSION_FILE = os.path.join(PROJECT_ROOT, "pyinfraformat", "__init__.py")
9+
PROJECT_ROOT = Path(os.path.realpath(__file__)).parent
10+
REQUIREMENTS_FILE = PROJECT_ROOT / "requirements.txt"
11+
README_FILE = PROJECT_ROOT / "README.md"
12+
VERSION_FILE = PROJECT_ROOT / "pyinfraformat" / "__init__.py"
1313

1414

1515
def get_requirements():
1616
"""Read contents from requirements.txt."""
17-
with codecs.open(REQUIREMENTS_FILE) as buff:
17+
with open(REQUIREMENTS_FILE, encoding="utf-8") as buff:
1818
return buff.read().splitlines()
1919

2020

2121
def get_long_description():
2222
"""Read contents from README.md."""
23-
with codecs.open(README_FILE, "rt") as buff:
23+
with open(README_FILE, encoding="utf-8") as buff:
2424
return buff.read()
2525

2626

2727
def get_version():
2828
"""Read version info from __init__.py."""
29-
lines = open(VERSION_FILE).readlines()
29+
with open(VERSION_FILE, encoding="utf-8") as buff:
30+
lines = buff.readlines()
3031
version_regex = r"^__version__ = ['\"]([^'\"]*)['\"]"
3132
for line in lines:
3233
version_search = re.search(version_regex, line, re.MULTILINE)

0 commit comments

Comments
 (0)