From 024efc03b62c8a43fe78abc8aa3b2f398f6dbc35 Mon Sep 17 00:00:00 2001 From: dherrada Date: Mon, 9 Mar 2020 17:22:16 -0400 Subject: [PATCH 1/2] Ran black, made pylint 2.x compatible --- .github/workflows/build.yml | 6 +- .pylintrc | 2 +- adafruit_azureiot.py | 77 ++++++++--------- docs/conf.py | 112 ++++++++++++++----------- examples/azureiot_device_management.py | 10 ++- examples/azureiot_devicetwin.py | 18 ++-- examples/azureiot_simpletest.py | 18 ++-- setup.py | 53 +++++------- 8 files changed, 158 insertions(+), 138 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11ce574..fff3aa9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,9 +34,13 @@ jobs: with: repository: adafruit/actions-ci-circuitpython-libs path: actions-ci - - name: Install deps + - name: Install dependencies + # (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.) run: | source actions-ci/install.sh + - name: Pip install pylint, black, & Sphinx + run: | + pip install --force-reinstall pylint==1.9.2 black==19.10b0 Sphinx sphinx-rtd-theme - name: Library version run: git describe --dirty --always --tags - name: PyLint diff --git a/.pylintrc b/.pylintrc index 039eaec..d8f0ee8 100644 --- a/.pylintrc +++ b/.pylintrc @@ -52,7 +52,7 @@ confidence= # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" # disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call -disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error +disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option diff --git a/adafruit_azureiot.py b/adafruit_azureiot.py index 625c472..f78d5d6 100644 --- a/adafruit_azureiot.py +++ b/adafruit_azureiot.py @@ -42,14 +42,16 @@ __version__ = "0.0.0-auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT.git" -AZ_API_VER = "2018-06-30" # Azure URI API Version Identifier -AZURE_HTTP_ERROR_CODES = [400, 401, 404, 403, 412, 429, 500] # Azure HTTP Status Codes +AZ_API_VER = "2018-06-30" # Azure URI API Version Identifier +AZURE_HTTP_ERROR_CODES = [400, 401, 404, 403, 412, 429, 500] # Azure HTTP Status Codes + class IOT_Hub: """ Provides access to a Microsoft Azure IoT Hub. https://docs.microsoft.com/en-us/rest/api/iothub/ """ + def __init__(self, wifi_manager, iot_hub_name, sas_token, device_id): """ Creates an instance of an Azure IoT Hub Client. :param wifi_manager: WiFiManager object from ESPSPI_WiFiManager. @@ -58,14 +60,14 @@ def __init__(self, wifi_manager, iot_hub_name, sas_token, device_id): :param str device_id: Unique Azure IoT Device Identifier. """ _wifi_type = str(type(wifi_manager)) - if 'ESPSPI_WiFiManager' in _wifi_type: + if "ESPSPI_WiFiManager" in _wifi_type: self._wifi = wifi_manager else: raise TypeError("This library requires a WiFiManager object.") self._iot_hub_url = "https://{0}.azure-devices.net".format(iot_hub_name) self._sas_token = sas_token self._device_id = device_id - self._azure_header = {"Authorization":self._sas_token} + self._azure_header = {"Authorization": self._sas_token} @property def device_id(self): @@ -97,19 +99,20 @@ def get_hub_message(self): """ reject_message = True # get a device-bound notification - path = "{0}/devices/{1}/messages/deviceBound?api-version={2}".format(self._iot_hub_url, - self._device_id, - AZ_API_VER) + path = "{0}/devices/{1}/messages/deviceBound?api-version={2}".format( + self._iot_hub_url, self._device_id, AZ_API_VER + ) data = self._get(path, is_c2d=True) - if data == 204: # device's message queue is empty + if data == 204: # device's message queue is empty return None - etag = data[1]['etag'] - if etag: # either complete or nack the message + etag = data[1]["etag"] + if etag: # either complete or nack the message reject_message = False path_complete = "{0}/devices/{1}/messages/deviceBound/{2}?api-version={3}".format( - self._iot_hub_url, self._device_id, etag.strip('\'"'), AZ_API_VER) + self._iot_hub_url, self._device_id, etag.strip("'\""), AZ_API_VER + ) if reject_message: - path_complete += '&reject' + path_complete += "&reject" del_status = self._delete(path_complete) if del_status == 204: return data[0] @@ -120,16 +123,18 @@ def send_device_message(self, message): """Sends a device-to-cloud message. :param string message: Message to send to Azure IoT. """ - path = "{0}/devices/{1}/messages/events?api-version={2}".format(self._iot_hub_url, - self._device_id, AZ_API_VER) + path = "{0}/devices/{1}/messages/events?api-version={2}".format( + self._iot_hub_url, self._device_id, AZ_API_VER + ) self._post(path, message, return_response=False) # Device Twin def get_device_twin(self): """Returns the device's device twin information in JSON format. """ - path = "{0}/twins/{1}?api-version={2}".format(self._iot_hub_url, - self._device_id, AZ_API_VER) + path = "{0}/twins/{1}?api-version={2}".format( + self._iot_hub_url, self._device_id, AZ_API_VER + ) return self._get(path) def update_device_twin(self, properties): @@ -137,16 +142,18 @@ def update_device_twin(self, properties): :param str properties: Device Twin Properties (https://docs.microsoft.com/en-us/rest/api/iothub/service/updatetwin#twinproperties) """ - path = "{0}/twins/{1}?api-version={2}".format(self._iot_hub_url, - self._device_id, AZ_API_VER) + path = "{0}/twins/{1}?api-version={2}".format( + self._iot_hub_url, self._device_id, AZ_API_VER + ) return self._patch(path, properties) def replace_device_twin(self, properties): """Replaces tags and desired properties of a device twin. :param str properties: Device Twin Properties. """ - path = "{0}/twins/{1}?api-version-{2}".format(self._iot_hub_url, - self._device_id, AZ_API_VER) + path = "{0}/twins/{1}?api-version-{2}".format( + self._iot_hub_url, self._device_id, AZ_API_VER + ) return self._put(path, properties) # IoT Hub Service @@ -160,8 +167,9 @@ def get_device(self): """Gets device information from the identity registry of an IoT Hub. """ - path = "{0}/devices/{1}?api-version={2}".format(self._iot_hub_url, - self._device_id, AZ_API_VER) + path = "{0}/devices/{1}?api-version={2}".format( + self._iot_hub_url, self._device_id, AZ_API_VER + ) return self._get(path) # HTTP Helper Methods @@ -170,10 +178,7 @@ def _post(self, path, payload, return_response=True): :param str path: Formatted Azure IOT Hub Path. :param str payload: JSON-formatted Data Payload. """ - response = self._wifi.post( - path, - json=payload, - headers=self._azure_header) + response = self._wifi.post(path, json=payload, headers=self._azure_header) self._parse_http_status(response.status_code, response.reason) if return_response: return response.json() @@ -184,9 +189,7 @@ def _get(self, path, is_c2d=False): :param str path: Formatted Azure IOT Hub Path. :param bool is_c2d: Cloud-to-device get request. """ - response = self._wifi.get( - path, - headers=self._azure_header) + response = self._wifi.get(path, headers=self._azure_header) status_code = response.status_code if is_c2d: if status_code == 200: @@ -205,12 +208,10 @@ def _delete(self, path, etag=None): :param str path: Formatted Azure IOT Hub Path. """ if etag: - data_headers = {"Authorization":self._sas_token, "If-Match":'"%s"'%etag} + data_headers = {"Authorization": self._sas_token, "If-Match": '"%s"' % etag} else: data_headers = self._azure_header - response = self._wifi.delete( - path, - headers=data_headers) + response = self._wifi.delete(path, headers=data_headers) self._parse_http_status(response.status_code, response.reason) status_code = response.status_code response.close() @@ -221,10 +222,7 @@ def _patch(self, path, payload): :param str path: Formatted Azure IOT Hub Path. :param str payload: JSON-formatted payload. """ - response = self._wifi.patch( - path, - json=payload, - headers=self._azure_header) + response = self._wifi.patch(path, json=payload, headers=self._azure_header) self._parse_http_status(response.status_code, response.reason) json_data = response.json() response.close() @@ -235,10 +233,7 @@ def _put(self, path, payload=None): :param str path: Formatted Azure IOT Hub Path. :param str payload: JSON-formatted payload. """ - response = self._wifi.put( - path, - json=payload, - headers=self._azure_header) + response = self._wifi.put(path, json=payload, headers=self._azure_header) self._parse_http_status(response.status_code, response.reason) json_data = response.json() response.close() diff --git a/docs/conf.py b/docs/conf.py index e88b191..bef783e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,7 +2,8 @@ import os import sys -sys.path.insert(0, os.path.abspath('..')) + +sys.path.insert(0, os.path.abspath("..")) # -- General configuration ------------------------------------------------ @@ -10,10 +11,10 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.intersphinx', - 'sphinx.ext.napoleon', - 'sphinx.ext.todo', + "sphinx.ext.autodoc", + "sphinx.ext.intersphinx", + "sphinx.ext.napoleon", + "sphinx.ext.todo", ] # TODO: Please Read! @@ -23,29 +24,32 @@ # autodoc_mock_imports = ["digitalio", "busio"] -intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)} +intersphinx_mapping = { + "python": ("https://docs.python.org/3.4", None), + "CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None), +} # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] -source_suffix = '.rst' +source_suffix = ".rst" # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'Adafruit AzureIoT Library' -copyright = u'2019 Brent Rubell' -author = u'Brent Rubell' +project = "Adafruit AzureIoT Library" +copyright = "2019 Brent Rubell" +author = "Brent Rubell" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u'1.0' +version = "1.0" # The full version, including alpha/beta/rc tags. -release = u'1.0' +release = "1.0" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -57,7 +61,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"] # The reST default role (used for this markup: `text`) to use for all # documents. @@ -69,7 +73,7 @@ add_function_parentheses = True # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False @@ -84,59 +88,62 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -on_rtd = os.environ.get('READTHEDOCS', None) == 'True' +on_rtd = os.environ.get("READTHEDOCS", None) == "True" if not on_rtd: # only import and set the theme if we're building docs locally try: import sphinx_rtd_theme - html_theme = 'sphinx_rtd_theme' - html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.'] + + html_theme = "sphinx_rtd_theme" + html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."] except: - html_theme = 'default' - html_theme_path = ['.'] + html_theme = "default" + html_theme_path = ["."] else: - html_theme_path = ['.'] + html_theme_path = ["."] # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # The name of an image file (relative to this directory) to use as a favicon of # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # -html_favicon = '_static/favicon.ico' +html_favicon = "_static/favicon.ico" # Output file base name for HTML help builder. -htmlhelp_basename = 'AdafruitAzureiotLibrarydoc' +htmlhelp_basename = "AdafruitAzureiotLibrarydoc" # -- Options for LaTeX output --------------------------------------------- latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'AdafruitAzureIoTLibrary.tex', u'AdafruitAzureIoT Library Documentation', - author, 'manual'), + ( + master_doc, + "AdafruitAzureIoTLibrary.tex", + "AdafruitAzureIoT Library Documentation", + author, + "manual", + ), ] # -- Options for manual page output --------------------------------------- @@ -144,8 +151,13 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'AdafruitAzureIoTlibrary', u'Adafruit AzureIoT Library Documentation', - [author], 1) + ( + master_doc, + "AdafruitAzureIoTlibrary", + "Adafruit AzureIoT Library Documentation", + [author], + 1, + ) ] # -- Options for Texinfo output ------------------------------------------- @@ -154,7 +166,13 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'AdafruitAzureIoTLibrary', u'Adafruit AzureIoT Library Documentation', - author, 'AdafruitAzureIoTLibrary', 'One line description of project.', - 'Miscellaneous'), + ( + master_doc, + "AdafruitAzureIoTLibrary", + "Adafruit AzureIoT Library Documentation", + author, + "AdafruitAzureIoTLibrary", + "One line description of project.", + "Miscellaneous", + ), ] diff --git a/examples/azureiot_device_management.py b/examples/azureiot_device_management.py index 18a2c80..28fed04 100644 --- a/examples/azureiot_device_management.py +++ b/examples/azureiot_device_management.py @@ -23,13 +23,17 @@ esp32_reset = DigitalInOut(board.D5) spi = busio.SPI(board.SCK, board.MOSI, board.MISO) esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset) -status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards +status_light = neopixel.NeoPixel( + board.NEOPIXEL, 1, brightness=0.2 +) # Uncomment for Most Boards """Uncomment below for ItsyBitsy M4""" -#status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2) +# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2) wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light) # Create an instance of the Azure IoT Hub -hub = IOT_Hub(wifi, secrets['azure_iot_hub'], secrets['azure_iot_sas'], secrets['device_id']) +hub = IOT_Hub( + wifi, secrets["azure_iot_hub"], secrets["azure_iot_sas"], secrets["device_id"] +) # Enumerate all devices on an Azure IoT Hub all_hub_devices = hub.get_devices() diff --git a/examples/azureiot_devicetwin.py b/examples/azureiot_devicetwin.py index 6430e19..40d8757 100644 --- a/examples/azureiot_devicetwin.py +++ b/examples/azureiot_devicetwin.py @@ -23,25 +23,31 @@ esp32_reset = DigitalInOut(board.D5) spi = busio.SPI(board.SCK, board.MOSI, board.MISO) esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset) -status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards +status_light = neopixel.NeoPixel( + board.NEOPIXEL, 1, brightness=0.2 +) # Uncomment for Most Boards """Uncomment below for ItsyBitsy M4""" -#status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2) +# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2) wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light) # Create an instance of the Azure IoT Hub -hub = IOT_Hub(wifi, secrets['azure_iot_hub'], secrets['azure_iot_sas'], secrets['device_id']) +hub = IOT_Hub( + wifi, secrets["azure_iot_hub"], secrets["azure_iot_sas"], secrets["device_id"] +) # Get a Device Twin device_twin = hub.get_device_twin() # Filter out the device's name from the twin's properties -device_name = device_twin['properties']['desired']['deviceName'] +device_name = device_twin["properties"]["desired"]["deviceName"] print(device_name) # Update a Device Twin's Properties -data = {"properties":{"desired": {"deviceName": "{{BasementTemperatureLoggerFeather}}"}}} +data = { + "properties": {"desired": {"deviceName": "{{BasementTemperatureLoggerFeather}}"}} +} hub.update_device_twin(data) # And read the updated device twin information device_twin = hub.get_device_twin() -device_name = device_twin['properties']['desired']['deviceName'] +device_name = device_twin["properties"]["desired"]["deviceName"] print(device_name) diff --git a/examples/azureiot_simpletest.py b/examples/azureiot_simpletest.py index a2c8f8b..87910f5 100644 --- a/examples/azureiot_simpletest.py +++ b/examples/azureiot_simpletest.py @@ -24,26 +24,30 @@ esp32_reset = DigitalInOut(board.D5) spi = busio.SPI(board.SCK, board.MOSI, board.MISO) esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset) -status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards +status_light = neopixel.NeoPixel( + board.NEOPIXEL, 1, brightness=0.2 +) # Uncomment for Most Boards """Uncomment below for ItsyBitsy M4""" -#status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2) +# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2) wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light) # Create an instance of the Azure IoT Hub -hub = IOT_Hub(wifi, secrets['azure_iot_hub'], secrets['azure_iot_sas'], secrets['device_id']) +hub = IOT_Hub( + wifi, secrets["azure_iot_hub"], secrets["azure_iot_sas"], secrets["device_id"] +) # Send a Device-to-Cloud message -print('Sending Data to Azure IoT Hub...') +print("Sending Data to Azure IoT Hub...") data = randint(0, 100) hub.send_device_message(str(data)) -print('Data Sent!') +print("Data Sent!") # Receive a Cloud-to-Device message # NOTE: HTTP Cloud-to-Device messages are HEAVILY throttled over HTTP. # Microsoft suggests a polling interval of the below code for every 25 minutes. -print('Receiving a message from an Azure IoT Hub...') +print("Receiving a message from an Azure IoT Hub...") message = hub.get_hub_message() if message is None: - print('IoT Hub Message Queue is empty!') + print("IoT Hub Message Queue is empty!") else: print(message) diff --git a/setup.py b/setup.py index 430c025..9505c57 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,7 @@ """ from setuptools import setup, find_packages + # To use a consistent encoding from codecs import open from os import path @@ -13,52 +14,40 @@ here = path.abspath(path.dirname(__file__)) # Get the long description from the README file -with open(path.join(here, 'README.rst'), encoding='utf-8') as f: +with open(path.join(here, "README.rst"), encoding="utf-8") as f: long_description = f.read() setup( - name='adafruit-circuitpython-azureiot', - + name="adafruit-circuitpython-azureiot", use_scm_version=True, - setup_requires=['setuptools_scm'], - - description='Access to Microsoft Azure IoT from CircuitPython', + setup_requires=["setuptools_scm"], + description="Access to Microsoft Azure IoT from CircuitPython", long_description=long_description, - long_description_content_type='text/x-rst', - + long_description_content_type="text/x-rst", # The project's main homepage. - url='https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT', - + url="https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT", # Author details - author='Adafruit Industries', - author_email='circuitpython@adafruit.com', - - install_requires=[ - 'Adafruit-Blinka', - 'Adafruit_CircuitPython_ESP32SPI' - ], - + author="Adafruit Industries", + author_email="circuitpython@adafruit.com", + install_requires=["Adafruit-Blinka", "Adafruit_CircuitPython_ESP32SPI"], # Choose your license - license='MIT', - + license="MIT", # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Libraries', - 'Topic :: System :: Hardware', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries", + "Topic :: System :: Hardware", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", ], - # What does your project relate to? - keywords='adafruit blinka circuitpython micropython azureiot azure, iot, device, services', - + keywords="adafruit blinka circuitpython micropython azureiot azure, iot, device, services", # You can just specify the packages manually here if your project is # simple. Or you can use find_packages(). # TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER, # CHANGE `py_modules=['...']` TO `packages=['...']` - py_modules=['adafruit_azureiot'], + py_modules=["adafruit_azureiot"], ) From db11331bf6ac7bced2893a0425ced606d8a79cfb Mon Sep 17 00:00:00 2001 From: dherrada Date: Mon, 9 Mar 2020 19:10:39 -0400 Subject: [PATCH 2/2] Updated pylint to latest version --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fff3aa9..97fe64d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,7 @@ jobs: source actions-ci/install.sh - name: Pip install pylint, black, & Sphinx run: | - pip install --force-reinstall pylint==1.9.2 black==19.10b0 Sphinx sphinx-rtd-theme + pip install pylint black==19.10b0 Sphinx sphinx-rtd-theme - name: Library version run: git describe --dirty --always --tags - name: PyLint