diff --git a/docs/_static/favicon.ico.license b/docs/_static/favicon.ico.license index 5e0b36f..dd06ad6 100644 --- a/docs/_static/favicon.ico.license +++ b/docs/_static/favicon.ico.license @@ -1,4 +1,3 @@ SPDX-FileCopyrightText: 2023 Immaterial SPDX-License-Identifier: CC-BY-4.0 - diff --git a/docs/conf.py b/docs/conf.py index 1eb6ef9..5abd85e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - # SPDX-FileCopyrightText: 2023 Jose D. Montoya # # SPDX-License-Identifier: MIT @@ -16,8 +14,8 @@ from mock import Mock to_be_mocked = [ - 'micropython', - 'machine', + "micropython", + "machine", ] for module in to_be_mocked: sys.modules[module] = Mock() @@ -32,7 +30,6 @@ extensions = [ "sphinx.ext.autodoc", "sphinx.ext.intersphinx", - "sphinx.ext.napoleon", "sphinx.ext.viewcode", "sphinx_immaterial", ] @@ -203,61 +200,3 @@ # These paths are either relative to html_static_path # or fully qualified paths (eg. https://...) html_css_files = ["extra_css.css"] - - -# -- 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', -} - -# 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, - "MicroPython_mcp9808_Library.tex", - "MicroPython mcp9808 Library Documentation", - author, - "manual", - ), -] - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ( - master_doc, - "MicroPython_mcp9808_Library", - "MicroPython mcp9808 Library Documentation", - [author], - 1, - ), -] - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - master_doc, - "MicroPython_mcp9808_Library", - "MicroPython mcp9808 Library Documentation", - author, - "MicroPython_mcp9808_Library", - "One line description of project.", - "Miscellaneous", - ), -] diff --git a/docs/index.rst b/docs/index.rst index 96f5fd0..fd980d6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -24,4 +24,4 @@ Table of Contents .. toctree:: :caption: Other Links - Download from GitHub + Download from GitHub diff --git a/examples/mcp9808_hysteresis.py b/examples/mcp9808_hysteresis.py index ba3d8a2..079420d 100644 --- a/examples/mcp9808_hysteresis.py +++ b/examples/mcp9808_hysteresis.py @@ -15,7 +15,7 @@ for hysteresis in mcp9808.hysteresis_values: print("Current Hysteresis setting: ", mcp.hysteresis) for _ in range(10): - temp = mcp.temperature - print("Temperature: {:.2f}C".format(temp)) + print(f"Temperature: {mcp.temperature:.2f}°C") + print() time.sleep(0.5) mcp.hysteresis = hysteresis diff --git a/examples/mcp9808_power_mode.py b/examples/mcp9808_power_mode.py index d504322..86bd6b6 100644 --- a/examples/mcp9808_power_mode.py +++ b/examples/mcp9808_power_mode.py @@ -15,7 +15,7 @@ for power_mode in mcp9808.power_mode_values: print("Current Power mode setting: ", mcp.power_mode) for _ in range(10): - temp = mcp.temperature - print("Temperature: {:.2f}C".format(temp)) + print(f"Temperature: {mcp.temperature:.2f}°C") + print() time.sleep(0.5) mcp.power_mode = power_mode diff --git a/examples/mcp9808_simpletest.py b/examples/mcp9808_simpletest.py index 8b6d779..0210006 100644 --- a/examples/mcp9808_simpletest.py +++ b/examples/mcp9808_simpletest.py @@ -10,6 +10,6 @@ mcp = mcp9808.MCP9808(i2c) while True: - temp = mcp.temperature - print("Temperature: {:.2f}C".format(temp)) + print(f"Temperature: {mcp.temperature:.2f}°C") + print() time.sleep(0.5) diff --git a/examples/mcp9808_temperature_limits.py b/examples/mcp9808_temperature_limits.py index 2e18a48..8fed547 100644 --- a/examples/mcp9808_temperature_limits.py +++ b/examples/mcp9808_temperature_limits.py @@ -14,7 +14,8 @@ mcp.temperature_critical = 35 while True: - print("Temperature: {:.2f}C".format(mcp.temperature)) + print(f"Temperature: {mcp.temperature:.2f}°C") + print() alert_status = mcp.alert_status if alert_status.high_alert: print("Temperature above high set limit!") diff --git a/examples/mcp9808_temperature_resolution.py b/examples/mcp9808_temperature_resolution.py index d3f9264..d44cf27 100644 --- a/examples/mcp9808_temperature_resolution.py +++ b/examples/mcp9808_temperature_resolution.py @@ -15,7 +15,7 @@ for temperature_resolution in mcp9808.temperature_resolution_values: print("Current Temperature resolution setting: ", mcp.temperature_resolution) for _ in range(10): - temp = mcp.temperature - print("Temperature: {:.2f}C".format(temp)) + print(f"Temperature: {mcp.temperature:.2f}°C") + print() time.sleep(0.5) mcp.temperature_resolution = temperature_resolution diff --git a/micropython_mcp9808/i2c_helpers.py b/micropython_mcp9808/i2c_helpers.py index a33dc2b..3e31841 100644 --- a/micropython_mcp9808/i2c_helpers.py +++ b/micropython_mcp9808/i2c_helpers.py @@ -69,7 +69,6 @@ def __get__( obj, objtype=None, ) -> int: - mem_value = obj._i2c.readfrom_mem(obj._address, self.register, self.lenght) reg = 0 @@ -84,7 +83,6 @@ def __get__( return reg def __set__(self, obj, value: int) -> None: - memory_value = obj._i2c.readfrom_mem(obj._address, self.register, self.lenght) reg = 0 @@ -117,7 +115,6 @@ def __get__( obj, objtype=None, ): - if self.lenght <= 2: value = struct.unpack( self.format, diff --git a/micropython_mcp9808/mcp9808.py b/micropython_mcp9808/mcp9808.py index e831e28..472b0c3 100644 --- a/micropython_mcp9808/mcp9808.py +++ b/micropython_mcp9808/mcp9808.py @@ -174,7 +174,6 @@ def temperature(self): @staticmethod def _convert_temperature(temp: bytearray) -> float: - temp[0] = temp[0] & 0x1F if temp[0] & 0x10 == 0x10: temp[0] = temp[0] & 0x0F @@ -195,7 +194,6 @@ def temperature_upper(self, value: int) -> None: self._limit_temperatures(value, _UPPER_TEMP) def _get_temperature(self, register_address): - data = bytearray(2) self._i2c.readfrom_mem_into(self._address, register_address, data) diff --git a/pyproject.toml b/pyproject.toml index 1d819d5..51e2634 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,11 +20,9 @@ authors = [ urls = {Homepage = "https://github.com/jposada202020/MicroPython_MCP9808"} keywords = [ "sensor", - "micropython", "mcp9808", "temperature", "microchip", - "mcp9808", "temperature", "micropython", ]