예제 #1
0
파일: __init__.py 프로젝트: wxgeo/autoqcm
def test1():
    cd(dirname(__file__))
    #~ reload(generate)
    #~ reload(scan)
    id0 = 1173
    # 1173 = 1 + 4 + 16 + 128 + 1024 → ■■□■□■□□■□□■□□□□
    #
    #     ■   ■ □ ■ □ ■  □  □   ■   □   □   ■    □    □    □     □
    #   start 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384
    questions0 = ["A1","A2","B1","B2","C", "D", "E1", "E2", "E3",
                    10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
    n_answers0 = 5
    n_student0 = 27
    name = "test1"
    intro = r"""\begin{tikzpicture}[scale=0.5]
        \draw[rounded corners] (0,1) rectangle (14,-5);
        \draw[rounded corners,fill=gray!20!white] (0,-3) rectangle (14,-5);
        \draw[fill=white]  (0,0) rectangle (14,-4);
        \draw (0,0) -- (14,0) (7,0.5) node {\small\decofourleft\quad\textbf{\textsc{Interrogation Écrite n\textdegree{}3}}\quad\decofourright};
        \draw (0,0) node [below right] {\small\begin{minipage}{6cm}
                                        \begin{itemize}
                                         \item 1 bonne réponse rapporte 1 point
                                         \item 1 mauvaise réponse enlève 0,25 point
                                         \item l'absence de réponse n'enlève ni ne rajoute aucun point
                                        \end{itemize}
                                       \end{minipage}};

        \draw (0,-4) -- (14,-4) (7,-4.5) node {\small\textbf{Répondez dans le tableau ci-contre \ding{43}}};
        \end{tikzpicture}
        \hfill"""

    generate.generate_tex(filename=name, identifier=id0,
                 questions=questions0,
                 answers=n_answers0,
                 introduction=intro,
                 options={
                 (2, 3):"fill=blue!50!gray!50!white",
                 (4, 1): "fill=black",
                 (7, 2): "fill=red",
                 (19, 4):"fill=green!50!gray!50!white",
                 (19, 3):"fill=black!20!white",
                 },
                 #_n_student=n_student0,
                           )
    id1, answers, n_student1 = compile_and_scan(name)

    assert id1 == id0
    #assert n_student1 == n_student0
    assert len(questions0) == len(answers)
    assert all(n_answers0 == len(answer) for answer in answers)
    assert (array(answers).nonzero() == array(([2, 4, 7, 19, 19], [3, 1, 2, 3, 4]))).all()

    return ((id1, answers, n_student1))
예제 #2
0
파일: release.py 프로젝트: Grahack/geophar
    parser.error("fournir un (et un seul) argument (numero de version)")
version = args[0]

def version_interne(version):
    version = version.replace("alpha", "-3").replace("beta", "-2").replace("rc", "-1").replace(".", " ").replace("_", " ")
    return [int(n) for n in version.split(' ')]

def test_version(version):
    version = version.replace(' ', '_')
    reg='[0-9]+[.][0-9]+(([.][0-9]+([.][0-9]+)?)|(_(beta|alpha|rc)_[0-9]+))?$'
    if re.match(reg, version):
        return version

_module_path = os.path.split(os.path.realpath(sys._getframe().f_code.co_filename))[0]

s.cd(_module_path + '/../wxgeometrie')

sys.path.insert(0, os.getcwd())

# Option --dry-run
if options.fake:
    for nom, val in s.__dict__.items():
        if isinstance(val, types.FunctionType):
            setattr(s, nom, eval("lambda s, *args, **kw:print('@%s: ' + s)" %nom))

# Mise à jour de la version et de la date dans param.__init__.py
t=time.localtime()
date = str((t.tm_year, t.tm_mon, t.tm_mday))
contenu = []
with open('param/version.py', 'r') as f:
    for line in f:
예제 #3
0
                  "installation multi-utilisateurs.")
            sys.exit(1)
        choice = 'root'
        break
    else:
        print(u"Réponse incorrecte (tapez 'o' ou 'N').")


for loc in locations:
    locations[loc] = join(paths[choice], 'share', locations[loc])
    if not isdir(locations[loc]):
        os.makedirs(locations[loc])

# Copie des fichiers.

cd(join(_module_path, 'resources'))

cp('geophar.desktop', locations['desktop_path'])
cp('geophar.svg', locations['svg_icon_path'])
cp('geophar.png', locations['png_icon_path'])
cp('x-geophar.xml', locations['mime_path'])

cd('../..')

# Création du fichier sh.
if choice == 'root':
    exec_path = '/usr/local/bin'
else:
    exec_path = expanduser('~/bin')
    if not isdir(exec_path):
        os.mkdir(exec_path)
예제 #4
0
    parser.error("fournir un (et un seul) argument (numero de version)")
version = args[0]

def version_interne(version):
    version = version.replace("alpha", "-3").replace("beta", "-2").replace("rc", "-1").replace(".", " ").replace("_", " ")
    return [int(n) for n in version.split(' ')]

def test_version(version):
    version = version.replace(' ', '_')
    reg='[0-9]+[.][0-9]+(([.][0-9]+([.][0-9]+)?)|(_(beta|alpha|rc)_[0-9]+))?$'
    if re.match(reg, version):
        return version

_module_path = os.path.split(os.path.realpath(sys._getframe().f_code.co_filename))[0]

s.cd(_module_path + '/../wxgeometrie')

sys.path.insert(0, os.getcwd())

# Option --dry-run
if options.fake:
    for nom, val in s.__dict__.items():
        if isinstance(val, types.FunctionType):
            setattr(s, nom, eval("lambda s, *args, **kw:print('@%s: ' + s)" %nom))

# Mise à jour de la version et de la date dans param.__init__.py
t=time.localtime()
date = str((t.tm_year, t.tm_mon, t.tm_mday))
contenu = []
with open('param/version.py', 'r') as f:
    for line in f:
예제 #5
0
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA


import os, sys, time, re, types
from os.path import isfile
from optparse import OptionParser
from urllib2 import urlopen
import scriptlib as s

_module_path = os.path.split(os.path.realpath(sys._getframe().f_code.co_filename))[0]

s.cd(_module_path + '/../wxgeometrie')

parser = OptionParser(prog='release.py', usage="usage: %prog [options] release_number")
parser.add_option("-o", "--output", dest="output", default='..',
                  help="store output archive as FILE", metavar="FILE")
parser.add_option("-m", "--message", dest="message",
                  help="set release message to MSG (default: 'Version VERSION')", metavar="MSG")
parser.add_option("-n", "--dry-run",
                  action="store_true", dest="fake", default=False,
                  help="simulate only")
parser.add_option("-a", "--archive-only",
                  action="store_true", dest="archive_only", default=False,
                  help="Create an archive but DON'T make a release tag in git.\n"
                       "This is useful to make release candidates or test release process.")
parser.add_option("-p", "--publish",
                  action="store_true", dest="publish", default=False,