Skip to content

Commit 1626718

Browse files
nkpro2000srbessman
authored andcommitted
added DeprecationWarning
1 parent 63aacd8 commit 1626718

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

PSL/Peripherals.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import print_function
2+
from warnings import warn
23
import PSL.commands_proto as CP
34
import numpy as np
45
import time
@@ -394,7 +395,7 @@ def __retrievebuffer__(self):
394395
'''
395396
Fetch data acquired by the I2C scope. refer to :func:`__captureStart__`
396397
'''
397-
total_int_samples = self.total_bytes / 2
398+
total_int_samples = self.total_bytes // 2
398399
DATA_SPLITTING = 500
399400
print('fetchin samples : ', total_int_samples, ' split', DATA_SPLITTING)
400401
data = b''
@@ -525,56 +526,57 @@ class I2C(I2CMaster, I2CSlave): # for backwards compatibility
525526
def __init__(self, H):
526527
I2CMaster.__init__(self, H)
527528
I2CSlave.__init__(self, H, None)
529+
warn('I2C is deprecated; use I2CMaster and I2CSlave', DeprecationWarning)
528530

529-
def start(self, address, rw):
531+
def start(self, address, rw): # nosec
530532
self.address = address
531533
return super().start(rw)
532-
533-
def restart(self, address, rw):
534+
535+
def restart(self, address, rw): # nosec
534536
self.address = address
535537
return super().restart(rw)
536538

537-
def simpleRead(self, address, numbytes):
539+
def simpleRead(self, address, numbytes): # nosec
538540
self.address = address
539541
return super().simpleRead(numbytes)
540542

541-
def simple_read_byte(self, address):
543+
def simple_read_byte(self, address): # nosec
542544
self.address = address
543545
return super().simple_read_byte()
544546

545-
def simple_read_int(self, address):
547+
def simple_read_int(self, address): # nosec
546548
self.address = address
547549
return super().simple_read_int()
548550

549-
def simple_read_long(self, address):
551+
def simple_read_long(self, address): # nosec
550552
self.address = address
551553
return super().simple_read_long()
552554

553-
def readBulk(self, device_address, register_address, bytes_to_read):
555+
def readBulk(self, device_address, register_address, bytes_to_read): # nosec
554556
self.address = device_address
555557
return super().readBulk(register_address, bytes_to_read)
556558

557-
def read_bulk_byte(self, device_address, register_address):
559+
def read_bulk_byte(self, device_address, register_address): # nosec
558560
self.address = device_address
559561
return super().read_bulk_byte(register_address)
560562

561-
def read_bulk_int(self, device_address, register_address):
563+
def read_bulk_int(self, device_address, register_address): # nosec
562564
self.address = device_address
563565
return super().read_bulk_int(register_address)
564566

565-
def read_bulk_long(self, device_address, register_address):
567+
def read_bulk_long(self, device_address, register_address): # nosec
566568
self.address = device_address
567569
return super().read_bulk_long(register_address)
568570

569-
def writeBulk(self, device_address, bytestream):
571+
def writeBulk(self, device_address, bytestream): # nosec
570572
self.address = device_address
571573
return super().writeBulk(bytestream)
572574

573-
def __captureStart__(self, address, location, sample_length, total_samples, tg):
575+
def __captureStart__(self, address, location, sample_length, total_samples, tg): # nosec
574576
self.address = address
575577
return super().__captureStart__(location, sample_length, total_samples, tg)
576578

577-
def capture(self, address, location, sample_length, total_samples, tg, *args):
579+
def capture(self, address, location, sample_length, total_samples, tg, *args): # nosec
578580
self.address = address
579581
return super().capture(location, sample_length, total_samples, tg, *args)
580582

tests/test_peripherals_i2c.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
import pytest
33

44
from PSL import commands_proto as CP
5-
from PSL.Peripherals import I2CMaster, I2CSlave, I2C
5+
from PSL.Peripherals import I2CMaster, I2CSlave
66
from PSL.packet_handler import Handler
77

88
ADDRESS = 0X52
99
REGISTER_ADDRESS = 0x06
1010

1111
class MockHandler(Handler):
12-
def connect(self, *args, **kwargs):
12+
def connect(
13+
self, port: str = None, baudrate: int = 1000000, timeout: float = 1.0,
14+
):
1315
pass
1416

1517
@pytest.fixture

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy