Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 14, 2024
1 parent 707e325 commit aa980a5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions file_handling/read_file.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Relative path

Check failure on line 1 in file_handling/read_file.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (INP001)

file_handling/read_file.py:1:1: INP001 File `file_handling/read_file.py` is part of an implicit namespace package. Add an `__init__.py`.
def read_file():
fp = open(r'test_file.txt', 'r')
# read file
text = (fp.read())
# Closing the file after reading
fp.close()
"""
fp = open(r"test_file.txt", "r")

Check failure on line 3 in file_handling/read_file.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (UP015)

file_handling/read_file.py:3:10: UP015 Unnecessary open mode parameters

Check failure on line 3 in file_handling/read_file.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (SIM115)

file_handling/read_file.py:3:10: SIM115 Use a context manager for opening files
# read file
text = fp.read()
# Closing the file after reading
fp.close()
"""
>>> read_file()
>>> print("Hello World!")
"""
return text
return text


if __name__ == __main__:

Check failure on line 15 in file_handling/read_file.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F821)

file_handling/read_file.py:15:16: F821 Undefined name `__main__`
from doctest import testmod
testmod()
from doctest import testmod

testmod()

0 comments on commit aa980a5

Please sign in to comment.