Remove underscore from module names

This commit is contained in:
Lonami Exo 2018-06-18 21:02:42 +02:00
parent 262018959f
commit 4e9a84c3b5
19 changed files with 17 additions and 20 deletions

4
.gitignore vendored
View File

@ -5,8 +5,8 @@ docs/
# Generated code # Generated code
telethon/tl/functions/ telethon/tl/functions/
telethon/tl/types/ telethon/tl/types/
telethon/tl/all_tlobjects.py telethon/tl/alltlobjects.py
telethon/errors/rpc_error_list.py telethon/errors/rpcerrorlist.py
# User session # User session
*.session *.session

View File

@ -42,7 +42,7 @@ LIBRARY_DIR = 'telethon'
ERRORS_IN_JSON = os.path.join(GENERATOR_DIR, 'data', 'errors.json') ERRORS_IN_JSON = os.path.join(GENERATOR_DIR, 'data', 'errors.json')
ERRORS_IN_DESC = os.path.join(GENERATOR_DIR, 'data', 'error_descriptions') ERRORS_IN_DESC = os.path.join(GENERATOR_DIR, 'data', 'error_descriptions')
ERRORS_OUT = os.path.join(LIBRARY_DIR, 'errors', 'rpc_error_list.py') ERRORS_OUT = os.path.join(LIBRARY_DIR, 'errors', 'rpcerrorlist.py')
INVALID_BM_IN = os.path.join(GENERATOR_DIR, 'data', 'invalid_bot_methods.json') INVALID_BM_IN = os.path.join(GENERATOR_DIR, 'data', 'invalid_bot_methods.json')

View File

@ -14,7 +14,7 @@ from ..network import MTProtoSender, ConnectionTcpFull
from ..network.mtprotostate import MTProtoState from ..network.mtprotostate import MTProtoState
from ..sessions import Session, SQLiteSession from ..sessions import Session, SQLiteSession
from ..tl import TLObject, functions from ..tl import TLObject, functions
from ..tl.all_tlobjects import LAYER from ..tl.alltlobjects import LAYER
DEFAULT_DC_ID = 4 DEFAULT_DC_ID = 4
DEFAULT_IPV4_IP = '149.154.167.51' DEFAULT_IPV4_IP = '149.154.167.51'

View File

@ -4,7 +4,7 @@ such as the AES IGE mode used by Telegram, the authorization key bound with
their data centers, and so on. their data centers, and so on.
""" """
from .aes import AES from .aes import AES
from .aes_ctr import AESModeCTR from .aesctr import AESModeCTR
from .auth_key import AuthKey from .authkey import AuthKey
from .factorization import Factorization from .factorization import Factorization
from .cdn_decrypter import CdnDecrypter from .cdndecrypter import CdnDecrypter

View File

@ -12,8 +12,8 @@ from .common import (
) )
# This imports the base errors too, as they're imported there # This imports the base errors too, as they're imported there
from .rpc_base_errors import * from .rpcbaseerrors import *
from .rpc_error_list import * from .rpcerrorlist import *
def report_error(code, message, report_method): def report_error(code, message, report_method):

View File

@ -3,5 +3,5 @@ Several extensions Python is missing, such as a proper class to handle a TCP
communication with support for cancelling the operation, and an utility class communication with support for cancelling the operation, and an utility class
to read arbitrary binary data in a more comfortable way, with int/strings/etc. to read arbitrary binary data in a more comfortable way, with int/strings/etc.
""" """
from .binary_reader import BinaryReader from .binaryreader import BinaryReader
from .tcp_client import TcpClient from .tcpclient import TcpClient

View File

@ -7,7 +7,7 @@ from io import BufferedReader, BytesIO
from struct import unpack from struct import unpack
from ..errors import TypeNotFoundError from ..errors import TypeNotFoundError
from ..tl.all_tlobjects import tlobjects from ..tl.alltlobjects import tlobjects
from ..tl.core import core_objects from ..tl.core import core_objects

View File

@ -5,7 +5,7 @@ import re
import shutil import shutil
from collections import defaultdict from collections import defaultdict
from ..docs_writer import DocsWriter from ..docswriter import DocsWriter
from ..parsers import TLObject from ..parsers import TLObject
from ..utils import snake_to_camel_case from ..utils import snake_to_camel_case

View File

@ -1,6 +1,3 @@
import itertools
def generate_errors(errors, f): def generate_errors(errors, f):
# Exact/regex match to create {CODE: ErrorClassName} # Exact/regex match to create {CODE: ErrorClassName}
exact_match = [] exact_match = []
@ -20,7 +17,7 @@ def generate_errors(errors, f):
exact_match.append(error) exact_match.append(error)
# Imports and new subclass creation # Imports and new subclass creation
f.write('from .rpc_base_errors import RPCError, {}\n' f.write('from .rpcbaseerrors import RPCError, {}\n'
.format(", ".join(sorted(import_base)))) .format(", ".join(sorted(import_base))))
for cls, int_code in sorted(create_base.items(), key=lambda t: t[1]): for cls, int_code in sorted(create_base.items(), key=lambda t: t[1]):

View File

@ -6,7 +6,7 @@ import struct
from collections import defaultdict from collections import defaultdict
from zlib import crc32 from zlib import crc32
from ..source_builder import SourceBuilder from ..sourcebuilder import SourceBuilder
from ..utils import snake_to_camel_case from ..utils import snake_to_camel_case
AUTO_GEN_NOTICE = \ AUTO_GEN_NOTICE = \
@ -650,7 +650,7 @@ def generate_tlobjects(tlobjects, layer, import_depth, output_dir):
_write_modules(get_file('types'), import_depth, 'TLObject', _write_modules(get_file('types'), import_depth, 'TLObject',
namespace_types, type_constructors) namespace_types, type_constructors)
filename = os.path.join(get_file('all_tlobjects.py')) filename = os.path.join(get_file('alltlobjects.py'))
with open(filename, 'w', encoding='utf-8') as file: with open(filename, 'w', encoding='utf-8') as file:
with SourceBuilder(file) as builder: with SourceBuilder(file) as builder:
_write_all_tlobjects(tlobjects, layer, builder) _write_all_tlobjects(tlobjects, layer, builder)
@ -663,6 +663,6 @@ def clean_tlobjects(output_dir):
if os.path.isdir(d): if os.path.isdir(d):
shutil.rmtree(d) shutil.rmtree(d)
tl = get_file('all_tlobjects.py') tl = get_file('alltlobjects.py')
if os.path.isfile(tl): if os.path.isfile(tl):
os.remove(tl) os.remove(tl)