Skip to content

Commit

Permalink
added link to the issue related to protobuf and pylint, added more lo…
Browse files Browse the repository at this point in the history
…gging
  • Loading branch information
sjpark608 committed Dec 20, 2022
1 parent 7fb08ed commit df3486b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/edgepi/calibration/edgepi_eeprom.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'''Helper class to access on board eeprom'''

# pylint: disable=no-name-in-module
# pylint: disable=no-name-in-module https://github.com/protocolbuffers/protobuf/issues/10372

import logging
import math
Expand All @@ -23,6 +23,7 @@ class EdgePiEEPROM(I2CDevice):

def __init__(self):
self.log = logging.getLogger(__name__)
self.log.info("Initializing EEPROM Access")
self.eeprom_layout = EepromLayout()
super().__init__(self.__dev_path)

Expand Down Expand Up @@ -118,9 +119,9 @@ def sequential_read(self, mem_addr: int = None, length: int = None):
page_addr, byte_addr = self.__byte_address_generation(mem_addr)
mem_addr_list = self.__pack_mem_address(page_addr, byte_addr)
msg = self.set_read_msg(mem_addr_list, [0x00]*length)
self.log.debug(f'Reading Address {mem_addr}, {length} bytes, {msg[1].data}')
self.log.debug(f'Reading Address {mem_addr}, {length} bytes')
read_result = self.transfer(EEPROMInfo.DEV_ADDR.value, msg)
# self.log.debug(f'Read data: {msg[1].data}') TODO: log number of bytes
self.log.debug(f'Read data: {len(msg[1].data)}')
return read_result


Expand Down
2 changes: 1 addition & 1 deletion src/edgepi/calibration/protobuf_mapping.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""module to map protobuf data to a class"""

# pylint: disable=no-name-in-module
# pylint: disable=no-name-in-module https://github.com/protocolbuffers/protobuf/issues/10372
from dataclasses import dataclass
from edgepi.calibration.eeprom_mapping_pb2 import EepromLayout
from edgepi.calibration.calibration_constants import CalibParam
Expand Down
6 changes: 5 additions & 1 deletion src/edgepi/peripherals/i2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
Classes:
I2CDevice
"""
import logging

from typing import Union
from periphery import I2C

_logger = logging.getLogger(__name__)

class I2CDevice():
'''
I2C Device class
'''
def __init__(self, fd: str = None):
self.fd = fd
self.i2cdev = I2C(fd)
_logger.debug(f"Initialized I2C device with path '{self.fd}'")
self.i2cdev = I2C(devpath=fd)

def set_read_msg(self, addr:Union[int,list] = None, msg:list = None):
'''
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'''unit test for access eeprom'''

# pylint: disable=C0413
# pylint: disable=no-name-in-module
# pylint: disable=no-name-in-module https://github.com/protocolbuffers/protobuf/issues/10372

from unittest import mock
import os
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'''unit test for access eeprom'''
# pylint: disable=C0413
# pylint: disable=no-member
# pylint: disable=no-name-in-module
# pylint: disable=no-name-in-module https://github.com/protocolbuffers/protobuf/issues/10372
from unittest import mock
import os
PATH = os.path.dirname(os.path.abspath(__file__))
Expand Down
2 changes: 1 addition & 1 deletion src/test_edgepi/unit_tests/test_dac/test_edgepi_dac.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sys.modules['periphery'] = mock.MagicMock()

# pylint: disable=wrong-import-position
# pylint: disable=no-name-in-module
# pylint: disable=no-name-in-module https://github.com/protocolbuffers/protobuf/issues/10372
# pylint: disable=protected-access

import pytest
Expand Down

0 comments on commit df3486b

Please sign in to comment.