mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2026-09-08 01:41:59 +00:00
Make lint happier
This commit is contained in:
@@ -11,21 +11,27 @@ class SourceBuilder:
|
||||
self.auto_added_line = False
|
||||
|
||||
def indent(self):
|
||||
"""Indents the current source code line by the current indentation level"""
|
||||
"""Indents the current source code line
|
||||
by the current indentation level
|
||||
"""
|
||||
self.write(' ' * (self.current_indent * self.indent_size))
|
||||
|
||||
def write(self, string):
|
||||
"""Writes a string into the source code, applying indentation if required"""
|
||||
"""Writes a string into the source code,
|
||||
applying indentation if required
|
||||
"""
|
||||
if self.on_new_line:
|
||||
self.on_new_line = False # We're not on a new line anymore
|
||||
if string.strip(
|
||||
): # If the string was not empty, indent; Else it probably was a new line
|
||||
# If the string was not empty, indent; Else probably a new line
|
||||
if string.strip():
|
||||
self.indent()
|
||||
|
||||
self.out_stream.write(string)
|
||||
|
||||
def writeln(self, string=''):
|
||||
"""Writes a string into the source code _and_ appends a new line, applying indentation if required"""
|
||||
"""Writes a string into the source code _and_ appends a new line,
|
||||
applying indentation if required
|
||||
"""
|
||||
self.write(string + '\n')
|
||||
self.on_new_line = True
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ class TLParser:
|
||||
"""This method yields TLObjects from a given .tl file"""
|
||||
|
||||
with open(file_path, encoding='utf-8') as file:
|
||||
# Start by assuming that the next found line won't be a function (and will hence be a type)
|
||||
# Start by assuming that the next found line won't
|
||||
# be a function (and will hence be a type)
|
||||
is_function = False
|
||||
|
||||
# Read all the lines from the .tl file
|
||||
@@ -21,7 +22,8 @@ class TLParser:
|
||||
# Ensure that the line is not a comment
|
||||
if line and not line.startswith('//'):
|
||||
|
||||
# Check whether the line is a type change (types ⋄ functions) or not
|
||||
# Check whether the line is a type change
|
||||
# (types <-> functions) or not
|
||||
match = re.match('---(\w+)---', line)
|
||||
if match:
|
||||
following_types = match.group(1)
|
||||
|
||||
Reference in New Issue
Block a user