本文整理汇总了Python中sqlalchemy.util.immutabledict方法的典型用法代码示例。如果您正苦于以下问题:Python util.immutabledict方法的具体用法?Python util.immutabledict怎么用?Python util.immutabledict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqlalchemy.util
的用法示例。
在下文中一共展示了util.immutabledict方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def __init__(
self,
dialect,
statement,
bind=None,
schema_translate_map=None,
compile_kwargs=util.immutabledict(),
):
self._preparer = AthenaDDLIdentifierPreparer(dialect)
super(AthenaDDLCompiler, self).__init__(
dialect=dialect,
statement=statement,
bind=bind,
schema_translate_map=schema_translate_map,
compile_kwargs=compile_kwargs,
)
示例2: __init__
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def __init__(self, dialect, statement, column_keys=None,
inline=False, **kwargs):
if isinstance(statement, Column):
kwargs['compile_kwargs'] = util.immutabledict({'include_table': False})
super(BigQueryCompiler, self).__init__(dialect, statement, column_keys, inline, **kwargs)
示例3: test_union_no_change
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def test_union_no_change(self):
d = util.immutabledict({1: 2, 3: 4})
d2 = d.union({})
is_(d2, d)
示例4: test_merge_with_no_change
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def test_merge_with_no_change(self):
d = util.immutabledict({1: 2, 3: 4})
d2 = d.merge_with({}, None)
eq_(d2, {1: 2, 3: 4})
is_(d2, d)
示例5: test_merge_with_dicts
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def test_merge_with_dicts(self):
d = util.immutabledict({1: 2, 3: 4})
d2 = d.merge_with({3: 5, 7: 12}, {9: 18, 15: 25})
eq_(d, {1: 2, 3: 4})
eq_(d2, {1: 2, 3: 5, 7: 12, 9: 18, 15: 25})
assert isinstance(d2, util.immutabledict)
d3 = d.merge_with({17: 42})
eq_(d3, {1: 2, 3: 4, 17: 42})
示例6: test_merge_with_tuples
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def test_merge_with_tuples(self):
d = util.immutabledict({1: 2, 3: 4})
d2 = d.merge_with([(3, 5), (7, 12)], [(9, 18), (15, 25)])
eq_(d, {1: 2, 3: 4})
eq_(d2, {1: 2, 3: 5, 7: 12, 9: 18, 15: 25})
示例7: test_union_dictionary
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def test_union_dictionary(self):
d = util.immutabledict({1: 2, 3: 4})
d2 = d.union({3: 5, 7: 12})
assert isinstance(d2, util.immutabledict)
eq_(d, {1: 2, 3: 4})
eq_(d2, {1: 2, 3: 5, 7: 12})
示例8: test_keys
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def test_keys(self):
d = util.immutabledict({1: 2, 3: 4})
eq_(set(d.keys()), {1, 3})
示例9: test_values
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def test_values(self):
d = util.immutabledict({1: 2, 3: 4})
eq_(set(d.values()), {2, 4})
示例10: test_items
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def test_items(self):
d = util.immutabledict({1: 2, 3: 4})
eq_(set(d.items()), {(1, 2), (3, 4)})
示例11: test_contains
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def test_contains(self):
d = util.immutabledict({1: 2, 3: 4})
assert 1 in d
assert "foo" not in d
示例12: test_rich_compare
# 需要导入模块: from sqlalchemy import util [as 别名]
# 或者: from sqlalchemy.util import immutabledict [as 别名]
def test_rich_compare(self):
d = util.immutabledict({1: 2, 3: 4})
d2 = util.immutabledict({1: 2, 3: 4})
d3 = util.immutabledict({5: 12})
d4 = {5: 12}
eq_(d, d2)
ne_(d, d3)
ne_(d, d4)
eq_(d3, d4)