Commit 2d2ea33c authored by Stefan Behnel's avatar Stefan Behnel

removed lots of unused imports, delayed some imports that are only needed for...

removed lots of unused imports, delayed some imports that are only needed for Cython specific syntax

--HG--
extra : rebase_source : a2df3675fd1efae1a1122ca9742e99ab1405fba6
parent 84307315
from Cython.Compiler.Visitor import CythonTransform from Cython.Compiler.Visitor import CythonTransform
from Cython.Compiler.Nodes import DefNode, CFuncDefNode
from Cython.Compiler.Errors import CompileError
from Cython.Compiler.StringEncoding import EncodedString from Cython.Compiler.StringEncoding import EncodedString
from Cython.Compiler import Options from Cython.Compiler import Options
from Cython.Compiler import PyrexTypes, ExprNodes from Cython.Compiler import PyrexTypes, ExprNodes
......
from Visitor import VisitorTransform, CythonTransform from Visitor import CythonTransform
from ModuleNode import ModuleNode from ModuleNode import ModuleNode
from Nodes import *
from ExprNodes import * from ExprNodes import *
from StringEncoding import EncodedString
from Errors import CompileError from Errors import CompileError
from UtilityCode import CythonUtilityCode from UtilityCode import CythonUtilityCode
from Code import UtilityCode, ContentHashingUtilityCode from Code import UtilityCode
import Cython.Compiler.Options
import Interpreter import Interpreter
import PyrexTypes import PyrexTypes
import Naming import Naming
import Symtab import Symtab
import textwrap
def dedent(text, reindent=0): def dedent(text, reindent=0):
text = textwrap.dedent(text) from textwrap import dedent
text = dedent(text)
if reindent > 0: if reindent > 0:
indent = " " * reindent indent = " " * reindent
text = '\n'.join([indent + x for x in text.split('\n')]) text = '\n'.join([indent + x for x in text.split('\n')])
......
from Cython.Compiler.Visitor import VisitorTransform, CythonTransform from Cython.Compiler.Visitor import VisitorTransform
from Cython.Compiler.ModuleNode import ModuleNode from Cython.Compiler.Nodes import StatListNode
from Cython.Compiler.Nodes import *
from Cython.Compiler.ExprNodes import *
class ExtractPxdCode(VisitorTransform): class ExtractPxdCode(VisitorTransform):
""" """
......
...@@ -3,8 +3,6 @@ from PyrexTypes import * ...@@ -3,8 +3,6 @@ from PyrexTypes import *
from UtilityCode import CythonUtilityCode from UtilityCode import CythonUtilityCode
from Errors import error from Errors import error
from Scanning import StringSourceDescriptor from Scanning import StringSourceDescriptor
import Options
import Buffer
import MemoryView import MemoryView
class CythonScope(ModuleScope): class CythonScope(ModuleScope):
......
...@@ -8,10 +8,10 @@ cython.declare(PyrexTypes=object, Naming=object, ExprNodes=object, Nodes=object, ...@@ -8,10 +8,10 @@ cython.declare(PyrexTypes=object, Naming=object, ExprNodes=object, Nodes=object,
import Builtin import Builtin
import ExprNodes import ExprNodes
import Nodes import Nodes
from PyrexTypes import py_object_type, unspecified_type from PyrexTypes import py_object_type
from Visitor import TreeVisitor, CythonTransform from Visitor import TreeVisitor, CythonTransform
from Errors import error, warning, CompileError, InternalError from Errors import error, warning, InternalError
class TypedExprNode(ExprNodes.ExprNode): class TypedExprNode(ExprNodes.ExprNode):
# Used for declaring assignments of a specified type without a known entry. # Used for declaring assignments of a specified type without a known entry.
......
...@@ -6,7 +6,6 @@ For now this only covers parse tree to value conversion of ...@@ -6,7 +6,6 @@ For now this only covers parse tree to value conversion of
compile-time values. compile-time values.
""" """
import sys
from Nodes import * from Nodes import *
from ExprNodes import * from ExprNodes import *
from Errors import CompileError from Errors import CompileError
......
...@@ -7,9 +7,6 @@ if sys.version_info[:2] < (2, 3): ...@@ -7,9 +7,6 @@ if sys.version_info[:2] < (2, 3):
sys.stderr.write("Sorry, Cython requires Python 2.3 or later\n") sys.stderr.write("Sorry, Cython requires Python 2.3 or later\n")
sys.exit(1) sys.exit(1)
import itertools
import Code
import Errors import Errors
# Do not import Parsing here, import it when needed, because Parsing imports # Do not import Parsing here, import it when needed, because Parsing imports
# Nodes, which globally needs debug command line options initialized to set a # Nodes, which globally needs debug command line options initialized to set a
...@@ -18,11 +15,9 @@ import Errors ...@@ -18,11 +15,9 @@ import Errors
# import Parsing # import Parsing
import Version import Version
from Scanning import PyrexScanner, FileSourceDescriptor from Scanning import PyrexScanner, FileSourceDescriptor
from Errors import PyrexError, CompileError, InternalError, AbortError, error, warning from Errors import PyrexError, CompileError, error, warning
from Symtab import ModuleScope from Symtab import ModuleScope
from Cython import Utils from Cython import Utils
from Cython.Utils import open_new_file, replace_suffix
import DebugFlags
import Options import Options
module_name_pattern = re.compile(r"[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$") module_name_pattern = re.compile(r"[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$")
......
from Errors import CompileError, error from Errors import CompileError, error
import ExprNodes import ExprNodes
from ExprNodes import IntNode, NoneNode, IntBinopNode, NameNode, AttributeNode from ExprNodes import IntNode, NameNode, AttributeNode
from Visitor import CythonTransform
import Options import Options
from Code import UtilityCode from Code import UtilityCode
from UtilityCode import CythonUtilityCode from UtilityCode import CythonUtilityCode
from PyrexTypes import py_object_type, cython_memoryview_ptr_type
import Buffer import Buffer
import PyrexTypes import PyrexTypes
......
...@@ -16,10 +16,8 @@ import Code ...@@ -16,10 +16,8 @@ import Code
import Naming import Naming
import Nodes import Nodes
import Options import Options
import PyrexTypes
import TypeSlots import TypeSlots
import Version import Version
import DebugFlags
import PyrexTypes import PyrexTypes
from Errors import error, warning from Errors import error, warning
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
import cython import cython
cython.declare(sys=object, os=object, time=object, copy=object, cython.declare(sys=object, os=object, time=object, copy=object,
Builtin=object, error=object, warning=object, Naming=object, PyrexTypes=object, Builtin=object, error=object, warning=object, Naming=object, PyrexTypes=object,
py_object_type=object, ModuleScope=object, LocalScope=object, ClosureScope=object, \ py_object_type=object, ModuleScope=object, LocalScope=object, ClosureScope=object,
StructOrUnionScope=object, PyClassScope=object, CClassScope=object, StructOrUnionScope=object, PyClassScope=object, CClassScope=object,
CppClassScope=object, UtilityCode=object, EncodedString=object, CppClassScope=object, UtilityCode=object, EncodedString=object,
absolute_path_length=cython.Py_ssize_t) absolute_path_length=cython.Py_ssize_t)
import sys, os, time, copy, textwrap import sys, os, time, copy
import Builtin import Builtin
from Errors import error, warning, InternalError, CompileError from Errors import error, warning, InternalError, CompileError
......
import cython import cython
cython.declare(PyrexTypes=object, Naming=object, ExprNodes=object, Nodes=object, cython.declare(PyrexTypes=object, Naming=object, ExprNodes=object, Nodes=object,
Options=object, UtilNodes=object, ModuleNode=object, Options=object, UtilNodes=object, LetNode=object,
LetNode=object, LetRefNode=object, TreeFragment=object, LetRefNode=object, TreeFragment=object, EncodedString=object,
TemplateTransform=object, EncodedString=object,
error=object, warning=object, copy=object) error=object, warning=object, copy=object)
import PyrexTypes import PyrexTypes
...@@ -14,9 +13,8 @@ import Builtin ...@@ -14,9 +13,8 @@ import Builtin
from Cython.Compiler.Visitor import VisitorTransform, TreeVisitor from Cython.Compiler.Visitor import VisitorTransform, TreeVisitor
from Cython.Compiler.Visitor import CythonTransform, EnvTransform, ScopeTrackingTransform from Cython.Compiler.Visitor import CythonTransform, EnvTransform, ScopeTrackingTransform
from Cython.Compiler.ModuleNode import ModuleNode
from Cython.Compiler.UtilNodes import LetNode, LetRefNode, ResultRefNode from Cython.Compiler.UtilNodes import LetNode, LetRefNode, ResultRefNode
from Cython.Compiler.TreeFragment import TreeFragment, TemplateTransform from Cython.Compiler.TreeFragment import TreeFragment
from Cython.Compiler.StringEncoding import EncodedString from Cython.Compiler.StringEncoding import EncodedString
from Cython.Compiler.Errors import error, warning, CompileError, InternalError from Cython.Compiler.Errors import error, warning, CompileError, InternalError
......
...@@ -7,9 +7,7 @@ ...@@ -7,9 +7,7 @@
import cython import cython
cython.declare(Nodes=object, ExprNodes=object, EncodedString=object) cython.declare(Nodes=object, ExprNodes=object, EncodedString=object)
import os
import re import re
import sys
from Cython.Compiler.Scanning import PyrexScanner, FileSourceDescriptor from Cython.Compiler.Scanning import PyrexScanner, FileSourceDescriptor
import Nodes import Nodes
...@@ -17,7 +15,7 @@ import ExprNodes ...@@ -17,7 +15,7 @@ import ExprNodes
import StringEncoding import StringEncoding
from StringEncoding import EncodedString, BytesLiteral, _unicode, _bytes from StringEncoding import EncodedString, BytesLiteral, _unicode, _bytes
from ModuleNode import ModuleNode from ModuleNode import ModuleNode
from Errors import error, warning, InternalError from Errors import error, warning
from Cython import Utils from Cython import Utils
import Future import Future
import Options import Options
......
...@@ -5,7 +5,7 @@ import Errors ...@@ -5,7 +5,7 @@ import Errors
import DebugFlags import DebugFlags
import Options import Options
from Visitor import CythonTransform from Visitor import CythonTransform
from Errors import PyrexError, CompileError, InternalError, AbortError, error from Errors import CompileError, InternalError, AbortError
# #
# Really small pipeline stages # Really small pipeline stages
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# Cython/Python language types # Cython/Python language types
# #
import cython
from Code import UtilityCode, LazyUtilityCode, ContentHashingUtilityCode from Code import UtilityCode, LazyUtilityCode, ContentHashingUtilityCode
import StringEncoding import StringEncoding
import Naming import Naming
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
# Cython Scanner # Cython Scanner
# #
import sys
import os import os
import platform import platform
...@@ -11,10 +10,10 @@ import cython ...@@ -11,10 +10,10 @@ import cython
cython.declare(EncodedString=object, string_prefixes=object, raw_prefixes=object, IDENT=unicode, cython.declare(EncodedString=object, string_prefixes=object, raw_prefixes=object, IDENT=unicode,
print_function=object) print_function=object)
from Cython import Plex, Utils from Cython import Utils
from Cython.Plex.Scanners import Scanner from Cython.Plex.Scanners import Scanner
from Cython.Plex.Errors import UnrecognizedInput from Cython.Plex.Errors import UnrecognizedInput
from Errors import CompileError, error from Errors import error
from Lexicon import string_prefixes, raw_prefixes, make_lexicon, IDENT from Lexicon import string_prefixes, raw_prefixes, make_lexicon, IDENT
from Future import print_function from Future import print_function
......
...@@ -3,13 +3,11 @@ ...@@ -3,13 +3,11 @@
# #
import re import re
from Cython import Utils
from Errors import warning, error, InternalError from Errors import warning, error, InternalError
from StringEncoding import EncodedString from StringEncoding import EncodedString
import Options, Naming import Options, Naming
import PyrexTypes import PyrexTypes
from PyrexTypes import py_object_type, unspecified_type from PyrexTypes import py_object_type, unspecified_type
import TypeSlots
from TypeSlots import \ from TypeSlots import \
pyfunction_signature, pymethod_signature, \ pyfunction_signature, pymethod_signature, \
get_special_method_signature, get_property_accessor_signature get_special_method_signature, get_property_accessor_signature
......
...@@ -6,7 +6,6 @@ import re ...@@ -6,7 +6,6 @@ import re
from StringIO import StringIO from StringIO import StringIO
from Scanning import PyrexScanner, StringSourceDescriptor from Scanning import PyrexScanner, StringSourceDescriptor
from Symtab import ModuleScope from Symtab import ModuleScope
import Symtab
import PyrexTypes import PyrexTypes
from Visitor import VisitorTransform from Visitor import VisitorTransform
from Nodes import Node, StatListNode from Nodes import Node, StatListNode
......
from Errors import error, warning, message, warn_once, InternalError from Errors import error, message
import ExprNodes import ExprNodes
import Nodes import Nodes
import Builtin import Builtin
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
import Naming import Naming
import PyrexTypes import PyrexTypes
import StringEncoding import StringEncoding
import sys
invisible = ['__cinit__', '__dealloc__', '__richcmp__', invisible = ['__cinit__', '__dealloc__', '__richcmp__',
'__nonzero__', '__bool__'] '__nonzero__', '__bool__']
......
from TreeFragment import parse_from_strings, StringParseContext from TreeFragment import parse_from_strings, StringParseContext
from Scanning import StringSourceDescriptor
import Symtab import Symtab
import Naming import Naming
from Cython.Compiler import Visitor
import Code import Code
class NonManglingModuleScope(Symtab.ModuleScope): class NonManglingModuleScope(Symtab.ModuleScope):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment