<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>idea Formatting linter/parser be applied to snippets before they are copied to the clipboard in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/formatting-linter-parser-be-applied-to-snippets/idi-p/933606</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ArcGIS Pro 2.4.1:&amp;nbsp; When using “Copy Python Command” from context menu in Geoprocessing History the resultant code uses inconsistent formatting, mixing single and double quotes for parameters. While technically it’s not wrong, it goes against best practice and sets the stage for making mistakes later. Arguments should be all single or all double quoted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example raw clipboard contents:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;arcpy.management.MakeImageServerLayer("https://services.example.ca/imagery/services/Elevation/Elevation/ImageServer", "AOI - from elev svc", "299910.08935875 848995.617035001 304601.63344125 853442.221065001", None, "Seamline", '', "0", '', 1, "LowPS = 1", "None")&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Reformatted using a font which carefully distinguishes quote types and inconsistent quoting highlighted:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;arcpy.management.MakeImageServerLayer(&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "https://services.example.ca/imagery/services/Elevation/Elevation/ImageServer",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "AOI - from elev svc",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "299910.08935875 848995.617035001 304601.63344125 853442.221065001",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; None,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Seamline",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: yellow;"&gt;&lt;STRONG&gt;''&lt;/STRONG&gt;&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "0",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: yellow;"&gt;&lt;STRONG&gt;''&lt;/STRONG&gt;&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "LowPS = 1",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "None")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example in this screenshot the user is invited to interpret &lt;EM&gt;Seamline&lt;/EM&gt; as one parameter and &lt;EM&gt;comma&lt;/EM&gt;&amp;nbsp; as the next parameter “,” when it’s actually ((( Seamline – comma – empty-single-quotes – comma ))).&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="457187" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/457187_pastedImage_5.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It’s not until carefully reformatting the code snippet that the real structure becomes apparent. An enhancement I recommend is that a python formatting linter/parser be applied to snippets before they are copied to the clipboard.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(&lt;EM&gt;Black &lt;/EM&gt;would be an excellent choice: &lt;A href="https://black.readthedocs.io/en/stable/"&gt;https://black.readthedocs.io/en/stable/&lt;/A&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Aug 2019 22:15:25 GMT</pubDate>
    <dc:creator>MattWilkie1</dc:creator>
    <dc:date>2019-08-15T22:15:25Z</dc:date>
    <item>
      <title>Formatting linter/parser be applied to snippets before they are copied to the clipboard</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/formatting-linter-parser-be-applied-to-snippets/idi-p/933606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ArcGIS Pro 2.4.1:&amp;nbsp; When using “Copy Python Command” from context menu in Geoprocessing History the resultant code uses inconsistent formatting, mixing single and double quotes for parameters. While technically it’s not wrong, it goes against best practice and sets the stage for making mistakes later. Arguments should be all single or all double quoted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example raw clipboard contents:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;arcpy.management.MakeImageServerLayer("https://services.example.ca/imagery/services/Elevation/Elevation/ImageServer", "AOI - from elev svc", "299910.08935875 848995.617035001 304601.63344125 853442.221065001", None, "Seamline", '', "0", '', 1, "LowPS = 1", "None")&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Reformatted using a font which carefully distinguishes quote types and inconsistent quoting highlighted:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;arcpy.management.MakeImageServerLayer(&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "https://services.example.ca/imagery/services/Elevation/Elevation/ImageServer",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "AOI - from elev svc",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "299910.08935875 848995.617035001 304601.63344125 853442.221065001",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; None,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Seamline",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: yellow;"&gt;&lt;STRONG&gt;''&lt;/STRONG&gt;&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "0",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: yellow;"&gt;&lt;STRONG&gt;''&lt;/STRONG&gt;&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "LowPS = 1",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "None")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example in this screenshot the user is invited to interpret &lt;EM&gt;Seamline&lt;/EM&gt; as one parameter and &lt;EM&gt;comma&lt;/EM&gt;&amp;nbsp; as the next parameter “,” when it’s actually ((( Seamline – comma – empty-single-quotes – comma ))).&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="457187" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/457187_pastedImage_5.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It’s not until carefully reformatting the code snippet that the real structure becomes apparent. An enhancement I recommend is that a python formatting linter/parser be applied to snippets before they are copied to the clipboard.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(&lt;EM&gt;Black &lt;/EM&gt;would be an excellent choice: &lt;A href="https://black.readthedocs.io/en/stable/"&gt;https://black.readthedocs.io/en/stable/&lt;/A&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Aug 2019 22:15:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/formatting-linter-parser-be-applied-to-snippets/idi-p/933606</guid>
      <dc:creator>MattWilkie1</dc:creator>
      <dc:date>2019-08-15T22:15:25Z</dc:date>
    </item>
  </channel>
</rss>

