File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
source-code/command-line-arguments/Fire Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -10,3 +10,5 @@ applications with a command line interface.
10
10
1 . ` sayer.py ` : Illustration of grouped commands.
11
11
1 . ` cl_logger.py ` /` log_management.py ` /` log_operations.py ` : logging
12
12
from the command line example.
13
+ 1 . ` job.py ` : simple class definition to explore interacting with
14
+ objects from the CLI.
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ import fire
3
+
4
+
5
+ class Job :
6
+
7
+ _nodes : int
8
+ _ntasks : int
9
+
10
+ def __init__ (self , nodes = 1 , ntasks = 1 ):
11
+ self .nodes = nodes
12
+ self .ntasks = ntasks
13
+
14
+ @property
15
+ def nodes (self ):
16
+ return self ._nodes
17
+
18
+ @nodes .setter
19
+ def nodes (self , nodes ):
20
+ self ._nodes = nodes
21
+ return self
22
+
23
+
24
+ @property
25
+ def ntasks (self ):
26
+ return self ._ntasks
27
+
28
+ @ntasks .setter
29
+ def ntasks (self , ntasks ):
30
+ self ._ntasks = ntasks
31
+ return self
32
+
33
+ def print (self ):
34
+ return f'nodes={ self .nodes } ntasks={ self .ntasks } '
35
+
36
+ if __name__ == '__main__' :
37
+ fire .Fire (Job )
You can’t perform that action at this time.
0 commit comments