Skip to content

Commit bef804b

Browse files
authored
Merge pull request #2811 from DimitriPapadopoulos/codespell
Fix typos
2 parents b1d9021 + 4a28307 commit bef804b

16 files changed

+32
-32
lines changed

docs/CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This release is API compatible but contains a major internal change in the HTTP
1313
the fetcher at Updater initialization and explicitly depending on requests
1414
* ngclient: TLS certificate source was changed. Certificates now come from operating
1515
system certificate store instead of `certifi` (#2762)
16-
* Test infrastucture has improved and should now be more usable externally, e.g. in
16+
* Test infrastructure has improved and should now be more usable externally, e.g. in
1717
distro test suites (#2749)
1818

1919
## v5.1.0
@@ -789,7 +789,7 @@ Note: This is a backwards-incompatible pre-release.
789789
* Minor bug fixes, such as catching correct type and number of exceptions,
790790
detection of slow retrieval attack, etc.
791791

792-
* Do not list Root's hash and lenth in Snapshot (only its version number).
792+
* Do not list Root's hash and length in Snapshot (only its version number).
793793

794794
* Allow user to configure hashing algorithm used to generate hashed bin delegations.
795795

docs/_posts/2022-05-04-ngclient-design.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ We recently released a new TUF client implementation, `ngclient`, in Python-TUF.
77

88
# Simpler implementation, "correct" abstractions
99

10-
The legacy code had a few problems that could be summarized as non-optimal abstractions: Significant effort had been put to code re-use, but not enough attention had been paid to ensure the expectations and promises of that shared code were the same in all cases of re-use. This combined with Pythons type ambiguity, use of dictionaries as "blob"-like data structures and extensive use of global state meant touching the shared functions was a gamble: there was no way to be sure something wouldn't break.
10+
The legacy code had a few problems that could be summarized as non-optimal abstractions: Significant effort had been put to code reuse, but not enough attention had been paid to ensure the expectations and promises of that shared code were the same in all cases of reuse. This combined with Pythons type ambiguity, use of dictionaries as "blob"-like data structures and extensive use of global state meant touching the shared functions was a gamble: there was no way to be sure something wouldn't break.
1111

1212
During the redesign, we really concentrated on finding abstractions that fit the processes we wanted to implement. It may be worth mentioning that in some cases this meant abstractions that have no equivalent in the TUF specification: some of the issues in the legacy implementation look like the result of mapping the TUF specifications [_Detailed client workflow_](https://theupdateframework.github.io/specification/latest/#detailed-client-workflow) directly into code.
1313

examples/manual_repo/hashed_bin_delegation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'repository_lib'. (see ADR-0010 for details about repository library design)
88
99
Contents:
10-
- Re-usable hash bin delegation helpers
10+
- Reusable hash bin delegation helpers
1111
- Basic hash bin delegation example
1212
1313
See 'basic_repo.py' for a more comprehensive TUF metadata API example.
@@ -133,7 +133,7 @@ def find_hash_bin(path: str) -> str:
133133
# Keys
134134
# ----
135135
# Given that the primary concern of hash bin delegation is to reduce network
136-
# overhead, it is acceptable to re-use one signing key for all delegated
136+
# overhead, it is acceptable to reuse one signing key for all delegated
137137
# targets roles (bin-n). However, we do use a different key for the delegating
138138
# targets role (bins). Considering the high responsibility but also low
139139
# volatility of the bins role, it is recommended to require signature

tests/simple_server.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import socketserver
99
from http.server import SimpleHTTPRequestHandler
1010

11-
# Allow re-use so you can re-run tests as often as you want even if the
12-
# tests re-use ports. Otherwise TCP TIME-WAIT prevents reuse for ~1 minute
11+
# Allow reuse so you can re-run tests as often as you want even if the
12+
# tests reuse ports. Otherwise TCP TIME-WAIT prevents reuse for ~1 minute
1313
socketserver.TCPServer.allow_reuse_address = True
1414

1515
httpd = socketserver.TCPServer(("localhost", 0), SimpleHTTPRequestHandler)

tests/test_api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_generic_read(self) -> None:
105105
(Timestamp.type, Timestamp),
106106
(Targets.type, Targets),
107107
]:
108-
# Load JSON-formatted metdata of each supported type from file
108+
# Load JSON-formatted metadata of each supported type from file
109109
# and from out-of-band read JSON string
110110
path = os.path.join(self.repo_dir, "metadata", metadata + ".json")
111111
md_obj = Metadata.from_file(path)
@@ -181,7 +181,7 @@ def test_to_from_bytes(self) -> None:
181181
with open(path, "rb") as f:
182182
metadata_bytes = f.read()
183183
md_obj = Metadata.from_bytes(metadata_bytes)
184-
# Comparate that from_bytes/to_bytes doesn't change the content
184+
# Compare that from_bytes/to_bytes doesn't change the content
185185
# for two cases for the serializer: noncompact and compact.
186186

187187
# Case 1: test noncompact by overriding the default serializer.

tests/test_examples.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def tearDown(self) -> None:
4848
def _run_script_and_assert_files(
4949
self, script_name: str, filenames_created: list[str]
5050
) -> None:
51-
"""Run script in exmple dir and assert that it created the
51+
"""Run script in example dir and assert that it created the
5252
files corresponding to the passed filenames inside a 'tmp*' test dir at
5353
CWD."""
5454
script_path = str(self.repo_examples_dir / script_name)

tests/test_metadata_eq_.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
)
2828

2929

30-
class TestMetadataComparisions(unittest.TestCase):
30+
class TestMetadataComparisons(unittest.TestCase):
3131
"""Test __eq__ for all classes inside tuf/api/metadata.py."""
3232

3333
metadata: ClassVar[dict[str, bytes]]

tests/test_repository.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_do_snapshot_after_snapshot_key_change(self) -> None:
209209
self.assertEqual(2, snapshot_versions[-1].signed.version)
210210

211211
def test_do_timestamp(self) -> None:
212-
# Expect no-op because snpashot has not changed and timestamp is still valid
212+
# Expect no-op because snapshot has not changed and timestamp is still valid
213213
created, _ = self.repo.do_timestamp()
214214

215215
self.assertFalse(created)

tests/test_trusted_metadata_set.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,17 @@ def test_update_metadata_output(self) -> None:
152152
)
153153
snapshot = self.trusted_set.update_snapshot(self.metadata["snapshot"])
154154
targets = self.trusted_set.update_targets(self.metadata["targets"])
155-
delegeted_targets_1 = self.trusted_set.update_delegated_targets(
155+
delegated_targets_1 = self.trusted_set.update_delegated_targets(
156156
self.metadata["role1"], "role1", "targets"
157157
)
158-
delegeted_targets_2 = self.trusted_set.update_delegated_targets(
158+
delegated_targets_2 = self.trusted_set.update_delegated_targets(
159159
self.metadata["role2"], "role2", "role1"
160160
)
161161
self.assertIsInstance(timestamp, Timestamp)
162162
self.assertIsInstance(snapshot, Snapshot)
163163
self.assertIsInstance(targets, Targets)
164-
self.assertIsInstance(delegeted_targets_1, Targets)
165-
self.assertIsInstance(delegeted_targets_2, Targets)
164+
self.assertIsInstance(delegated_targets_1, Targets)
165+
self.assertIsInstance(delegated_targets_2, Targets)
166166

167167
def test_out_of_order_ops(self) -> None:
168168
# Update snapshot before timestamp
@@ -193,7 +193,7 @@ def test_out_of_order_ops(self) -> None:
193193

194194
self.trusted_set.update_targets(self.metadata[Targets.type])
195195

196-
# Update snapshot after sucessful targets update
196+
# Update snapshot after successful targets update
197197
with self.assertRaises(RuntimeError):
198198
self.trusted_set.update_snapshot(self.metadata[Snapshot.type])
199199

tests/test_updater_delegation_graphs.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def test_hash_bins_graph_traversal(
399399
) -> None:
400400
"""Test that delegated roles are traversed in the order of appearance
401401
in the delegator's metadata, using pre-order depth-first search and that
402-
they correctly reffer to the corresponding hash bin prefixes"""
402+
they correctly refer to the corresponding hash bin prefixes"""
403403

404404
try:
405405
exp_files = [*TOP_LEVEL_ROLE_NAMES, *test_data.visited_order]
@@ -440,37 +440,37 @@ class SuccinctRolesTestCase:
440440
# In each test case target_path is a path to a random target we want to
441441
# fetch and expected_target_bin is the bin we are expecting to visit.
442442
succinct_bins_graph = {
443-
"bin amount = 2, taget bin index 0": SuccinctRolesTestCase(
443+
"bin amount = 2, target bin index 0": SuccinctRolesTestCase(
444444
bit_length=1,
445445
target_path="boo",
446446
expected_target_bin="bin-0",
447447
),
448-
"bin amount = 2, taget bin index 1": SuccinctRolesTestCase(
448+
"bin amount = 2, target bin index 1": SuccinctRolesTestCase(
449449
bit_length=1,
450450
target_path="too",
451451
expected_target_bin="bin-1",
452452
),
453-
"bin amount = 4, taget bin index 0": SuccinctRolesTestCase(
453+
"bin amount = 4, target bin index 0": SuccinctRolesTestCase(
454454
bit_length=2,
455455
target_path="foo",
456456
expected_target_bin="bin-0",
457457
),
458-
"bin amount = 4, taget bin index 1": SuccinctRolesTestCase(
458+
"bin amount = 4, target bin index 1": SuccinctRolesTestCase(
459459
bit_length=2,
460460
target_path="doo",
461461
expected_target_bin="bin-1",
462462
),
463-
"bin amount = 4, taget bin index 2": SuccinctRolesTestCase(
463+
"bin amount = 4, target bin index 2": SuccinctRolesTestCase(
464464
bit_length=2,
465465
target_path="too",
466466
expected_target_bin="bin-2",
467467
),
468-
"bin amount = 4, taget bin index 3": SuccinctRolesTestCase(
468+
"bin amount = 4, target bin index 3": SuccinctRolesTestCase(
469469
bit_length=2,
470470
target_path="bar",
471471
expected_target_bin="bin-3",
472472
),
473-
"bin amount = 256, taget bin index fc": SuccinctRolesTestCase(
473+
"bin amount = 256, target bin index fc": SuccinctRolesTestCase(
474474
bit_length=8,
475475
target_path="bar",
476476
expected_target_bin="bin-fc",

tests/test_updater_key_rotations.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_root_rotation(self, root_versions: list[MdVersion]) -> None:
209209
MdVersion(keys=[2], threshold=1, sigs=[1, 3, 4], res=UnsignedMetadataError),
210210
"3-of-5, one key signature wrong: not signed with 3 expected keys":
211211
MdVersion(keys=[0, 1, 3, 4, 5], threshold=3, sigs=[0, 2, 4], res=UnsignedMetadataError),
212-
"2-of-5, one key signature mising: threshold not reached":
212+
"2-of-5, one key signature missing: threshold not reached":
213213
MdVersion(keys=[0, 1, 3, 4, 5], threshold=3, sigs=[0, 4], res=UnsignedMetadataError),
214214
"3-of-5, sign first combo":
215215
MdVersion(keys=[0, 1, 2, 3, 4], threshold=3, sigs=[0, 2, 4]),

tests/test_updater_top_level_update.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ def test_expired_metadata(self) -> None:
820820
- Repository bumps snapshot and targets to v2 on day 0
821821
- Timestamp v2 expiry set to day 21
822822
- Second updater refresh performed on day 18,
823-
it is successful and timestamp/snaphot final versions are v2"""
823+
it is successful and timestamp/snapshot final versions are v2"""
824824

825825
now = datetime.datetime.now(timezone.utc)
826826
self.sim.timestamp.expires = now + datetime.timedelta(days=7)

tests/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def _start_redirect_thread(self) -> None:
261261
@staticmethod
262262
def _log_queue_worker(stream: IO, line_queue: queue.Queue) -> None:
263263
"""
264-
Worker function to run in a seprate thread.
264+
Worker function to run in a separate thread.
265265
Reads from 'stream', puts lines in a Queue (Queue is thread-safe).
266266
"""
267267

@@ -356,7 +356,7 @@ def clean(self) -> None:
356356
Calls flush_log to check for logged information, but not yet flushed.
357357
"""
358358

359-
# If there is anything logged, flush it before closing the resourses.
359+
# If there is anything logged, flush it before closing the resources.
360360
self.flush_log()
361361

362362
self._kill_server_process()

tuf/api/exceptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class DownloadHTTPError(DownloadError):
6363
Returned by FetcherInterface implementations for HTTP errors.
6464
6565
Args:
66-
message: The HTTP error messsage
66+
message: The HTTP error message
6767
status_code: The HTTP status code
6868
"""
6969

tuf/ngclient/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class UpdaterConfig:
2929
Args:
3030
max_root_rotations: Maximum number of root rotations.
3131
max_delegations: Maximum number of delegations.
32-
root_max_length: Maxmimum length of a root metadata file.
32+
root_max_length: Maximum length of a root metadata file.
3333
timestamp_max_length: Maximum length of a timestamp metadata file.
3434
snapshot_max_length: Maximum length of a snapshot metadata file.
3535
targets_max_length: Maximum length of a targets metadata file.

tuf/ngclient/updater.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Updater:
9090
download both metadata and targets. Default is ``Urllib3Fetcher``
9191
config: ``Optional``; ``UpdaterConfig`` could be used to setup common
9292
configuration options.
93-
bootstrap: ``Optional``; initial root metadata. A boostrap root should
93+
bootstrap: ``Optional``; initial root metadata. A bootstrap root should
9494
always be provided. If it is not, the current root.json in the
9595
metadata cache is used as the initial root.
9696

0 commit comments

Comments
 (0)