kbasic 0.3.16__tar.gz → 0.3.18__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.
Files changed (26) hide show
  1. {kbasic-0.3.16 → kbasic-0.3.18}/PKG-INFO +1 -1
  2. {kbasic-0.3.16 → kbasic-0.3.18}/pyproject.toml +1 -1
  3. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/parsing/basic.py +17 -20
  4. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/parsing/logging.py +1 -1
  5. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/vectors.py +13 -1
  6. {kbasic-0.3.16 → kbasic-0.3.18}/README.md +0 -0
  7. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/Tex.py +0 -0
  8. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/__init__.py +0 -0
  9. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/array.py +0 -0
  10. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/audio/__init__.py +0 -0
  11. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/audio/lib/Caroline Rose - year of the slug - 01 everything in its right place.wav +0 -0
  12. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/audio/lib/success.mp3 +0 -0
  13. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/audio/sound.py +0 -0
  14. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/bar.py +0 -0
  15. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/environment/Keyan.py +0 -0
  16. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/environment/__init__.py +0 -0
  17. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/environment/anvil.py +0 -0
  18. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/environment/defaultPC.py +0 -0
  19. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/parsing/__init__.py +0 -0
  20. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/parsing/parser.py +0 -0
  21. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/parsing/toml.py +0 -0
  22. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/parsing/utils.py +0 -0
  23. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/shell.py +0 -0
  24. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/strings.py +0 -0
  25. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/typing.py +0 -0
  26. {kbasic-0.3.16 → kbasic-0.3.18}/src/kbasic/user_input.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: kbasic
3
- Version: 0.3.16
3
+ Version: 0.3.18
4
4
  Summary: Keyan's basic utility functions.
5
5
  Author: Keyan Gootkin
6
6
  Author-email: Keyan Gootkin <keyangootkin@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "kbasic"
3
- version = "0.3.16"
3
+ version = "0.3.18"
4
4
  description = "Keyan's basic utility functions."
5
5
  readme = "README.md"
6
6
  authors = [
@@ -1,10 +1,13 @@
1
- """the bulk of kbasics path logic lives here."""
2
- # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
3
- # >-|===|> Imports <|===|-<
4
- # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
5
- from os import remove, system, walk
6
- from os.path import split, splitext, splitroot, exists, isdir, isfile, abspath, \
7
- expanduser, expandvars, basename
1
+ """
2
+ the bulk of kbasics path logic lives here. File and Folder will both work for anything that accepts
3
+ an os.PathLike argument, such as the builtin open function.
4
+ """
5
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
6
+ # >-|===|> Imports <|===|-<
7
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
8
+ from os import remove, system
9
+ from os.path import split, splitext, splitroot, exists, isdir, isfile, abspath, expanduser,\
10
+ expandvars
8
11
  from shutil import copy, move, copytree, rmtree
9
12
  from typing import Self, Optional
10
13
  from glob import glob
@@ -49,11 +52,8 @@ class File:
49
52
  self.drive, self.root, _ = splitroot(self.path)
50
53
  self.parent = Folder(parentpath)
51
54
  self.lines = []
52
- def __repr__(self) -> str:
53
- return self.path
54
- def __str__(self) -> str:
55
- if not self.loaded: self.read()
56
- return "\n".join(self.lines)
55
+ def __repr__(self) -> str: return self.path
56
+ def __str__(self) -> str: return self.path
57
57
  def __eq__(self, other) -> bool:
58
58
  if type(other) != File: return False
59
59
  return (self.path == other.path) & (self.lines == other.lines)
@@ -70,6 +70,7 @@ class File:
70
70
  def __radd__(self, other):
71
71
  if other==0: return self
72
72
  return self.__add__(other)
73
+ def __fspath__(self) -> str: return self.path
73
74
  @property
74
75
  def exists(self) -> bool:
75
76
  """_summary_
@@ -88,7 +89,8 @@ class File:
88
89
  Args:
89
90
  destination (str): _description_
90
91
  """
91
- if destination is None: destination = str(self.parent / f"{self.title}-copy{self.extension}")
92
+ if destination is None:
93
+ destination = str(self.parent / f"{self.title}-copy{self.extension}")
92
94
  copy(self.path, destination)
93
95
  return File(destination, verbose=self.verbose, master=self)
94
96
  def move(self, destination:str):
@@ -167,13 +169,7 @@ class Folder:
167
169
  self.master = master if not isinstance(master, str) else Folder(master)
168
170
  self.parentpath, self.name = split(self.path)
169
171
  def __repr__(self) -> str: return self.path
170
- def __str__(self) -> str:
171
- output = []
172
- for root, dirs, files in walk(self.path):
173
- level = root.replace(self.path, '').count('/')
174
- output.append(f'{'----'*level}{basename(root)}')
175
- for f in files: output.append(f'|{'----'*(level+1)}> {f}')
176
- return '\n'.join(output)
172
+ def __str__(self) -> str: return self.path
177
173
  def __len__(self) -> int: return len(self.children)
178
174
  def __iter__(self):
179
175
  self.index = 0
@@ -204,6 +200,7 @@ class Folder:
204
200
  def __truediv__(self, other):
205
201
  match other:
206
202
  case str(): return Path(f"{self.path}/{other}")
203
+ def __fspath__(self) -> str: return self.path
207
204
  @property
208
205
  def parent(self) -> Self:
209
206
  """summary"""
@@ -10,7 +10,7 @@ from kbasic.parsing.basic import File
10
10
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
11
11
  # >-|===|> Definitions <|===|-<
12
12
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
13
- default_format = '%(name)s : %(levelname)-8s: %(message)s'
13
+ default_format = '%(name)50s : %(levelname)-8s: %(message)s'
14
14
 
15
15
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
16
16
  # >-|===|> Functions <|===|-<
@@ -1,10 +1,12 @@
1
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
2
+ # =>> KBASIC.VECTOR <<=
3
+ # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
1
4
  """Implement vector classes for vector analysis"""
2
5
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
3
6
  # >-|===|> Imports <|===|-<
4
7
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
5
8
  from typing import Self
6
9
  from collections.abc import Generator
7
- from functools import total_ordering
8
10
  from numpy import array, cos, sin, sqrt, exp, sum
9
11
  from kbasic.typing import Number, Array
10
12
 
@@ -135,6 +137,8 @@ class VectorBase:
135
137
  return type(self)(other//c for c in self)
136
138
  case Array():
137
139
  return type(self)(c2//c1 for c1, c2 in zip(self, other))
140
+
141
+
138
142
  class Vector(VectorBase):
139
143
  def __new__(cls, *components) -> Self: # the vector factory
140
144
  match components:
@@ -161,11 +165,15 @@ class Vector(VectorBase):
161
165
  return VectorBase(*components)
162
166
  case x:
163
167
  raise TypeError(f"given components:\n{components}\nof type: {type(x)}")
168
+
169
+
164
170
  class Norm(VectorBase):
165
171
  def __init__(self, *components):
166
172
  self.components = components
167
173
  gen = (x/abs(self) for x in self)
168
174
  super().__init__(gen)
175
+
176
+
169
177
  class Quaternion(Norm):
170
178
  def __init__(self, angle, axis):
171
179
  q0 = cos(angle/2)
@@ -173,6 +181,8 @@ class Quaternion(Norm):
173
181
  self.axis *= sin(angle/2)
174
182
  self.axis *= sqrt(1-q0**2)/abs(self.axis)
175
183
  super().__init__(q0, *self.axis.components)
184
+
185
+
176
186
  class R2(VectorBase):
177
187
  def __init__(self, *components):
178
188
  super().__init__(*components)
@@ -185,6 +195,8 @@ class R2(VectorBase):
185
195
  r_rotated = r * exp(1j*angle)
186
196
  self.__init__(r_rotated.real, r_rotated.imag)
187
197
  return self
198
+
199
+
188
200
  class R3(VectorBase):
189
201
  def __init__(self, *components):
190
202
  super().__init__(*components)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes