mirror of
https://forge.apps.education.fr/blender-edutech/ropy.git
synced 2024-01-27 08:23:20 +01:00
Vérification du script rp_cmd.py avec pylint
This commit is contained in:
parent
4a7efd400f
commit
e081e5225d
BIN
ropy-31.blend
BIN
ropy-31.blend
Binary file not shown.
26
rp.py
26
rp.py
@ -10,15 +10,13 @@ import os
|
||||
import webbrowser # Lien internet
|
||||
import threading # Multithreading
|
||||
import xml.etree.ElementTree as ET # Creating/parsing XML file
|
||||
import runpy # Execution de script Python légère (sans import)
|
||||
import ast # Parser de code Python
|
||||
from pylint import epylint as lint # Controle de code Python
|
||||
import runpy # Exécution de script Python légère (sans import)
|
||||
from pylint import epylint as lint # Mesure de la qualité d'un code Python
|
||||
|
||||
import rp_map1 as rp_map # Map definition
|
||||
import rp_doc # Documentation
|
||||
import rp_store # Store
|
||||
import rp_about # About
|
||||
# import ct_cmd # user script (commands)
|
||||
|
||||
###############################################################################
|
||||
# rp.py
|
||||
@ -45,11 +43,6 @@ scene.objects['Commands']['debug_fps']=False
|
||||
# Memory
|
||||
sys.setrecursionlimit(10**5) # Limite sur la récursivité (valeur par défaut : 1000) -> segfault de Blender
|
||||
|
||||
# Dynamic import user file
|
||||
# importlib.invalidate_caches()
|
||||
# ct_map = importlib.import_module('ct_map1') # Waves script
|
||||
# ct_cmd = importlib.import_module('ct_cmd') # User script (commands) -> segfault de Blender
|
||||
|
||||
# UPBGE scene
|
||||
eevee = bpy.context.scene.eevee
|
||||
fps_time=0.0
|
||||
@ -221,15 +214,14 @@ def terrain_init (cont):
|
||||
##
|
||||
|
||||
def python_validation():
|
||||
lint.py_run('rp_cmd.py --disable=C --disable=W --disable=R')
|
||||
with open('rp_cmd.py') as f:
|
||||
contents = f.read()
|
||||
try:
|
||||
ast.parse(contents)
|
||||
# or compile(contents, fname, 'exec', ast.PyCF_ONLY_AST)
|
||||
return True
|
||||
except SyntaxError:
|
||||
(pylint_stdout, pylint_stderr) = lint.py_run('rp_cmd.py --disable=C --disable=W --disable=R', return_std=True)
|
||||
stdout = pylint_stdout.read()
|
||||
stderr = pylint_stderr.read()
|
||||
if " error (" in stdout: # Présence d'erreur
|
||||
print(stdout)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def terrain_run ():
|
||||
|
||||
|
46
rp_cmd.py
46
rp_cmd.py
@ -28,49 +28,23 @@ from rp_lib import * # Bibliothèque Ropy
|
||||
def commandes():
|
||||
|
||||
# Ecrire votre code ici ...
|
||||
print ('okok')
|
||||
rp_gauche()
|
||||
rp_avancer()
|
||||
rp_avancer()
|
||||
rp_droite()
|
||||
for i in range (10):
|
||||
rp_avancer()
|
||||
rp_marquer()
|
||||
|
||||
rp_fin() # A garder
|
||||
|
||||
###############################################################################
|
||||
# En: Externals calls << DONT CHANGE THIS SECTION >>
|
||||
# Fr: Appels externes << NE PAS MODIFIER CETTE SECTION >>
|
||||
# En: External call << DONT CHANGE THIS SECTION >>
|
||||
# Fr: Appel externe << NE PAS MODIFIER CETTE SECTION >>
|
||||
###############################################################################
|
||||
|
||||
if __name__=='start':
|
||||
thread_cmd_start(commandes)
|
||||
if __name__=='stop':
|
||||
thread_cmd_stop()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user