Various string cleanups (#30435)
* Remove some unnecessary string concatenations * Replace some simple str.formats with f-strings * Replace some string concatenations with f-strings
This commit is contained in:
1 parent
5ad209c6fd
commit
fa4fa30461
105 files changed
+241
-314
No files matched your search
+5
-11
@@ -712,18 +712,14 @@ class State:
|
||||
|
||||
if not valid_entity_id(entity_id) and not temp_invalid_id_bypass:
|
||||
raise InvalidEntityFormatError(
|
||||
(
|
||||
"Invalid entity id encountered: {}. "
|
||||
"Format should be <domain>.<object_id>"
|
||||
).format(entity_id)
|
||||
f"Invalid entity id encountered: {entity_id}. "
|
||||
"Format should be <domain>.<object_id>"
|
||||
)
|
||||
|
||||
if not valid_state(state):
|
||||
raise InvalidStateError(
|
||||
(
|
||||
"Invalid state encountered for entity id: {}. "
|
||||
"State max length is 255 characters."
|
||||
).format(entity_id)
|
||||
f"Invalid state encountered for entity id: {entity_id}. "
|
||||
"State max length is 255 characters."
|
||||
)
|
||||
|
||||
self.entity_id = entity_id.lower()
|
||||
@@ -1034,9 +1030,7 @@ class ServiceCall:
|
||||
self.domain, self.service, self.context.id, util.repr_helper(self.data)
|
||||
)
|
||||
|
||||
return "<ServiceCall {}.{} (c:{})>".format(
|
||||
self.domain, self.service, self.context.id
|
||||
)
|
||||
return f"<ServiceCall {self.domain}.{self.service} (c:{self.context.id})>"
|
||||
|
||||
|
||||
class ServiceRegistry:
|
||||
|
||||
Reference in new issue
Block a user