Skip to content

Commit ff6f0e6

Browse files
committed
Added abspath to PathPlus, and add CR, LF and TAB to words.py
1 parent ab96f34 commit ff6f0e6

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

domdf_python_tools/paths.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,17 @@ def __exit__(self, t, v, tb):
694694
# removed in the future.
695695
pass
696696

697+
def abspath(self) -> "PathPlus":
698+
"""
699+
Return the absolute version of the path.
700+
701+
:rtype:
702+
703+
.. versionadded:: 1.2.0
704+
"""
705+
706+
return self.__class__(os.path.abspath(self))
707+
697708

698709
class PosixPathPlus(PathPlus, pathlib.PurePosixPath):
699710
"""

domdf_python_tools/words.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@
6565
"alpha_sort",
6666
"as_text",
6767
"word_join",
68+
"TAB",
69+
"CR",
70+
"LF",
6871
]
6972

7073
ascii_digits = "0123456789"
@@ -537,3 +540,13 @@ def word_join(
537540
return delimiter.join(words[:-1]) + f"{delimiter}{connective} {words[-1]}"
538541
else:
539542
return delimiter.join(words[:-1]) + f" {connective} {words[-1]}"
543+
544+
545+
#: A literal ``TAB`` (``\\t``) character for use in f-strings.
546+
TAB = "\t"
547+
548+
#: The carriage return character (``\\r``) for use in f-strings.
549+
CR = "\r"
550+
551+
#: The newline character (``\\n``) for use in f-strings.
552+
LF = "\r"

0 commit comments

Comments
 (0)