Mercurial > hgrepos > Python > apps > py-cutils
comparison cutils/util/walk.py @ 282:d507ae4943d5
Reordering of methods: make it a little bit more consistent
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 23 Feb 2025 12:40:28 +0100 |
| parents | 16507317e834 |
| children | 99b78fa04bc1 |
comparison
equal
deleted
inserted
replaced
| 281:16507317e834 | 282:d507ae4943d5 |
|---|---|
| 98 if (b'\n' in s) or (b'\r' in s) or (b'\\' in s): | 98 if (b'\n' in s) or (b'\r' in s) or (b'\\' in s): |
| 99 return None | 99 return None |
| 100 return s | 100 return s |
| 101 | 101 |
| 102 @property | 102 @property |
| 103 def alt_fsname(self): | |
| 104 """Alternative and "escaped" filesystem name -- always bytes. | |
| 105 | |
| 106 :rtype: bytes | |
| 107 | |
| 108 """ | |
| 109 if self._alt_fsname is _notset: | |
| 110 self._alt_fsname = WalkDirEntry.alt_fs(self._name) | |
| 111 return self._alt_fsname | |
| 112 | |
| 113 @property | |
| 114 def fspath(self): | 103 def fspath(self): |
| 115 """Always bytes. | 104 """Always bytes. |
| 116 | 105 |
| 117 Also do not allow CR of LF in the path. | 106 Also do not allow CR of LF in the path. |
| 118 | 107 |
| 129 else: | 118 else: |
| 130 p = os.fsencode(self._path) | 119 p = os.fsencode(self._path) |
| 131 if (b'\n' in p) or (b'\r' in p) or (b'\\' in p): | 120 if (b'\n' in p) or (b'\r' in p) or (b'\\' in p): |
| 132 return None | 121 return None |
| 133 return p | 122 return p |
| 123 | |
| 124 @property | |
| 125 def alt_fsname(self): | |
| 126 """Alternative and "escaped" filesystem name -- always bytes. | |
| 127 | |
| 128 :rtype: bytes | |
| 129 | |
| 130 """ | |
| 131 if self._alt_fsname is _notset: | |
| 132 self._alt_fsname = WalkDirEntry.alt_fs(self._name) | |
| 133 return self._alt_fsname | |
| 134 | 134 |
| 135 @property | 135 @property |
| 136 def alt_fspath(self): | 136 def alt_fspath(self): |
| 137 """Alternative and "escaped" filesystem path -- always bytes. | 137 """Alternative and "escaped" filesystem path -- always bytes. |
| 138 | 138 |
