From 02a847b64a5b37cbbaa05dd2469ee41154326d25 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sun, 21 May 2017 13:59:16 +0200 Subject: [PATCH] Make lint happier --- README.rst | 8 ++--- docs/generate.py | 22 ++++++------- docs/res/core.html | 1 + telethon/crypto/__init__.py | 2 +- .../{factorizator.py => factorization.py} | 6 ++-- telethon/errors.py | 2 +- telethon/helpers.py | 9 +++--- telethon/interactive_telegram_client.py | 2 +- telethon/network/authenticator.py | 8 ++--- telethon/network/mtproto_plain_sender.py | 2 +- telethon/network/mtproto_sender.py | 6 ++-- telethon/parser/markdown_parser.py | 26 +++++++-------- telethon/telegram_client.py | 16 ++++------ telethon/tl/session.py | 4 +-- telethon/utils/tl_utils.py | 4 +-- telethon_generator/parser/tl_object.py | 8 ++--- telethon_generator/tl_generator.py | 2 +- telethon_tests/crypto_test.py | 32 ++++++++++++------- telethon_tests/network_test.py | 8 ++--- try_telethon.py | 8 ++--- 20 files changed, 92 insertions(+), 84 deletions(-) rename telethon/crypto/{factorizator.py => factorization.py} (91%) diff --git a/README.rst b/README.rst index 18798325..0cacfa67 100755 --- a/README.rst +++ b/README.rst @@ -70,10 +70,10 @@ If you've installed Telethon via pip, launch an interactive python3 session and .. code:: python >>> from telethon import InteractiveTelegramClient - >>> # 'sessionid' can be 'yourname'. It'll be saved as yourname.session + >>> # 'session_id' can be 'your_name'. It'll be saved as your_name.session >>> # Also (obviously) replace the api_id and api_hash with your values ... - >>> client = InteractiveTelegramClient('sessionid', '+34600000000', + >>> client = InteractiveTelegramClient('session_id', '+34600000000', ... api_id=12345, api_hash='0123456789abcdef0123456789abcdef') ================== @@ -93,7 +93,7 @@ Then, simply run ``python3 try_telethon.py`` to start the interactive example. Using Telethon ============== -If you really want to learn how to use Telethon, it is **highly adviced** that +If you really want to learn how to use Telethon, it is **highly advised** that you take a look to the `InteractiveTelegramClient `_ file and check how it works. This file contains everything you'll need to build @@ -208,7 +208,7 @@ Once this is done, pass the proxy settings to the ``TelegramClient`` constructor >>> from telethon import InteractiveTelegramClient >>> import socks - >>> client = InteractiveTelegramClient('sessionid', '+34600000000', + >>> client = InteractiveTelegramClient('session_id', '+34600000000', ... api_id=12345, api_hash='0123456789abcdef0123456789abcdef', ... proxy=(socks.SOCKS5, 'localhost', 4444)) diff --git a/docs/generate.py b/docs/generate.py index 096ddceb..f7fd2e50 100755 --- a/docs/generate.py +++ b/docs/generate.py @@ -63,20 +63,20 @@ def get_create_path_for(tlobject): return os.path.join(out_dir, get_file_name(tlobject, add_extension=True)) -def get_path_for_type(type, relative_to='.'): +def get_path_for_type(type_, relative_to='.'): """Similar to getting the path for a TLObject, it might not be possible to have the TLObject itself but rather its name (the type); this method works in the same way, returning a relative path""" - if type.lower() in {'int', 'long', 'int128', 'int256', 'double', - 'vector', 'string', 'bool', 'true', 'bytes', 'date'}: - path = 'index.html#%s' % type.lower() + if type_.lower() in {'int', 'long', 'int128', 'int256', 'double', + 'vector', 'string', 'bool', 'true', 'bytes', 'date'}: + path = 'index.html#%s' % type_.lower() - elif '.' in type: + elif '.' in type_: # If it's not a core type, then it has to be a custom Telegram type - namespace, name = type.split('.') + namespace, name = type_.split('.') path = 'types/%s/%s' % (namespace, get_file_name(name, add_extension=True)) else: - path = 'types/%s' % get_file_name(type, add_extension=True) + path = 'types/%s' % get_file_name(type_, add_extension=True) return get_relative_path(path, relative_to) @@ -128,7 +128,7 @@ def build_menu(docs, filename, relative_main_index): def generate_index(folder, original_paths): """Generates the index file for the specified folder""" - # Determine the namespaces listed here (as subfolders) + # Determine the namespaces listed here (as sub folders) # and the files (.html files) that we should link to namespaces = [] files = [] @@ -320,10 +320,10 @@ def generate_documentation(scheme_file): docs.write_text('The following %d methods return this type as a result.' % len(functions)) docs.begin_table(2) - for function in functions: - link = get_create_path_for(function) + for func in functions: + link = get_create_path_for(func) link = get_relative_path(link, relative_to=filename) - docs.add_row(get_class_name(function), link=link) + docs.add_row(get_class_name(func), link=link) docs.end_table() docs.end_body() diff --git a/docs/res/core.html b/docs/res/core.html index fff04fa0..713c16bf 100644 --- a/docs/res/core.html +++ b/docs/res/core.html @@ -188,6 +188,7 @@ messages = result.messages you're still able to invoke these methods manually.

+