Feat: clean repository

This commit is contained in:
Bertrand Benjamin 2022-04-08 19:34:22 +02:00
parent 5f0fc8bc42
commit ce98f46bca
8 changed files with 0 additions and 367 deletions

View File

@ -1,10 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# encoding: utf-8 # encoding: utf-8
#from .bopytex import subject_metadatas, crazy_feed, pdfjoin
# ----------------------------- # -----------------------------
# Reglages pour 'vim' # Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4: # vim:set autoindent expandtab tabstop=4 shiftwidth=4:

View File

@ -1,33 +0,0 @@
#!/usr/bin/env python
# encoding: utf-8
"""
Custom filter for Bopytex
"""
__all__ = ["do_calculus"]
def do_calculus(steps, name="A", sep="=", end="", joining=" \\\\ \n"):
"""Display properly the calculus
Generate this form string:
"name & sep & a_step end joining"
:param steps: list of steps
:returns: latex string ready to be endbeded
"""
ans = joining.join([
name + " & "
+ sep + " & "
+ str(s) + end for s in steps
])
return ans
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del

View File

@ -1,38 +0,0 @@
#!/usr/bin/env python
# encoding: utf-8
from random import randint
def pythagore_triplet(v_min = 1, v_max = 10):
"""Random pythagore triplet generator
:param v_min: minimum in randint
:param v_max: max in randint
:returns: (a,b,c) such that a^2 + b^2 = c^2
"""
u = randint(v_min,v_max)
v = randint(v_min,v_max)
while v == u:
v = randint(v_min,v_max)
u, v = max(u,v), min(u,v)
return (u**2-v**2 , 2*u*v, u**2 + v**2)
if __name__ == '__main__':
print(pythagore_triplet())
for j in range(1,10):
for i in range(j,10):
print((i**2-j**2 , 2*i*j, i**2 + j**2))
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del

View File

@ -1,33 +0,0 @@
\Block{macro solveEquation(P)}
On commence par calculer le discriminant de $P(x) = \Var{P}$.
\begin{eqnarray*}
\Delta & = & b^2-4ac \\
\Var{P.delta.explain()|calculus(name="\\Delta")}
\end{eqnarray*}
\Block{if P.delta > 0}
comme $\Delta = \Var{P.delta} > 0$ donc $P$ a deux racines
\begin{eqnarray*}
x_1 & = & \frac{-b - \sqrt{\Delta}}{2a} = \frac{\Var{-P.b} - \sqrt{\Var{P.delta}}}{2 \times \Var{P.a}} = \Var{P.roots()[0] } \\
x_2 & = & \frac{-b + \sqrt{\Delta}}{2a} = \frac{\Var{-P.b} + \sqrt{\Var{P.delta}}}{2 \times \Var{P.a}} = \Var{P.roots()[1] }
\end{eqnarray*}
Les solutions de l'équation $\Var{P} = 0$ sont donc $\mathcal{S} = \left\{ \Var{P.roots()[0]}; \Var{P.roots()[1]} \right\}$
\Block{elif P.delta == 0}
Comme $\Delta = 0$ donc $P$ a une racine
\begin{eqnarray*}
x_1 = \frac{-b}{2a} = \frac{-\Var{P.b}}{2\times \Var{P.a}} = \Var{P.roots()[0]} \\
\end{eqnarray*}
La solution de $\Var{P} = 0$ est donc $\mathcal{S} = \left\{ \Var{P.roots()[0]}\right\}$
\Block{else}
Alors $\Delta = \Var{P.delta} < 0$ donc $P$ n'a pas de racine donc l'équation $\Var{P} = 0$ n'a pas de solution.
\Block{endif}
\Block{endmacro}

View File

@ -1,19 +0,0 @@
% vim:ft=tex:
%
\documentclass[12pt]{article}
\begin{document}
\section{Ajouts de fractions}
Adding two fractions
%- set e = Expression.random("{a} / {b} + {c} / {k*b}", ["b > 1", "k>1"])
\[
A = \Var{e}
\]
Solution
\[
\Var{e.simplify().explain() | join('=')}
\]
\end{document}

View File

@ -1,6 +0,0 @@
nom,classe,elo
Bob,1ST,1000
Pipo,1ST,1300
Popi,1ST,100
Boule,1ST,4000
Bill,1ST,1300
1 nom classe elo
2 Bob 1ST 1000
3 Pipo 1ST 1300
4 Popi 1ST 100
5 Boule 1ST 4000
6 Bill 1ST 1300

View File

@ -1,22 +0,0 @@
\documentclass[12pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\title{
Tests
}
\author{
Benjamin Bertrand
}
\begin{document}
\maketitle
\end{document}

View File

@ -1,212 +0,0 @@
#!/usr/bin/env python
# encoding: utf-8
import pytest
import os
from pathlib import Path
from shutil import copyfile
from bopytex.bopytex import produce_and_compile, subject_metadatas
SNIPPETS_PATH = Path("snippets/")
TEST_PATH = Path("test")
TEST_TEMPLATE_PATH = TEST_PATH / "templates/"
@pytest.fixture
def prepare_test_template(tmp_path):
""" Create a tmp directory, copy snippets inside
return tmp directory name
"""
tmp = tmp_path
snippets = TEST_TEMPLATE_PATH.glob("tpl_*.tex")
for s in snippets:
copyfile(s, tmp / s.name)
csvs = TEST_PATH.glob("*.csv")
for s in csvs:
copyfile(s, tmp / s.name)
prev_dir = Path.cwd()
os.chdir(tmp)
yield tmp
os.chdir(prev_dir)
@pytest.fixture
def prepare_snippets(tmp_path):
""" Create a tmp directory, copy snippets inside
return tmp directory name
"""
tmp = tmp_path
snippets = SNIPPETS_PATH.glob("tpl_*.tex")
for s in snippets:
copyfile(s, tmp / s.name)
prev_dir = Path.cwd()
os.chdir(tmp)
yield tmp
os.chdir(prev_dir)
def test_produce_and_compile_base(prepare_test_template):
test_tpl = list(Path(".").glob("tpl_*.tex"))
assert [tpl.name for tpl in test_tpl] == ["tpl_test.tex"]
for tpl in test_tpl:
produce_and_compile(
{
"template": tpl,
"working_dir": None,
"only_corr": False,
"students_csv": None,
"number_subjects": 1,
"dirty": False,
"no_compile": False,
"no_join": False,
"corr": False,
"crazy": False,
}
)
def test_produce_and_compile_csv(prepare_test_template):
test_tpl = Path(".").glob("tpl_*.tex")
for tpl in test_tpl:
options = {
"template": tpl,
"working_dir": None,
"only_corr": False,
"students_csv": "students.csv",
"number_subjects": 1,
"dirty": False,
"no_compile": False,
"no_join": False,
"corr": False,
"crazy": False,
}
# produce_and_compile(options)
def test_metadatas(prepare_test_template):
test_tpl = Path(".").glob("tpl_*.tex")
for tpl in test_tpl:
options = {
"template": tpl,
"working_dir": None,
"only_corr": False,
"students_csv": "students.csv",
"number_subjects": 1,
"dirty": False,
"no_compile": False,
"no_join": False,
"corr": False,
"crazy": False,
}
metadatas = subject_metadatas(options)
meta = [
{
"num": "01",
"nom": "Bob",
"classe": "1ST",
"elo": "1000",
"texfile": "01_test.tex",
"template": "tpl_test.tex",
"directory": ".",
},
{
"num": "02",
"nom": "Pipo",
"classe": "1ST",
"elo": "1300",
"texfile": "02_test.tex",
"template": "tpl_test.tex",
"directory": ".",
},
{
"num": "03",
"nom": "Popi",
"classe": "1ST",
"elo": "100",
"texfile": "03_test.tex",
"template": "tpl_test.tex",
"directory": ".",
},
{
"num": "04",
"nom": "Boule",
"classe": "1ST",
"elo": "4000",
"texfile": "04_test.tex",
"template": "tpl_test.tex",
"directory": ".",
},
{
"num": "05",
"nom": "Bill",
"classe": "1ST",
"elo": "1300",
"texfile": "05_test.tex",
"template": "tpl_test.tex",
"directory": ".",
},
]
assert metadatas == meta
def test_pdfjoin_current_directory(prepare_test_template):
wdir = prepare_test_template
pass
def test_pdfjoin_deep_directory():
pass
def test_pdfjoin_dont_remove():
pass
def test_subject_names():
pass
def test_feed_texfiles():
pass
def test_tex2pdf_current_directory():
pass
def test_tex2pdf_deep_directory():
pass
def test_activate_solution():
pass
# def test_snippets(prepare_snippets):
# snippets = list(Path(".").glob("tpl_*.tex"))
# for tpl in snippets:
# produce_and_compile(
# {
# "template": tpl,
# "working_dir": None,
# "only_corr": False,
# "students_csv": None,
# "number_subjects": 1,
# "dirty": False,
# "no_compile": False,
# "no_join": False,
# "corr": False,
# "crazy": False,
# }
# )
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del