From c5b562d4f6b0b0d1f81e0b1809768ad559621f39 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Mon, 4 Sep 2017 14:08:36 +0200 Subject: [PATCH] Move the from tlobject import TLObject to only the top of the file --- telethon_generator/tl_generator.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/telethon_generator/tl_generator.py b/telethon_generator/tl_generator.py index b6134ad9..5e3d4b08 100644 --- a/telethon_generator/tl_generator.py +++ b/telethon_generator/tl_generator.py @@ -121,6 +121,14 @@ class TLGenerator: with open(file, 'w', encoding='utf-8') as f, \ SourceBuilder(f) as builder: builder.writeln(AUTO_GEN_NOTICE) + + # Both types and functions inherit from the TLObject class + # so they all can be serialized and sent, however, only the + # functions are "content_related". + builder.writeln( + 'from {}.tl.tlobject import TLObject'.format('.' * depth) + ) + # Add the relative imports to the namespaces, # unless we already are in a namespace. if not ns: @@ -148,14 +156,7 @@ class TLGenerator: Additional information such as file path depth and the Type: [Constructors] must be given for proper importing and documentation strings. - '""" - - # Both types and functions inherit from the TLObject class so they - # all can be serialized and sent, however, only the functions are - # "content_related". - builder.writeln('from {}.tl.tlobject import TLObject' - .format('.' * depth)) - + """ if tlobject.is_function: util_imports = set() for a in tlobject.args: