From 7e88aa243ed3356655b3a86da42e4d5dffb2bf10 Mon Sep 17 00:00:00 2001 From: Victor Uriarte Date: Sat, 28 May 2016 17:28:54 -0700 Subject: Bid Adieu to metaclass The singleton pattern isn't applicable since only one language is being implemented. Simplify Lexer initialization. Fix compat func `u` on Py3. Signature didn't match Py2. Feature isn't used yet. --- sqlparse/compat.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'sqlparse/compat.py') diff --git a/sqlparse/compat.py b/sqlparse/compat.py index 334883b..84d0c96 100644 --- a/sqlparse/compat.py +++ b/sqlparse/compat.py @@ -14,7 +14,7 @@ PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 if PY3: - def u(s): + def u(s, encoding=None): return str(s) @@ -37,17 +37,3 @@ elif PY2: text_type = unicode string_types = (basestring,) from StringIO import StringIO - - -# Directly copied from six: -def with_metaclass(meta, *bases): - """Create a base class with a metaclass.""" - - # This requires a bit of explanation: the basic idea is to make a dummy - # metaclass for one level of class instantiation that replaces itself with - # the actual metaclass. - class metaclass(meta): - def __new__(cls, name, this_bases, d): - return meta(name, bases, d) - - return type.__new__(metaclass, 'temporary_class', (), {}) -- cgit v1.2.1