mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
Removed decprecated Set module import.
On some places, the built-in set type was not yet used --HG-- branch : 0.6-maint
This commit is contained in:
parent
b2f01c17e0
commit
3cf551cb65
@ -24,7 +24,6 @@ import sys
|
||||
import os
|
||||
from warnings import warn
|
||||
from types import GeneratorType
|
||||
from sets import Set
|
||||
|
||||
from myhdl import Cosimulation, StopSimulation, _SuspendSimulation
|
||||
from myhdl import _simulator, SimulationError
|
||||
@ -202,7 +201,7 @@ class Simulation(object):
|
||||
|
||||
def _checkArgs(arglist):
|
||||
waiters = []
|
||||
ids = Set()
|
||||
ids = set()
|
||||
cosim = None
|
||||
for arg in arglist:
|
||||
if isinstance(arg, GeneratorType):
|
||||
|
@ -23,7 +23,6 @@ import sys
|
||||
import inspect
|
||||
from types import FunctionType
|
||||
import compiler
|
||||
from sets import Set
|
||||
import re
|
||||
|
||||
from myhdl import Signal, AlwaysCombError
|
||||
@ -67,8 +66,8 @@ INPUT, OUTPUT, INOUT = range(3)
|
||||
|
||||
class _SigNameVisitor(object):
|
||||
def __init__(self, symdict):
|
||||
self.inputs = Set()
|
||||
self.outputs = Set()
|
||||
self.inputs = set()
|
||||
self.outputs = set()
|
||||
self.toplevel = 1
|
||||
self.symdict = symdict
|
||||
|
||||
|
@ -31,7 +31,6 @@ from types import GeneratorType
|
||||
import compiler
|
||||
from compiler import ast
|
||||
import linecache
|
||||
from sets import Set
|
||||
|
||||
from myhdl import ExtractHierarchyError, ToVerilogError, ToVHDLError
|
||||
from myhdl._Signal import Signal, _isListOfSigs
|
||||
|
@ -30,7 +30,6 @@ import sys
|
||||
import inspect
|
||||
|
||||
from types import GeneratorType
|
||||
from sets import Set
|
||||
from types import GeneratorType, ListType, TupleType
|
||||
|
||||
from myhdl._Cosimulation import Cosimulation
|
||||
@ -39,7 +38,7 @@ from myhdl._instance import _Instantiator
|
||||
def _isGenSeq(obj):
|
||||
if isinstance(obj, (Cosimulation, _Instantiator)):
|
||||
return True
|
||||
if not isinstance(obj, (ListType, TupleType, Set)):
|
||||
if not isinstance(obj, (ListType, TupleType, set)):
|
||||
return False
|
||||
## if not obj:
|
||||
## return False
|
||||
|
@ -28,7 +28,6 @@ import time
|
||||
import os
|
||||
path = os.path
|
||||
import shutil
|
||||
from sets import Set
|
||||
|
||||
from myhdl import _simulator, Signal, __version__
|
||||
from myhdl._extractHierarchy import _HierExtr
|
||||
|
@ -26,7 +26,6 @@ import exceptions
|
||||
import sys
|
||||
import inspect
|
||||
import re
|
||||
from sets import Set
|
||||
from types import FunctionType, GeneratorType, ListType, TupleType
|
||||
import compiler
|
||||
# hope this will always work ...
|
||||
@ -49,7 +48,7 @@ def _isGenFunc(obj):
|
||||
def _flatten(*args):
|
||||
arglist = []
|
||||
for arg in args:
|
||||
if isinstance(arg, (list, tuple, Set)):
|
||||
if isinstance(arg, (list, tuple, set)):
|
||||
for item in arg:
|
||||
arglist.extend(_flatten(item))
|
||||
else:
|
||||
|
@ -25,7 +25,6 @@
|
||||
import inspect
|
||||
import compiler
|
||||
from compiler import ast as astNode
|
||||
from sets import Set
|
||||
from types import GeneratorType, FunctionType, ClassType, MethodType
|
||||
from cStringIO import StringIO
|
||||
import re
|
||||
@ -302,7 +301,7 @@ def hasType(obj, theType):
|
||||
|
||||
class ReferenceStack(list):
|
||||
def push(self):
|
||||
self.append(Set())
|
||||
self.append(set())
|
||||
def add(self, item):
|
||||
self[-1].add(item)
|
||||
def __contains__(self, item):
|
||||
@ -355,8 +354,8 @@ class _AnalyzeVisitor(_ConversionMixin):
|
||||
def __init__(self, ast):
|
||||
ast.sigdict = {}
|
||||
ast.vardict = {}
|
||||
ast.inputs = Set()
|
||||
ast.outputs = Set()
|
||||
ast.inputs = set()
|
||||
ast.outputs = set()
|
||||
ast.argnames = []
|
||||
ast.kind = None
|
||||
ast.hasYield = 0
|
||||
@ -365,7 +364,7 @@ class _AnalyzeVisitor(_ConversionMixin):
|
||||
self.ast = ast
|
||||
self.labelStack = []
|
||||
self.refStack = ReferenceStack()
|
||||
self.globalRefs = Set()
|
||||
self.globalRefs = set()
|
||||
|
||||
|
||||
def binaryOp(self, node, *args):
|
||||
@ -684,7 +683,7 @@ class _AnalyzeVisitor(_ConversionMixin):
|
||||
# don't infer a case if there's no elsif test
|
||||
if not node.tests[1:]:
|
||||
return
|
||||
choices = Set()
|
||||
choices = set()
|
||||
choices.add(item1._index)
|
||||
for test, suite in node.tests[1:]:
|
||||
if not hasattr(test, 'case'):
|
||||
|
@ -30,7 +30,6 @@ import inspect
|
||||
from datetime import datetime
|
||||
import compiler
|
||||
from compiler import ast as astNode
|
||||
from sets import Set
|
||||
from types import GeneratorType, FunctionType, ClassType, StringType
|
||||
from cStringIO import StringIO
|
||||
import __builtin__
|
||||
@ -68,7 +67,7 @@ def _flatten(*args):
|
||||
for arg in args:
|
||||
if id(arg) in _userCodeMap['vhdl']:
|
||||
arglist.append(_userCodeMap['vhdl'][id(arg)])
|
||||
elif isinstance(arg, (list, tuple, Set)):
|
||||
elif isinstance(arg, (list, tuple, set)):
|
||||
for item in arg:
|
||||
arglist.extend(_flatten(item))
|
||||
else:
|
||||
|
@ -30,7 +30,6 @@ import inspect
|
||||
from datetime import datetime
|
||||
import compiler
|
||||
from compiler import ast as astNode
|
||||
from sets import Set
|
||||
from types import GeneratorType, FunctionType, ClassType, TypeType, StringType
|
||||
from cStringIO import StringIO
|
||||
import __builtin__
|
||||
@ -63,7 +62,7 @@ def _flatten(*args):
|
||||
for arg in args:
|
||||
if id(arg) in _userCodeMap['verilog']:
|
||||
arglist.append(_userCodeMap['verilog'][id(arg)])
|
||||
elif isinstance(arg, (list, tuple, Set)):
|
||||
elif isinstance(arg, (list, tuple, set)):
|
||||
for item in arg:
|
||||
arglist.extend(_flatten(item))
|
||||
else:
|
||||
|
@ -27,7 +27,6 @@ from random import randrange
|
||||
import unittest
|
||||
from unittest import TestCase
|
||||
import inspect
|
||||
from sets import Set
|
||||
|
||||
from myhdl import Signal, Simulation, instances, AlwaysError, \
|
||||
intbv, delay, StopSimulation, now
|
||||
|
@ -27,7 +27,6 @@ from random import randrange
|
||||
import unittest
|
||||
from unittest import TestCase
|
||||
import inspect
|
||||
from sets import Set
|
||||
|
||||
from myhdl import Signal, Simulation, instances, AlwaysCombError, \
|
||||
intbv, delay, StopSimulation, now
|
||||
@ -92,7 +91,7 @@ class AlwaysCombCompilationTest(TestCase):
|
||||
v = u
|
||||
g = always_comb(h).gen
|
||||
i = g.gi_frame.f_locals['self']
|
||||
expected = Set(['a'])
|
||||
expected = set(['a'])
|
||||
self.assertEqual(i.inputs, expected)
|
||||
|
||||
def testInfer2(self):
|
||||
@ -103,7 +102,7 @@ class AlwaysCombCompilationTest(TestCase):
|
||||
g = a
|
||||
g = always_comb(h).gen
|
||||
i = g.gi_frame.f_locals['self']
|
||||
expected = Set(['a', 'x'])
|
||||
expected = set(['a', 'x'])
|
||||
self.assertEqual(i.inputs, expected)
|
||||
|
||||
def testInfer3(self):
|
||||
@ -114,7 +113,7 @@ class AlwaysCombCompilationTest(TestCase):
|
||||
a = 1
|
||||
g = always_comb(h).gen
|
||||
i = g.gi_frame.f_locals['self']
|
||||
expected = Set(['x'])
|
||||
expected = set(['x'])
|
||||
self.assertEqual(i.inputs, expected)
|
||||
|
||||
def testInfer4(self):
|
||||
@ -125,7 +124,7 @@ class AlwaysCombCompilationTest(TestCase):
|
||||
x = 1
|
||||
g = always_comb(h).gen
|
||||
i = g.gi_frame.f_locals['self']
|
||||
expected = Set(['a'])
|
||||
expected = set(['a'])
|
||||
self.assertEqual(i.inputs, expected)
|
||||
|
||||
|
||||
@ -159,7 +158,7 @@ class AlwaysCombCompilationTest(TestCase):
|
||||
c.next[a:0] = x[b:0]
|
||||
g = always_comb(h).gen
|
||||
i = g.gi_frame.f_locals['self']
|
||||
expected = Set(['a', 'b', 'x'])
|
||||
expected = set(['a', 'b', 'x'])
|
||||
self.assertEqual(i.inputs, expected)
|
||||
|
||||
def testInfer8(self):
|
||||
@ -170,7 +169,7 @@ class AlwaysCombCompilationTest(TestCase):
|
||||
c.next[8:1+a+v] = x[4:b*3+u]
|
||||
g = always_comb(h).gen
|
||||
i = g.gi_frame.f_locals['self']
|
||||
expected = Set(['a', 'b', 'x'])
|
||||
expected = set(['a', 'b', 'x'])
|
||||
self.assertEqual(i.inputs, expected)
|
||||
|
||||
def testInfer9(self):
|
||||
@ -179,7 +178,7 @@ class AlwaysCombCompilationTest(TestCase):
|
||||
c.next[a-1] = x[b-1]
|
||||
g = always_comb(h).gen
|
||||
i = g.gi_frame.f_locals['self']
|
||||
expected = Set(['a', 'b', 'x'])
|
||||
expected = set(['a', 'b', 'x'])
|
||||
self.assertEqual(i.inputs, expected)
|
||||
|
||||
def testInfer10(self):
|
||||
@ -190,7 +189,7 @@ class AlwaysCombCompilationTest(TestCase):
|
||||
c.next = f(a, 2*b, d*x)
|
||||
g = always_comb(h).gen
|
||||
i = g.gi_frame.f_locals['self']
|
||||
expected = Set(['a', 'b', 'd', 'x'])
|
||||
expected = set(['a', 'b', 'd', 'x'])
|
||||
self.assertEqual(i.inputs, expected)
|
||||
|
||||
def testEmbeddedFunction(self):
|
||||
|
@ -27,7 +27,6 @@ from random import randrange
|
||||
import unittest
|
||||
from unittest import TestCase
|
||||
import inspect
|
||||
from sets import Set
|
||||
|
||||
from myhdl import Signal, Simulation, instances, InstanceError, \
|
||||
intbv, delay, StopSimulation, now
|
||||
|
Loading…
x
Reference in New Issue
Block a user