Skip to content

Commit

Permalink
Reduced extra depth of headings in regex
Browse files Browse the repository at this point in the history
  • Loading branch information
vdsukhov committed Sep 19, 2024
1 parent 4cfe52c commit c05357c
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 68 deletions.
20 changes: 9 additions & 11 deletions _sources/chapters/regex.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"id": "bdda5240-1266-43dc-8794-160f713adaed",
"metadata": {},
"source": [
"#### regex approach\n",
"#### Regex approach\n",
"\n",
"Python has a special module called `re` that can be used to work with regular expressions."
]
Expand Down Expand Up @@ -681,11 +681,11 @@
"\n",
"A capturing group is created by placing the desired pattern inside parentheses `()`.\n",
"\n",
"#### Basic Syntax\n",
"**Basic Syntax**\n",
"\n",
"- **Pattern**: `(subpattern)`\n",
"- Pattern: `(subpattern)`\n",
"\n",
"#### Examples\n",
"**Examples**\n",
"\n",
"- **Pattern**: `(cat)`\n",
" - Matches and captures the exact string `\"cat\"`.\n",
Expand All @@ -694,15 +694,14 @@
" - Captures three groups of digits in a Social Security number format.\n",
"\n",
"\n",
"#### Groups Numbering\n",
"Groups are automatically numbered based on the order of their opening parentheses `(` from left to right.\n",
"**Groups Numbering.** Groups are automatically numbered based on the order of their opening parentheses `(` from left to right.\n",
"\n",
"- **Group 0**: The entire match.\n",
"- **Group 1**: The first capturing group.\n",
"- **Group 2**: The second capturing group.\n",
"- **And so on...**\n",
"\n",
"#### Implementation"
"**Implementation**"
]
},
{
Expand Down Expand Up @@ -744,11 +743,10 @@
"\n",
"Named groups assign a name to a group, making your regex more readable and the code easier to maintain.\n",
"\n",
"#### Syntax\n",
"\n",
"- **Pattern**: `(?P<name>subpattern)`\n",
"**Syntax**\n",
"- Pattern: `(?P<name>subpattern)`\n",
"\n",
"#### Example"
"**Example**"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion chapters/functional_programming.html
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ <h4>Examples of Common Use Cases<a class="headerlink" href="#examples-of-common-
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Finished sleeping
slow_function took 0.5004 seconds to execute.
slow_function took 0.5003 seconds to execute.
</pre></div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions chapters/lists_and_tuples.html
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,9 @@ <h3><code class="docutils literal notranslate"><span class="pre">list</span></co
</summary>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Ids after numbers_2 = numbers_1
140707577746752 140707577746752
139714782779584 139714782779584
Ids after numbers_2 = numbers_1[::]
140707577746752 140707577804928
139714782779584 139714782784192
</pre></div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions chapters/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ <h3><code class="docutils literal notranslate"><span class="pre">datetime</span>
<span class="expanded">Hide code cell output</span>
</summary>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2024-09-19 14:16:30.550518
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2024-09-19 14:33:42.696814
</pre></div>
</div>
</div>
Expand All @@ -1130,7 +1130,7 @@ <h3><code class="docutils literal notranslate"><span class="pre">datetime</span>
<span class="expanded">Hide code cell output</span>
</summary>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2024-09-19 14:16:30
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2024-09-19 14:33:42
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -1178,7 +1178,7 @@ <h3><code class="docutils literal notranslate"><span class="pre">datetime</span>
<span class="expanded">Hide code cell output</span>
</summary>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2024-09-12 14:16:30.564862
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2024-09-12 14:33:42.709877
</pre></div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions chapters/oop1.html
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ <h3>Interaction with namespaces<a class="headerlink" href="#interaction-with-nam
<span class="expanded">Hide code cell output</span>
</summary>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>{&#39;__name__&#39;: &#39;__main__&#39;, &#39;__doc__&#39;: &#39;Automatically created module for IPython interactive environment&#39;, &#39;__package__&#39;: None, &#39;__loader__&#39;: None, &#39;__spec__&#39;: None, &#39;__builtin__&#39;: &lt;module &#39;builtins&#39; (built-in)&gt;, &#39;__builtins__&#39;: &lt;module &#39;builtins&#39; (built-in)&gt;, &#39;_ih&#39;: [&#39;&#39;, &#39;def local_scope_example():\n local_variable = &quot;I am local&quot;\n print(local_variable)\n\nlocal_scope_example()\n# This line would raise an error as local_variable is not accessible here.\n# print(local_variable)&#39;, &#39;def outer_function():\n outer_variable = &quot;I am in the outer function&quot;\n\n def inner_function():\n inner_variable = &quot;I am in the inner function&quot;\n print(outer_variable)\n print(inner_variable)\n\n inner_function()\n\nouter_function()&#39;, &#39;global_variable = &quot;I am global&quot;\n\ndef global_scope_example():\n print(global_variable)\n\nglobal_scope_example()\nprint(global_variable)&#39;, &#39;global_variable = &quot;I am global&quot;\n\ndef check_globals():\n print(globals())\n\ncheck_globals()&#39;], &#39;_oh&#39;: {}, &#39;_dh&#39;: [PosixPath(&#39;/home/vdsukhov/gitrepos/github/python-intro-course/chapters&#39;)], &#39;In&#39;: [&#39;&#39;, &#39;def local_scope_example():\n local_variable = &quot;I am local&quot;\n print(local_variable)\n\nlocal_scope_example()\n# This line would raise an error as local_variable is not accessible here.\n# print(local_variable)&#39;, &#39;def outer_function():\n outer_variable = &quot;I am in the outer function&quot;\n\n def inner_function():\n inner_variable = &quot;I am in the inner function&quot;\n print(outer_variable)\n print(inner_variable)\n\n inner_function()\n\nouter_function()&#39;, &#39;global_variable = &quot;I am global&quot;\n\ndef global_scope_example():\n print(global_variable)\n\nglobal_scope_example()\nprint(global_variable)&#39;, &#39;global_variable = &quot;I am global&quot;\n\ndef check_globals():\n print(globals())\n\ncheck_globals()&#39;], &#39;Out&#39;: {}, &#39;get_ipython&#39;: &lt;bound method InteractiveShell.get_ipython of &lt;ipykernel.zmqshell.ZMQInteractiveShell object at 0x7f116bc28050&gt;&gt;, &#39;exit&#39;: &lt;IPython.core.autocall.ZMQExitAutocall object at 0x7f116bfdb0e0&gt;, &#39;quit&#39;: &lt;IPython.core.autocall.ZMQExitAutocall object at 0x7f116bfdb0e0&gt;, &#39;open&#39;: &lt;function open at 0x7f118d5ade40&gt;, &#39;_&#39;: &#39;&#39;, &#39;__&#39;: &#39;&#39;, &#39;___&#39;: &#39;&#39;, &#39;_i&#39;: &#39;global_variable = &quot;I am global&quot;\n\ndef global_scope_example():\n print(global_variable)\n\nglobal_scope_example()\nprint(global_variable)&#39;, &#39;_ii&#39;: &#39;def outer_function():\n outer_variable = &quot;I am in the outer function&quot;\n\n def inner_function():\n inner_variable = &quot;I am in the inner function&quot;\n print(outer_variable)\n print(inner_variable)\n\n inner_function()\n\nouter_function()&#39;, &#39;_iii&#39;: &#39;def local_scope_example():\n local_variable = &quot;I am local&quot;\n print(local_variable)\n\nlocal_scope_example()\n# This line would raise an error as local_variable is not accessible here.\n# print(local_variable)&#39;, &#39;_i1&#39;: &#39;def local_scope_example():\n local_variable = &quot;I am local&quot;\n print(local_variable)\n\nlocal_scope_example()\n# This line would raise an error as local_variable is not accessible here.\n# print(local_variable)&#39;, &#39;local_scope_example&#39;: &lt;function local_scope_example at 0x7f116bc32b60&gt;, &#39;_i2&#39;: &#39;def outer_function():\n outer_variable = &quot;I am in the outer function&quot;\n\n def inner_function():\n inner_variable = &quot;I am in the inner function&quot;\n print(outer_variable)\n print(inner_variable)\n\n inner_function()\n\nouter_function()&#39;, &#39;outer_function&#39;: &lt;function outer_function at 0x7f116bc33920&gt;, &#39;_i3&#39;: &#39;global_variable = &quot;I am global&quot;\n\ndef global_scope_example():\n print(global_variable)\n\nglobal_scope_example()\nprint(global_variable)&#39;, &#39;global_variable&#39;: &#39;I am global&#39;, &#39;global_scope_example&#39;: &lt;function global_scope_example at 0x7f116bc33600&gt;, &#39;_i4&#39;: &#39;global_variable = &quot;I am global&quot;\n\ndef check_globals():\n print(globals())\n\ncheck_globals()&#39;, &#39;check_globals&#39;: &lt;function check_globals at 0x7f116bc337e0&gt;}
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>{&#39;__name__&#39;: &#39;__main__&#39;, &#39;__doc__&#39;: &#39;Automatically created module for IPython interactive environment&#39;, &#39;__package__&#39;: None, &#39;__loader__&#39;: None, &#39;__spec__&#39;: None, &#39;__builtin__&#39;: &lt;module &#39;builtins&#39; (built-in)&gt;, &#39;__builtins__&#39;: &lt;module &#39;builtins&#39; (built-in)&gt;, &#39;_ih&#39;: [&#39;&#39;, &#39;def local_scope_example():\n local_variable = &quot;I am local&quot;\n print(local_variable)\n\nlocal_scope_example()\n# This line would raise an error as local_variable is not accessible here.\n# print(local_variable)&#39;, &#39;def outer_function():\n outer_variable = &quot;I am in the outer function&quot;\n\n def inner_function():\n inner_variable = &quot;I am in the inner function&quot;\n print(outer_variable)\n print(inner_variable)\n\n inner_function()\n\nouter_function()&#39;, &#39;global_variable = &quot;I am global&quot;\n\ndef global_scope_example():\n print(global_variable)\n\nglobal_scope_example()\nprint(global_variable)&#39;, &#39;global_variable = &quot;I am global&quot;\n\ndef check_globals():\n print(globals())\n\ncheck_globals()&#39;], &#39;_oh&#39;: {}, &#39;_dh&#39;: [PosixPath(&#39;/home/vdsukhov/gitrepos/github/python-intro-course/chapters&#39;)], &#39;In&#39;: [&#39;&#39;, &#39;def local_scope_example():\n local_variable = &quot;I am local&quot;\n print(local_variable)\n\nlocal_scope_example()\n# This line would raise an error as local_variable is not accessible here.\n# print(local_variable)&#39;, &#39;def outer_function():\n outer_variable = &quot;I am in the outer function&quot;\n\n def inner_function():\n inner_variable = &quot;I am in the inner function&quot;\n print(outer_variable)\n print(inner_variable)\n\n inner_function()\n\nouter_function()&#39;, &#39;global_variable = &quot;I am global&quot;\n\ndef global_scope_example():\n print(global_variable)\n\nglobal_scope_example()\nprint(global_variable)&#39;, &#39;global_variable = &quot;I am global&quot;\n\ndef check_globals():\n print(globals())\n\ncheck_globals()&#39;], &#39;Out&#39;: {}, &#39;get_ipython&#39;: &lt;bound method InteractiveShell.get_ipython of &lt;ipykernel.zmqshell.ZMQInteractiveShell object at 0x7f2ea85300e0&gt;&gt;, &#39;exit&#39;: &lt;IPython.core.autocall.ZMQExitAutocall object at 0x7f2ea8530620&gt;, &#39;quit&#39;: &lt;IPython.core.autocall.ZMQExitAutocall object at 0x7f2ea8530620&gt;, &#39;open&#39;: &lt;function open at 0x7f2eb1e5de40&gt;, &#39;_&#39;: &#39;&#39;, &#39;__&#39;: &#39;&#39;, &#39;___&#39;: &#39;&#39;, &#39;_i&#39;: &#39;global_variable = &quot;I am global&quot;\n\ndef global_scope_example():\n print(global_variable)\n\nglobal_scope_example()\nprint(global_variable)&#39;, &#39;_ii&#39;: &#39;def outer_function():\n outer_variable = &quot;I am in the outer function&quot;\n\n def inner_function():\n inner_variable = &quot;I am in the inner function&quot;\n print(outer_variable)\n print(inner_variable)\n\n inner_function()\n\nouter_function()&#39;, &#39;_iii&#39;: &#39;def local_scope_example():\n local_variable = &quot;I am local&quot;\n print(local_variable)\n\nlocal_scope_example()\n# This line would raise an error as local_variable is not accessible here.\n# print(local_variable)&#39;, &#39;_i1&#39;: &#39;def local_scope_example():\n local_variable = &quot;I am local&quot;\n print(local_variable)\n\nlocal_scope_example()\n# This line would raise an error as local_variable is not accessible here.\n# print(local_variable)&#39;, &#39;local_scope_example&#39;: &lt;function local_scope_example at 0x7f2ea852ef20&gt;, &#39;_i2&#39;: &#39;def outer_function():\n outer_variable = &quot;I am in the outer function&quot;\n\n def inner_function():\n inner_variable = &quot;I am in the inner function&quot;\n print(outer_variable)\n print(inner_variable)\n\n inner_function()\n\nouter_function()&#39;, &#39;outer_function&#39;: &lt;function outer_function at 0x7f2ea852f920&gt;, &#39;_i3&#39;: &#39;global_variable = &quot;I am global&quot;\n\ndef global_scope_example():\n print(global_variable)\n\nglobal_scope_example()\nprint(global_variable)&#39;, &#39;global_variable&#39;: &#39;I am global&#39;, &#39;global_scope_example&#39;: &lt;function global_scope_example at 0x7f2ea852f6a0&gt;, &#39;_i4&#39;: &#39;global_variable = &quot;I am global&quot;\n\ndef check_globals():\n print(globals())\n\ncheck_globals()&#39;, &#39;check_globals&#39;: &lt;function check_globals at 0x7f2ea852fb00&gt;}
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -883,7 +883,7 @@ <h3>Magic methods<a class="headerlink" href="#magic-methods" title="Link to this
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;__main__.Car object at 0x7f116bc6b170&gt;, &lt;__main__.Car object at 0x7f116bc69e50&gt;, &lt;__main__.Car object at 0x7f116bc69b50&gt;]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;__main__.Car object at 0x7f2ea85630e0&gt;, &lt;__main__.Car object at 0x7f2ea8562840&gt;, &lt;__main__.Car object at 0x7f2ea85322d0&gt;]
</pre></div>
</div>
</div>
Expand Down
Loading

0 comments on commit c05357c

Please sign in to comment.