Update base.py

This commit is contained in:
Namhyeon Go 2024-11-12 17:09:40 +09:00 committed by GitHub
parent c19a38a008
commit ed91362515
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -200,13 +200,16 @@ class Extension:
@classmethod
def test_connector(cls, data):
def test(prelude, data):
return data.find(prelude) == 0
def test(preludes, data):
for prelude in preludes:
if data.find(prelude) == 0:
return True
return False
for extension in cls.extensions:
if (
extension.type == "connector"
and test(extension.prelude, data)
and test(extension.preludes, data)
):
return extension
return None