Add BuiltinScope (#469)

* Add more builtin tests

* Introduce a BuiltinScope that sits above GlobalScope

* Address comments and fix lint

* Updating documentation

* Update scope illustration

* Add BuiltinScope to libcst.metadata

* Lazily create builtin assignments, update scope diagram
This commit is contained in:
Luke Petre 2021-03-24 19:12:56 +00:00 committed by GitHub
parent 0ee0831eb6
commit 4ab866e40f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 584 additions and 263 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Before After
Before After

View file

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
@ -9,29 +7,25 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="132.62682mm"
height="103.25121mm"
viewBox="0 0 132.62682 103.2512"
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg8"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="python-scopes.svg"
inkscape:export-filename="/home/bgw/Documents/lint-docs-pycon/python-scopes.png"
inkscape:export-xdpi="200.09"
inkscape:export-ydpi="200.09"
enable-background="new">
inkscape:version="1.0.2 (e86c8708, 2021-01-15)"
sodipodi:docname="drawing.svg"
inkscape:export-filename="/Users/lpetre/Desktop/rect846-0.png"
inkscape:export-xdpi="191.53999"
inkscape:export-ydpi="191.53999">
<defs
id="defs2">
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter862">
<feBlend
inkscape:collect="always"
mode="lighten"
in2="BackgroundImage"
id="feBlend864" />
</filter>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 148.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="210 : 148.5 : 1"
inkscape:persp3d-origin="105 : 99 : 1"
id="perspective178" />
</defs>
<sodipodi:namedview
id="base"
@ -40,16 +34,17 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7071068"
inkscape:cx="114.72171"
inkscape:cy="244.35769"
inkscape:zoom="1.5810773"
inkscape:cx="394.23269"
inkscape:cy="326.05841"
inkscape:document-units="mm"
inkscape:current-layer="layer2"
inkscape:current-layer="layer8"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1574"
inkscape:window-height="978"
inkscape:window-x="474"
inkscape:window-y="327"
inkscape:window-width="1458"
inkscape:window-height="932"
inkscape:window-x="0"
inkscape:window-y="23"
inkscape:window-maximized="0" />
<metadata
id="metadata5">
@ -63,223 +58,440 @@
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Layer 2"
transform="translate(-5.9299994,-39.669584)"
style="filter:url(#filter862)">
<rect
style="opacity:1;fill:#b8d9f8;fill-opacity:1;stroke:#3e99ed;stroke-width:0.84;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect846"
width="131.78682"
height="102.41121"
x="6.3499994"
y="40.089584" />
<rect
style="opacity:1;fill:#e7c2ee;fill-opacity:1;stroke:#a132b8;stroke-width:0.83999997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect846-3"
width="127.44389"
height="79.862946"
x="8.0697889"
y="52.789581" />
<rect
style="opacity:1;fill:#f7b9be;fill-opacity:1;stroke:#eb4b59;stroke-width:0.83999997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect846-3-9"
width="112.51761"
height="56.470001"
x="20.108335"
y="73.691681" />
<g
id="g851"
transform="translate(5.4713964,-0.41999999)">
<rect
y="40.089584"
x="94.592438"
height="8.467"
width="38.492985"
id="rect846-9"
style="opacity:1;fill:#3e99ed;fill-opacity:1;stroke:none;stroke-width:0.21471134;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.64413405, 0.21471134;stroke-dashoffset:0;stroke-opacity:1" />
<text
id="text880"
y="45.703152"
x="130.23187"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:5.64444447px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Light';text-align:end;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';text-align:end;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke-width:0.26458332px"
y="45.703152"
x="130.23187"
id="tspan878"
sodipodi:role="line">global scope</tspan></text>
</g>
<g
id="g841"
transform="translate(5.0972261,-2.5366649)">
<rect
y="54.906246"
x="95.938049"
height="8.467"
width="34.898407"
id="rect846-3-0"
style="opacity:1;fill:#a132b8;fill-opacity:1;stroke:none;stroke-width:0.20444053;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.61332162, 0.20444055;stroke-dashoffset:0;stroke-opacity:1" />
<text
id="text880-4"
y="60.584724"
x="128.49477"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444447px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444447px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
y="60.584724"
x="128.49477"
id="tspan878-5"
sodipodi:role="line">class scope</tspan></text>
</g>
<g
id="g846"
transform="translate(4.72303,-0.41999999)">
<rect
y="73.691681"
x="84.802856"
height="8.4666672"
width="43.520058"
id="rect846-3-9-9"
style="opacity:1;fill:#eb4b59;fill-opacity:1;stroke:none;stroke-width:0.22829711;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.68489136, 0.22829713;stroke-dashoffset:0;stroke-opacity:1" />
<text
transform="scale(1.0012369,0.99876463)"
id="text880-2"
y="79.502075"
x="125.36142"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444447px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444447px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
y="79.502075"
x="125.36142"
id="tspan878-0"
sodipodi:role="line">function scope</tspan></text>
</g>
<rect
style="opacity:1;fill:#fdd2b3;fill-opacity:1;stroke:#fb8d3f;stroke-width:0.83999997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect846-3-9-3"
width="95.492546"
height="26.722916"
x="34.081287"
y="101.19372" />
<g
id="g846-6"
transform="translate(1.6709308,27.08203)">
<rect
y="73.691681"
x="65.532722"
height="8.4666672"
width="62.79018"
id="rect846-3-9-9-7"
style="opacity:1;fill:#fb8d3f;fill-opacity:1;stroke:none;stroke-width:0.23110457;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.69331375, 0.23110459;stroke-dashoffset:0;stroke-opacity:1" />
<text
transform="scale(1.0012369,0.99876463)"
id="text880-2-5"
y="79.502075"
x="125.36142"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444447px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444447px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
y="79.502075"
x="125.36142"
id="tspan878-0-3"
sodipodi:role="line">comprehension scope</tspan></text>
</g>
</g>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-5.9299994,-39.669584)"
sodipodi:insensitive="true">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.64444447px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="14.287499"
y="18.393749"
id="text817"><tspan
sodipodi:role="line"
id="tspan815"
x="14.287499"
y="23.332638"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro';stroke-width:0.26458332px" /></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:5.64444447px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Light';letter-spacing:0px;word-spacing:0px;fill:#1c1e20;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="9.260417"
y="47.233334"
id="text821"><tspan
sodipodi:role="line"
x="9.260417"
y="47.233334"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan823">ITERATIONS = 10</tspan><tspan
sodipodi:role="line"
x="9.260417"
y="54.288891"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan837" /><tspan
sodipodi:role="line"
x="9.260417"
y="61.344444"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan843">class Cls:</tspan><tspan
sodipodi:role="line"
x="9.260417"
y="68.400002"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan939"> class_attribute = 20</tspan><tspan
sodipodi:role="line"
x="9.260417"
y="75.455559"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan918" /><tspan
sodipodi:role="line"
x="9.260417"
y="82.511108"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan827"> def fn():</tspan><tspan
sodipodi:role="line"
x="9.260417"
y="89.566666"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan829"> for i in range(ITERATIONS):</tspan><tspan
sodipodi:role="line"
x="9.260417"
y="96.622223"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan831"> ...</tspan><tspan
sodipodi:role="line"
x="9.260417"
y="103.67778"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan876" /><tspan
sodipodi:role="line"
x="9.260417"
y="110.73334"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan833"> return [</tspan><tspan
sodipodi:role="line"
x="9.260417"
y="117.78889"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan870"> i for i in range(10)</tspan><tspan
sodipodi:role="line"
x="9.260417"
y="124.84444"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan872"> ]</tspan><tspan
sodipodi:role="line"
x="9.260417"
y="131.89999"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan879" /><tspan
sodipodi:role="line"
x="9.260417"
y="138.95555"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458332px"
id="tspan841">Cls().fn()</tspan></text>
id="layer1">
<g
inkscape:groupmode="layer"
id="layer8"
inkscape:label="builtin"
style="display:inline">
<rect
style="display:inline;fill:#3ad96d;fill-opacity:1;stroke:#3e9961;stroke-width:0.84;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;"
id="rect846-0"
width="131.78682"
height="102.41121"
x="32.380394"
y="-127.55679"
transform="matrix(1.0238813,0,0,1.1721179,3.6866905,175.82934)"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<g
id="g851-0"
transform="translate(38.926913,-13.869216)"
style="display:inline"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
y="40.089584"
x="94.592438"
height="8.467"
width="38.492985"
id="rect846-9-3"
style="opacity:1;fill:#3e9961;fill-opacity:1;stroke:none;stroke-width:0.214711;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.644134, 0.214711;stroke-dashoffset:0;stroke-opacity:1" />
<text
id="text880-9"
y="45.703152"
x="130.23187"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:5.64444px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Light';text-align:end;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';text-align:end;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke-width:0.264583px"
y="45.703152"
x="130.23187"
id="tspan878-57"
sodipodi:role="line">builtin scope</tspan></text>
</g>
<g
inkscape:label="Layer 1"
id="layer1-6-3-4"
transform="translate(-38.485254,-185.17167)"
style="display:inline;"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="14.287499"
y="18.393749"
id="text817-0-1" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Light';letter-spacing:0px;word-spacing:0px;fill:#1c1e20;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="78.052086"
y="218.07857"
id="text821-5-5"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"><tspan
sodipodi:role="line"
x="78.052086"
y="218.07857"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan1835">class range(stop)</tspan><tspan
sodipodi:role="line"
x="78.052086"
y="225.13412"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan1841"> ...</tspan><tspan
sodipodi:role="line"
x="78.052086"
y="232.18967"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan1839" /></text>
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="global"
style="display:inline">
<rect
style="fill:#b8d9f8;fill-opacity:1;stroke:#3e99ed;stroke-width:0.84;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;opacity:1;"
id="rect846"
width="131.78682"
height="102.41121"
x="38.218014"
y="41.986538"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<g
id="g851"
transform="translate(37.339412,1.476952)"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
y="40.089584"
x="94.592438"
height="8.467"
width="38.492985"
id="rect846-9"
style="opacity:1;fill:#3e99ed;fill-opacity:1;stroke:none;stroke-width:0.214711;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.644134, 0.21471100000000001;stroke-dashoffset:0;stroke-opacity:1;" />
<text
id="text880"
y="45.703152"
x="130.23187"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Light';text-align:end;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';text-align:end;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke-width:0.26458300000000001px;"
y="45.703152"
x="130.23187"
id="tspan878"
sodipodi:role="line">global scope</tspan></text>
</g>
<g
inkscape:label="Layer 1"
id="layer1-6"
transform="translate(31.868016,1.896952)"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="14.287499"
y="18.393749"
id="text817" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Light';letter-spacing:0px;word-spacing:0px;fill:#1c1e20;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="9.260417"
y="47.233334"
id="text821"><tspan
sodipodi:role="line"
x="9.260417"
y="47.233334"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan823">ITERATIONS = 10</tspan><tspan
sodipodi:role="line"
x="9.260417"
y="54.288883"
id="tspan879" /><tspan
sodipodi:role="line"
x="9.260417"
y="61.344433"
id="tspan729" /><tspan
sodipodi:role="line"
x="9.260417"
y="68.399986"
id="tspan731" /><tspan
sodipodi:role="line"
x="9.260417"
y="75.455536"
id="tspan733" /><tspan
sodipodi:role="line"
x="9.260417"
y="82.511086"
id="tspan735" /><tspan
sodipodi:role="line"
x="9.260417"
y="89.566635"
id="tspan737" /><tspan
sodipodi:role="line"
x="9.260417"
y="96.622185"
id="tspan739" /><tspan
sodipodi:role="line"
x="9.260417"
y="103.67773"
id="tspan741" /><tspan
sodipodi:role="line"
x="9.260417"
y="110.73328"
id="tspan743" /><tspan
sodipodi:role="line"
x="9.260417"
y="117.78883"
id="tspan745" /><tspan
sodipodi:role="line"
x="9.260417"
y="124.84438"
id="tspan747" /><tspan
sodipodi:role="line"
x="9.260417"
y="131.89993"
id="tspan749" /><tspan
sodipodi:role="line"
x="9.260417"
y="138.95549"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan841">Cls().fn()</tspan></text>
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="class"
style="display:inline">
<rect
style="display:inline;fill:#e7c2ee;fill-opacity:1;stroke:#a132b8;stroke-width:0.84;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;"
id="rect846-3"
width="127.44389"
height="79.862946"
x="39.937805"
y="54.686535"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<g
id="g841"
transform="translate(36.965242,-0.639713)"
style="display:inline;"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
y="54.906246"
x="95.938049"
height="8.467"
width="34.898407"
id="rect846-3-0"
style="opacity:1;fill:#a132b8;fill-opacity:1;stroke:none;stroke-width:0.204441;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.613322, 0.20444100000000001;stroke-dashoffset:0;stroke-opacity:1;" />
<text
id="text880-4"
y="60.584724"
x="128.49477"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;"
y="60.584724"
x="128.49477"
id="tspan878-5"
sodipodi:role="line">class scope</tspan></text>
</g>
<g
inkscape:label="Layer 1"
id="layer1-6-3"
transform="translate(-35.19329,-156.57945)"
style="display:inline;"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="14.287499"
y="18.393749"
id="text817-0" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Light';letter-spacing:0px;word-spacing:0px;fill:#1c1e20;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="78.052086"
y="218.07857"
id="text821-5"><tspan
sodipodi:role="line"
x="78.052086"
y="218.07857"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan843-7">class Cls:</tspan><tspan
sodipodi:role="line"
x="78.052086"
y="225.13412"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan939-2"> class_attribute = 20</tspan><tspan
sodipodi:role="line"
x="78.052086"
y="232.18967"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan841-4" /></text>
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer5"
inkscape:label="function"
style="display:inline">
<rect
style="display:inline;fill:#f7b9be;fill-opacity:1;stroke:#eb4b59;stroke-width:0.84;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal;"
id="rect846-3-9"
width="112.51761"
height="56.470001"
x="51.976353"
y="75.588638"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<g
id="g846"
transform="translate(36.591047,1.476952)"
style="display:inline;"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
y="73.691681"
x="84.802856"
height="8.4666672"
width="43.520058"
id="rect846-3-9-9"
style="opacity:1;fill:#eb4b59;fill-opacity:1;stroke:none;stroke-width:0.228297;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.684891, 0.22829700000000000;stroke-dashoffset:0;stroke-opacity:1;" />
<text
transform="scale(1.0012369,0.99876463)"
id="text880-2"
y="79.502075"
x="125.36142"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;"
y="79.502075"
x="125.36142"
id="tspan878-0"
sodipodi:role="line">function scope</tspan></text>
</g>
<g
inkscape:label="Layer 1"
id="layer1-6-1"
transform="translate(-51.06829,-6.1449257)"
style="display:inline;"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="14.287499"
y="18.393749"
id="text817-1" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Light';letter-spacing:0px;word-spacing:0px;fill:#1c1e20;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="97.706848"
y="89.566666"
id="text821-2"><tspan
sodipodi:role="line"
x="97.706848"
y="89.566666"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan827-7"> def fn():</tspan><tspan
sodipodi:role="line"
x="97.706848"
y="96.622215"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan829-3"> for i in range(ITERATIONS):</tspan><tspan
sodipodi:role="line"
x="97.706848"
y="103.67776"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan831-4"> ...</tspan><tspan
sodipodi:role="line"
x="97.706848"
y="110.73332"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan841-0" /></text>
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer6"
inkscape:label="comprehension"
style="display:inline">
<rect
style="display:inline;fill:#fdd2b3;fill-opacity:1;stroke:#fb8d3f;stroke-width:0.84;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal;"
id="rect846-3-9-3"
width="95.492546"
height="26.722916"
x="65.949303"
y="103.09068"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<g
id="g846-6"
transform="translate(33.538946,28.978982)"
style="display:inline;"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
y="73.691681"
x="65.532722"
height="8.4666672"
width="62.79018"
id="rect846-3-9-9-7"
style="opacity:1;fill:#fb8d3f;fill-opacity:1;stroke:none;stroke-width:0.231105;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.693314, 0.23110500000000000;stroke-dashoffset:0;stroke-opacity:1;" />
<text
transform="scale(1.0012369,0.99876463)"
id="text880-2-5"
y="79.502075"
x="125.36142"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue Medium';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:end;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:end;white-space:normal;shape-padding:0;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;"
y="79.502075"
x="125.36142"
id="tspan878-0-3"
sodipodi:role="line">comprehension scope</tspan></text>
</g>
<g
inkscape:label="Layer 1"
id="layer1-6-1-7"
transform="translate(-73.368884,-116.51398)"
style="display:inline;"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="14.287499"
y="18.393749"
id="text817-1-3" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:5.64444000000000035px;line-height:125%;font-family:'Source Sans Pro';-inkscape-font-specification:'Source Sans Pro Light';letter-spacing:0px;word-spacing:0px;fill:#1c1e20;fill-opacity:1;stroke:none;stroke-width:0.26458300000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="125.67709"
y="228.66191"
id="text821-2-6"><tspan
sodipodi:role="line"
x="125.67709"
y="228.66191"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan833-7-2"> return [</tspan><tspan
sodipodi:role="line"
x="125.67709"
y="235.71745"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan870-2-9"> i for i in range(10)</tspan><tspan
sodipodi:role="line"
x="125.67709"
y="242.77301"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan872-56-7"> ]</tspan><tspan
sodipodi:role="line"
x="125.67709"
y="249.82855"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Source Code Pro';-inkscape-font-specification:'Source Code Pro';fill:#1c1e20;fill-opacity:1;stroke-width:0.26458300000000001px;"
id="tspan841-0-8" /></text>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before After
Before After

View file

@ -40,8 +40,8 @@ The wrapper provides a :func:`~libcst.metadata.MetadataWrapper.resolve` function
.. autoclass:: libcst.metadata.MetadataWrapper
:special-members: __init__
If you're working with visitors, which extend :class:`~libcst.MetadataDependent`,
metadata dependencies will be automatically computed when visited by a
If you're working with visitors, which extend :class:`~libcst.MetadataDependent`,
metadata dependencies will be automatically computed when visited by a
:class:`~libcst.metadata.MetadataWrapper` and are accessible through
:func:`~libcst.MetadataDependent.get_metadata`
@ -134,14 +134,15 @@ New scopes are created for classes, functions, and comprehensions. Other block
constructs like conditional statements, loops, and try…except don't create their
own scope.
There are four different type of scope in Python:
There are five different type of scope in Python:
:class:`~libcst.metadata.BuiltinScope`,
:class:`~libcst.metadata.GlobalScope`,
:class:`~libcst.metadata.ClassScope`,
:class:`~libcst.metadata.FunctionScope`, and
:class:`~libcst.metadata.ComprehensionScope`.
.. image:: _static/img/python_scopes.png
:alt: Diagram showing how the above 4 scopes are nested in each other
:alt: Diagram showing how the above 5 scopes are nested in each other
:width: 400
:align: center
@ -175,6 +176,9 @@ assigned or accessed within.
:no-undoc-members:
:special-members: __contains__, __getitem__, __iter__
.. autoclass:: libcst.metadata.BuiltinScope
:no-undoc-members:
.. autoclass:: libcst.metadata.GlobalScope
:no-undoc-members: