Skip to content

Commit ed7bb9a

Browse files
Fix typos in code comments, simplify them
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
1 parent 2802010 commit ed7bb9a

File tree

17 files changed

+35
-45
lines changed

17 files changed

+35
-45
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ load-plugins=
4646
# W0141 - Use of builtin functions
4747

4848
#
49-
# For now, priorize Python3 mirgration as the use of pylint (e.g. enconding warnings).
49+
# Disable warnings that are not severe, but warn e.g about missing encoding:
5050
#
5151
disable=W0142,W0703,C0111,R0201,W0603,W0613,W0212,W0141,
5252
bad-option-value, # Skip complaining about suppressions for older option values

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ See <https://github.com/xenserver/python-libs/pull/23> for the context of this e
176176

177177
## Guidelines
178178

179-
Charset encoding/string handling:
179+
Character set encoding/string handling:
180180
See [README-Unicode.md](README-Unicode.md) for details on Unicode support.
181181

182182
## Users

pylint_runner.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@
66
- Markdown Reports for showing them in the GitHub Actions Summary
77
- a pylint.txt for diff-quality to ensure no regressions in diffs.
88
9-
Pylint for Python2 does not support JSONReporter, so this wrapper only supports
10-
the native Python3 checks, not the 2to3 conversion checks selected by the --py3k
11-
options provied only in the Pylint for Python2.
12-
The older pylint-2.16 could be checked if it supports both.
13-
14-
The output for GitHub of this script is fitered for putting the
15-
focus on severen warnings for the Python3 transition, expecially
16-
the encoding warnings are important.
9+
The output for GitHub of this script is filtered for focussing on severe warnings.
10+
Especially, the encoding warnings are important.
1711
1812
On stdout, the format used by GitHub to generate error annotations us used.
1913
These error annotations are shown on the top of the GitHub Action summary page
2014
and are also shown in the diff view at the their code locations.
2115
2216
It also generates a markdown report including two Markdown
23-
tables (one for summary, one with the individual erros)
17+
tables (one for summary, one with the individual errors)
2418
which can be viewed locally and is also shown in the GitHub
2519
Action's Summary Report.
2620
"""
@@ -99,7 +93,7 @@ def cleanup_results_dict(r, sym):
9993
# This is illegal according to:
10094
# https://docs.python.org/3/reference/datamodel.html#object.__hash__
10195
#
102-
# Reference: pylint3 removed the --py3k checker "because the transition is bedind us":
96+
# Reference: pylint3 removed the --py3k checker "because the transition is behind us":
10397
# https://github.com/pylint-dev/pylint/blob/main/pylint/extensions/eq_without_hash.py
10498
#
10599
# But some checks are still useful in python3 after all, and this is the remnant of it.
@@ -147,7 +141,6 @@ def pylint_project(check_dirs: List[str], errorlog: TextIO, branch_url: str):
147141
lineno = r["line"]
148142
# Write errors in the format for diff-quality to check against regressions:
149143
errorlog.write(f"{path}:{lineno}: [{msg_id}({sym}), {r['obj']}] {msg}\n")
150-
# For suggestions to fix existing warnings, be more focussed on serverity:
151144
if not msg:
152145
continue
153146

@@ -214,7 +207,7 @@ def main(dirs: List[str], output_file: str, pylint_logfile: str, branch_url: str
214207
with open(pylint_logfile, "w", encoding="utf-8") as txt_out:
215208
panda_overview, panda_results = pylint_project(dirs, txt_out, branch_url)
216209

217-
# Write the panda dable to a markdown output file:
210+
# Write the panda table to a markdown output file:
218211
summary_file = output_file or os.environ.get("GITHUB_STEP_SUMMARY")
219212
if not summary_file:
220213
return

pytype_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def setup_and_run_pytype_action(scriptname: str):
163163
branch = os.environ.get("GITHUB_HEAD_REF", None) or os.environ.get("GITHUB_REF_NAME", None)
164164
filelink_baseurl = f"{server_url}/{repository}/blob/{branch}"
165165
retcode, results = run_pytype_and_parse_annotations(xfail_files, filelink_baseurl)
166-
# Write the panda dable to a markdown output file:
166+
# Write the panda table to a markdown output file:
167167
summary_file = os.environ.get("GITHUB_STEP_SUMMARY", None)
168168
if summary_file:
169169
with open(summary_file, "w", encoding="utf-8") as fp:

tests/conftest.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ def set_warnings():
2424
2525
One purpose of this fixture that with it, we can globally enable
2626
Development Mode (https://docs.python.org/3/library/devmode.html)
27-
using setenv = PYTHONDEVMODE=yes in tox.int which enables further
27+
using setenv:PYTHONDEVMODE=yes in tox.ini which enables further
2828
run-time checking during tests.
2929
30-
By additionally using setenv = PYTHONWARNINGS=ignore in tox.ini,
31-
we can disabling the Deprecation warnings wihch pytest plugins exhibit
32-
(which we are not interested in, those are not our responsiblity).
33-
and this fixture will still enable the default warning filter to
34-
have e.g. ResourceWarning checks enabled.
30+
Using setenv:PYTHONWARNINGS=ignore in tox.ini, we disable the Deprecation
31+
warnings caused by pytest plugins. This fixture still enable the default
32+
warning filter to have e.g. ResourceWarning checks enabled.
3533
3634
Another nice effect is that also during interactive pytest use, the
3735
default warning filter also provides checking of ResourceWarning:

tests/test_bootloader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_grub2(self):
4848

4949
class TestLinuxBootloader(unittest.TestCase):
5050
def setUp(self):
51-
self.tmpdir = mkdtemp(prefix="testbl")
51+
self.tmpdir = mkdtemp(prefix="test-bootloader")
5252
bootdir = os.path.join(self.tmpdir, "boot")
5353
grubdir = os.path.join(bootdir, "grub")
5454
os.makedirs(grubdir)

tests/test_ifrename_logic.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_newhw_norules_1eth(self):
7777
def test_newhw_norules_2eth(self):
7878
"""
7979
Two previously unrecognised nics, with no other rules. Expecting
80-
them to be renamed to eth0 and 1 respectivly
80+
them to be renamed to eth0 and 1 respectively
8181
"""
8282

8383
eth0 = MACPCI("ab:cd:ef:12:34:56","0000:00:0f.0","side-12-eth1")
@@ -96,7 +96,7 @@ def test_newhw_norules_2eth(self):
9696

9797
def test_newhw_1srule_1eth(self):
9898
"""
99-
One previously unrecognised nic with a static rule refering to it.
99+
One previously unrecognised nic with a static rule referring to it.
100100
Expecting it to be named to eth0 as per the static rule.
101101
"""
102102

@@ -336,7 +336,7 @@ def test_usecase5(self):
336336

337337
def test_CA_94279(self):
338338
"""
339-
CA-94279 occured because the logic did no honour the order paramater
339+
CA-94279 occurred because the logic did no honor the order parameter
340340
from biosdevname if it was the only deciding factor. (It appears rare
341341
for the embedded network cards to have a greater PCI sbdf than the non-
342342
embedded cards)
@@ -528,11 +528,11 @@ def setUp(self):
528528
Set up a lot of MACPCI objects.
529529
530530
This reflection magic creates many self.cXXX objects where XXX
531-
represents the indicies of mac, pci and eth names.
531+
represents the indices of mac, pci and eth names.
532532
e.g. self.c123 means the 1st mac, 2nd pci and 3rd eth
533533
self.c221 means the 2nd mac, 2nd pci and 1st eth
534534
535-
In addition, set up equivelent self.sXXX objects which have a kname
535+
In addition, set up equivalent self.sXXX objects which have a kname
536536
set to None and a tname set to the 'eth'
537537
"""
538538

tests/test_mac.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_colon_too_many_octets(self):
4545
MAC(val)
4646
self.assertFalse(MAC.is_valid(val))
4747

48-
def test_dash_too_few_octetes(self):
48+
def test_dash_too_few_octets(self):
4949
val = "00-00-00-00-00"
5050
with self.assertRaises(ValueError):
5151
MAC(val)
@@ -190,7 +190,7 @@ def test_random(self):
190190
self.assertEqual(mac.as_string("-", True), "15-52-4A-B4-0C-FF")
191191
self.assertEqual(mac.as_string(".", True), "1552.4AB4.0CFF")
192192

193-
class TestCompaisons(unittest.TestCase):
193+
class TestComparisons(unittest.TestCase):
194194

195195
def test_equal(self):
196196

tests/test_sbdfi_to_nic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def check_raises(exc_type, func, sbdfi, nic_list):
3535

3636

3737
def test_sbdf_index():
38-
"""Test all possible uses and xcp.pci.pci_sbdfi_to_nic() and raised Execptions"""
38+
"""Test all possible uses and xcp.pci.pci_sbdfi_to_nic() and raised Exceptions"""
3939
assert pci_sbdfi_to_nic("0000:01:00.0", nics) == nics[0]
4040
assert pci_sbdfi_to_nic("0000:01:00.0[0]", nics) == nics[0]
4141
assert pci_sbdfi_to_nic("0000:01:00.0[1]", nics) == nics[1]

xcp/accessor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,11 @@ def __repr__(self):
395395
return "<HTTPAccessor: %s>" % self.baseAddress
396396

397397

398-
# Tuple passed in tests to isinstanc(val, ...Types) to check types:
398+
# Tuple passed in tests to isinstance(val, ...Types) to check types:
399399
MountingAccessorTypes = (DeviceAccessor, NFSAccessor)
400400
"""Tuple for type checking in unit tests testing subclasses of MountingAccessor"""
401401

402-
# Tuple passed in tests to isinstanc(val, ...Types) to check types:
402+
# Tuple passed in tests to isinstance(val, ...Types) to check types:
403403
LocalTypes = (DeviceAccessor, NFSAccessor, FileAccessor)
404404

405405

0 commit comments

Comments
 (0)