Use only ASCII characters on the code (closes #104)

This commit is contained in:
Lonami Exo 2017-06-10 13:39:37 +02:00
parent 5c138977c3
commit c6acd6adc5
3 changed files with 13 additions and 12 deletions

View File

@ -467,7 +467,7 @@ class TelegramClient(TelegramBareClient):
def send_read_acknowledge(self, entity, messages=None, max_id=None):
"""Sends a "read acknowledge" (i.e., notifying the given peer that we've
read their messages, also known as the "double check ✅✅").
read their messages, also known as the "double check").
Either a list of messages (or a single message) can be given,
or the maximum message ID (until which message we want to send the read acknowledge).
@ -506,7 +506,8 @@ class TelegramClient(TelegramBareClient):
# Performer and song title and add DocumentAttributeAudio
]
# Ensure we have a mime type, any; but it cannot be None
# «The "octet-stream" subtype is used to indicate that a body contains arbitrary binary data.»
# 'The "octet-stream" subtype is used to indicate that a body
# contains arbitrary binary data.'
if not mime_type:
mime_type = 'application/octet-stream'
self.send_media_file(
@ -809,7 +810,7 @@ class TelegramClient(TelegramBareClient):
if self.sender.logging_out:
# This error is okay when logging out, means we got disconnected
# TODO Not sure why this happens because we call disconnect()
# TODO Not sure why this happens because we call disconnect()...
self._set_updates_thread(running=False)
else:
raise

View File

@ -42,12 +42,12 @@ class TLObject:
([0-9a-f]+) # The constructor ID is in hexadecimal form
(?:\s # After that, we want to match its arguments (name:type)
{? # For handling the start of the «{X:Type}» case
{? # For handling the start of the '{X:Type}' case
\w+ # The argument name will always be an alpha-only name
: # Then comes the separator between name:type
[\w\d<>#.?!]+ # The type is slightly more complex, since it's alphanumeric and it can
# also have Vector<type>, flags:# and flags.0?default, plus :!X as type
}? # For handling the end of the «{X:Type}» case
}? # For handling the end of the '{X:Type}' case
)* # Match 0 or more arguments
\s # Leave a space between the arguments and the equal
=
@ -146,14 +146,14 @@ class TLArg:
'!') # Strip the exclamation mark always to have only the name
# The type may be a flag (flags.IDX?REAL_TYPE)
# Note that «flags» is NOT the flags name; this is determined by a previous argument
# However, we assume that the argument will always be called «flags»
# Note that 'flags' is NOT the flags name; this is determined by a previous argument
# However, we assume that the argument will always be called 'flags'
flag_match = re.match(r'flags.(\d+)\?([\w<>.]+)', self.type)
if flag_match:
self.is_flag = True
self.flag_index = int(flag_match.group(1))
self.type = flag_match.group(
2) # Update the type to match the exact type, not the "flagged" one
# Update the type to match the exact type, not the "flagged" one
self.type = flag_match.group(2)
# Then check if the type is a Vector<REAL_TYPE>
vector_match = re.match(r'vector<(\w+)>', self.type, re.IGNORECASE)

View File

@ -165,7 +165,7 @@ class TLGenerator:
for arg in args:
if not arg.flag_indicator:
builder.write(
':param {}: Telegram type: «{}».'.format(
':param {}: Telegram type: "{}".'.format(
arg.name, arg.type))
if arg.is_vector:
builder.write(' Must be a list.'.format(
@ -342,7 +342,7 @@ class TLGenerator:
:param builder: The source code builder
:param arg: The argument to write
:param args: All the other arguments in TLObject same on_send. This is required to determine the flags value
:param name: The name of the argument. Defaults to «self.argname»
:param name: The name of the argument. Defaults to "self.argname"
This argument is an option because it's required when writing Vectors<>
"""
@ -437,7 +437,7 @@ class TLGenerator:
:param builder: The source code builder
:param arg: The argument to write
:param args: All the other arguments in TLObject same on_send. This is required to determine the flags value
:param name: The name of the argument. Defaults to «self.argname»
:param name: The name of the argument. Defaults to "self.argname"
This argument is an option because it's required when writing Vectors<>
"""