| {"repo": "pimoroni/inky", "pull_number": 24, "instance_id": "pimoroni__inky-24", "issue_numbers": "", "base_commit": "5f70ca8db69d8bcea79cb5faf1f0d59f358d555e", "patch": "diff --git a/library/inky/eeprom.py b/library/inky/eeprom.py\n--- a/library/inky/eeprom.py\n+++ b/library/inky/eeprom.py\n@@ -4,7 +4,7 @@\n \n import datetime\n import struct\n-import smbus\n+from smbus2 import SMBus\n \n EEP_ADRESS = 0x50\n EEP_WP = 12\n@@ -95,7 +95,7 @@ def get_color(self):\n def read_eeprom():\n \"\"\"Return a class representing EEPROM contents, or none.\"\"\"\n try:\n- i2c = smbus.SMBus(1)\n+ i2c = SMBus(1)\n i2c.write_i2c_block_data(EEP_ADRESS, 0x00, [0x00])\n return EPDType.from_bytes(i2c.read_i2c_block_data(0x50, 0, 29))\n except IOError:\ndiff --git a/library/inky/inky.py b/library/inky/inky.py\n--- a/library/inky/inky.py\n+++ b/library/inky/inky.py\n@@ -13,7 +13,7 @@\n sys.exit('This library requires the RPi.GPIO module\\nInstall with: sudo apt install python-rpi.gpio')\n \n try:\n- import smbus\n+ from smbus2 import SMBus\n except ImportError:\n sys.exit('This library requires the SMBus module\\nInstall with: sudo apt install python-smbus')\n \ndiff --git a/library/setup.py b/library/setup.py\n--- a/library/setup.py\n+++ b/library/setup.py\n@@ -53,5 +53,5 @@\n py_modules=[],\n packages=['inky'],\n include_package_data=True,\n- install_requires=['numpy', 'spidev', 'RPi.GPIO']\n+ install_requires=['numpy', 'spidev', 'RPi.GPIO', 'smbus2']\n )\n", "test_patch": "diff --git a/library/tests/test_init.py b/library/tests/test_init.py\n--- a/library/tests/test_init.py\n+++ b/library/tests/test_init.py\n@@ -9,8 +9,8 @@ def mockery():\n sys.modules['RPi'] = mock.Mock()\n sys.modules['RPi.GPIO'] = mock.Mock()\n sys.modules['spidev'] = mock.Mock()\n- sys.modules['smbus'] = mock.Mock()\n- sys.modules['smbus'].SMBus = MockSMBus\n+ sys.modules['smbus2'] = mock.Mock()\n+ sys.modules['smbus2'].SMBus = MockSMBus\n \n \n def test_init_phat_black():\n", "problem_statement": "", "hints_text": "", "created_at": "2019-03-03T02:30:46Z"} | |