From: Mike Bayer Date: Thu, 20 Jan 2011 18:32:59 +0000 (-0500) Subject: rename 'frozendict' to 'immutabledict', since 'frozen' implies hashability X-Git-Tag: rel_0_7b1~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eee9b55f0ccaa5243442a59788acaa04be6ac6be;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git rename 'frozendict' to 'immutabledict', since 'frozen' implies hashability like frozenset which isn't really the purpose of 'immutabledict' (could be someday, in which case, we'd change the name back :) ) --- diff --git a/CHANGES b/CHANGES index b86d3b788e..c643b17f22 100644 --- a/CHANGES +++ b/CHANGES @@ -5,7 +5,66 @@ CHANGES ======= 0.7.0b1 ======= +- Detailed descriptions of each change below are + described at: + http://www.sqlalchemy.org/trac/wiki/07Migration + +- general + - New event system, supercedes all extensions, listeners, + etc. [ticket:1902] + + - Logging enhancements + [ticket:1926] + + - Setup no longer installs a Nose plugin + [ticket:1949] + - orm + - More succinct form of query.join(target, onclause) + [ticket:1923] + + - Hybrid Attributes, implements/supercedes synonym() + [ticket:1903] + + - Rewrite of composites [ticket:2008] + + - Mutation Event Extension, supercedes "mutable=True" + + - PickleType and ARRAY mutability turned off by default + [ticket:1980] + + - Simplified polymorphic_on assignment + [ticket:1895] + + - Flushing of Orphans that have no parent is allowed + [ticket:1912] + + - Warnings generated when collection members, scalar referents + not part of the flush + [ticket:1973] + + - Non-`Table`-derived constructs can be mapped + [ticket:1876] + + - Tuple label names in Query Improved + [ticket:1942] + + - Mapped column attributes reference the most specific + column first + [ticket:1892] + + - Mapping to joins with two or more same-named columns + requires explicit declaration + [ticket:1896] + + - Mapper requires that polymorphic_on column be present + in the mapped selectable + [ticket:1875] + + - compile_mappers() renamed configure_mappers(), simplified + configuration internals + [ticket:1966] + - the aliased() function, if passed a SQL FromClause element (i.e. not a mapped class), will return element.alias() instead of raising an error on AliasedClass. [ticket:2018] @@ -21,7 +80,41 @@ CHANGES in the open transaction of an engine explicitly. [ticket:1996] + - Query.join(), Query.outerjoin(), eagerload(), + eagerload_all(), others no longer allow lists + of attributes as arguments (i.e. option([x, y, z]) + form, deprecated since 0.5) + + - ScopedSession.mapper is removed + (deprecated since 0.5) + - sql + - LIMIT/OFFSET clauses now use bind parameters + [ticket:805] + +=== TypeDecorator works with primary key columns === + +[ticket:2005] [ticket:2006] + +=== `DDL()` Constructs now Escape Percent Signs === + +[ticket:1897] + +=== `Table.c` / `MetaData.tables` refined a bit, don't allow direct mutation === + +[ticket:1893] [ticket:1917] + +=== Callables passed to `bindparam()` don't get evaluated === + +[ticket:1950] + +=== types.type_map is now private, types._type_map === + +[ticket:1870] + +=== Non-public Pool Methods Underscored === +[ticket:1982] + - Added NULLS FIRST and NULLS LAST support. It's implemented as an extension to the asc() and desc() operators, called nullsfirst() and nullslast(). [ticket:723] @@ -64,6 +157,10 @@ CHANGES - TypeDecorator is present in the "sqlalchemy" import space. +-sqlite + - SQLite dialect now uses `NullPool` for file-based databases + [ticket:1921] + - mssql - the String/Unicode types, and their counterparts VARCHAR/ NVARCHAR, emit "max" as the length when no length is diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 8de2e2a3a9..ccce58b9c2 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -1734,7 +1734,7 @@ class Engine(Connectable, log.Identified): """ - _execution_options = util.frozendict() + _execution_options = util.immutabledict() Connection = Connection def __init__(self, pool, dialect, url, diff --git a/lib/sqlalchemy/ext/sqlsoup.py b/lib/sqlalchemy/ext/sqlsoup.py index 9e6f63acac..ded8a35cd5 100644 --- a/lib/sqlalchemy/ext/sqlsoup.py +++ b/lib/sqlalchemy/ext/sqlsoup.py @@ -620,7 +620,7 @@ class SqlSoup(object): self.session.expunge_all() def map_to(self, attrname, tablename=None, selectable=None, - schema=None, base=None, mapper_args=util.frozendict()): + schema=None, base=None, mapper_args=util.immutabledict()): """Configure a mapping to the given attrname. This is the "master" method that can be used to create any diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index 5964459182..42dd60a2fc 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -93,10 +93,10 @@ class Query(object): _select_from_entity = None _filter_aliases = None _from_obj_alias = None - _joinpath = _joinpoint = util.frozendict() - _execution_options = util.frozendict() - _params = util.frozendict() - _attributes = util.frozendict() + _joinpath = _joinpoint = util.immutabledict() + _execution_options = util.immutabledict() + _params = util.immutabledict() + _attributes = util.immutabledict() _with_options = () _with_hints = () _enable_single_crit = True diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 26f6075126..cf39d29ace 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -1940,7 +1940,7 @@ class MetaData(SchemaItem): ``MetaData``. """ - self.tables = util.frozendict() + self.tables = util.immutabledict() self._schemas = set() self.bind = bind self.metadata = self diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 8a9d33d553..64274359b1 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -2556,7 +2556,7 @@ class Executable(_Generative): """ supports_execution = True - _execution_options = util.frozendict() + _execution_options = util.immutabledict() @_generative def execution_options(self, **kw): @@ -4003,7 +4003,7 @@ class Select(_SelectBase): __visit_name__ = 'select' _prefixes = () - _hints = util.frozendict() + _hints = util.immutabledict() def __init__(self, columns, @@ -4457,7 +4457,7 @@ class UpdateBase(Executable, ClauseElement): _execution_options = \ Executable._execution_options.union({'autocommit': True}) - kwargs = util.frozendict() + kwargs = util.immutabledict() def _process_colparams(self, parameters): if isinstance(parameters, (list, tuple)): diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index a2ecafaa85..1dcf379a95 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -703,7 +703,7 @@ class _DateAffinity(object): def _expression_adaptations(self): raise NotImplementedError() - _blank_dict = util.frozendict() + _blank_dict = util.immutabledict() def _adapt_expression(self, op, othertype): othertype = othertype._type_affinity return op, \ diff --git a/lib/sqlalchemy/util/__init__.py b/lib/sqlalchemy/util/__init__.py index 6950aa8e6d..f4861e5f4b 100644 --- a/lib/sqlalchemy/util/__init__.py +++ b/lib/sqlalchemy/util/__init__.py @@ -8,7 +8,7 @@ from compat import callable, cmp, reduce, defaultdict, py25_dict, \ threading, py3k, jython, win32, set_types, buffer, pickle, \ update_wrapper, partial, md5_hex, decode_slice, dottedgetter -from _collections import NamedTuple, ImmutableContainer, frozendict, \ +from _collections import NamedTuple, ImmutableContainer, immutabledict, \ Properties, OrderedProperties, ImmutableProperties, OrderedDict, \ OrderedSet, IdentitySet, OrderedIdentitySet, column_set, \ column_dict, ordered_column_set, populate_column_dict, unique_list, \ diff --git a/lib/sqlalchemy/util/_collections.py b/lib/sqlalchemy/util/_collections.py index 269a3d5390..3adbf99133 100644 --- a/lib/sqlalchemy/util/_collections.py +++ b/lib/sqlalchemy/util/_collections.py @@ -39,7 +39,7 @@ class ImmutableContainer(object): __delitem__ = __setitem__ = __setattr__ = _immutable -class frozendict(ImmutableContainer, dict): +class immutabledict(ImmutableContainer, dict): clear = pop = popitem = setdefault = \ update = ImmutableContainer._immutable @@ -53,18 +53,18 @@ class frozendict(ImmutableContainer, dict): pass def __reduce__(self): - return frozendict, (dict(self), ) + return immutabledict, (dict(self), ) def union(self, d): if not self: - return frozendict(d) + return immutabledict(d) else: - d2 = frozendict(self) + d2 = immutabledict(self) dict.update(d2, d) return d2 def __repr__(self): - return "frozendict(%s)" % dict.__repr__(self) + return "immutabledict(%s)" % dict.__repr__(self) class Properties(object): """Provide a __getattr__/__setattr__ interface over a dict.""" diff --git a/test/base/test_utils.py b/test/base/test_utils.py index 8451144471..e44a1862f0 100644 --- a/test/base/test_utils.py +++ b/test/base/test_utils.py @@ -82,7 +82,7 @@ class OrderedSetTest(TestBase): class FrozenDictTest(TestBase): def test_serialize(self): - d = util.frozendict({1:2, 3:4}) + d = util.immutabledict({1:2, 3:4}) for loads, dumps in picklers(): print loads(dumps(d)) diff --git a/test/lib/testing.py b/test/lib/testing.py index d6338cf10f..cdd5ee258f 100644 --- a/test/lib/testing.py +++ b/test/lib/testing.py @@ -723,12 +723,12 @@ class AssertsExecutionResults(object): numbers of rows that the test suite manipulates. """ - class frozendict(dict): + class immutabledict(dict): def __hash__(self): return id(self) found = util.IdentitySet(result) - expected = set([frozendict(e) for e in expected]) + expected = set([immutabledict(e) for e in expected]) for wrong in itertools.ifilterfalse(lambda o: type(o) == cls, found): fail('Unexpected type "%s", expected "%s"' % (