ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Command.Command Class Reference

Public Member Functions

 __init__ (self, driver, args, log_file)
 
 add_option_with_valid_args (self, option, attrs)
 
 add_option_with_values (self, option, values)
 
 add_noarg_option_if_valid_arg (self, option, attr)
 
 run (self)
 

Data Fields

 cmd
 
 driver
 
 args
 
 log_file
 

Detailed Description

Definition at line 20 of file Command.py.

Constructor & Destructor Documentation

◆ __init__()

Command.Command.__init__ (   self,
  driver,
  args,
  log_file 
)

Definition at line 21 of file Command.py.

21 def __init__(self, driver, args, log_file):
22 self.cmd = [driver]
23 self.driver = driver
24 self.args = args
25 self.log_file = log_file
26

Member Function Documentation

◆ add_noarg_option_if_valid_arg()

Command.Command.add_noarg_option_if_valid_arg (   self,
  option,
  attr 
)

Definition at line 46 of file Command.py.

46 def add_noarg_option_if_valid_arg(self, option, attr):
47 if oneutils.is_valid_attr(self.args, attr):
48 self.cmd.append(option)
49 return self
50

References locop::NodeDesc.args(), locop::NodeDesc.args(), Command.Command.args, Content.args, Event.args, and Command.Command.cmd.

◆ add_option_with_valid_args()

Command.Command.add_option_with_valid_args (   self,
  option,
  attrs 
)

Definition at line 29 of file Command.py.

29 def add_option_with_valid_args(self, option, attrs):
30 for attr in attrs:
31 if not oneutils.is_valid_attr(self.args, attr):
32 return self
33 self.cmd.append(option)
34 for attr in attrs:
35 self.cmd.append(getattr(self.args, attr))
36 return self
37

References locop::NodeDesc.args(), locop::NodeDesc.args(), Command.Command.args, Content.args, Event.args, and Command.Command.cmd.

◆ add_option_with_values()

Command.Command.add_option_with_values (   self,
  option,
  values 
)

Definition at line 39 of file Command.py.

39 def add_option_with_values(self, option, values):
40 self.cmd.append(option)
41 for value in values:
42 self.cmd.append(value)
43 return self
44

References Command.Command.cmd.

◆ run()

Command.Command.run (   self)

Definition at line 52 of file Command.py.

52 def run(self):
53 self.log_file.write((' '.join(self.cmd) + '\n').encode())
54 oneutils.run(self.cmd, err_prefix=self.driver, logfile=self.log_file)
void run(std::ofstream &os, const circle::Model *model)

References Command.Command.cmd, argumentparse.ArgumentParser.driver, Command.Command.driver, and Command.Command.log_file.

Field Documentation

◆ args

Command.Command.args

◆ cmd

◆ driver

Command.Command.driver

◆ log_file

Command.Command.log_file

Definition at line 25 of file Command.py.

Referenced by Command.Command.run().


The documentation for this class was generated from the following file: