-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from vroncevic/dev
[gen_rpc] Updated ATS CLI mechanism, docs
- Loading branch information
Showing
39 changed files
with
421 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,15 +59,15 @@ <h1>Source code for gen_rpc</h1><div class="highlight"><pre> | |
<span class="sd">'''</span> | ||
|
||
<span class="kn">import</span> <span class="nn">sys</span> | ||
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Any</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">Dict</span> | ||
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">List</span><span class="p">,</span> <span class="n">Dict</span><span class="p">,</span> <span class="n">Optional</span> | ||
<span class="kn">from</span> <span class="nn">os.path</span> <span class="kn">import</span> <span class="n">exists</span><span class="p">,</span> <span class="n">dirname</span><span class="p">,</span> <span class="n">realpath</span> | ||
<span class="kn">from</span> <span class="nn">os</span> <span class="kn">import</span> <span class="n">getcwd</span> | ||
<span class="kn">from</span> <span class="nn">argparse</span> <span class="kn">import</span> <span class="n">Namespace</span> | ||
|
||
<span class="k">try</span><span class="p">:</span> | ||
<span class="kn">from</span> <span class="nn">ats_utilities.splash</span> <span class="kn">import</span> <span class="n">Splash</span> | ||
<span class="kn">from</span> <span class="nn">ats_utilities.logging</span> <span class="kn">import</span> <span class="n">ATSLogger</span> | ||
<span class="kn">from</span> <span class="nn">ats_utilities.cli.cfg_cli</span> <span class="kn">import</span> <span class="n">CfgCLI</span> | ||
<span class="kn">from</span> <span class="nn">ats_utilities.cli</span> <span class="kn">import</span> <span class="n">ATSCli</span> | ||
<span class="kn">from</span> <span class="nn">ats_utilities.console_io.error</span> <span class="kn">import</span> <span class="n">error_message</span> | ||
<span class="kn">from</span> <span class="nn">ats_utilities.console_io.verbose</span> <span class="kn">import</span> <span class="n">verbose_message</span> | ||
<span class="kn">from</span> <span class="nn">ats_utilities.console_io.success</span> <span class="kn">import</span> <span class="n">success_message</span> | ||
|
@@ -82,15 +82,15 @@ <h1>Source code for gen_rpc</h1><div class="highlight"><pre> | |
<span class="n">__copyright__</span> <span class="o">=</span> <span class="s1">'(C) 2024, https://vroncevic.github.io/gen_rpc'</span> | ||
<span class="n">__credits__</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'Vladimir Roncevic'</span><span class="p">,</span> <span class="s1">'Python Software Foundation'</span><span class="p">]</span> | ||
<span class="n">__license__</span> <span class="o">=</span> <span class="s1">'https://github.com/vroncevic/gen_rpc/blob/dev/LICENSE'</span> | ||
<span class="n">__version__</span> <span class="o">=</span> <span class="s1">'1.0.2'</span> | ||
<span class="n">__version__</span> <span class="o">=</span> <span class="s1">'1.0.3'</span> | ||
<span class="n">__maintainer__</span> <span class="o">=</span> <span class="s1">'Vladimir Roncevic'</span> | ||
<span class="n">__email__</span> <span class="o">=</span> <span class="s1">'[email protected]'</span> | ||
<span class="n">__status__</span> <span class="o">=</span> <span class="s1">'Updated'</span> | ||
|
||
|
||
<div class="viewcode-block" id="GenRPC"> | ||
<a class="viewcode-back" href="../gen_rpc.html#gen_rpc.GenRPC">[docs]</a> | ||
<span class="k">class</span> <span class="nc">GenRPC</span><span class="p">(</span><span class="n">CfgCLI</span><span class="p">):</span> | ||
<span class="k">class</span> <span class="nc">GenRPC</span><span class="p">(</span><span class="n">ATSCli</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">'''</span> | ||
<span class="sd"> Defines class GenRPC with attribute(s) and method(s).</span> | ||
<span class="sd"> Loads base information, creates a CLI interface, and runs operations.</span> | ||
|
@@ -138,9 +138,9 @@ <h1>Source code for gen_rpc</h1><div class="highlight"><pre> | |
<span class="n">verbose</span><span class="p">,</span> <span class="p">[</span><span class="sa">f</span><span class="s1">'</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s1"> init tool info'</span><span class="p">]</span> | ||
<span class="p">)</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">_logger</span><span class="p">:</span> <span class="n">ATSLogger</span> <span class="o">=</span> <span class="n">ATSLogger</span><span class="p">(</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">(),</span> <span class="sa">f</span><span class="s1">'</span><span class="si">{</span><span class="n">current_dir</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">_LOG</span><span class="si">}</span><span class="s1">'</span><span class="p">,</span> <span class="n">verbose</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">(),</span> <span class="kc">True</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">True</span><span class="p">,</span> <span class="n">verbose</span> | ||
<span class="p">)</span> | ||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">tool_operational</span><span class="p">:</span> | ||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_operational</span><span class="p">():</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">add_new_option</span><span class="p">(</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">_OPS</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_OPS</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">dest</span><span class="o">=</span><span class="s1">'name'</span><span class="p">,</span> | ||
<span class="n">help</span><span class="o">=</span><span class="s1">'generate project (provide name)'</span> | ||
|
@@ -164,9 +164,9 @@ <h1>Source code for gen_rpc</h1><div class="highlight"><pre> | |
<span class="sd"> :exceptions: None</span> | ||
<span class="sd"> '''</span> | ||
<span class="n">status</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> | ||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">tool_operational</span><span class="p">:</span> | ||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_operational</span><span class="p">():</span> | ||
<span class="k">try</span><span class="p">:</span> | ||
<span class="n">args</span><span class="p">:</span> <span class="n">Any</span> <span class="o">|</span> <span class="n">Namespace</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parse_args</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span> | ||
<span class="n">args</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Namespace</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parse_args</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span> | ||
<span class="k">if</span> <span class="ow">not</span> <span class="nb">bool</span><span class="p">(</span><span class="nb">getattr</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="s2">"name"</span><span class="p">)):</span> | ||
<span class="n">error_message</span><span class="p">(</span> | ||
<span class="p">[</span><span class="sa">f</span><span class="s1">'</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s1"> missing name argument'</span><span class="p">]</span> | ||
|
@@ -207,7 +207,7 @@ <h1>Source code for gen_rpc</h1><div class="highlight"><pre> | |
<span class="p">)</span> | ||
<span class="k">except</span> <span class="ne">SystemExit</span><span class="p">:</span> | ||
<span class="n">error_message</span><span class="p">(</span> | ||
<span class="p">[</span><span class="sa">f</span><span class="s1">'</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s1"> expected argument -n'</span><span class="p">]</span> | ||
<span class="p">[</span><span class="sa">f</span><span class="s1">'</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_GEN_VERBOSE</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s1"> expected argument name'</span><span class="p">]</span> | ||
<span class="p">)</span> | ||
<span class="k">return</span> <span class="n">status</span> | ||
<span class="k">else</span><span class="p">:</span> | ||
|
Oops, something went wrong.