Skip to content

Commit 1236e1e

Browse files
committed
codespell
1 parent 19bbf49 commit 1236e1e

7 files changed

+13
-8
lines changed

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ help:
1212
@echo - make typecheck -- Typecheck
1313
@echo - make venv ------- Create virtual environment
1414

15+
.PHONY: isort
16+
codespell:
17+
@codespell -w cstruct tests examples setup.py
18+
1519
.PHONY: isort
1620
isort:
1721
@isort --profile black cstruct tests examples setup.py
@@ -46,6 +50,6 @@ typecheck:
4650
mypy --strict --no-warn-unused-ignores cstruct
4751

4852
venv:
49-
python3 -m virtualenv .
53+
python3 -m venv . || python3 -m virtualenv .
5054
. bin/activate; pip install -Ur requirements.txt
5155
. bin/activate; pip install -Ur requirements-dev.txt

cstruct/abstract.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ class AbstractCStruct(metaclass=CStructMeta):
8080
__size__: int = 0
8181
" Size in bytes "
8282
__fields__: List[str] = []
83-
" Struct/union fileds "
83+
" Struct/union fields "
8484
__fields_types__: Dict[str, FieldType]
8585
" Dictionary mapping field names to types "
8686
__byte_order__: Optional[str] = None
8787
" Byte order "
8888
__alignment__: int = 0
89-
" Alignament "
89+
" Alignment "
9090
__is_union__: bool = False
9191
" True if the class is an union, False if it is a struct "
9292

@@ -125,7 +125,7 @@ def parse(
125125
__is_union__: True for union, False for struct
126126
127127
Returns:
128-
cls: a new class mapping the defintion
128+
cls: a new class mapping the definition
129129
"""
130130
cls_kargs: Dict[str, Any] = dict(kargs)
131131
if __byte_order__ is not None:

cstruct/c_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def parse_struct(
436436
for nested_field_name, nested_field_type in field_type.ref.__fields_types__.items():
437437
if nested_field_name in fields_types:
438438
raise ParserError(f"Duplicate member `{nested_field_name}`")
439-
# set the corret offset
439+
# set the correct offset
440440
nested_field_type = nested_field_type.copy()
441441
nested_field_type.base_offset = offset + nested_field_type.base_offset
442442
nested_field_type.offset = offset + nested_field_type.offset

cstruct/cstruct.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def unpack_from(self, buffer: Optional[bytes], offset: int = 0, flexible_array_l
4848
Args:
4949
buffer: bytes to be unpacked
5050
offset: optional buffer offset
51-
flexible_array_length: optional flexible array lenght (number of elements)
51+
flexible_array_length: optional flexible array length (number of elements)
5252
"""
5353
self.set_flexible_array_length(flexible_array_length)
5454
if buffer is None:

cstruct/field.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def native_format(self) -> str:
192192
try:
193193
return get_native_type(self.c_type).native_format
194194
except KeyError:
195-
raise ParserError(f"Unknow type `{self.c_type}`")
195+
raise ParserError(f"Unknown type `{self.c_type}`")
196196
elif self.is_enum:
197197
return self.ref.__native_format__
198198
else:

cstruct/mem_cstruct.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def unpack_from(self, buffer: Optional[bytes], offset: int = 0, flexible_array_l
6666
Args:
6767
buffer: bytes to be unpacked
6868
offset: optional buffer offset
69-
flexible_array_length: optional flexible array lenght (number of elements)
69+
flexible_array_length: optional flexible array length (number of elements)
7070
"""
7171
self.set_flexible_array_length(flexible_array_length)
7272
self.__base__ = offset # Base offset

requirements-dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
black
22
build
3+
codespell
34
coverage[toml]
45
flake8
56
isort

0 commit comments

Comments
 (0)