diff --git a/.gitignore b/.gitignore index d646835..93c25a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc __pycache__/ +*.dist-info/ diff --git a/Makefile b/Makefile index 93cc7a8..df3e576 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ deploy: cp -rf smarty "$(QGIS_PLUGINS_DIR)/smarty" redeploy: deploy - osascript -e 'quit app "QGIS"' + killall QGIS > /dev/null 2>&1 || true open -a QGIS vendor: diff --git a/requirements.txt b/requirements.txt index 46bb80f..96313fc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ smartystreets-python-sdk==6.1.0 +git+ssh://git@github.com/smarty/summary.git@v0.1.1 diff --git a/smarty/metadata.txt b/smarty/metadata.txt index 49c54c3..b0153d6 100644 --- a/smarty/metadata.txt +++ b/smarty/metadata.txt @@ -6,7 +6,7 @@ name=Smarty qgisMinimumVersion=3.0 description=Smarty Geocoding QGIS Plugin -version=1.0.14 +version=1.0.15 author=Smarty email=osgeo-it@smarty.com diff --git a/smarty/smarty.py b/smarty/smarty.py index e4a74ab..355fc20 100644 --- a/smarty/smarty.py +++ b/smarty/smarty.py @@ -34,6 +34,7 @@ from smartystreets_python_sdk import StaticCredentials, exceptions, ClientBuilder, SharedCredentials, Batch, Request from smartystreets_python_sdk.us_street import Lookup as StreetLookup from smartystreets_python_sdk.us_autocomplete_pro import Lookup as AutocompleteProLookup +from summary import summary ######### # Initialize Qt resources from file resources.py @@ -345,8 +346,8 @@ def smarty_single(self): self.dlg.dst_result.setText(str(dst)) # Check if the candidate returned is good to plot. - success = Utils.handle_success(result) - if success == "No Match - The address is invalid.": + success = self.handle_success(result) + if success == "No Match": self.dlg.resize(586, 532) self.dlg.results.setVisible(True) self.dlg.summary_result.setText(success) @@ -623,7 +624,7 @@ def process_batch(self, batch_meta, id_column_name, address, city, state, zip, l feature.setGeometry(QgsGeometry.fromPointXY(point_out)) # Handle success of address lookup - success = Utils.handle_success(candidates) + success = self.handle_success(candidates) # Set attributes for associated layer feature.setAttributes([lookup_id, address_result, longitude, latitude, city_result, state_result, zip_result, zip_4, precision, county, @@ -1017,15 +1018,15 @@ def autocomplete_state(self): self.dlg.single_address_lookup.setCompleter(None) def handle_success(self, result): # Handle and determine the success of the API request - if Utils.is_valid(result): - return "valid_address" - if Utils.is_invalid(result): - return "invalid_address" - if Utils.is_missing_secondary(result): - return "missing_secondary" - if Utils.is_ambiguous(result): - return "ambiguous_address" - return "MAJOR ERROR" + enhanced_match = "" + dpv_match_code = "" + dpv_footnotes = "" + if len(result) > 0: + candidate = result[0] + enhanced_match = candidate.analysis.enhanced_match + dpv_match_code = candidate.analysis.dpv_match_code + dpv_footnotes = candidate.analysis.dpv_footnotes + return summary(enhanced_match, dpv_match_code, dpv_footnotes) def output_csv(self, layer_out): # Throw error if the file path has not been chosen diff --git a/smarty/smartystreets_python_sdk-6.1.0.dist-info/INSTALLER b/smarty/smartystreets_python_sdk-6.1.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/smarty/smartystreets_python_sdk-6.1.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/smarty/smartystreets_python_sdk-6.1.0.dist-info/METADATA b/smarty/smartystreets_python_sdk-6.1.0.dist-info/METADATA deleted file mode 100644 index 71411a2..0000000 --- a/smarty/smartystreets_python_sdk-6.1.0.dist-info/METADATA +++ /dev/null @@ -1,30 +0,0 @@ -Metadata-Version: 2.4 -Name: smartystreets_python_sdk -Version: 6.1.0 -Summary: An official library to help Python developers easily access the SmartyStreets APIs -Home-page: https://github.com/smartystreets/smartystreets-python-sdk -Download-URL: https://github.com/smartystreets/smartystreets-python-sdk/tarball/6.1.0 -Author: SmartyStreets SDK Team -Author-email: support@smartystreets.com -License: Apache 2 -Keywords: smartystreets,smarty,address,validation,verification,street,sdk,library,geocode -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Natural Language :: English -Classifier: Programming Language :: Python :: 3 -License-File: LICENSE.md -Requires-Dist: requests -Dynamic: author -Dynamic: author-email -Dynamic: classifier -Dynamic: description -Dynamic: download-url -Dynamic: home-page -Dynamic: keywords -Dynamic: license -Dynamic: license-file -Dynamic: requires-dist -Dynamic: summary - -Official Python library for SmartyStreets diff --git a/smarty/smartystreets_python_sdk-6.1.0.dist-info/RECORD b/smarty/smartystreets_python_sdk-6.1.0.dist-info/RECORD deleted file mode 100644 index b436510..0000000 --- a/smarty/smartystreets_python_sdk-6.1.0.dist-info/RECORD +++ /dev/null @@ -1,171 +0,0 @@ -smartystreets_python_sdk-6.1.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -smartystreets_python_sdk-6.1.0.dist-info/METADATA,sha256=uD3h0K_qRovZB3QfTfCstRPIoa8hC6HbkqCHxp2uHHc,1054 -smartystreets_python_sdk-6.1.0.dist-info/RECORD,, -smartystreets_python_sdk-6.1.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -smartystreets_python_sdk-6.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91 -smartystreets_python_sdk-6.1.0.dist-info/licenses/LICENSE.md,sha256=Cu67SvL5YQlDIEaH0UOH2rlm4LIPiCfdO4hlAACCWl4,11332 -smartystreets_python_sdk-6.1.0.dist-info/top_level.txt,sha256=uPitCujTcHdnUQwzTZKMfb1GoYxgM5Evyq_CJrhfVnU,58 -smartystreets_python_sdk/__init__.py,sha256=cJpR9L-R1gDD7b4-L3QJltQOacFe8Sdom586X3feFJo,805 -smartystreets_python_sdk/__pycache__/__init__.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/basic_auth_credentials.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/batch.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/client_builder.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/custom_header_sender.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/custom_query_sender.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/errors.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/exceptions.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/license_sender.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/native_serializer.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/proxy.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/request.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/requests_sender.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/response.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/retry_sender.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/shared_credentials.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/signing_sender.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/static_credentials.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/status_code_sender.cpython-311.pyc,, -smartystreets_python_sdk/__pycache__/url_prefix_sender.cpython-311.pyc,, -smartystreets_python_sdk/basic_auth_credentials.py,sha256=-9vCG8z0Mr8GR-7Zl8UuXWbfzposXc9aIRa1Ynjz2Ek,401 -smartystreets_python_sdk/batch.py,sha256=FafhYEGpTbHIb6oGkBozblsf00PNfMQsCVT_EY0c-aw,1371 -smartystreets_python_sdk/client_builder.py,sha256=g-hhGVT9xSzFEZnkApabmITcpJe8K0I8ZXLQnZ5047A,12787 -smartystreets_python_sdk/custom_header_sender.py,sha256=qmTUM7afM5mBGGocuzr1THbB5f7F5NMNr5dgycuHMco,795 -smartystreets_python_sdk/custom_query_sender.py,sha256=q238mqAOh3nK26HS5mHUmeucT3_ki6ue5PFJtOAcTMw,364 -smartystreets_python_sdk/errors.py,sha256=DTnAmoxVG1uSCFsmzkknzVqzXyOHqYx28eXkdbUw28k,1214 -smartystreets_python_sdk/exceptions.py,sha256=TFnXjje1TPwfZ4S0L1l0gQqejEzy5FQVTfBCwGNYkvs,830 -smartystreets_python_sdk/international_autocomplete/__init__.py,sha256=zmHkBQ4bBdQRXgA98Luey4xGgAOYUD0j8_nMcz-1kDw,87 -smartystreets_python_sdk/international_autocomplete/__pycache__/__init__.cpython-311.pyc,, -smartystreets_python_sdk/international_autocomplete/__pycache__/candidate.cpython-311.pyc,, -smartystreets_python_sdk/international_autocomplete/__pycache__/client.cpython-311.pyc,, -smartystreets_python_sdk/international_autocomplete/__pycache__/lookup.cpython-311.pyc,, -smartystreets_python_sdk/international_autocomplete/candidate.py,sha256=SMy274DXAIwA7Gp4jQ_-oFbAzPU7vuYQaDrpvHVNrKQ,679 -smartystreets_python_sdk/international_autocomplete/client.py,sha256=ejuGxnrt6C2-jHlvq5QOanzOlssdOOoPqaAzhEQaGNs,2339 -smartystreets_python_sdk/international_autocomplete/lookup.py,sha256=HZdbDW3DpfUuuSa8yU9zuIBxYHm6rApV6YU_qNFjcCM,1268 -smartystreets_python_sdk/international_postal_code/__init__.py,sha256=zmHkBQ4bBdQRXgA98Luey4xGgAOYUD0j8_nMcz-1kDw,87 -smartystreets_python_sdk/international_postal_code/__pycache__/__init__.cpython-311.pyc,, -smartystreets_python_sdk/international_postal_code/__pycache__/candidate.cpython-311.pyc,, -smartystreets_python_sdk/international_postal_code/__pycache__/client.cpython-311.pyc,, -smartystreets_python_sdk/international_postal_code/__pycache__/lookup.cpython-311.pyc,, -smartystreets_python_sdk/international_postal_code/candidate.py,sha256=cOEHsemaWzOfPoUE21BdqLMvqE4LgR_zkKuWBtdt8fM,829 -smartystreets_python_sdk/international_postal_code/client.py,sha256=MoWTqqwN0xuiQdoOduYL2UiwW8YeUY27cAxIddjLR_8,1570 -smartystreets_python_sdk/international_postal_code/lookup.py,sha256=J55Hi62-nvRTpjNHrNOnOdNeh-mb-Ed3De1v1jmLyVs,945 -smartystreets_python_sdk/international_street/__init__.py,sha256=lCUAdOYSQ4vKvcSRvmGIjElHWPE188CXrGtHEMUnbWg,184 -smartystreets_python_sdk/international_street/__pycache__/__init__.cpython-311.pyc,, -smartystreets_python_sdk/international_street/__pycache__/analysis.cpython-311.pyc,, -smartystreets_python_sdk/international_street/__pycache__/candidate.cpython-311.pyc,, -smartystreets_python_sdk/international_street/__pycache__/changes.cpython-311.pyc,, -smartystreets_python_sdk/international_street/__pycache__/client.cpython-311.pyc,, -smartystreets_python_sdk/international_street/__pycache__/components.cpython-311.pyc,, -smartystreets_python_sdk/international_street/__pycache__/language_mode.cpython-311.pyc,, -smartystreets_python_sdk/international_street/__pycache__/lookup.cpython-311.pyc,, -smartystreets_python_sdk/international_street/__pycache__/metadata.cpython-311.pyc,, -smartystreets_python_sdk/international_street/__pycache__/rootlevel.cpython-311.pyc,, -smartystreets_python_sdk/international_street/analysis.py,sha256=va5FCw0oCR_d7eME-8fvQ2ErwFvHnwB6ZLxt_jUuOgM,437 -smartystreets_python_sdk/international_street/candidate.py,sha256=vV3jAYYRQZTHi9LKzbs4_02gtdsuVoGYecK6y2dmKwc,672 -smartystreets_python_sdk/international_street/changes.py,sha256=qBUYwl90FKppDLLg1j4VG4yi6GzYAeVracwEO5I9Yu0,226 -smartystreets_python_sdk/international_street/client.py,sha256=gtJcIjrRcvfhUuxnNjE8n19SO3M2ZGdDce87U60DA48,2370 -smartystreets_python_sdk/international_street/components.py,sha256=Q8VbHv5jTaOJ_gYAoTxFpKZHibNYz3fQLBqKPnD7Az0,3812 -smartystreets_python_sdk/international_street/language_mode.py,sha256=zf45F-2Y-RCYdE88JcRnN8R2HPs_EbP6A2chYTKvhbk,35 -smartystreets_python_sdk/international_street/lookup.py,sha256=qmYEEAwXI85mcG5CoPPBKmOt51SVaAdf7l1L4IkYPY4,2679 -smartystreets_python_sdk/international_street/metadata.py,sha256=DM9VJAxrUV5czeOwxt3ea6171-xBupUSVZRFWGsKEWw,598 -smartystreets_python_sdk/international_street/rootlevel.py,sha256=ZeErBuBhNkgD7-nEOXa4EDYN-EOYvlKqPiaycz_J_08,759 -smartystreets_python_sdk/license_sender.py,sha256=hAPSejluaFcAjhG2B5nt910Q474hnbtMnbb2FPUXi3c,313 -smartystreets_python_sdk/native_serializer.py,sha256=QpN2-woD1Muu3bzr-LVzF4n3l-0Ae2OtynVCW4YxoIc,225 -smartystreets_python_sdk/proxy.py,sha256=2asS-F-v_rikgPQvVJh10oI5Wp8ezprS1E10tZUFKXc,506 -smartystreets_python_sdk/request.py,sha256=mEXPJKPJQqAWs4iNZ1HqVL8UhAB37HollVniYPPpvuw,337 -smartystreets_python_sdk/requests_sender.py,sha256=veejQiYR2vwyhbVz8n21gzXFmaKx7wFdSAInwJF4YP4,3395 -smartystreets_python_sdk/response.py,sha256=_uzx5N4MhqKZSBBnOaeaRda1XS41RHNcHowy5Kjz3hY,617 -smartystreets_python_sdk/retry_sender.py,sha256=8V2_a1PKKvILKhUMrvQINXc5CIa7JhWOnOrb5HBnHG4,1257 -smartystreets_python_sdk/shared_credentials.py,sha256=YJTE3_089mTqB2OlLSfxUfp9s33MoiHG3DB65zTxoNs,248 -smartystreets_python_sdk/signing_sender.py,sha256=g5USdC86_HnL5t2oH2oyCqEevakcqdVhedML-ws4OEI,220 -smartystreets_python_sdk/static_credentials.py,sha256=BHx34sjh-QKqjGziAaYASFSblG0WpvEnAqNwz1BQe58,280 -smartystreets_python_sdk/status_code_sender.py,sha256=m3QhbF7u_bsA8j2ETQ1YUOJsD6SFy3zwYdOuLBOGv_U,2602 -smartystreets_python_sdk/url_prefix_sender.py,sha256=_NGjV9fNbaQI9zRfsVHpmIraXE0L6nC6AygNNbbsHS4,372 -smartystreets_python_sdk/us_autocomplete_pro/__init__.py,sha256=l4m1GmSshTs5jtUVwrGIwFZ0FaPUwjhPzOpgVg6udDs,89 -smartystreets_python_sdk/us_autocomplete_pro/__pycache__/__init__.cpython-311.pyc,, -smartystreets_python_sdk/us_autocomplete_pro/__pycache__/client.cpython-311.pyc,, -smartystreets_python_sdk/us_autocomplete_pro/__pycache__/geolocation_type.cpython-311.pyc,, -smartystreets_python_sdk/us_autocomplete_pro/__pycache__/lookup.cpython-311.pyc,, -smartystreets_python_sdk/us_autocomplete_pro/__pycache__/suggestion.cpython-311.pyc,, -smartystreets_python_sdk/us_autocomplete_pro/client.py,sha256=6emfu5NqeIgIEnAsLKDYuuCdgqWBCkdqgnVXqpP1cEM,2901 -smartystreets_python_sdk/us_autocomplete_pro/geolocation_type.py,sha256=Y3Dl2fYDyCnEZY6e39CV8v5iLFfdoo7y3BxkdXZBHCI,29 -smartystreets_python_sdk/us_autocomplete_pro/lookup.py,sha256=aDJ5Fhu8m2O6C_vmj8EzOVTDzPr3Hc576PEuRDsLzMo,4314 -smartystreets_python_sdk/us_autocomplete_pro/suggestion.py,sha256=eMr4BDL0XK5wwCIt1Ijt1RJVtDrKKCdnmZe-HAOb3xU,451 -smartystreets_python_sdk/us_enrichment/__init__.py,sha256=eWKzMA_YOl9rlbMi5Zmnnk_GVKTbQXH78MBBWfxCOKk,368 -smartystreets_python_sdk/us_enrichment/__pycache__/__init__.cpython-311.pyc,, -smartystreets_python_sdk/us_enrichment/__pycache__/client.cpython-311.pyc,, -smartystreets_python_sdk/us_enrichment/__pycache__/lookup.cpython-311.pyc,, -smartystreets_python_sdk/us_enrichment/__pycache__/response.cpython-311.pyc,, -smartystreets_python_sdk/us_enrichment/business/__init__.py,sha256=uAJgJDshudrPwGdGkU7E5KBYwLlSrzvkFiv0Kd0ReTQ,129 -smartystreets_python_sdk/us_enrichment/business/__pycache__/__init__.cpython-311.pyc,, -smartystreets_python_sdk/us_enrichment/business/__pycache__/detail.cpython-311.pyc,, -smartystreets_python_sdk/us_enrichment/business/__pycache__/summary.cpython-311.pyc,, -smartystreets_python_sdk/us_enrichment/business/detail.py,sha256=rLYUmEVOz1LegIoFYNDRhTehb7_5aKTJ7xJntXDz9Ws,14605 -smartystreets_python_sdk/us_enrichment/business/summary.py,sha256=4epCKRql0_HZ8SGIH06GmIj81sPu6eSo9aIV93tRptg,536 -smartystreets_python_sdk/us_enrichment/client.py,sha256=t3mBN3dfdpRtpM3hMnj_vK5nEm0UlgDgG2exrxMe_mU,6581 -smartystreets_python_sdk/us_enrichment/lookup.py,sha256=341lcUXgJs2Omk7QnztAeTArZ42CqKfGaAYbFKD-Lvg,2399 -smartystreets_python_sdk/us_enrichment/response.py,sha256=zqQBPMTFkYDJ-wI6iDt2bfz4aeHnTSGs7utnuLD_Hq0,62925 -smartystreets_python_sdk/us_extract/__init__.py,sha256=Fc_OZTtDwP5lE1HXFnbrcGXmEa6pNU4MJxvXlgAUuSU,141 -smartystreets_python_sdk/us_extract/__pycache__/__init__.cpython-311.pyc,, -smartystreets_python_sdk/us_extract/__pycache__/address.cpython-311.pyc,, -smartystreets_python_sdk/us_extract/__pycache__/client.cpython-311.pyc,, -smartystreets_python_sdk/us_extract/__pycache__/lookup.cpython-311.pyc,, -smartystreets_python_sdk/us_extract/__pycache__/metadata.cpython-311.pyc,, -smartystreets_python_sdk/us_extract/__pycache__/result.cpython-311.pyc,, -smartystreets_python_sdk/us_extract/address.py,sha256=vtMzxoocQGISehKm78Bzqm-hqif-o-_-P0OB-Q2AZO4,613 -smartystreets_python_sdk/us_extract/client.py,sha256=k4KMcFohAnMZ_hO-ciyC5rzoFmNMOgOZ-DuCb7uMoHg,2207 -smartystreets_python_sdk/us_extract/lookup.py,sha256=6xnVgkT_nbz5eGtZWYhorOH-_RbSAY1o7tX89bmuzbI,945 -smartystreets_python_sdk/us_extract/metadata.py,sha256=4j898o9Wp_QxCgGqVxGUkHn7Hm2Lb35lHQv98bZhfHo,478 -smartystreets_python_sdk/us_extract/result.py,sha256=yPnmrotiq5-DHU1x6FxRkpjo6KiACWpOrjG-U2eIrMw,619 -smartystreets_python_sdk/us_reverse_geo/__init__.py,sha256=ePdvUgk-y-6jTZzGmDPiyPgpi6u_dSmF5mWHJLXezD4,176 -smartystreets_python_sdk/us_reverse_geo/__pycache__/__init__.cpython-311.pyc,, -smartystreets_python_sdk/us_reverse_geo/__pycache__/address.cpython-311.pyc,, -smartystreets_python_sdk/us_reverse_geo/__pycache__/client.cpython-311.pyc,, -smartystreets_python_sdk/us_reverse_geo/__pycache__/coordinate.cpython-311.pyc,, -smartystreets_python_sdk/us_reverse_geo/__pycache__/lookup.cpython-311.pyc,, -smartystreets_python_sdk/us_reverse_geo/__pycache__/response.cpython-311.pyc,, -smartystreets_python_sdk/us_reverse_geo/__pycache__/result.cpython-311.pyc,, -smartystreets_python_sdk/us_reverse_geo/address.py,sha256=9ImBpoVsI-CSkntZsELiDwY3_FHhK0VLdmxLghe4RVs,451 -smartystreets_python_sdk/us_reverse_geo/client.py,sha256=gsGAaXsbkDPE9ma6gEilbhjO6FeSKfnVKmXEG-WXoQc,1406 -smartystreets_python_sdk/us_reverse_geo/coordinate.py,sha256=qlnkLnV3nsCP_5s91UoovBgdsmQHLxGmvrmHLFk1BqQ,507 -smartystreets_python_sdk/us_reverse_geo/lookup.py,sha256=4EwaqCpsBRAuUpVkN8gevTK7FVzGiJU34YJ8rvxgZhw,647 -smartystreets_python_sdk/us_reverse_geo/response.py,sha256=lyI8XRkzvnMFgvK7ndGj0GSzwOERChrw5FY3wBZl0ps,194 -smartystreets_python_sdk/us_reverse_geo/result.py,sha256=5sRFUwoJsBqMRmZ5JhqD_VBCv3kcLarXSYNV1A07aCc,379 -smartystreets_python_sdk/us_street/__init__.py,sha256=f_baQcNCWCTLwH9uGO_xsFPdfgK10gT7aA1sItGLCuA,185 -smartystreets_python_sdk/us_street/__pycache__/__init__.cpython-311.pyc,, -smartystreets_python_sdk/us_street/__pycache__/analysis.cpython-311.pyc,, -smartystreets_python_sdk/us_street/__pycache__/candidate.cpython-311.pyc,, -smartystreets_python_sdk/us_street/__pycache__/client.cpython-311.pyc,, -smartystreets_python_sdk/us_street/__pycache__/component_analysis.cpython-311.pyc,, -smartystreets_python_sdk/us_street/__pycache__/components.cpython-311.pyc,, -smartystreets_python_sdk/us_street/__pycache__/lookup.cpython-311.pyc,, -smartystreets_python_sdk/us_street/__pycache__/match_info.cpython-311.pyc,, -smartystreets_python_sdk/us_street/__pycache__/match_type.cpython-311.pyc,, -smartystreets_python_sdk/us_street/__pycache__/metadata.cpython-311.pyc,, -smartystreets_python_sdk/us_street/__pycache__/output_format.cpython-311.pyc,, -smartystreets_python_sdk/us_street/analysis.py,sha256=y4tnZ-K9acqWtfAKkkS7EaMDpJdNjY8Z-yTcmEgb3g4,1802 -smartystreets_python_sdk/us_street/candidate.py,sha256=O7YCz-rz3wu20pblQ0AnwaYeBLWhRIFkuQvMBGwAqFY,2284 -smartystreets_python_sdk/us_street/client.py,sha256=qSZo3Wv1wOGPqwpMVwwUbPAZdj8cfNFbPBKngsubnJ4,3780 -smartystreets_python_sdk/us_street/component_analysis.py,sha256=SCNHra9OGVR-DZmSDuRuE1t4Ff8ZLSbj1QSt-9JrMIQ,3162 -smartystreets_python_sdk/us_street/components.py,sha256=uG5UCNxcxeGvHtca9aixt2tk5LF7sXDne6yVB_t3nww,2630 -smartystreets_python_sdk/us_street/lookup.py,sha256=_PZhl9T-UBrsMQq-XFXefHzMn37mLDu7augUMYb9BeY,2245 -smartystreets_python_sdk/us_street/match_info.py,sha256=IlrotWKFgbU2Ea3_F4j2ttuv2-L4cQCtb323JGbQauE,428 -smartystreets_python_sdk/us_street/match_type.py,sha256=Y_MlddxylUgBmW_f20HmfEqoyJfp4TiVzaXxXEsTWG4,124 -smartystreets_python_sdk/us_street/metadata.py,sha256=VWlTYqfaeMlJeDvyjIGwS2ZV_dS0GZyBnlOhJ6mdu1o,2294 -smartystreets_python_sdk/us_street/output_format.py,sha256=YuFLP81dRw43gwae2CO28FE4z8zoH2GlzCEkJhJu4qQ,111 -smartystreets_python_sdk/us_zipcode/__init__.py,sha256=Yw0343wwUaSD0FTS5GfTEgsK3lsqr-1OqOX7KGLrCsc,179 -smartystreets_python_sdk/us_zipcode/__pycache__/__init__.cpython-311.pyc,, -smartystreets_python_sdk/us_zipcode/__pycache__/alternate_county.cpython-311.pyc,, -smartystreets_python_sdk/us_zipcode/__pycache__/city.cpython-311.pyc,, -smartystreets_python_sdk/us_zipcode/__pycache__/client.cpython-311.pyc,, -smartystreets_python_sdk/us_zipcode/__pycache__/lookup.cpython-311.pyc,, -smartystreets_python_sdk/us_zipcode/__pycache__/result.cpython-311.pyc,, -smartystreets_python_sdk/us_zipcode/__pycache__/zipcode.cpython-311.pyc,, -smartystreets_python_sdk/us_zipcode/alternate_county.py,sha256=j1ya-Dosx_ZbxBE9reTHK23meavitEsH2FpzIa5o-qE,353 -smartystreets_python_sdk/us_zipcode/city.py,sha256=0SAnjWOli2t38wsQSSb28JkdSTMWctWToMljeiIXYzw,411 -smartystreets_python_sdk/us_zipcode/client.py,sha256=9UJzNvk7BM3DC00wltIdmDyLA-0fHsSiguceES_jcDo,2205 -smartystreets_python_sdk/us_zipcode/lookup.py,sha256=SYlMExfKS9clDrDOdE7RX69XAUK3yjPeIIQ_gfBvXDQ,687 -smartystreets_python_sdk/us_zipcode/result.py,sha256=HZiLJ6xmJ6jdFwNCmBJDPA4uH5kNHIjpZ2Rj2cCw4Io,938 -smartystreets_python_sdk/us_zipcode/zipcode.py,sha256=gHJAv6nObkKi8hdcRgOgEfTOazEmXB6uAFr2rWhbqao,852 -smartystreets_python_sdk_version/__init__.py,sha256=eg7m4JO8kxAXocPAUQeVPe5xu-pqJTMYPbp39lRhkL4,122 -smartystreets_python_sdk_version/__pycache__/__init__.cpython-311.pyc,, diff --git a/smarty/smartystreets_python_sdk-6.1.0.dist-info/REQUESTED b/smarty/smartystreets_python_sdk-6.1.0.dist-info/REQUESTED deleted file mode 100644 index e69de29..0000000 diff --git a/smarty/smartystreets_python_sdk-6.1.0.dist-info/WHEEL b/smarty/smartystreets_python_sdk-6.1.0.dist-info/WHEEL deleted file mode 100644 index 14a883f..0000000 --- a/smarty/smartystreets_python_sdk-6.1.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: setuptools (82.0.1) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/smarty/smartystreets_python_sdk-6.1.0.dist-info/licenses/LICENSE.md b/smarty/smartystreets_python_sdk-6.1.0.dist-info/licenses/LICENSE.md deleted file mode 100644 index 6611688..0000000 --- a/smarty/smartystreets_python_sdk-6.1.0.dist-info/licenses/LICENSE.md +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright Smarty - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/smarty/smartystreets_python_sdk-6.1.0.dist-info/top_level.txt b/smarty/smartystreets_python_sdk-6.1.0.dist-info/top_level.txt deleted file mode 100644 index 6368c2c..0000000 --- a/smarty/smartystreets_python_sdk-6.1.0.dist-info/top_level.txt +++ /dev/null @@ -1,2 +0,0 @@ -smartystreets_python_sdk -smartystreets_python_sdk_version diff --git a/smarty/summary/__init__.py b/smarty/summary/__init__.py new file mode 100644 index 0000000..433fb78 --- /dev/null +++ b/smarty/summary/__init__.py @@ -0,0 +1,63 @@ +MESSAGE_MATCH = 'Match' +MESSAGE_MATCH_WITH_EXCEPTION = 'Match With Exceptions' +MESSAGE_NO_MATCH = 'No Match' + +ENHANCED_NO_MATCH = 'none' +ENHANCED_POSTAL_MATCH = 'postal-match' +ENHANCED_NON_POSTAL_MATCH = 'non-postal-match' +ENHANCED_MISSING_SECONDARY = 'missing-secondary' +ENHANCED_UNKNOWN_SECONDARY = 'unknown-secondary' +ENHANCED_IGNORED_INPUT = 'ignored-input' + +DPV_MILITARY_MATCH = 'F1' +DPV_BOX_NUMBER_MISSING = 'P1' +DPV_CONFIRMED_PMB = 'RR' +DPV_CONFIRMED_WITHOUT_PMB = 'R1' +DPV_PHANTOM_CARRIER_ROUTE = 'R7' +DPV_UNIQUE_ZIP_CODE = 'U1' +DPV_TRAILING_ALPHA = 'TA' + +_dpv_exception_set = { + DPV_MILITARY_MATCH, + DPV_BOX_NUMBER_MISSING, + DPV_CONFIRMED_PMB, + DPV_CONFIRMED_WITHOUT_PMB, + DPV_PHANTOM_CARRIER_ROUTE, + DPV_UNIQUE_ZIP_CODE, + DPV_TRAILING_ALPHA, +} + + +def _has_dpv_footnote_exceptions(dpv_footnotes: str) -> bool: + if dpv_footnotes is None: + return False + return any(dpv_footnotes[i:i+2] in _dpv_exception_set for i in range(0, len(dpv_footnotes) - 1, 2)) + + +def _enhanced_match_summary(enhanced_match: str, dpv_footnotes: str) -> str: + is_postal_match = False + has_enhanced_exception = False + for val in enhanced_match.split(','): + if val in (ENHANCED_POSTAL_MATCH, ENHANCED_NON_POSTAL_MATCH): + is_postal_match = True + elif val in (ENHANCED_MISSING_SECONDARY, ENHANCED_UNKNOWN_SECONDARY, ENHANCED_IGNORED_INPUT): + has_enhanced_exception = True + if not is_postal_match: + return MESSAGE_NO_MATCH + if has_enhanced_exception or _has_dpv_footnote_exceptions(dpv_footnotes): + return MESSAGE_MATCH_WITH_EXCEPTION + return MESSAGE_MATCH + + +def _dpv_match_code_summary(dpv_match_code: str, dpv_footnotes: str) -> str: + if dpv_match_code == 'Y': + return MESSAGE_MATCH_WITH_EXCEPTION if _has_dpv_footnote_exceptions(dpv_footnotes) else MESSAGE_MATCH + if dpv_match_code in ('S', 'D'): + return MESSAGE_MATCH_WITH_EXCEPTION + return MESSAGE_NO_MATCH + + +def summary(enhanced_match: str, dpv_match_code: str, dpv_footnotes: str) -> str: + if enhanced_match: + return _enhanced_match_summary(enhanced_match, dpv_footnotes) + return _dpv_match_code_summary(dpv_match_code, dpv_footnotes) diff --git a/vendor.sh b/vendor.sh index 634ba2a..a97e456 100755 --- a/vendor.sh +++ b/vendor.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -# Updates the vendored Smarty SDK inside the plugin directory. +# Updates the vendored Smarty SDK and summary library inside the plugin directory. # Usage: ./vendor.sh -# After running, commit the updated smartystreets_python_sdk* directories. +# After running, commit the updated vendored directories. set -euo pipefail PLUGIN_DIR="smarty" @@ -11,11 +11,15 @@ rm -rf "$PLUGIN_DIR/smartystreets_python_sdk" rm -rf "$PLUGIN_DIR/smartystreets_python_sdk_version" rm -rf "$PLUGIN_DIR"/smartystreets_python_sdk-*.dist-info -# Install SDK without transitive deps — requests is bundled with QGIS's Python +# Remove old vendored summary artifacts +rm -rf "$PLUGIN_DIR/summary" +rm -rf "$PLUGIN_DIR"/summary-*.dist-info + +# Install libraries without transitive deps — requests is bundled with QGIS's Python pip install -r requirements.txt --target "$PLUGIN_DIR" --no-deps --upgrade # Remove bytecode cache that pip may have left behind find "$PLUGIN_DIR" -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true find "$PLUGIN_DIR" -name "*.pyc" -delete 2>/dev/null || true -echo "Done. Commit the updated smartystreets_python_sdk* directories." +echo "Done. Commit the updated vendored directories."