kbasic 0.3.0__tar.gz → 0.3.1__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.3.0 → kbasic-0.3.1}/PKG-INFO +1 -1
- {kbasic-0.3.0 → kbasic-0.3.1}/pyproject.toml +1 -1
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/__init__.py +1 -1
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/vectors.py +17 -17
- {kbasic-0.3.0 → kbasic-0.3.1}/README.md +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/Tex.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/array.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/audio/__init__.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/audio/lib/Caroline Rose - year of the slug - 01 everything in its right place.wav +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/audio/lib/success.mp3 +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/audio/sound.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/bar.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/environment/Keyan.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/environment/__init__.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/environment/anvil.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/environment/defaultPC.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/parsing/__init__.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/parsing/basic.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/parsing/log.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/parsing/parser.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/parsing/toml.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/parsing/utils.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/shell.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/strings.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/typing.py +0 -0
- {kbasic-0.3.0 → kbasic-0.3.1}/src/kbasic/user_input.py +0 -0
|
@@ -28,9 +28,9 @@ def hamilton_product(q1, q2):
|
|
|
28
28
|
class VectorBase:
|
|
29
29
|
def __init__(self, *components) -> None:
|
|
30
30
|
match components[0]:
|
|
31
|
-
case
|
|
31
|
+
case Number():
|
|
32
32
|
self.components = components
|
|
33
|
-
case
|
|
33
|
+
case Array():
|
|
34
34
|
self.components = tuple(array(x) for x in components)
|
|
35
35
|
case Generator():
|
|
36
36
|
self.components = tuple(components[0])
|
|
@@ -77,15 +77,15 @@ class VectorBase:
|
|
|
77
77
|
match other:
|
|
78
78
|
case VectorBase():
|
|
79
79
|
return Vector(xs+xo for xs, xo in zip(self.components, other.components))
|
|
80
|
-
case
|
|
80
|
+
case Number():
|
|
81
81
|
return Vector(xi+other for xi in self)
|
|
82
|
-
case
|
|
82
|
+
case Array():
|
|
83
83
|
return Vector(xs+xo for xs, xo in zip(self.components, other))
|
|
84
84
|
def __sub__(self, other) -> Self:
|
|
85
85
|
match other:
|
|
86
|
-
case
|
|
86
|
+
case Number():
|
|
87
87
|
return type(self)(x-other for x in self)
|
|
88
|
-
case
|
|
88
|
+
case Array():
|
|
89
89
|
return type(self)(xs-xo for xs, xo in zip(self.components, other))
|
|
90
90
|
case VectorBase():
|
|
91
91
|
return type(self)(xs-xo for xs, xo in zip(self.components, other.components))
|
|
@@ -93,23 +93,23 @@ class VectorBase:
|
|
|
93
93
|
match other:
|
|
94
94
|
case VectorBase():
|
|
95
95
|
return sum(list(c1*c2 for c1,c2 in zip(self, other)), axis=0)
|
|
96
|
-
case
|
|
96
|
+
case Number():
|
|
97
97
|
return type(self)(c*other for c in self)
|
|
98
|
-
case
|
|
98
|
+
case Array():
|
|
99
99
|
return type(self)(c1*c2 for c1, c2 in zip(self, other))
|
|
100
100
|
def __truediv__(self, other) -> Self:
|
|
101
101
|
match other:
|
|
102
102
|
case VectorBase():
|
|
103
103
|
return Vector(c1 / c2 for c1, c2 in zip(self, other))
|
|
104
|
-
case
|
|
104
|
+
case Number():
|
|
105
105
|
return type(self)(c / other for c in self)
|
|
106
|
-
case
|
|
106
|
+
case Array():
|
|
107
107
|
return type(self)(c1 / c2 for c1, c2 in zip(self, other))
|
|
108
108
|
def __floordiv__(self, other) -> Self:
|
|
109
109
|
match other:
|
|
110
|
-
case
|
|
110
|
+
case Number():
|
|
111
111
|
return type(self)(c//other for c in self)
|
|
112
|
-
case
|
|
112
|
+
case Array():
|
|
113
113
|
return type(self)(c1//c2 for c1, c2 in zip(self, other))
|
|
114
114
|
def __radd__(self, other) -> Self:
|
|
115
115
|
match other:
|
|
@@ -125,15 +125,15 @@ class VectorBase:
|
|
|
125
125
|
case _: return self.__mul__(other)
|
|
126
126
|
def __rtruediv__(self, other) -> Self:
|
|
127
127
|
match other:
|
|
128
|
-
case
|
|
128
|
+
case Number():
|
|
129
129
|
return type(self)(other/c for c in self)
|
|
130
|
-
case
|
|
130
|
+
case Array():
|
|
131
131
|
return type(self)(c2/c1 for c1, c2 in zip(self, other))
|
|
132
132
|
def __rfloordiv__(self, other) -> Self:
|
|
133
133
|
match other:
|
|
134
|
-
case
|
|
134
|
+
case Number():
|
|
135
135
|
return type(self)(other//c for c in self)
|
|
136
|
-
case
|
|
136
|
+
case Array():
|
|
137
137
|
return type(self)(c2//c1 for c1, c2 in zip(self, other))
|
|
138
138
|
class Vector(VectorBase):
|
|
139
139
|
def __new__(cls, *components) -> Self: # the vector factory
|
|
@@ -145,7 +145,7 @@ class Vector(VectorBase):
|
|
|
145
145
|
case (Generator(),):
|
|
146
146
|
return Vector(tuple(components[0]))
|
|
147
147
|
# single array
|
|
148
|
-
case (
|
|
148
|
+
case (Array(),):
|
|
149
149
|
return Vector(*x)
|
|
150
150
|
# 2D
|
|
151
151
|
case (x, y):
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|