2
2
#
3
3
# paths.py
4
4
"""
5
- Functions for paths and files
5
+ Functions for paths and files.
6
6
"""
7
7
#
8
8
# Copyright © 2018-2020 Dominic Davis-Foster <[email protected] >
@@ -154,7 +154,7 @@ def maybe_make(directory: PathLike, mode=0o777, parents: bool = False, exist_ok:
154
154
155
155
def parent_path (path : PathLike ) -> pathlib .Path :
156
156
"""
157
- Returns the path of the parent directory for the given file or directory
157
+ Returns the path of the parent directory for the given file or directory.
158
158
159
159
:param path: Path to find the parent for
160
160
@@ -169,7 +169,7 @@ def parent_path(path: PathLike) -> pathlib.Path:
169
169
170
170
def read (filename : PathLike ) -> str :
171
171
"""
172
- Read a file in the current directory (in text mode)
172
+ Read a file in the current directory (in text mode).
173
173
174
174
.. warning::
175
175
@@ -225,7 +225,7 @@ def relpath(path: PathLike, relative_to: Optional[PathLike] = None) -> pathlib.P
225
225
226
226
def write (var : str , filename : PathLike ) -> None :
227
227
"""
228
- Write a variable to file in the current directory
228
+ Write a variable to file in the current directory.
229
229
230
230
TODO: make this the file in the given directory, by default the current directory
231
231
@@ -239,7 +239,7 @@ def write(var: str, filename: PathLike) -> None:
239
239
240
240
def clean_writer (string : str , fp : IO ) -> None :
241
241
"""
242
- Write string to ``fp`` without trailing spaces
242
+ Write string to ``fp`` without trailing spaces.
243
243
244
244
:param string:
245
245
:type string: str
@@ -256,7 +256,7 @@ def clean_writer(string: str, fp: IO) -> None:
256
256
257
257
for line in buffer :
258
258
fp .write (line )
259
- fp .write (" \n " )
259
+ fp .write (' \n ' )
260
260
261
261
262
262
def make_executable (filename : PathLike ) -> None :
0 commit comments