Skip to content

Commit

Permalink
deploy: 252ebd8
Browse files Browse the repository at this point in the history
  • Loading branch information
dskrypa committed Dec 15, 2024
1 parent 6ed2470 commit f932560
Show file tree
Hide file tree
Showing 37 changed files with 124 additions and 87 deletions.
Binary file modified _build/api/cli_command_parser.conversion.argparse_ast.doctree
Binary file not shown.
Binary file modified _build/api/cli_command_parser.exceptions.doctree
Binary file not shown.
Binary file modified _build/api/cli_command_parser.inputs.base.doctree
Binary file not shown.
Binary file modified _build/api/cli_command_parser.inputs.files.doctree
Binary file not shown.
Binary file modified _build/api/cli_command_parser.inputs.numeric.doctree
Binary file not shown.
Binary file modified _build/api/cli_command_parser.inputs.utils.doctree
Binary file not shown.
Binary file modified _build/api/cli_command_parser.metadata.doctree
Binary file not shown.
Binary file modified _build/api/cli_command_parser.parameters.actions.doctree
Binary file not shown.
Binary file modified _build/api/cli_command_parser.parameters.base.doctree
Binary file not shown.
Binary file modified _build/api/cli_command_parser.parameters.options.doctree
Binary file not shown.
Binary file modified _build/environment.pickle
Binary file not shown.
Binary file removed _ext/__pycache__/field_list_refs.cpython-312.pyc
Binary file not shown.
Binary file added _ext/__pycache__/field_list_refs.cpython-313.pyc
Binary file not shown.
Binary file removed _ext/__pycache__/show_on_github.cpython-312.pyc
Binary file not shown.
Binary file added _ext/__pycache__/show_on_github.cpython-313.pyc
Binary file not shown.
16 changes: 8 additions & 8 deletions _modules/cli_command_parser/exceptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -1001,14 +1001,14 @@ <h1>Source code for cli_command_parser.exceptions</h1><div class="highlight"><pr
<span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</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">TYPE_CHECKING</span><span class="p">,</span> <span class="n">Any</span><span class="p">,</span> <span class="n">Optional</span><span class="p">,</span> <span class="n">Collection</span><span class="p">,</span> <span class="n">Mapping</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">TYPE_CHECKING</span><span class="p">,</span> <span class="n">Any</span><span class="p">,</span> <span class="n">Collection</span><span class="p">,</span> <span class="n">Mapping</span><span class="p">,</span> <span class="n">Optional</span>

<span class="kn">from</span> <span class="nn">.utils</span> <span class="kn">import</span> <span class="n">_parse_tree_target_repr</span>

<span class="k">if</span> <span class="n">TYPE_CHECKING</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">.parameters</span> <span class="kn">import</span> <span class="n">Parameter</span><span class="p">,</span> <span class="n">BaseOption</span>
<span class="kn">from</span> <span class="nn">.parameters</span> <span class="kn">import</span> <span class="n">BaseOption</span><span class="p">,</span> <span class="n">Parameter</span>
<span class="kn">from</span> <span class="nn">.parse_tree</span> <span class="kn">import</span> <span class="n">PosNode</span><span class="p">,</span> <span class="n">Target</span><span class="p">,</span> <span class="n">Word</span>
<span class="kn">from</span> <span class="nn">.typing</span> <span class="kn">import</span> <span class="n">ParamOrGroup</span>
<span class="kn">from</span> <span class="nn">.parse_tree</span> <span class="kn">import</span> <span class="n">PosNode</span><span class="p">,</span> <span class="n">Word</span><span class="p">,</span> <span class="n">Target</span>

<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span>
<span class="s1">&#39;CommandParserException&#39;</span><span class="p">,</span>
Expand Down Expand Up @@ -1251,13 +1251,13 @@ <h1>Source code for cli_command_parser.exceptions</h1><div class="highlight"><pr
<span class="k">class</span> <span class="nc">InvalidChoice</span><span class="p">(</span><span class="n">BadArgument</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Error raised when a value that does not match one of the pre-defined choices was provided for a Parameter&quot;&quot;&quot;</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">param</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Parameter</span><span class="p">],</span> <span class="n">invalid</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="n">choices</span><span class="p">:</span> <span class="n">Collection</span><span class="p">[</span><span class="n">Any</span><span class="p">]):</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">param</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Parameter</span><span class="p">],</span> <span class="n">invalid</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="n">choices</span><span class="p">:</span> <span class="n">Collection</span><span class="p">[</span><span class="n">Any</span><span class="p">],</span> <span class="n">env_var</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span>
<span class="n">src</span> <span class="o">=</span> <span class="sa">f</span><span class="s1">&#39; from env var=</span><span class="si">{</span><span class="n">env_var</span><span class="si">!r}</span><span class="s1">&#39;</span> <span class="k">if</span> <span class="n">env_var</span> <span class="k">else</span> <span class="s1">&#39;&#39;</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">invalid</span><span class="p">,</span> <span class="n">Collection</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">invalid</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
<span class="n">bad_str</span> <span class="o">=</span> <span class="sa">f</span><span class="s1">&#39;choices: </span><span class="si">{</span><span class="s2">&quot;, &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">repr</span><span class="p">,</span><span class="w"> </span><span class="n">invalid</span><span class="p">))</span><span class="si">}</span><span class="s1">&#39;</span>
<span class="n">bad_str</span> <span class="o">=</span> <span class="sa">f</span><span class="s1">&#39;choices</span><span class="si">{</span><span class="n">src</span><span class="si">}</span><span class="s1">: </span><span class="si">{</span><span class="s2">&quot;, &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">repr</span><span class="p">,</span><span class="w"> </span><span class="n">invalid</span><span class="p">))</span><span class="si">}</span><span class="s1">&#39;</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">bad_str</span> <span class="o">=</span> <span class="sa">f</span><span class="s1">&#39;choice: </span><span class="si">{</span><span class="n">invalid</span><span class="si">!r}</span><span class="s1">&#39;</span>
<span class="n">choices_str</span> <span class="o">=</span> <span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">repr</span><span class="p">,</span> <span class="n">choices</span><span class="p">))</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">param</span><span class="p">,</span> <span class="sa">f</span><span class="s1">&#39;invalid </span><span class="si">{</span><span class="n">bad_str</span><span class="si">}</span><span class="s1"> (choose from: </span><span class="si">{</span><span class="n">choices_str</span><span class="si">}</span><span class="s1">)&#39;</span><span class="p">)</span></div>
<span class="n">bad_str</span> <span class="o">=</span> <span class="sa">f</span><span class="s1">&#39;choice</span><span class="si">{</span><span class="n">src</span><span class="si">}</span><span class="s1">: </span><span class="si">{</span><span class="n">invalid</span><span class="si">!r}</span><span class="s1">&#39;</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">param</span><span class="p">,</span> <span class="sa">f</span><span class="s1">&#39;invalid </span><span class="si">{</span><span class="n">bad_str</span><span class="si">}</span><span class="s1"> (choose from: </span><span class="si">{</span><span class="s2">&quot;, &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">repr</span><span class="p">,</span><span class="w"> </span><span class="n">choices</span><span class="p">))</span><span class="si">}</span><span class="s1">)&#39;</span><span class="p">)</span></div>



Expand Down
6 changes: 3 additions & 3 deletions _modules/cli_command_parser/inputs/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ <h1>Source code for cli_command_parser.inputs.base</h1><div class="highlight"><p
<span class="kn">from</span> <span class="nn">abc</span> <span class="kn">import</span> <span class="n">ABC</span><span class="p">,</span> <span class="n">abstractmethod</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">Generic</span><span class="p">,</span> <span class="n">Optional</span>

<span class="kn">from</span> <span class="nn">..typing</span> <span class="kn">import</span> <span class="n">T</span><span class="p">,</span> <span class="n">Bool</span>
<span class="kn">from</span> <span class="nn">..typing</span> <span class="kn">import</span> <span class="n">Bool</span><span class="p">,</span> <span class="n">T</span>

<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;InputType&#39;</span><span class="p">]</span>

Expand All @@ -1025,11 +1025,11 @@ <h1>Source code for cli_command_parser.inputs.base</h1><div class="highlight"><p
<a class="viewcode-back" href="../../../api/cli_command_parser.inputs.base.html#cli_command_parser.inputs.base.InputType.is_valid_type">[docs]</a>
<span class="k">def</span> <span class="nf">is_valid_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span> <span class="c1"># pylint: disable=W0613</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Called during parsing when :meth:`.Parameter.would_accept` is called to determine if the value would be</span>
<span class="sd"> Called during parsing when :meth:`.ParamAction.would_accept` is called to determine if the value would be</span>
<span class="sd"> accepted later for processing / conversion via :meth:`.__call__`. May be overridden in subclasses to</span>
<span class="sd"> provide actual validation, if necessary.</span>

<span class="sd"> Not called by :meth:`.Parameter.take_action` - value validation should happen in :meth:`.__call__`</span>
<span class="sd"> Note: value validation should happen in :meth:`.__call__`, not in this method.</span>

<span class="sd"> :param value: A parsed argument</span>
<span class="sd"> :return: True if this input would accept it for processing later (where it may still be rejected), False if</span>
Expand Down
2 changes: 1 addition & 1 deletion _modules/cli_command_parser/inputs/numeric.html
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ <h1>Source code for cli_command_parser.inputs.numeric</h1><div class="highlight"
<a class="viewcode-back" href="../../../api/cli_command_parser.inputs.numeric.html#cli_command_parser.inputs.numeric.NumericInput.is_valid_type">[docs]</a>
<span class="k">def</span> <span class="nf">is_valid_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Called during parsing when :meth:`.Parameter.would_accept` is called to determine if the value would be</span>
<span class="sd"> Called during parsing when :meth:`.ParamAction.would_accept` is called to determine if the value would be</span>
<span class="sd"> accepted later for processing / conversion when called.</span>

<span class="sd"> :param value: The parsed argument to validate</span>
Expand Down
Loading

0 comments on commit f932560

Please sign in to comment.