minor code fix: remove duplicate type check branch (#22536)

This commit is contained in:
NeatGuyCoding 2025-07-17 13:20:31 +08:00 committed by GitHub
parent e4ae1e2b94
commit c3037c5491
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1 additions and 4 deletions

View File

@ -91,8 +91,6 @@ class SegmentType(StrEnum):
return SegmentType.OBJECT return SegmentType.OBJECT
elif isinstance(value, File): elif isinstance(value, File):
return SegmentType.FILE return SegmentType.FILE
elif isinstance(value, str):
return SegmentType.STRING
else: else:
return None return None

View File

@ -152,7 +152,6 @@ class VariablePool(BaseModel):
self.variable_dictionary[selector[0]] = {} self.variable_dictionary[selector[0]] = {}
return return
key, hash_key = self._selector_to_keys(selector) key, hash_key = self._selector_to_keys(selector)
hash_key = hash(tuple(selector[1:]))
self.variable_dictionary[key].pop(hash_key, None) self.variable_dictionary[key].pop(hash_key, None)
def convert_template(self, template: str, /): def convert_template(self, template: str, /):

View File

@ -376,7 +376,7 @@ class TestSegmentDumpAndLoad:
f"get_segment_discriminator failed for serialized form of type {type(variable)}" f"get_segment_discriminator failed for serialized form of type {type(variable)}"
) )
def test_invlaid_value_for_discriminator(self): def test_invalid_value_for_discriminator(self):
# Test invalid cases # Test invalid cases
assert get_segment_discriminator({"value_type": "invalid"}) is None assert get_segment_discriminator({"value_type": "invalid"}) is None
assert get_segment_discriminator({}) is None assert get_segment_discriminator({}) is None