Skip to content

Commit ba425bd

Browse files
authored
fix docs (#544)
* fix docs * try to fix indentation warnings * that doesnt belong here * increase timeout * fix warnings * fix mypy warning * wait longer
1 parent afde3fe commit ba425bd

File tree

6 files changed

+56
-52
lines changed

6 files changed

+56
-52
lines changed

.github/workflows/doc.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@ jobs:
1717
- name: Set up Python
1818
uses: actions/setup-python@v5
1919
with:
20-
python-version: 3.9
20+
python-version: 3.12
2121
- name: Install dependencies
2222
run: |
2323
python3 -m venv venv
2424
venv/bin/pip install --upgrade pip
2525
venv/bin/pip install ".[doc,cli]"
2626
- name: Run doc
27-
run: |
28-
source venv/bin/activate
29-
cd doc
30-
make html
27+
run: venv/bin/sphinx-build -N -bhtml doc/ doc/_build -W

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ venv/bin/pytest: venv/
1616
venv/bin/pip install -e ".[test]"
1717

1818
venv/bin/sphinx-build: venv/
19-
venv/bin/pip install -e ".[doc]"
19+
venv/bin/pip install -e ".[doc,cli]"
2020

2121
venv/bin/tox: venv/
2222
venv/bin/pip install tox
@@ -29,7 +29,7 @@ setup: venv/installed
2929

3030
.PHONY: doc
3131
doc: venv/bin/sphinx-build
32-
cd doc && make html
32+
venv/bin/sphinx-build -N -bhtml doc/ doc/_build
3333

3434
.PHONY: check
3535
check: venv/bin/pytest

requirements-dev.txt

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,29 @@
55
# 'tox -e requirements-dev'
66
#
77

8-
alabaster==0.7.16
8+
alabaster==1.0.0
99
# via sphinx
1010
apeye==1.4.1
1111
# via sphinx-toolbox
1212
apeye-core==1.1.5
1313
# via apeye
14-
autodocsumm==0.2.12
14+
autodocsumm==0.2.14
1515
# via sphinx-toolbox
16-
babel==2.15.0
16+
babel==2.16.0
1717
# via sphinx
1818
beautifulsoup4==4.12.3
1919
# via sphinx-toolbox
2020
cachecontrol[filecache]==0.14.0
2121
# via sphinx-toolbox
22-
cachetools==5.3.3
22+
cachetools==5.5.0
2323
# via tox
24-
certifi==2024.7.4
25-
# via requests
24+
certifi==2024.8.30
25+
# via
26+
# requests
27+
# sphinx-prompt
2628
chardet==5.2.0
2729
# via tox
28-
charset-normalizer==3.3.2
30+
charset-normalizer==3.4.0
2931
# via requests
3032
click==8.1.7
3133
# via python-snap7 (pyproject.toml)
@@ -35,9 +37,9 @@ cssutils==2.11.1
3537
# via dict2css
3638
dict2css==0.3.0.post1
3739
# via sphinx-toolbox
38-
distlib==0.3.8
40+
distlib==0.3.9
3941
# via virtualenv
40-
docutils==0.20.1
42+
docutils==0.21.2
4143
# via
4244
# sphinx
4345
# sphinx-prompt
@@ -52,20 +54,21 @@ domdf-python-tools==3.9.0
5254
# sphinx-toolbox
5355
enum-tools[sphinx]==0.12.0
5456
# via python-snap7 (pyproject.toml)
55-
exceptiongroup==1.2.1
57+
exceptiongroup==1.2.2
5658
# via pytest
57-
filelock==3.15.4
59+
filelock==3.16.1
5860
# via
5961
# cachecontrol
6062
# sphinx-toolbox
6163
# tox
6264
# virtualenv
6365
html5lib==1.1
6466
# via sphinx-toolbox
65-
idna==3.7
67+
idna==3.10
6668
# via
6769
# apeye-core
6870
# requests
71+
# sphinx-prompt
6972
imagesize==1.4.1
7073
# via sphinx
7174
iniconfig==2.0.0
@@ -76,17 +79,17 @@ jinja2==3.1.4
7679
# sphinx-jinja2-compat
7780
markdown-it-py==3.0.0
7881
# via rich
79-
markupsafe==2.1.5
82+
markupsafe==3.0.2
8083
# via
8184
# jinja2
8285
# sphinx-jinja2-compat
8386
mdurl==0.1.2
8487
# via markdown-it-py
85-
more-itertools==10.3.0
88+
more-itertools==10.5.0
8689
# via cssutils
87-
msgpack==1.0.8
90+
msgpack==1.1.0
8891
# via cachecontrol
89-
mypy==1.10.1
92+
mypy==1.13.0
9093
# via python-snap7 (pyproject.toml)
9194
mypy-extensions==1.0.0
9295
# via mypy
@@ -98,7 +101,7 @@ packaging==24.1
98101
# pytest
99102
# sphinx
100103
# tox
101-
platformdirs==4.2.2
104+
platformdirs==4.3.6
102105
# via
103106
# apeye
104107
# tox
@@ -114,30 +117,30 @@ pygments==2.18.0
114117
# sphinx
115118
# sphinx-prompt
116119
# sphinx-tabs
117-
pyproject-api==1.7.1
120+
pyproject-api==1.8.0
118121
# via tox
119-
pytest==8.2.2
122+
pytest==8.3.3
120123
# via python-snap7 (pyproject.toml)
121124
requests==2.32.3
122125
# via
123126
# apeye
124127
# cachecontrol
125128
# sphinx
126-
rich==13.7.1
129+
rich==13.9.4
127130
# via python-snap7 (pyproject.toml)
128131
ruamel-yaml==0.18.6
129132
# via sphinx-toolbox
130-
ruamel-yaml-clib==0.2.8
133+
ruamel-yaml-clib==0.2.12
131134
# via ruamel-yaml
132-
ruff==0.5.1
135+
ruff==0.7.2
133136
# via python-snap7 (pyproject.toml)
134137
six==1.16.0
135138
# via html5lib
136139
snowballstemmer==2.2.0
137140
# via sphinx
138-
soupsieve==2.5
141+
soupsieve==2.6
139142
# via beautifulsoup4
140-
sphinx==7.3.7
143+
sphinx==8.1.3
141144
# via
142145
# autodocsumm
143146
# enum-tools
@@ -148,58 +151,62 @@ sphinx==7.3.7
148151
# sphinx-tabs
149152
# sphinx-toolbox
150153
# sphinxcontrib-jquery
151-
sphinx-autodoc-typehints==2.2.2
154+
sphinx-autodoc-typehints==2.5.0
152155
# via sphinx-toolbox
153156
sphinx-jinja2-compat==0.3.0
154157
# via
155158
# enum-tools
156159
# sphinx-toolbox
157-
sphinx-prompt==1.8.0
160+
sphinx-prompt==1.9.0
158161
# via sphinx-toolbox
159-
sphinx-rtd-theme==2.0.0
162+
sphinx-rtd-theme==3.0.1
160163
# via python-snap7 (pyproject.toml)
161164
sphinx-tabs==3.4.5
162165
# via sphinx-toolbox
163-
sphinx-toolbox==3.7.0
166+
sphinx-toolbox==3.8.1
164167
# via enum-tools
165-
sphinxcontrib-applehelp==1.0.8
168+
sphinxcontrib-applehelp==2.0.0
166169
# via sphinx
167-
sphinxcontrib-devhelp==1.0.6
170+
sphinxcontrib-devhelp==2.0.0
168171
# via sphinx
169-
sphinxcontrib-htmlhelp==2.0.5
172+
sphinxcontrib-htmlhelp==2.1.0
170173
# via sphinx
171174
sphinxcontrib-jquery==4.1
172175
# via sphinx-rtd-theme
173176
sphinxcontrib-jsmath==1.0.1
174177
# via sphinx
175-
sphinxcontrib-qthelp==1.0.7
178+
sphinxcontrib-qthelp==2.0.0
176179
# via sphinx
177-
sphinxcontrib-serializinghtml==1.1.10
180+
sphinxcontrib-serializinghtml==2.0.0
178181
# via sphinx
179182
tabulate==0.9.0
180183
# via sphinx-toolbox
181-
tomli==2.0.1
184+
tomli==2.0.2
182185
# via
183186
# mypy
184187
# pyproject-api
185188
# pytest
186189
# sphinx
187190
# tox
188-
tox==4.16.0
191+
tox==4.23.2
189192
# via python-snap7 (pyproject.toml)
190193
types-click==7.1.8
191194
# via python-snap7 (pyproject.toml)
192-
types-setuptools==70.2.0.20240704
195+
types-setuptools==75.2.0.20241025
193196
# via python-snap7 (pyproject.toml)
194197
typing-extensions==4.12.2
195198
# via
196199
# domdf-python-tools
197200
# enum-tools
198201
# mypy
202+
# rich
199203
# sphinx-toolbox
200-
urllib3==2.2.2
201-
# via requests
202-
virtualenv==20.26.3
204+
# tox
205+
urllib3==2.2.3
206+
# via
207+
# requests
208+
# sphinx-prompt
209+
virtualenv==20.27.1
203210
# via tox
204211
webencodings==0.5.1
205212
# via html5lib

snap7/util/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def make_rows(self) -> None:
315315
if key and key in self.index:
316316
msg = f"{key} not unique!"
317317
logger.error(msg)
318-
self.index[key] = row
318+
self.index[str(key)] = row
319319

320320
def __getitem__(self, key: str, default: Optional[None] = None) -> Union[None, "Row"]:
321321
"""Access a row of the table through its index.

snap7/util/getters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ def get_char(bytearray_: bytearray, byte_index: int) -> str:
636636
>>> from snap7 import Client
637637
>>> data = Client().db_read(db_number=1, start=10, size=1)
638638
>>> get_char(data, 0)
639-
C
639+
'C'
640640
"""
641641
char = chr(bytearray_[byte_index])
642642
return char
@@ -659,7 +659,7 @@ def get_wchar(bytearray_: bytearray, byte_index: int) -> str:
659659
>>> from snap7 import Client
660660
>>> data = Client().db_read(db_number=1, start=10, size=2)
661661
>>> get_wchar(data, 0)
662-
C
662+
'C'
663663
"""
664664
if bytearray_[byte_index] == 0:
665665
return chr(bytearray_[1])

tests/test_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ def test_get_param(self) -> None:
382382
self.assertRaises(Exception, self.client.get_param, non_client)
383383

384384
def test_as_copy_ram_to_rom(self) -> None:
385-
response = self.client.as_copy_ram_to_rom(timeout=1)
386-
self.client.wait_as_completion(1100)
385+
response = self.client.as_copy_ram_to_rom(timeout=2)
386+
self.client.wait_as_completion(2000)
387387
self.assertEqual(0, response)
388388

389389
def test_as_ct_read(self) -> None:
@@ -714,7 +714,7 @@ def test_as_tm_write(self) -> None:
714714

715715
def test_copy_ram_to_rom(self) -> None:
716716
# Cli_CopyRamToRom
717-
self.assertEqual(0, self.client.copy_ram_to_rom(timeout=1))
717+
self.assertEqual(0, self.client.copy_ram_to_rom(timeout=2))
718718

719719
def test_ct_read(self) -> None:
720720
# Cli_CTRead

0 commit comments

Comments
 (0)