summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2009-08-07 11:03:23 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2009-08-07 11:03:23 +0200
commita79438e016dadb93543eb73d23f153e43dcb836a (patch)
treed671c6a83de12b027a2b730732a5e5f8168f92a8
parent417ecf4be0c01159bd464d1264cae24f91bf023b (diff)
downloadlogilab-common-a79438e016dadb93543eb73d23f153e43dcb836a.tar.gz
remove deprecated code
-rw-r--r--adbh.py15
-rw-r--r--astutils.py73
-rw-r--r--compat.py5
-rw-r--r--fileutils.py72
-rw-r--r--table.py53
-rw-r--r--testlib.py125
6 files changed, 0 insertions, 343 deletions
diff --git a/adbh.py b/adbh.py
index 66fc7b5..0636bbe 100644
--- a/adbh.py
+++ b/adbh.py
@@ -16,7 +16,6 @@ Helpers are provided for postgresql, mysql and sqlite.
"""
__docformat__ = "restructuredtext en"
-from logilab.common.deprecation import deprecated
class BadQuery(Exception): pass
class UnsupportedFunction(BadQuery): pass
@@ -158,20 +157,6 @@ class _GenericAdvFuncHelper:
raise UnsupportedFunction(funcname)
function_description = classmethod(function_description)
- #@deprecated('use users_support attribute')
- def support_users(self):
- """return True if the DBMS support users (this is usually
- not true for in memory DBMS)
- """
- return self.users_support
- support_user = deprecated('use users_support attribute')(support_users)
-
- #@deprecated('use groups_support attribute')
- def support_groups(self):
- """return True if the DBMS support groups"""
- return self.groups_support
- support_user = deprecated('use groups_support attribute')(support_groups)
-
def func_sqlname(self, funcname):
funcdef = self.function_description(funcname)
return funcdef.backend_name(self.backend_name)
diff --git a/astutils.py b/astutils.py
deleted file mode 100644
index 88a0ea1..0000000
--- a/astutils.py
+++ /dev/null
@@ -1,73 +0,0 @@
-"""functions to manipulate ast tuples.
-
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
-:license: General Public License version 2 - http://www.gnu.org/licenses
-"""
-__docformat__ = "restructuredtext en"
-__author__ = u"Sylvain Thenault"
-
-from warnings import warn
-warn('this module has been moved into logilab.astng and will disappear from \
-logilab.common in a future release',
- DeprecationWarning, stacklevel=1)
-
-import symbol
-import token
-from types import TupleType
-
-def debuild(ast_tuple):
- """
- reverse ast_tuple to string
- """
- if type(ast_tuple[1]) is TupleType:
- result = ''
- for child in ast_tuple[1:]:
- result = '%s%s' % (result, debuild(child))
- return result
- else:
- return ast_tuple[1]
-
-def clean(ast_tuple):
- """
- reverse ast tuple to a list of tokens
- merge sequences (token.NAME, token.DOT, token.NAME)
- """
- result = []
- last = None
- for couple in _clean(ast_tuple):
- if couple[0] == token.NAME and last == token.DOT:
- result[-1][1] += couple[1]
- elif couple[0] == token.DOT and last == token.NAME:
- result[-1][1] += couple[1]
- else:
- result.append(couple)
- last = couple[0]
- return result
-
-def _clean(ast_tuple):
- """ transform the ast into as list of tokens (i.e. final elements)
- """
- if type(ast_tuple[1]) is TupleType:
- v = []
- for c in ast_tuple[1:]:
- v += _clean(c)
- return v
- else:
- return [list(ast_tuple[:2])]
-
-def cvrtr(tuple):
- """debug method returning an ast string in a readable fashion"""
- if type(tuple) is TupleType:
- try:
- try:
- txt = 'token.'+token.tok_name[tuple[0]]
- except:
- txt = 'symbol.'+symbol.sym_name[tuple[0]]
- except:
- txt = 'Unknown token/symbol'
- return [txt] + map(cvrtr, tuple[1:])
- else:
- return tuple
-
-__all__ = ('debuild', 'clean', 'cvrtr')
diff --git a/compat.py b/compat.py
index 928d76a..4e24620 100644
--- a/compat.py
+++ b/compat.py
@@ -14,8 +14,6 @@ from warnings import warn
import __builtin__
-from logilab.common.deprecation import class_renamed
-
try:
set = set
frozenset = frozenset
@@ -114,9 +112,6 @@ except NameError:
del _baseset # don't explicity provide this class
-Set = class_renamed('Set', set, 'logilab.common.compat.Set is deprecated, '
- 'use logilab.common.compat.set instead')
-
try:
from itertools import izip, chain, imap
except ImportError:
diff --git a/fileutils.py b/fileutils.py
index a2afbc5..177c604 100644
--- a/fileutils.py
+++ b/fileutils.py
@@ -394,75 +394,3 @@ def remove_dead_links(directory, verbose=0):
print 'remove dead link', src
remove(src)
walk(directory, _remove_dead_link, None)
-
-
-from warnings import warn
-
-def files_by_ext(directory, include_exts=None, exclude_exts=None,
- exclude_dirs=BASE_BLACKLIST):
- """Return a list of files in a directory matching (or not) some
- extensions: you should either give the `include_exts` argument (and
- only files ending with one of the listed extensions will be
- considered) or the `exclude_exts` argument (and only files not
- ending by one of the listed extensions will be considered).
- Subdirectories are processed recursivly.
-
- :type directory: str
- :param directory: directory where files should be searched
-
- :type include_exts: list or tuple or None
- :param include_exts: list of file extensions to consider
-
- :type exclude_exts: list or tuple or None
- :param exclude_exts: list of file extensions to ignore
-
- :type exclude_dirs: list or tuple or None
- :param exclude_dirs: list of directory where we should not recurse
-
- :rtype: list
- :return: the list of files matching input criteria
- """
- assert not (include_exts and exclude_exts)
- warn("files_by_ext is deprecated, use shellutils.find instead" ,
- DeprecationWarning, stacklevel=2)
- if include_exts:
- return find(directory, include_exts, blacklist=exclude_dirs)
- return find(directory, exclude_exts, exclude=True, blacklist=exclude_dirs)
-
-def include_files_by_ext(directory, include_exts, exclude_dirs=BASE_BLACKLIST):
- """Return a list of files in a directory matching some extensions.
-
- :type directory: str
- :param directory: directory where files should be searched
-
- :type include_exts: list or tuple or None
- :param include_exts: list of file extensions to consider
-
- :type exclude_dirs: list or tuple or None
- :param exclude_dirs: list of directory where we should not recurse
-
- :rtype: list
- :return: the list of files matching input criterias
- """
- warn("include_files_by_ext is deprecated, use shellutils.find instead" ,
- DeprecationWarning, stacklevel=2)
- return find(directory, include_exts, blacklist=exclude_dirs)
-
-def exclude_files_by_ext(directory, exclude_exts, exclude_dirs=BASE_BLACKLIST):
- """Return a list of files in a directory not matching some extensions.
-
- :type directory: str
- :param directory: directory where files should be searched
-
- :type exclude_exts: list or tuple or None
- :param exclude_exts: list of file extensions to ignore
-
- :type exclude_dirs: list or tuple or None
- :param exclude_dirs: list of directory where we should not recurse
-
- :rtype: list
- :return: the list of files matching input criterias
- """
- warn("exclude_files_by_ext is deprecated, use shellutils.find instead" ,
- DeprecationWarning, stacklevel=2)
- return find(directory, exclude_exts, exclude=True, blacklist=exclude_dirs)
diff --git a/table.py b/table.py
index 9a18168..df1e23f 100644
--- a/table.py
+++ b/table.py
@@ -6,8 +6,6 @@
"""
__docformat__ = "restructuredtext en"
-from warnings import warn
-
from logilab.common.compat import enumerate, sum, set
class Table(object):
@@ -353,30 +351,9 @@ class Table(object):
else:
return tab.data[0][0]
- def get_dimensions(self):
- """Returns a tuple which represents the table's shape
- """
- warn('table.get_dimensions() is deprecated, use table.shape instead',
- DeprecationWarning, stacklevel=2)
- return self.shape
-
- def get_element(self, row_index, col_index):
- """Returns the element at [row_index][col_index]
- """
- warn('Table.get_element() is deprecated, use Table.get_cell instead',
- DeprecationWarning, stacklevel=2)
- return self.data[row_index][col_index]
-
- def get_cell(self, row_index, col_index):
- warn('table.get_cell(i,j) is deprecated, use table[i,j] instead',
- DeprecationWarning, stacklevel=2)
- return self.data[row_index][col_index]
-
def get_cell_by_ids(self, row_id, col_id):
"""Returns the element at [row_id][col_id]
"""
- #warn('table.get_cell_by_ids(i,j) is deprecated, use table[i,j] instead',
- # DeprecationWarning, stacklevel=2)
try:
row_index = self.row_names.index(row_id)
except ValueError:
@@ -388,40 +365,18 @@ class Table(object):
raise KeyError("Column (%s) not found in table" % (col_id))
return self.data[row_index][col_index]
- def get_row(self, row_index):
- """Returns the 'row_index' row
- """
- warn('table.get_row(i) is deprecated, use table[i] instead',
- DeprecationWarning, stacklevel=2)
- return self.data[row_index]
-
def get_row_by_id(self, row_id):
"""Returns the 'row_id' row
"""
- #warn('table.get_row_by_id(i) is deprecated, use table[i] instead',
- # DeprecationWarning, stacklevel=2)
try:
row_index = self.row_names.index(row_id)
except ValueError:
raise KeyError("Row (%s) not found in table" % (row_id))
return self.data[row_index]
- def get_column(self, col_index, distinct=False):
- """Returns the 'col_index' col
- """
- warn('table.get_column(i) is deprecated, use table[:,i] instead',
- DeprecationWarning, stacklevel=2)
- col = [row[col_index] for row in self.data]
- if distinct:
- return set(col)
- else:
- return col
-
def get_column_by_id(self, col_id, distinct=False):
"""Returns the 'col_id' col
"""
- #warn('table.get_column_by_id(i) is deprecated, use table[:,i] instead',
- # DeprecationWarning, stacklevel=2)
try:
col_index = self.col_names.index(col_id)
except ValueError:
@@ -429,14 +384,6 @@ class Table(object):
return self.get_column(col_index, distinct)
- def get_rows(self):
- """Returns all the rows in the table
- """
- warn('table.get_rows() is deprecated, just iterate over table instead',
- DeprecationWarning, stacklevel=2)
- return self.data
-
-
def get_columns(self):
"""Returns all the columns in the table
"""
diff --git a/testlib.py b/testlib.py
index d795d92..f19d6d1 100644
--- a/testlib.py
+++ b/testlib.py
@@ -56,7 +56,6 @@ except ImportError:
pass
test_support = TestSupport()
-from logilab.common.deprecation import class_renamed, deprecated
# pylint: disable-msg=W0622
from logilab.common.compat import set, enumerate, any, sorted
# pylint: enable-msg=W0622
@@ -97,117 +96,6 @@ def with_tempdir(callable):
return proxy
-@deprecated("testlib.main() is obsolete, use the pytest tool instead")
-def main(testdir=None, exitafter=True):
- """Execute a test suite.
-
- This also parses command-line options and modifies its behaviour
- accordingly.
-
- tests -- a list of strings containing test names (optional)
- testdir -- the directory in which to look for tests (optional)
-
- Users other than the Python test suite will certainly want to
- specify testdir; if it's omitted, the directory containing the
- Python test suite is searched for.
-
- If the tests argument is omitted, the tests listed on the
- command-line will be used. If that's empty, too, then all *.py
- files beginning with test_ will be used.
-
- """
-
- try:
- opts, args = getopt.getopt(sys.argv[1:], 'hvqxr:t:pcd', ['help'])
- except getopt.error, msg:
- print msg
- print __doc__
- return 2
- verbose = 0
- quiet = False
- profile = False
- exclude = []
- capture = 0
- for o, a in opts:
- if o == '-v':
- verbose += 1
- elif o == '-q':
- quiet = True
- verbose = 0
- elif o == '-x':
- exclude.append(a)
- elif o == '-t':
- testdir = a
- elif o == '-p':
- profile = True
- elif o == '-c':
- capture += 1
- elif o == '-d':
- global ENABLE_DBC
- ENABLE_DBC = True
- elif o in ('-h', '--help'):
- print __doc__
- sys.exit(0)
-
- args = [item.rstrip('.py') for item in args]
- exclude = [item.rstrip('.py') for item in exclude]
-
- if testdir is not None:
- os.chdir(testdir)
- sys.path.insert(0, '')
- tests = find_tests('.', args or DEFAULT_PREFIXES, excludes=exclude)
- # Tell tests to be moderately quiet
- test_support.verbose = verbose
- if profile:
- print >> sys.stderr, '** profiled run'
- from hotshot import Profile
- prof = Profile('stones.prof')
- start_time, start_ctime = time.time(), time.clock()
- good, bad, skipped, all_result = prof.runcall(run_tests, tests, quiet,
- verbose, None, capture)
- end_time, end_ctime = time.time(), time.clock()
- prof.close()
- else:
- start_time, start_ctime = time.time(), time.clock()
- good, bad, skipped, all_result = run_tests(tests, quiet, verbose, None,
- capture)
- end_time, end_ctime = time.time(), time.clock()
- if not quiet:
- print '*'*80
- if all_result:
- print 'Ran %s test cases in %0.2fs (%0.2fs CPU)' % (
- all_result.testsRun, end_time - start_time,
- end_ctime - start_ctime),
- if all_result.errors:
- print ', %s errors' % len(all_result.errors),
- if all_result.failures:
- print ', %s failed' % len(all_result.failures),
- if all_result.skipped:
- print ', %s skipped' % len(all_result.skipped),
- print
- if good:
- if not bad and not skipped and len(good) > 1:
- print "All",
- print _count(len(good), "test"), "OK."
- if bad:
- print _count(len(bad), "test"), "failed:",
- print ', '.join(bad)
- if skipped:
- print _count(len(skipped), "test"), "skipped:",
- print ', '.join(['%s (%s)' % (test, msg) for test, msg in skipped])
- if profile:
- from hotshot import stats
- stats = stats.load('stones.prof')
- stats.sort_stats('time', 'calls')
- stats.print_stats(30)
- if exitafter:
- sys.exit(len(bad) + len(skipped))
- else:
- sys.path.pop(0)
- return len(bad)
-
-
-
def run_tests(tests, quiet, verbose, runner=None, capture=0):
"""Execute a list of tests.
@@ -921,10 +809,6 @@ succeeded tests into", osp.join(os.getcwd(),FILE_RESTART)
except Exception, exc:
print 'teardown_module error:', exc
sys.exit(1)
- if os.environ.get('PYDEBUG'):
- warnings.warn("PYDEBUG usage is deprecated, use -i / --pdb instead",
- DeprecationWarning)
- self.pdbmode = True
if result.debuggers and self.pdbmode:
start_interactive_mode(result)
if not self.batchmode:
@@ -1313,7 +1197,6 @@ succeeded test into", osp.join(os.getcwd(),FILE_RESTART)
"""mark a test as skipped for the <msg> reason"""
msg = msg or 'test was skipped'
raise TestSkipped(msg)
- skipped_test = deprecated()(skip)
def assertIn(self, object, set):
"""assert <object> are in <set>"""
@@ -1439,19 +1322,12 @@ succeeded test into", osp.join(os.getcwd(),FILE_RESTART)
if msg is None:
msg = 'XML stream not well formed'
self.fail(msg)
- assertXMLValid = deprecated('assertXMLValid renamed to more precise '
- 'assertXMLWellFormed')(assertXMLWellFormed)
-
def assertXMLStringWellFormed(self, xml_string, msg=None):
"""asserts the XML string is well-formed (no DTD conformance check)"""
stream = StringIO(xml_string)
self.assertXMLWellFormed(stream, msg)
- assertXMLStringValid = deprecated(
- 'assertXMLStringValid renamed to more precise assertXMLStringWellFormed')(
- assertXMLStringWellFormed)
-
def assertXMLEqualsTuple(self, element, tup):
"""compare an ElementTree Element to a tuple formatted as follow:
(tagname, [attrib[, children[, text[, tail]]]])"""
@@ -1801,7 +1677,6 @@ class MockConnection:
"""Mock close method"""
pass
-MockConnexion = class_renamed('MockConnexion', MockConnection)
def mock_object(**params):
"""creates an object using params to set attributes