Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applied several PEP8 Styleguidelines. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions DySMo/src/Definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@

from enum import Enum


class Color(Enum):
BLACK = 1;
BLUE = 2;
CYAN = 3;
GREEN = 4;
MAGENTA = 5;
RED = 6;
YELLOW = 7;
BLACK = 1
BLUE = 2
CYAN = 3
GREEN = 4
MAGENTA = 5
RED = 6
YELLOW = 7
96 changes: 49 additions & 47 deletions DySMo/src/DySMo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,63 +20,65 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""

#Lib
import os;
import sys;
import PySimLib;
#Local
from Definitions import *;
from exceptions.ModeException import ModeException;
from Mode import Mode;
from Plots import *;
from Transition import Transition;
from VSM import VSM;
# Lib
import os
import sys
import PySimLib
# Local
from Definitions import *
from exceptions.ModeException import ModeException
from Mode import Mode
from Plots import *
from Transition import Transition
from VSM import VSM



#Functions
# Functions
def ExecPythonFile(fileName):
file = open(fileName);
content = file.read();
code = compile(content, fileName, 'exec');
exec(code);

#Functions for config script
file = open(fileName)
content = file.read()
code = compile(content, fileName, 'exec')
exec(code)

# Functions for config script


def Solver(name):
return PySimLib.FindSolver(name);

func = VSM.simulate;

#Checks
return PySimLib.FindSolver(name)


func = VSM.simulate

# Checks
if(len(sys.argv) == 1):
print("Please provide a path to a variable-structure simulatiom description file as argument.");
print("Exiting...");
exit();
print("Please provide a path to a variable-structure simulatiom description file as argument.")
print("Exiting...")
exit()

if(len(sys.argv) == 3):
if(sys.argv[2] == "clean"):
func = VSM.clean;
else:
print("You specified the following unknown argument:", sys.argv[2]);
print("Exiting...");
exit();
if(sys.argv[2] == "clean"):
func = VSM.clean
else:
print("You specified the following unknown argument:", sys.argv[2])
print("Exiting...")
exit()


#paths
configPath = os.path.abspath(sys.argv[1]);
# paths
configPath = os.path.abspath(sys.argv[1])

#instantiate model
model = VSM(configPath); #The global model instance
# instantiate model
model = VSM(configPath) # The global model instance

#execute config file
ExecPythonFile(sys.argv[1]);
# execute config file
ExecPythonFile(sys.argv[1])

#run simulation
os.chdir(model.getPath()); #switch to model path
# run simulation
os.chdir(model.getPath()) # switch to model path
try:
func(model);
func(model)
except ModeException as e:
print("ERROR: ", e);
print("See Log file for details.");
model.shutdown();
print("ERROR: ", e)
print("See Log file for details.")

model.shutdown()
Loading