Skip to content

Commit

Permalink
move db module back to be more backwards compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
gijzelaerr committed Jul 4, 2024
1 parent c3b6254 commit e6373b3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from db_layouts import tank_rc_if_db_layout

from snap7 import Client, Row, DB
from snap7.db import print_row
from util.db import print_row

client = Client()
client.connect("192.168.200.24", 0, 3)
Expand Down
2 changes: 1 addition & 1 deletion example/write_multi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ctypes
import snap7
from snap7.types import Area, S7DataItem, WordLen
from snap7.db import set_int, set_real, get_int, get_real, get_s5time
from util.db import set_int, set_real, get_int, get_real, get_s5time


client = snap7.client.Client()
Expand Down
2 changes: 1 addition & 1 deletion snap7/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .server import Server
from .logo import Logo
from .partner import Partner
from .db import Row, DB
from .util.db import Row, DB
from .types import Area, Block, WordLen, SrvEvent, SrvArea

__all__ = ["Client", "Server", "Logo", "Partner", "Row", "DB", "Area", "Block", "WordLen", "SrvEvent", "SrvArea"]
Expand Down
2 changes: 1 addition & 1 deletion snap7/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def write_area(self, area: Area, db_number: int, start: int, data: bytearray) ->
Snap7 error code.
Exmaple:
>>> from db import DB
>>> from util.db import DB
>>> import snap7
>>> client = snap7.client.Client()
>>> client.connect("192.168.0.1", 0, 0)
Expand Down
2 changes: 1 addition & 1 deletion snap7/db.py → snap7/util/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,4 +745,4 @@ def read(self, client: Client) -> None:


# backwards compatible alias
DBRow = Row
DB_Row = Row
4 changes: 1 addition & 3 deletions tests/test_mainloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

import snap7.error
import snap7.server
import snap7.db
from snap7.db import get_bool, get_dint, get_dword, get_int, get_real, get_sint, get_string, get_usint, get_word
from snap7.util import get_bool, get_dint, get_dword, get_int, get_real, get_sint, get_string, get_usint, get_word
from snap7.client import Client
import snap7.types

logging.basicConfig(level=logging.WARNING)

Expand Down

0 comments on commit e6373b3

Please sign in to comment.