kisstdlib 0.0.2__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/PKG-INFO +1 -1
- kisstdlib-0.0.4/kisstdlib/io/stdio.py +30 -0
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/io/wrapper.py +24 -11
- kisstdlib-0.0.4/kisstdlib/path.py +163 -0
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib.egg-info/PKG-INFO +1 -1
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib.egg-info/SOURCES.txt +1 -0
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/pyproject.toml +1 -1
- kisstdlib-0.0.2/kisstdlib/path.py +0 -98
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/README.md +0 -0
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/__init__.py +2 -2
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/argparse/__init__.py +2 -2
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/argparse/better.py +2 -2
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/exceptions.py +2 -2
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/io/__init__.py +2 -2
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/io/base.py +2 -2
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/io/encoder/__init__.py +2 -2
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/io/encoder/base.py +2 -2
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/io/encoder/pyrepr.py +2 -2
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/logging.py +2 -2
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib/py.typed +0 -0
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib.egg-info/dependency_links.txt +0 -0
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/kisstdlib.egg-info/top_level.txt +0 -0
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/setup.cfg +0 -0
- {kisstdlib-0.0.2 → kisstdlib-0.0.4}/setup.py +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright (c) 2018-2024 Jan Malakhovski <oxij@oxij.org>
|
|
2
|
+
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
|
+
#
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
# furnished to do so, subject to the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
# copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
# SOFTWARE.
|
|
22
|
+
|
|
23
|
+
import os as _os
|
|
24
|
+
import sys as _sys
|
|
25
|
+
|
|
26
|
+
from .wrapper import *
|
|
27
|
+
|
|
28
|
+
stdin = TIOWrappedReader(_os.fdopen(_sys.stdin.fileno(), "rb"))
|
|
29
|
+
stdout = TIOWrappedWriter(_os.fdopen(_sys.stdout.fileno(), "wb"))
|
|
30
|
+
stderr = TIOWrappedWriter(_os.fdopen(_sys.stderr.fileno(), "wb"))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Copyright (c) 2018-2024 Jan Malakhovski <oxij@oxij.org>
|
|
2
2
|
#
|
|
3
|
-
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
|
@@ -27,28 +27,37 @@ import typing as _t
|
|
|
27
27
|
|
|
28
28
|
from .base import *
|
|
29
29
|
|
|
30
|
+
_logger = _logging.getLogger("kisstd")
|
|
31
|
+
|
|
30
32
|
class MinimalIOWrapper(MinimalIO):
|
|
33
|
+
fobj : _t.Any
|
|
34
|
+
fileno : int | None
|
|
35
|
+
|
|
31
36
|
def __init__(self, fobj : _t.Any) -> None:
|
|
32
37
|
self.fobj = fobj
|
|
33
38
|
# _socket.socket's fileno() will return -1 after
|
|
34
39
|
# .close() and poll needs an actual value to unsubscribe
|
|
35
40
|
# properly so we have to keep a copy here
|
|
36
41
|
try:
|
|
37
|
-
self.
|
|
42
|
+
self.fileno = fobj.fileno()
|
|
38
43
|
except OSError:
|
|
39
|
-
self.
|
|
40
|
-
|
|
44
|
+
self.fileno = None
|
|
45
|
+
_logger.debug("init %s", self)
|
|
41
46
|
|
|
42
47
|
def __del__(self) -> None:
|
|
43
|
-
|
|
48
|
+
_logger.debug("del %s", self)
|
|
44
49
|
|
|
45
50
|
def __repr__(self) -> str:
|
|
46
|
-
if self.
|
|
47
|
-
desc = "fd=" + str(self.
|
|
51
|
+
if self.fileno is not None:
|
|
52
|
+
desc = "fd=" + str(self.fileno)
|
|
48
53
|
else:
|
|
49
54
|
desc = "obj=" + str(id(self.fobj))
|
|
50
55
|
return "<%s %s %s closed=%s>" % (self.__class__.__name__, hex(id(self)), desc, self.closed)
|
|
51
56
|
|
|
57
|
+
@property
|
|
58
|
+
def isatty(self) -> bool:
|
|
59
|
+
return self.fobj.isatty() # type: ignore
|
|
60
|
+
|
|
52
61
|
def close(self) -> None:
|
|
53
62
|
self.fobj.close()
|
|
54
63
|
|
|
@@ -114,6 +123,10 @@ class TIOWrappedWriter(TIOWrapper, MinimalIOWriter):
|
|
|
114
123
|
else:
|
|
115
124
|
self.write_bytes(data)
|
|
116
125
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
126
|
+
def write_ln(self, data : str | ByteString) -> None:
|
|
127
|
+
self.write(data)
|
|
128
|
+
self.write_bytes(self.eol)
|
|
129
|
+
|
|
130
|
+
def __exit__(self, exc_type : _t.Any, exc_value : _t.Any, exc_tb : _t.Any) -> None:
|
|
131
|
+
self.flush()
|
|
132
|
+
self.close()
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Copyright (c) 2018-2024 Jan Malakhovski <oxij@oxij.org>
|
|
2
|
+
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
|
+
#
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
# furnished to do so, subject to the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
# copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
# SOFTWARE.
|
|
22
|
+
|
|
23
|
+
import errno as _errno
|
|
24
|
+
import os as _os
|
|
25
|
+
import os.path as _op
|
|
26
|
+
import stat as _stat
|
|
27
|
+
import typing as _t
|
|
28
|
+
|
|
29
|
+
IncludeFilesFunc = _t.Callable[[_t.AnyStr], bool]
|
|
30
|
+
IncludeDirectoriesFunc = _t.Callable[[_t.AnyStr, bool, list[tuple[_t.AnyStr, bool]]], bool | None]
|
|
31
|
+
|
|
32
|
+
def walk_orderly(path : _t.AnyStr,
|
|
33
|
+
*,
|
|
34
|
+
include_files : bool | IncludeFilesFunc[_t.AnyStr] = True,
|
|
35
|
+
include_directories : bool | IncludeDirectoriesFunc[_t.AnyStr] = True,
|
|
36
|
+
follow_symlinks : bool = True,
|
|
37
|
+
ordering : bool | None = True,
|
|
38
|
+
handle_error : _t.Callable[..., None] | None = None,
|
|
39
|
+
path_is_file_maybe : bool = True) -> _t.Iterable[tuple[_t.AnyStr, bool]]:
|
|
40
|
+
"""Similar to os.walk, but produces an iterator over plain file paths, allows
|
|
41
|
+
non-directories as input (which will just output a single element), and
|
|
42
|
+
the output is guaranteed to be ordered if `ordering` is not `None`.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
if path_is_file_maybe:
|
|
46
|
+
try:
|
|
47
|
+
fstat = _os.stat(path, follow_symlinks = follow_symlinks)
|
|
48
|
+
except OSError as exc:
|
|
49
|
+
if handle_error is not None:
|
|
50
|
+
eno = exc.errno
|
|
51
|
+
handle_error("failed to stat `%s`: [Errno %d, %s] %s: %s", eno, _errno.errorcode.get(eno, "?"), _os.strerror(eno), path)
|
|
52
|
+
return
|
|
53
|
+
raise
|
|
54
|
+
|
|
55
|
+
if not _stat.S_ISDIR(fstat.st_mode):
|
|
56
|
+
if isinstance(include_files, bool):
|
|
57
|
+
if not include_files:
|
|
58
|
+
return
|
|
59
|
+
elif not include_files(path):
|
|
60
|
+
return
|
|
61
|
+
yield path, False
|
|
62
|
+
return
|
|
63
|
+
|
|
64
|
+
try:
|
|
65
|
+
scandir_it = _os.scandir(path)
|
|
66
|
+
except OSError as exc:
|
|
67
|
+
if handle_error is not None:
|
|
68
|
+
eno = exc.errno
|
|
69
|
+
handle_error("failed to `scandir`: [Errno %d, %s] %s: %s", eno, _errno.errorcode.get(eno, "?"), _os.strerror(eno), path)
|
|
70
|
+
return
|
|
71
|
+
raise
|
|
72
|
+
|
|
73
|
+
complete = True
|
|
74
|
+
elements : list[tuple[_t.AnyStr, bool]] = []
|
|
75
|
+
|
|
76
|
+
with scandir_it:
|
|
77
|
+
while True:
|
|
78
|
+
try:
|
|
79
|
+
entry : _os.DirEntry[_t.AnyStr] = next(scandir_it)
|
|
80
|
+
except StopIteration:
|
|
81
|
+
break
|
|
82
|
+
except OSError as exc:
|
|
83
|
+
if handle_error is not None:
|
|
84
|
+
eno = exc.errno
|
|
85
|
+
handle_error("failed in `scandir`: [Errno %d, %s] %s: %s", eno, _errno.errorcode.get(eno, "?"), _os.strerror(eno), path)
|
|
86
|
+
return
|
|
87
|
+
raise
|
|
88
|
+
else:
|
|
89
|
+
try:
|
|
90
|
+
entry_is_dir = entry.is_dir(follow_symlinks = follow_symlinks)
|
|
91
|
+
except OSError as exc:
|
|
92
|
+
if handle_error is not None:
|
|
93
|
+
eno = exc.errno
|
|
94
|
+
handle_error("failed to `stat`: [Errno %d, %s] %s: %s", eno, _errno.errorcode.get(eno, "?"), _os.strerror(eno), path)
|
|
95
|
+
# NB: skip errors here
|
|
96
|
+
complete = False
|
|
97
|
+
continue
|
|
98
|
+
raise
|
|
99
|
+
|
|
100
|
+
elements.append((entry.path, entry_is_dir))
|
|
101
|
+
|
|
102
|
+
if ordering is not None:
|
|
103
|
+
elements.sort(reverse=not ordering)
|
|
104
|
+
|
|
105
|
+
if isinstance(include_directories, bool):
|
|
106
|
+
if include_directories:
|
|
107
|
+
yield path, True
|
|
108
|
+
else:
|
|
109
|
+
inc = include_directories(path, complete, elements)
|
|
110
|
+
if inc is None:
|
|
111
|
+
return
|
|
112
|
+
elif inc:
|
|
113
|
+
yield path, True
|
|
114
|
+
|
|
115
|
+
for epath, eis_dir in elements:
|
|
116
|
+
if eis_dir:
|
|
117
|
+
yield from walk_orderly(epath,
|
|
118
|
+
include_files=include_files,
|
|
119
|
+
include_directories=include_directories,
|
|
120
|
+
follow_symlinks=follow_symlinks,
|
|
121
|
+
ordering=ordering,
|
|
122
|
+
handle_error=handle_error,
|
|
123
|
+
path_is_file_maybe=False)
|
|
124
|
+
else:
|
|
125
|
+
yield epath, False
|
|
126
|
+
|
|
127
|
+
def as_include_directories(f : IncludeFilesFunc[_t.AnyStr]) -> IncludeDirectoriesFunc[_t.AnyStr]:
|
|
128
|
+
"""`convert walk_orderly(..., include_files, ...)` filter to `include_directories` filter"""
|
|
129
|
+
def func(path : _t.AnyStr, complete : bool, elements : list[tuple[_t.AnyStr, bool]]) -> bool:
|
|
130
|
+
return f(path)
|
|
131
|
+
return func
|
|
132
|
+
|
|
133
|
+
def with_extension_in(exts : list[str | bytes] | set[str | bytes]) -> IncludeFilesFunc[_t.AnyStr]:
|
|
134
|
+
"""`walk_orderly(..., include_files, ...)` (or `include_directories`) filter that makes it only include files that have one of the given extensions"""
|
|
135
|
+
def pred(path : _t.AnyStr) -> bool:
|
|
136
|
+
_, ext = _op.splitext(path)
|
|
137
|
+
return ext in exts
|
|
138
|
+
return pred
|
|
139
|
+
|
|
140
|
+
def with_extension_not_in(exts : list[str | bytes] | set[str | bytes]) -> IncludeFilesFunc[_t.AnyStr]:
|
|
141
|
+
"""`walk_orderly(..., include_files, ...)` (or `include_directories`) filter that makes it only include files that do not have any of the given extensions"""
|
|
142
|
+
def pred(path : _t.AnyStr) -> bool:
|
|
143
|
+
_, ext = _op.splitext(path)
|
|
144
|
+
return ext not in exts
|
|
145
|
+
return pred
|
|
146
|
+
|
|
147
|
+
def not_empty_directories(path : _t.AnyStr, complete : bool, elements : list[tuple[_t.AnyStr, bool]]) -> bool:
|
|
148
|
+
"""`walk_orderly(..., include_directories, ...)` filter that makes it print only non-empty directories"""
|
|
149
|
+
if len(elements) == 0:
|
|
150
|
+
return not complete
|
|
151
|
+
return True
|
|
152
|
+
|
|
153
|
+
def leaf_directories(path : _t.AnyStr, complete : bool, elements : list[tuple[_t.AnyStr, bool]]) -> bool:
|
|
154
|
+
"""`walk_orderly(..., include_directories, ...)` filter that makes it print leaf directories only, i.e. only directories without sub-directories"""
|
|
155
|
+
if complete and all(map(lambda x: not x[1], elements)):
|
|
156
|
+
return True
|
|
157
|
+
return False
|
|
158
|
+
|
|
159
|
+
def not_empty_leaf_directories(path : _t.AnyStr, complete : bool, elements : list[tuple[_t.AnyStr, bool]]) -> bool:
|
|
160
|
+
"""`walk_orderly(..., include_directories, ...)` filter that makes it print only non-empty leaf directories, i.e. non-empty directories without sub-directories"""
|
|
161
|
+
if not_empty_directories(path, complete, elements) and leaf_directories(path, complete, elements):
|
|
162
|
+
return True
|
|
163
|
+
return False
|
|
@@ -3,7 +3,7 @@ requires = ["setuptools"]
|
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
[project]
|
|
5
5
|
name = "kisstdlib"
|
|
6
|
-
version = "0.0.
|
|
6
|
+
version = "0.0.4"
|
|
7
7
|
authors = [{ name = "Jan Malakhovski", email = "oxij@oxij.org" }]
|
|
8
8
|
description = "Keep It Simple STandarD LIBraries set for Python"
|
|
9
9
|
readme = "README.md"
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# This file is a part of kisstdlib project.
|
|
2
|
-
#
|
|
3
|
-
# Copyright (c) 2018-2023 Jan Malakhovski <oxij@oxij.org>
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
22
|
-
|
|
23
|
-
import logging as _logging
|
|
24
|
-
import os as _os
|
|
25
|
-
import stat as _stat
|
|
26
|
-
import typing as _t
|
|
27
|
-
|
|
28
|
-
def walk_orderly(path : _t.AnyStr,
|
|
29
|
-
include_directories : bool = True,
|
|
30
|
-
follow_symlinks : bool = True,
|
|
31
|
-
order_by : bool | None = True,
|
|
32
|
-
handle_error : _t.Callable[..., None] | None = _logging.error) -> _t.Iterable[_t.AnyStr]:
|
|
33
|
-
"""Similar to os.walk, but produces an iterator over plain file paths, allows
|
|
34
|
-
non-directories as input (which will just output a single element), and
|
|
35
|
-
the output is guaranteed to be ordered if `order_by` is not `None`.
|
|
36
|
-
"""
|
|
37
|
-
|
|
38
|
-
try:
|
|
39
|
-
fstat = _os.stat(path, follow_symlinks = follow_symlinks)
|
|
40
|
-
except OSError:
|
|
41
|
-
if handle_error is not None:
|
|
42
|
-
handle_error("failed to stat: %s", path)
|
|
43
|
-
return
|
|
44
|
-
raise
|
|
45
|
-
|
|
46
|
-
if not _stat.S_ISDIR(fstat.st_mode):
|
|
47
|
-
yield path
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
try:
|
|
51
|
-
scandir_it = _os.scandir(path)
|
|
52
|
-
except OSError:
|
|
53
|
-
if handle_error is not None:
|
|
54
|
-
handle_error("failed to scandir: %s", path)
|
|
55
|
-
return
|
|
56
|
-
raise
|
|
57
|
-
|
|
58
|
-
elements : list[_t.AnyStr] = []
|
|
59
|
-
|
|
60
|
-
with scandir_it:
|
|
61
|
-
while True:
|
|
62
|
-
try:
|
|
63
|
-
entry : _t.Any = next(scandir_it)
|
|
64
|
-
except StopIteration:
|
|
65
|
-
break
|
|
66
|
-
except OSError:
|
|
67
|
-
if handle_error is not None:
|
|
68
|
-
handle_error("failed in scandir: %s", path)
|
|
69
|
-
return
|
|
70
|
-
raise
|
|
71
|
-
else:
|
|
72
|
-
try:
|
|
73
|
-
is_dir = entry.is_dir(follow_symlinks = follow_symlinks)
|
|
74
|
-
except OSError:
|
|
75
|
-
if handle_error is not None:
|
|
76
|
-
handle_error("failed to stat: %s", entry.path)
|
|
77
|
-
return
|
|
78
|
-
raise
|
|
79
|
-
|
|
80
|
-
if is_dir:
|
|
81
|
-
if isinstance(entry.path, bytes):
|
|
82
|
-
elements.append(entry.path + b"/") # type: ignore
|
|
83
|
-
else:
|
|
84
|
-
elements.append(entry.path + "/")
|
|
85
|
-
else:
|
|
86
|
-
elements.append(entry.path)
|
|
87
|
-
|
|
88
|
-
if order_by is not None:
|
|
89
|
-
elements.sort(reverse=not order_by)
|
|
90
|
-
|
|
91
|
-
for path in elements:
|
|
92
|
-
lchar : _t.AnyStr = path[-1:]
|
|
93
|
-
if lchar == "/" or lchar == b"/":
|
|
94
|
-
if include_directories:
|
|
95
|
-
yield path
|
|
96
|
-
yield from walk_orderly(path, include_directories, follow_symlinks, order_by, handle_error)
|
|
97
|
-
else:
|
|
98
|
-
yield path
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# This file is a part of kisstdlib project.
|
|
2
|
-
#
|
|
3
1
|
# Copyright (c) 2018-2023 Jan Malakhovski <oxij@oxij.org>
|
|
4
2
|
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
|
+
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
|
7
7
|
# in the Software without restriction, including without limitation the rights
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# This file is a part of kisstdlib project.
|
|
2
|
-
#
|
|
3
1
|
# Copyright (c) 2023 Jan Malakhovski <oxij@oxij.org>
|
|
4
2
|
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
|
+
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
|
7
7
|
# in the Software without restriction, including without limitation the rights
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
# Copyright (c) 2022-2023 Jan Malakhovski <oxij@oxij.org>
|
|
2
|
+
#
|
|
1
3
|
# This file is a part of kisstdlib project.
|
|
2
4
|
#
|
|
3
5
|
# This file can be distributed under the terms of the MIT-style license given
|
|
4
6
|
# below or Python Software Foundation License version 2 (PSF-2.0) as published
|
|
5
7
|
# by Python Software Foundation.
|
|
6
8
|
#
|
|
7
|
-
# Copyright (c) 2022-2023 Jan Malakhovski <oxij@oxij.org>
|
|
8
|
-
#
|
|
9
9
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
10
|
# of this software and associated documentation files (the "Software"), to deal
|
|
11
11
|
# in the Software without restriction, including without limitation the rights
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# This file is a part of kisstdlib project.
|
|
2
|
-
#
|
|
3
1
|
# Copyright (c) 2023 Jan Malakhovski <oxij@oxij.org>
|
|
4
2
|
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
|
+
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
|
7
7
|
# in the Software without restriction, including without limitation the rights
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# This file is a part of kisstdlib project.
|
|
2
|
-
#
|
|
3
1
|
# Copyright (c) 2018-2023 Jan Malakhovski <oxij@oxij.org>
|
|
4
2
|
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
|
+
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
|
7
7
|
# in the Software without restriction, including without limitation the rights
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# This file is a part of kisstdlib project.
|
|
2
|
-
#
|
|
3
1
|
# Copyright (c) 2018-2023 Jan Malakhovski <oxij@oxij.org>
|
|
4
2
|
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
|
+
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
|
7
7
|
# in the Software without restriction, including without limitation the rights
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# This file is a part of kisstdlib project.
|
|
2
|
-
#
|
|
3
1
|
# Copyright (c) 2023 Jan Malakhovski <oxij@oxij.org>
|
|
4
2
|
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
|
+
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
|
7
7
|
# in the Software without restriction, including without limitation the rights
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# This file is a part of kisstdlib project.
|
|
2
|
-
#
|
|
3
1
|
# Copyright (c) 2023 Jan Malakhovski <oxij@oxij.org>
|
|
4
2
|
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
|
+
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
|
7
7
|
# in the Software without restriction, including without limitation the rights
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# This file is a part of kisstdlib project.
|
|
2
|
-
#
|
|
3
1
|
# Copyright (c) 2023 Jan Malakhovski <oxij@oxij.org>
|
|
4
2
|
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
|
+
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
|
7
7
|
# in the Software without restriction, including without limitation the rights
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# This file is a part of kisstdlib project.
|
|
2
|
-
#
|
|
3
1
|
# Copyright (c) 2023 Jan Malakhovski <oxij@oxij.org>
|
|
4
2
|
#
|
|
3
|
+
# This file is a part of kisstdlib project.
|
|
4
|
+
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
|
7
7
|
# in the Software without restriction, including without limitation the rights
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|