mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Use context manager instead of plain open (#1211)
Context manager with open closes the files after usage. When the object is already a pathlib.Path i used read_text write_text functions In some cases pathlib.Path.open were used in context manager, it is basically the same as builtin open. Thanks, Konstantin Baikov!
This commit is contained in:
parent
a1bcd2fbe5
commit
8e18c79431
17 changed files with 93 additions and 63 deletions
|
|
@ -75,10 +75,8 @@ def check_permission_actions_are_documented():
|
|||
from datasette.plugins import pm
|
||||
|
||||
content = (
|
||||
(pathlib.Path(__file__).parent.parent / "docs" / "authentication.rst")
|
||||
.open()
|
||||
.read()
|
||||
)
|
||||
pathlib.Path(__file__).parent.parent / "docs" / "authentication.rst"
|
||||
).read_text()
|
||||
permissions_re = re.compile(r"\.\. _permissions_([^\s:]+):")
|
||||
documented_permission_actions = set(permissions_re.findall(content)).union(
|
||||
UNDOCUMENTED_PERMISSIONS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue