kbasic 0.1.26__tar.gz → 0.1.28__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.
- {kbasic-0.1.26 → kbasic-0.1.28}/PKG-INFO +1 -1
- {kbasic-0.1.26 → kbasic-0.1.28}/pyproject.toml +1 -1
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/array.py +1 -1
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/parsing.py +16 -7
- {kbasic-0.1.26 → kbasic-0.1.28}/README.md +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/Tex.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/__init__.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/audio/__init__.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/audio/lib/Caroline Rose - year of the slug - 01 everything in its right place.wav +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/audio/lib/success.mp3 +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/audio/sound.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/bar.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/environment/Keyan.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/environment/__init__.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/environment/anvil.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/environment/defaultPC.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/shell.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/strings.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/typing.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/user_input.py +0 -0
- {kbasic-0.1.26 → kbasic-0.1.28}/src/kbasic/vectors.py +0 -0
|
@@ -35,7 +35,7 @@ def where_closest(arr:ArrayLike, value: Number) -> int | tuple[int]:
|
|
|
35
35
|
_type_: _description_
|
|
36
36
|
"""
|
|
37
37
|
arr = array(arr)
|
|
38
|
-
indices = unravel_index(argmin(absolute(arr-value)))
|
|
38
|
+
indices = unravel_index(argmin(absolute(arr-value)), arr.shape)
|
|
39
39
|
return indices if len(indices)>1 else indices[0]
|
|
40
40
|
def where_between(arr:ArrayLike, low: Number, high: Number) -> NDArray:
|
|
41
41
|
"""Find the range of indicies where arr is between low and high
|
|
@@ -22,24 +22,24 @@ unreadable_file_types: list[str] = ['.gz', '.tar', '.zip']
|
|
|
22
22
|
# >-|===|> Functions <|===|-<
|
|
23
23
|
# !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
|
|
24
24
|
def clean_path(path: str) -> str:
|
|
25
|
-
"""return an absolute,
|
|
25
|
+
"""return an absolute, normalzed, cleaned path with expanded environment
|
|
26
26
|
variables and user characters
|
|
27
27
|
|
|
28
28
|
Args:
|
|
29
|
-
path (str): input path
|
|
29
|
+
path (str): input path sting
|
|
30
30
|
|
|
31
31
|
Returns:
|
|
32
32
|
str: a path
|
|
33
33
|
"""
|
|
34
|
-
return normpath(expanduser(
|
|
35
|
-
def ensure_path(path: str) ->
|
|
36
|
-
"""make sure that a path
|
|
34
|
+
return normpath(expanduser(exandvars(path)))
|
|
35
|
+
def ensure_path(path: str) -> Non:
|
|
36
|
+
"""make sure that a path exiss
|
|
37
37
|
|
|
38
38
|
Args:
|
|
39
|
-
path (str): the path you
|
|
39
|
+
path (str): the path you ant to exist
|
|
40
40
|
"""
|
|
41
41
|
system(f"mkdir -p {path}")
|
|
42
|
-
def could_be_path(path: str) ->
|
|
42
|
+
def could_be_path(path: str) -> bol:
|
|
43
43
|
"""determine if this is anywhere close to a valid path
|
|
44
44
|
|
|
45
45
|
Args:
|
|
@@ -64,6 +64,9 @@ class File:
|
|
|
64
64
|
verbose (bool, optional): should this file be annoying. Defaults to
|
|
65
65
|
False.
|
|
66
66
|
"""
|
|
67
|
+
if type(path)==type(self):
|
|
68
|
+
self = path
|
|
69
|
+
return None
|
|
67
70
|
self.path: str = clean_path(path)
|
|
68
71
|
self.master = master if not isinstance(master, str) else File(master)
|
|
69
72
|
self.verbose = verbose
|
|
@@ -123,6 +126,9 @@ class TOML(File):
|
|
|
123
126
|
self.lines = [f"{k}={v}" for k,v in self._attrs.items()]
|
|
124
127
|
class Folder:
|
|
125
128
|
def __init__(self, path:str, master=None) -> None:
|
|
129
|
+
if type(path)==type(self):
|
|
130
|
+
self = path
|
|
131
|
+
return None
|
|
126
132
|
self.path = clean_path(path)
|
|
127
133
|
self.master = master if not isinstance(master, str) else Folder(master)
|
|
128
134
|
self.parentpath, self.name = split(self.path)
|
|
@@ -169,6 +175,9 @@ class Folder:
|
|
|
169
175
|
return None
|
|
170
176
|
rmtree(self.path)
|
|
171
177
|
|
|
178
|
+
# !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
|
|
179
|
+
# >-|===|> Functions <|===|-<
|
|
180
|
+
# !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
|
|
172
181
|
def parse(path: str | list[str]) -> Folder | File | list[Folder | File]:
|
|
173
182
|
"""take a path or list of paths and turn them into Folder or File objects as appropriate.
|
|
174
183
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|