they call me the quitter because i quit
This commit is contained in:
1 parent
f8a01d8a61
commit
fe24efff50
3 files changed
+79
-24
No files matched your search
+48
-24
@@ -22,7 +22,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": 1,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@@ -50,33 +50,18 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"# how do i import file\n",
|
"# how do i import file\n",
|
||||||
"# shit i shot myself in the foot here, gotta consult github.com/ldlda/unipy\n",
|
"# shit i shot myself in the foot here, gotta consult github.com/ldlda/unipy\n",
|
||||||
"def why_so_ass():\n",
|
"from importutil import why_so_ass\n",
|
||||||
" # import importlib\n",
|
|
||||||
" import importlib.util\n",
|
|
||||||
" from pathlib import Path\n",
|
|
||||||
" from sys import modules\n",
|
|
||||||
"\n",
|
|
||||||
" ## name goes here\n",
|
|
||||||
" tutofile = Path(\"../../0/tutorial.py\")\n",
|
|
||||||
" tutoname = \"tutorial1\"\n",
|
|
||||||
" tutonamesys = \"tutorial\"\n",
|
|
||||||
" # over\n",
|
|
||||||
"\n",
|
|
||||||
" if not tutofile.is_file():\n",
|
|
||||||
" raise FileNotFoundError(\"where bro pointing to\")\n",
|
|
||||||
" tutofile = tutofile.resolve(True)\n",
|
|
||||||
" spec = importlib.util.spec_from_file_location(name=tutoname, location=tutofile)\n",
|
|
||||||
"\n",
|
|
||||||
" tuto = importlib.util.module_from_spec(spec)\n",
|
|
||||||
" modules[tutonamesys] = tuto # !!\n",
|
|
||||||
" spec.loader.exec_module(tuto)\n",
|
|
||||||
" ## this line right here\n",
|
" ## this line right here\n",
|
||||||
" ## why do i need it to exec EVER WHY no i dont WHYYYYY\n",
|
" ## why do i need it to exec EVER WHY no i dont WHYYYYY\n",
|
||||||
" # if i do from tutorial import bungee_jumper in tutorial2.ipynb it dont do that # oh it does\n",
|
" # if i do from tutorial import bungee_jumper in tutorial2.ipynb it dont do that # oh it does\n",
|
||||||
|
"from pathlib import Path\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
"tutofile = Path(\"../../0/tutorial.py\")\n",
|
||||||
|
"tutoname = \"tutorial1\"\n",
|
||||||
|
"tutonamesys = \"tutorial\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"why_so_ass()\n",
|
"why_so_ass(tutofile, tutoname, tutonamesys)\n",
|
||||||
"del why_so_ass"
|
"del why_so_ass, tutofile, tutoname, tutonamesys"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -134,8 +119,9 @@
|
|||||||
"x = list(range(0, 21, 2))\n",
|
"x = list(range(0, 21, 2))\n",
|
||||||
"\n",
|
"\n",
|
||||||
"y = list(bungee_jumper(t=i, mass=68.1, drag_coeff=0.25) for i in x)\n",
|
"y = list(bungee_jumper(t=i, mass=68.1, drag_coeff=0.25) for i in x)\n",
|
||||||
"g = plt.gca()\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
|
"# nawgh this shit default in matlab cmon\n",
|
||||||
|
"g = plt.gca()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"plt.axis((0, 20, 0, 60))\n",
|
"plt.axis((0, 20, 0, 60))\n",
|
||||||
"g.xaxis.set_major_locator(MultipleLocator(base=2)) # stack overflow\n",
|
"g.xaxis.set_major_locator(MultipleLocator(base=2)) # stack overflow\n",
|
||||||
@@ -147,6 +133,8 @@
|
|||||||
"g.tick_params(axis=\"both\", direction=\"in\", top=True, right=True)\n",
|
"g.tick_params(axis=\"both\", direction=\"in\", top=True, right=True)\n",
|
||||||
"g.set_facecolor(\"#d4effb\")\n",
|
"g.set_facecolor(\"#d4effb\")\n",
|
||||||
"plt.gcf().set_facecolor(\"#d4effb\")\n",
|
"plt.gcf().set_facecolor(\"#d4effb\")\n",
|
||||||
|
"# writing css in python\n",
|
||||||
|
"\n",
|
||||||
"plt.plot(x, y) # looks ugly"
|
"plt.plot(x, y) # looks ugly"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -156,6 +144,42 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"actual brainrot\n"
|
"actual brainrot\n"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 49,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"{'a4': inspect._empty, 't2t': 'aabs'}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 49,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import inspect\n",
|
||||||
|
"from functools import cache\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"@cache\n",
|
||||||
|
"def test(a, v: int, /, f, c=1, *, a4, t2t: str | None = \"aabs\"):\n",
|
||||||
|
" u, g = a, v\n",
|
||||||
|
" return u - c\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"it = inspect.signature(test)\n",
|
||||||
|
"\n",
|
||||||
|
"{\n",
|
||||||
|
" i.name: (None if isinstance(42, inspect._empty) else i.default)\n",
|
||||||
|
" for i in it.parameters.values()\n",
|
||||||
|
" if i.kind == i.KEYWORD_ONLY\n",
|
||||||
|
"}"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
"ass"
|
||||||
|
|
||||||
|
# do not tamper
|
||||||
|
import importlib.util
|
||||||
|
from pathlib import Path
|
||||||
|
from sys import modules
|
||||||
|
|
||||||
|
# oho
|
||||||
|
|
||||||
|
|
||||||
|
def why_so_ass(file: Path | str, name: str, namesys: str = None):
|
||||||
|
"""register file as module on sys.modules.
|
||||||
|
namesys is the one have dots in it its ok"""
|
||||||
|
# import importlib
|
||||||
|
if namesys is None:
|
||||||
|
namesys = name
|
||||||
|
if not file.is_file():
|
||||||
|
raise FileNotFoundError("where bro pointing to")
|
||||||
|
file = file.resolve(True)
|
||||||
|
spec = importlib.util.spec_from_file_location(name=name, location=file)
|
||||||
|
|
||||||
|
mod = importlib.util.module_from_spec(spec)
|
||||||
|
modules[namesys] = mod # !!
|
||||||
|
spec.loader.exec_module(mod)
|
||||||
@@ -1 +1,8 @@
|
|||||||
# no bro why tf does func return evaluation AND jacobian matrix WHAT EVEN IS JACOBIAN MATRIX
|
# no bro why tf does func return evaluation AND jacobian matrix WHAT EVEN IS JACOBIAN MATRIX
|
||||||
|
# delegate this to code viewer, however to solve systems we can (and has already) do a def f(tuple) -> tuple
|
||||||
|
|
||||||
|
|
||||||
|
# ok i have revised calc 2 (a thing i totally forgot) and HOW TF
|
||||||
|
# DO YOU THINK I WOULD DO A multivariable DERIVATIVE???????
|
||||||
|
# HOW?
|
||||||
|
# in the slides they say symbolically SURE import sympy DO IT THEN
|
||||||
Reference in new issue
Block a user