Skip to content

Commit

Permalink
Deployed 39ee4cf with MkDocs version: 1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jg-rp committed Oct 13, 2023
1 parent 19765d5 commit 87e13b6
Show file tree
Hide file tree
Showing 8 changed files with 255 additions and 58 deletions.
72 changes: 44 additions & 28 deletions advanced/index.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ <h4 id="jsonpath.JSONPathEnvironment--class-attributes">Class attributes</h4>
<p>
<span class="doc-attribute-annotation">
<b>TYPE:</b>
<code><span title="typing.Type">Type</span>[<span title="jsonpath.lex.Lexer">Lexer</span>]</code>
<code><span title="typing.Type">Type</span>[<a class="autorefs autorefs-internal" title="jsonpath.lex.Lexer" href="../custom_api/#jsonpath.lex.Lexer">Lexer</a>]</code>
</span>
</p>
</td>
Expand Down Expand Up @@ -4425,8 +4425,8 @@ <h3 id="jsonpath.function_extensions.filter_function.FilterFunction.arg_types" c


<span class="doc doc-labels">
<small class="doc doc-label doc-label-abstractmethod"><code>abstractmethod</code></small>
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-abstractmethod"><code>abstractmethod</code></small>
</span>

</h3>
Expand All @@ -4449,8 +4449,8 @@ <h3 id="jsonpath.function_extensions.filter_function.FilterFunction.return_type"


<span class="doc doc-labels">
<small class="doc doc-label doc-label-abstractmethod"><code>abstractmethod</code></small>
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-abstractmethod"><code>abstractmethod</code></small>
</span>

</h3>
Expand Down
194 changes: 186 additions & 8 deletions custom_api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,30 @@
</li>

<li class="md-nav__item">
<a href="#jsonpathlexlexer" class="md-nav__link">
jsonpath.lex.Lexer
<a href="#jsonpath.lex.Lexer" class="md-nav__link">
Lexer
</a>

<nav class="md-nav" aria-label="Lexer">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#jsonpath.lex.Lexer.compile_rules" class="md-nav__link">
compile_rules()
</a>

</li>

<li class="md-nav__item">
<a href="#jsonpath.lex.Lexer.tokenize" class="md-nav__link">
tokenize()
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -721,10 +741,30 @@
</li>

<li class="md-nav__item">
<a href="#jsonpathlexlexer" class="md-nav__link">
jsonpath.lex.Lexer
<a href="#jsonpath.lex.Lexer" class="md-nav__link">
Lexer
</a>

<nav class="md-nav" aria-label="Lexer">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#jsonpath.lex.Lexer.compile_rules" class="md-nav__link">
compile_rules()
</a>

</li>

<li class="md-nav__item">
<a href="#jsonpath.lex.Lexer.tokenize" class="md-nav__link">
tokenize()
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -891,7 +931,9 @@ <h3 id="jsonpath.token.Token.position" class="doc doc-heading">

</div>

</div>
</div><div class="language-text highlight"><pre><span></span><code>handler: python
</code></pre></div>


<div class="doc doc-object doc-class">

Expand Down Expand Up @@ -1079,9 +1121,145 @@ <h3 id="jsonpath.filter.FilterExpression.set_children" class="doc doc-heading">

</div>

</div><h2 id="jsonpathlexlexer">jsonpath.lex.Lexer</h2>
<p>TODO:</p>
<h2 id="jsonpathparseparser">jsonpath.parse.Parser</h2>
</div><div class="language-text highlight"><pre><span></span><code>handler: python
</code></pre></div>


<div class="doc doc-object doc-class">



<h2 id="jsonpath.lex.Lexer" class="doc doc-heading">
<span class="doc doc-object-name doc-class-name">jsonpath.lex.Lexer</span>


</h2>


<div class="doc doc-contents first">


<p>Tokenize a JSONPath string.</p>
<p>Some customization can be achieved by subclassing <em>Lexer</em> and setting
class attributes. Then setting <code>lexer_class</code> on a <code>JSONPathEnvironment</code>.</p>

<table>
<thead>
<tr>
<th><b>ATTRIBUTE</b></th>
<th><b>DESCRIPTION</b></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>key_pattern</code></td>
<td class="doc-attribute-details">
<div class="doc-md-description">
<p>The regular expression pattern used to match mapping
keys/properties.</p>
</div>
<p>
</p>
</td>
</tr>
<tr>
<td><code>logical_not_pattern</code></td>
<td class="doc-attribute-details">
<div class="doc-md-description">
<p>The regular expression pattern used to match
logical negation tokens. By default, <code>not</code> and <code>!</code> are
equivalent.</p>
</div>
<p>
</p>
</td>
</tr>
<tr>
<td><code>logical_and_pattern</code></td>
<td class="doc-attribute-details">
<div class="doc-md-description">
<p>The regular expression pattern used to match
logical <em>and</em> tokens. By default, <code>and</code> and <code>&amp;&amp;</code> are equivalent.</p>
</div>
<p>
</p>
</td>
</tr>
<tr>
<td><code>logical_or_pattern</code></td>
<td class="doc-attribute-details">
<div class="doc-md-description">
<p>The regular expression pattern used to match
logical <em>or</em> tokens. By default, <code>or</code> and <code>||</code> are equivalent.</p>
</div>
<p>
</p>
</td>
</tr>
</tbody>
</table>





<div class="doc doc-children">









<div class="doc doc-object doc-function">



<h3 id="jsonpath.lex.Lexer.compile_rules" class="doc doc-heading">
<span class="doc doc-object-name doc-function-name">compile_rules</span>


</h3>
<div class="highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="n">compile_rules</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="n">Pattern</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>
</span></code></pre></div>

<div class="doc doc-contents ">

<p>Prepare regular expression rules.</p>

</div>

</div>

<div class="doc doc-object doc-function">



<h3 id="jsonpath.lex.Lexer.tokenize" class="doc doc-heading">
<span class="doc doc-object-name doc-function-name">tokenize</span>


</h3>
<div class="highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="n">tokenize</span><span class="p">(</span><span class="n">path</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Iterator</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span>
</span></code></pre></div>

<div class="doc doc-contents ">

<p>Generate a sequence of tokens from a JSONPath string.</p>

</div>

</div>



</div>

</div>

</div><h2 id="jsonpathparseparser">jsonpath.parse.Parser</h2>
<p>TODO:</p>
<h2 id="jsonpathselectorsjsonpathselector">jsonpath.selectors.JSONPathSelector</h2>
<p>TODO:</p>
Expand Down
Binary file modified objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,57 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://jg-rp.github.io/python-jsonpath/</loc>
<lastmod>2023-10-09</lastmod>
<lastmod>2023-10-13</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://jg-rp.github.io/python-jsonpath/advanced/</loc>
<lastmod>2023-10-09</lastmod>
<lastmod>2023-10-13</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://jg-rp.github.io/python-jsonpath/api/</loc>
<lastmod>2023-10-09</lastmod>
<lastmod>2023-10-13</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://jg-rp.github.io/python-jsonpath/async/</loc>
<lastmod>2023-10-09</lastmod>
<lastmod>2023-10-13</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://jg-rp.github.io/python-jsonpath/cli/</loc>
<lastmod>2023-10-09</lastmod>
<lastmod>2023-10-13</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://jg-rp.github.io/python-jsonpath/custom_api/</loc>
<lastmod>2023-10-09</lastmod>
<lastmod>2023-10-13</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://jg-rp.github.io/python-jsonpath/exceptions/</loc>
<lastmod>2023-10-09</lastmod>
<lastmod>2023-10-13</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://jg-rp.github.io/python-jsonpath/functions/</loc>
<lastmod>2023-10-09</lastmod>
<lastmod>2023-10-13</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://jg-rp.github.io/python-jsonpath/pointers/</loc>
<lastmod>2023-10-09</lastmod>
<lastmod>2023-10-13</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://jg-rp.github.io/python-jsonpath/quickstart/</loc>
<lastmod>2023-10-09</lastmod>
<lastmod>2023-10-13</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://jg-rp.github.io/python-jsonpath/syntax/</loc>
<lastmod>2023-10-09</lastmod>
<lastmod>2023-10-13</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>
Binary file modified sitemap.xml.gz
Binary file not shown.
17 changes: 10 additions & 7 deletions syntax/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -827,30 +827,33 @@ <h3 id="recursive-descent">Recursive descent (<code>..</code>)</h3>
<div class="language-text highlight"><pre><span></span><code><span id="__span-17-1"><a id="__codelineno-17-1" name="__codelineno-17-1" href="#__codelineno-17-1"></a>$...title
</span></code></pre></div>
<h3 id="filters-expression">Filters (<code>[?EXPRESSION]</code>)</h3>
<p>Filters allow you to remove nodes from a selection using a Boolean expression. When filtering a mapping-like object, <code>#</code> references the current key/property and <code>@</code> references the current value associated with <code>#</code>. When filtering a sequence-like object, <code>@</code> references the current item and <code>#</code> will hold the item's index in the sequence.</p>
<p>Filters allow you to remove nodes from a selection using a Boolean expression. A <em>filter query</em> is a JSONPath query nested within a filter expression. Every filter query must start with the root identifier (<code>$</code>), the current node identifier (<code>@</code>) or the <a href="../advanced/#filter-variables">filter context</a> identifier (<code>_</code>).</p>
<div class="language-text highlight"><pre><span></span><code><span id="__span-18-1"><a id="__codelineno-18-1" name="__codelineno-18-1" href="#__codelineno-18-1"></a>$..products[?(@.price &lt; $.price_cap)]
</span></code></pre></div>
<div class="language-text highlight"><pre><span></span><code><span id="__span-19-1"><a id="__codelineno-19-1" name="__codelineno-19-1" href="#__codelineno-19-1"></a>$..products[[email protected] &lt; $.price_cap]
</span></code></pre></div>
<p>When filtering a mapping-like object, <code>#</code> references the current key/property and <code>@</code> references the current value associated with <code>#</code>. When filtering a sequence-like object, <code>@</code> references the current item and <code>#</code> will hold the item's index in the sequence.</p>
<p>Comparison operators include <code>==</code>, <code>!=</code>, <code>&lt;</code>, <code>&gt;</code>, <code>&lt;=</code> and <code>&gt;=</code>. Plus <code>&lt;&gt;</code> as an alias for <code>!=</code>.</p>
<p><code>in</code> and <code>contains</code> are membership operators. <code>left in right</code> is equivalent to <code>right contains left</code>.</p>
<p><code>&amp;&amp;</code> and <code>||</code> are logical operators, <code>and</code> and <code>or</code> work too.</p>
<p><code>&amp;&amp;</code> and <code>||</code> are logical operators and terms can be grouped with parentheses. <code>and</code> and <code>or</code> work too.</p>
<p><code>=~</code> matches the left value with a regular expression literal. Regular expressions use a syntax similar to that found in JavaScript, where the pattern to match is surrounded by slashes, optionally followed by flags.</p>
<div class="language-text highlight"><pre><span></span><code><span id="__span-20-1"><a id="__codelineno-20-1" name="__codelineno-20-1" href="#__codelineno-20-1"></a>$..products[?(@.description =~ /.*trainers/i)]
</span></code></pre></div>
<p>Filter expressions can call predefined <a href="../functions/">function extensions</a> too.</p>
<div class="language-text highlight"><pre><span></span><code><span id="__span-21-1"><a id="__codelineno-21-1" name="__codelineno-21-1" href="#__codelineno-21-1"></a>$.categories[?count(@.products.*) &gt;= 2]
<p>A filter query on its own - one that is not part of a comparison expression - is an existence test. We also support comparing a filter query to the special <code>undefined</code> keyword. These two example are equivalent.</p>
<div class="language-text highlight"><pre><span></span><code><span id="__span-21-1"><a id="__codelineno-21-1" name="__codelineno-21-1" href="#__codelineno-21-1"></a>$..products[[email protected]_price]
</span></code></pre></div>
<p><code>undefined</code> can be used to filter on the absence of a key/property or an undefined value returned from a filter function. <code>missing</code> is an alias for <code>undefined</code>.</p>
<div class="language-text highlight"><pre><span></span><code><span id="__span-22-1"><a id="__codelineno-22-1" name="__codelineno-22-1" href="#__codelineno-22-1"></a>$..products[[email protected]_price == undefined]
</span></code></pre></div>
<p>Filter expressions can call predefined <a href="../functions/">function extensions</a> too.</p>
<div class="language-text highlight"><pre><span></span><code><span id="__span-23-1"><a id="__codelineno-23-1" name="__codelineno-23-1" href="#__codelineno-23-1"></a>$.categories[?count(@.products.*) &gt;= 2]
</span></code></pre></div>
<h3 id="union-and-intersection">Union (<code>|</code>) and intersection (<code>&amp;</code>)</h3>
<p>Union (<code>|</code>) and intersection (<code>&amp;</code>) are similar to Python's set operations, but we don't dedupe the matches (matches will often contain unhashable objects).</p>
<p>The <code>|</code> operator combines matches from two or more paths. This example selects a single list of all prices, plus the price cap as the last element.</p>
<div class="language-text highlight"><pre><span></span><code><span id="__span-23-1"><a id="__codelineno-23-1" name="__codelineno-23-1" href="#__codelineno-23-1"></a>$..products.*.price | $.price_cap
<div class="language-text highlight"><pre><span></span><code><span id="__span-24-1"><a id="__codelineno-24-1" name="__codelineno-24-1" href="#__codelineno-24-1"></a>$..products.*.price | $.price_cap
</span></code></pre></div>
<p>The <code>&amp;</code> operator produces matches that are common to both left and right paths. This example would select the list of products that are common to both the "footwear" and "headwear" categories.</p>
<div class="language-text highlight"><pre><span></span><code><span id="__span-24-1"><a id="__codelineno-24-1" name="__codelineno-24-1" href="#__codelineno-24-1"></a>$.categories[?(@.name == &#39;footwear&#39;)].products.* &amp; $.categories[?(@.name == &#39;headwear&#39;)].products.*
<div class="language-text highlight"><pre><span></span><code><span id="__span-25-1"><a id="__codelineno-25-1" name="__codelineno-25-1" href="#__codelineno-25-1"></a>$.categories[?(@.name == &#39;footwear&#39;)].products.* &amp; $.categories[?(@.name == &#39;headwear&#39;)].products.*
</span></code></pre></div>
<p>Note that <code>|</code> and <code>&amp;</code> are not allowed inside filter expressions.</p>
<h2 id="notable-differences">Notable differences</h2>
Expand Down

0 comments on commit 87e13b6

Please sign in to comment.