mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-10-31 16:07:44 +03:00 
			
		
		
		
	Make generated .to_bytes() more readable
This commit is contained in:
		
							parent
							
								
									195bba6f21
								
							
						
					
					
						commit
						76d14b2dd9
					
				|  | @ -300,15 +300,17 @@ class TLGenerator: | ||||||
| 
 | 
 | ||||||
|         # Write the .to_bytes() function |         # Write the .to_bytes() function | ||||||
|         builder.writeln('def to_bytes(self):') |         builder.writeln('def to_bytes(self):') | ||||||
|         builder.write("return b''.join((") |         builder.writeln("return b''.join((") | ||||||
|  |         builder.current_indent += 1 | ||||||
| 
 | 
 | ||||||
|         # First constructor code, we already know its bytes |         # First constructor code, we already know its bytes | ||||||
|         builder.write('{},'.format(repr(struct.pack('<I', tlobject.id)))) |         builder.writeln('{},'.format(repr(struct.pack('<I', tlobject.id)))) | ||||||
| 
 | 
 | ||||||
|         for arg in tlobject.args: |         for arg in tlobject.args: | ||||||
|             if TLGenerator.write_to_bytes(builder, arg, tlobject.args): |             if TLGenerator.write_to_bytes(builder, arg, tlobject.args): | ||||||
|                 builder.write(',') |                 builder.writeln(',') | ||||||
| 
 | 
 | ||||||
|  |         builder.current_indent -= 1 | ||||||
|         builder.writeln('))') |         builder.writeln('))') | ||||||
|         builder.end_block() |         builder.end_block() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user