mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-26 01:29:10 +00:00
5fd5e32cb1
* Create python-publish.yml
* populated publish-analysis.yml
moved legacy versions of analysis to seperate subfolder
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
* attempt to fix issue with publish action
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
* another attempt o fix publish-analysis.yml
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
* this should work now
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
* pypa can't take just one package so i'm trying all
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
* this should totally work now
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
* trying removing custom dir
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
* rename analysis to tra_analysis, bump version to 2.0.0
* remove old packages which are already on github releases
* remove pycache
* removed ipynb_checkpoints
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
* build
* do the dir thing
* trying removing custom dir
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
Signed-off-by: Dev Singh <dev@devksingh.com>
* rename analysis to tra_analysis, bump version to 2.0.0
Signed-off-by: Dev Singh <dev@devksingh.com>
* remove old packages which are already on github releases
Signed-off-by: Dev Singh <dev@devksingh.com>
* remove pycache
Signed-off-by: Dev Singh <dev@devksingh.com>
* build
Signed-off-by: Dev Singh <dev@devksingh.com>
* removed ipynb_checkpoints
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
Signed-off-by: Dev Singh <dev@devksingh.com>
* do the dir thing
Signed-off-by: Dev Singh <dev@devksingh.com>
* Revert "do the dir thing"
This reverts commit 2eb7ffca8d
.
* correct dir
* set correct yaml positions
Signed-off-by: Dev Singh <dev@devksingh.com>
* attempt to set correct dir
Signed-off-by: Dev Singh <dev@devksingh.com>
* run on tags only
Signed-off-by: Dev Singh <dev@devksingh.com>
* remove all caches from vcs
Signed-off-by: Dev Singh <dev@devksingh.com>
* bump version for testing
Signed-off-by: Dev Singh <dev@devksingh.com>
* remove broke build
Signed-off-by: Dev Singh <dev@devksingh.com>
* dont upload dists to github
Signed-off-by: Dev Singh <dev@devksingh.com>
* bump to 2.0.2 for testing
Signed-off-by: Dev Singh <dev@devksingh.com>
* fix yaml
Signed-off-by: Dev Singh <dev@devksingh.com>
* update docs
Signed-off-by: Dev Singh <dev@devksingh.com>
* add to readme
Signed-off-by: Dev Singh <dev@devksingh.com>
* run only on master
Signed-off-by: Dev Singh <dev@devksingh.com>
Co-authored-by: Arthur Lu <learthurgo@gmail.com>
Co-authored-by: Dev Singh <dsingh@CentaurusRidge.localdomain>
162 lines
4.7 KiB
Plaintext
162 lines
4.7 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import re\n",
|
|
"from decimal import Decimal\n",
|
|
"from functools import reduce"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"def add(string):\n",
|
|
" while(len(re.findall(\"[+]{1}[-]?\", string)) != 0):\n",
|
|
" string = re.sub(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x + y), [Decimal(i) for i in re.split(\"[+]{1}\", re.search(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n",
|
|
" return string"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"def sub(string):\n",
|
|
" while(len(re.findall(\"\\d+[.]?\\d*[-]{1,2}\\d+[.]?\\d*\", string)) != 0):\n",
|
|
" g = re.search(\"\\d+[.]?\\d*[-]{1,2}\\d+[.]?\\d*\", string).group()\n",
|
|
" if(re.search(\"[-]{1,2}\", g).group() == \"-\"):\n",
|
|
" r = re.sub(\"[-]{1}\", \"+-\", g, 1)\n",
|
|
" string = re.sub(g, r, string, 1)\n",
|
|
" elif(re.search(\"[-]{1,2}\", g).group() == \"--\"):\n",
|
|
" r = re.sub(\"[-]{2}\", \"+\", g, 1)\n",
|
|
" string = re.sub(g, r, string, 1)\n",
|
|
" else:\n",
|
|
" pass\n",
|
|
" return string"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"def mul(string):\n",
|
|
" while(len(re.findall(\"[*]{1}[-]?\", string)) != 0):\n",
|
|
" string = re.sub(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x * y), [Decimal(i) for i in re.split(\"[*]{1}\", re.search(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n",
|
|
" return string"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"def div(string):\n",
|
|
" while(len(re.findall(\"[/]{1}[-]?\", string)) != 0):\n",
|
|
" string = re.sub(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x / y), [Decimal(i) for i in re.split(\"[/]{1}\", re.search(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n",
|
|
" return string"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"def exp(string):\n",
|
|
" while(len(re.findall(\"[\\^]{1}[-]?\", string)) != 0):\n",
|
|
" string = re.sub(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x ** y), [Decimal(i) for i in re.split(\"[\\^]{1}\", re.search(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n",
|
|
" return string"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 12,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"def evaluate(string):\n",
|
|
" string = exp(string)\n",
|
|
" string = div(string)\n",
|
|
" string = mul(string)\n",
|
|
" string = sub(string)\n",
|
|
" print(string)\n",
|
|
" string = add(string)\n",
|
|
" return string"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 13,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "error",
|
|
"ename": "SyntaxError",
|
|
"evalue": "unexpected EOF while parsing (<ipython-input-13-f9fb4aededd9>, line 1)",
|
|
"traceback": [
|
|
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-13-f9fb4aededd9>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m def parentheses(string):\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unexpected EOF while parsing\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"def parentheses(string):"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 22,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"name": "stdout",
|
|
"text": "-158456325028528675187087900672.000000+0.8\n"
|
|
},
|
|
{
|
|
"output_type": "execute_result",
|
|
"data": {
|
|
"text/plain": "'-158456325028528675187087900672.000000'"
|
|
},
|
|
"metadata": {},
|
|
"execution_count": 22
|
|
}
|
|
],
|
|
"source": [
|
|
"string = \"8^32*4/-2+0.8\"\n",
|
|
"evaluate(string)"
|
|
]
|
|
}
|
|
],
|
|
"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.7.6-final"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
} |