Skip to content

Commit ee68f24

Browse files
committed
Add readability improvements (PIE)
1 parent 371469d commit ee68f24

9 files changed

Lines changed: 9 additions & 18 deletions

File tree

ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ select = [
1919
"I", # isort
2020
"F8", # pyflakes: undefined/unused names
2121
"F4", # pyflakes: imports/__future__
22+
"PIE", # small readability improvements
2223
]
2324

2425
# TODO: Revisit these
@@ -32,7 +33,6 @@ ignore = [
3233
"A", # prevent shadowing of python builtins
3334
"FIX", # prevent the creation of T0DO / F1XME comments
3435
# Checked, need manual work:
35-
"PIE", # small readability improvements
3636
"PYI", # typing best practices
3737
# Evaluate if we want to use:
3838
"S", # security related precautions

sdk/basyx/aas/adapter/aasx.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ def add_file(self, name: str, file: IO[bytes], content_type: str) -> str:
958958
:return: The file name as stored in the SupplementaryFileContainer. Typically, ``name`` or a modified version of
959959
``name`` to resolve conflicts.
960960
"""
961-
pass # pragma: no cover
961+
# pragma: no cover
962962

963963
@abc.abstractmethod
964964
def get_content_type(self, name: str) -> str:
@@ -969,7 +969,7 @@ def get_content_type(self, name: str) -> str:
969969
:return: The file's content_type
970970
:raises KeyError: If no file with this name is stored
971971
"""
972-
pass # pragma: no cover
972+
# pragma: no cover
973973

974974
@abc.abstractmethod
975975
def get_sha256(self, name: str) -> bytes:
@@ -982,7 +982,7 @@ def get_sha256(self, name: str) -> bytes:
982982
:return: The file content's sha256 hash sum
983983
:raises KeyError: If no file with this name is stored
984984
"""
985-
pass # pragma: no cover
985+
# pragma: no cover
986986

987987
@abc.abstractmethod
988988
def write_file(self, name: str, file: IO[bytes]) -> None:
@@ -993,28 +993,28 @@ def write_file(self, name: str, file: IO[bytes]) -> None:
993993
:param file: A binary file-like object with write() method to write the file contents into
994994
:raises KeyError: If no file with this name is stored
995995
"""
996-
pass # pragma: no cover
996+
# pragma: no cover
997997

998998
@abc.abstractmethod
999999
def delete_file(self, name: str) -> None:
10001000
"""
10011001
Deletes a file from this SupplementaryFileContainer given its name.
10021002
"""
1003-
pass # pragma: no cover
1003+
# pragma: no cover
10041004

10051005
@abc.abstractmethod
10061006
def __contains__(self, item: str) -> bool:
10071007
"""
10081008
Check if a file with the given name is stored in this SupplementaryFileContainer.
10091009
"""
1010-
pass # pragma: no cover
1010+
# pragma: no cover
10111011

10121012
@abc.abstractmethod
10131013
def __iter__(self) -> Iterator[str]:
10141014
"""
10151015
Return an iterator over all file names stored in this SupplementaryFileContainer.
10161016
"""
1017-
pass # pragma: no cover
1017+
# pragma: no cover
10181018

10191019

10201020
class DictSupplementaryFileContainer(AbstractSupplementaryFileContainer):

sdk/basyx/aas/adapter/json/json_deserialization.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,6 @@ class StrictStrippedAASFromJsonDecoder(
10241024
Non-failsafe decoder for stripped JSON objects.
10251025
"""
10261026

1027-
pass
10281027

10291028

10301029
def _select_decoder(

sdk/basyx/aas/adapter/xml/xml_deserialization.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,6 @@ class StrictStrippedAASFromXmlDecoder(
16391639
Non-failsafe decoder for stripped XML elements.
16401640
"""
16411641

1642-
pass
16431642

16441643

16451644
def _parse_xml_document(

sdk/basyx/aas/backend/couchdb.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,14 +583,12 @@ class CouchDBError(Exception):
583583
class CouchDBConnectionError(CouchDBError):
584584
"""Exception raised when the CouchDB server could not be reached"""
585585

586-
pass
587586

588587

589588
class CouchDBResponseError(CouchDBError):
590589
"""Exception raised by when an HTTP of the CouchDB server could not be handled (e.g.
591590
no JSON body)"""
592591

593-
pass
594592

595593

596594
class CouchDBServerError(CouchDBError):
@@ -606,4 +604,3 @@ def __init__(self, code: int, error: str, reason: str, *args):
606604
class CouchDBConflictError(CouchDBError):
607605
"""Exception raised when an object could not be committed due to a concurrent modification in the database"""
608606

609-
pass

sdk/basyx/aas/model/datatypes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ class HexBinary(bytearray):
276276
class Float(float):
277277
"""A 32bit IEEE754 float. This can not be represented with Python"""
278278

279-
pass
280279

281280

282281
class Long(int):

sdk/basyx/aas/model/provider.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class AbstractObjectProvider(Generic[_KEY, _VALUE], metaclass=abc.ABCMeta):
4141
@abc.abstractmethod
4242
def get_item(self, key: _KEY) -> _VALUE:
4343
"""Retrieve the item or raise a KeyError."""
44-
pass
4544

4645
def get(self, key: _KEY, default: Optional[_VALUE] = None) -> Optional[_VALUE]:
4746
"""Retrieve the item or return a default value."""

sdk/basyx/aas/util/identification.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def generate_id(self, proposal: Optional[str] = None) -> model.Identifier:
4141
fragment of an IRI). It may be ignored by some implementations of or be changed if the
4242
resulting id is already existing.
4343
"""
44-
pass
4544

4645

4746
class UUIDGenerator(AbstractIdentifierGenerator):
@@ -148,7 +147,7 @@ def generate_id(self, proposal: Optional[str] = None) -> model.Identifier:
148147
]
149148
}
150149
# Remove ASCII control characters
151-
_iri_segment_quote_table_tmpl.update({i: None for i in range(0, 0x1F)})
150+
_iri_segment_quote_table_tmpl.update({i: None for i in range(0x1F)})
152151
_iri_segment_quote_table_tmpl[0x7F] = None
153152
_iri_segment_quote_table: Dict[int, Optional[str]] = str.maketrans(
154153
_iri_segment_quote_table_tmpl

server/app/adapter/jsonization.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ class ServerStrictStrippedAASFromJsonDecoder(ServerStrictAASFromJsonDecoder, Ser
203203
Non-failsafe decoder for stripped JSON objects.
204204
"""
205205

206-
pass
207206

208207

209208
class ServerAASToJsonEncoder(AASToJsonEncoder):

0 commit comments

Comments
 (0)