Skip to content

Commit dcbf298

Browse files
committed
Changed .format() to f-strings.
1 parent 186902a commit dcbf298

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

pyVHDLModel/SyntaxModel.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ def UnitName(self) -> str:
920920
return self._unitName
921921

922922
def __str__(self) -> str:
923-
return "{value} {unit}".format(value=self._value, unit=self._unitName)
923+
return f"{self._value} {self._unitName}"
924924

925925

926926
@export
@@ -1021,11 +1021,7 @@ def Operand(self):
10211021
return self._operand
10221022

10231023
def __str__(self) -> str:
1024-
return "{leftOperator}{operand!s}{rightOperator}".format(
1025-
leftOperator=self._FORMAT[0],
1026-
operand=self._operand,
1027-
rightOperator=self._FORMAT[1],
1028-
)
1024+
return f"{self._FORMAT[0]}{self._operand!s}{self._FORMAT[1]}"
10291025

10301026

10311027
@export
@@ -1336,10 +1332,7 @@ def Subtyped(self):
13361332
return self._subtype
13371333

13381334
def __str__(self) -> str:
1339-
return "{subtype}'({operand!s})".format(
1340-
subtype=self._subtype,
1341-
operand=self._operand,
1342-
)
1335+
return f"{self._subtype}'({self._operand!s})"
13431336

13441337

13451338
@export

pyVHDLModel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def Parse(cls, value: Union[int, str]) -> 'Enum':
159159
try:
160160
return cls.__VERSION_MAPPINGS__[value]
161161
except KeyError:
162-
ValueError("Value '{0!s}' cannot be parsed to member of {1}.".format(value, cls.__name__))
162+
ValueError(f"Value '{value!s}' cannot be parsed to member of {cls.__name__}.")
163163

164164
def __lt__(self, other: Any) -> bool:
165165
if isinstance(other, VHDLVersion):

0 commit comments

Comments
 (0)