"i did it at home"

This commit is contained in:
lda committed 2025-02-04 18:42:05 +07:00
1 parent 90e0d7638b
commit a4fac93e3b
5 files changed
+207

No files matched your search

+126
View File
@@ -0,0 +1,126 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Bungee Plotter\n",
"\n",
"i loooooove this example this example is peam\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import math\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"my undeclared var is obviously undeclared\n",
"this will print\n",
"this will also print\n",
"2 + 3 = 5\n",
"1 is not a bad number\n",
"2 is not a bad number\n",
"3 is not a bad number\n",
"5 is not a bad number\n",
"6 is not a bad number\n",
"8 is not a bad number\n",
"9 is not a bad number\n",
"BungeeTuple(t=2.0, dt=2, vt=19.6133)\n",
"hello lda!\n",
"instance: 3\n",
"class: 1\n"
]
}
],
"source": [
"# how do i import file\n",
"# shit i shot myself in the foot here, gotta consult github.com/ldlda/unipy\n",
"def 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",
" ## 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",
"\n",
"\n",
"why_so_ass()\n",
"del why_so_ass"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"38.20507559806905"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from tutorial import bungee_jumper # surefire way to make all ides scream and cry\n",
"\n",
"bungee_jumper(t=5, mass=68.1, drag_coeff=0.25)\n",
"# dir()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
+5
View File
@@ -0,0 +1,5 @@
# system solver
we getting harder
use `from math import factorial`