mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Properly ignore core types when generating code
This commit is contained in:
@@ -4,7 +4,12 @@ from zlib import crc32
|
||||
|
||||
class TLObject:
|
||||
""".tl core types IDs (such as vector, booleans, etc.)"""
|
||||
CORE_TYPES = (0x1cb5c415, 0xbc799737, 0x997275b5, 0x3fedd339)
|
||||
CORE_TYPES = (
|
||||
0xbc799737, # boolFalse#bc799737 = Bool;
|
||||
0x997275b5, # boolTrue#997275b5 = Bool;
|
||||
0x3fedd339, # true#3fedd339 = True;
|
||||
0x1cb5c415, # vector#1cb5c415 {t:Type} # [ t ] = Vector t;
|
||||
)
|
||||
|
||||
def __init__(self, fullname, object_id, args, result, is_function):
|
||||
"""
|
||||
@@ -65,6 +70,10 @@ class TLObject:
|
||||
;$ # Finally, the line should always end with ;
|
||||
''', tl, re.IGNORECASE | re.VERBOSE)
|
||||
|
||||
if match is None:
|
||||
# Probably "vector#1cb5c415 {t:Type} # [ t ] = Vector t;"
|
||||
raise ValueError('Cannot parse TLObject', tl)
|
||||
|
||||
# Sub-regex to match the arguments (sadly, it cannot be embedded in the first regex)
|
||||
args_match = re.findall(r'''
|
||||
({)? # We may or may not capture the opening brace
|
||||
|
Reference in New Issue
Block a user