本文整理汇总了Python中sqlalchemy.ext.mutable.Mutable类的典型用法代码示例。如果您正苦于以下问题:Python Mutable类的具体用法?Python Mutable怎么用?Python Mutable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mutable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: coerce
def coerce(cls, key, value):
if not isinstance(value, MutableList):
if isinstance(value, list):
return MutableList(value)
value = Mutable.coerce(key, value)
return value
开发者ID:BostonUniversityCBMS,项目名称:ms_deisotope,代码行数:7,代码来源:db.py
示例2: coerce
def coerce(cls, key, value):
if not isinstance(value, MutationList):
if isinstance(value, list):
return cls(value)
return Mutable.coerce(key, value)
else:
return value
开发者ID:IonicaBizauKitchen,项目名称:Kotti,代码行数:7,代码来源:sqla.py
示例3: coerce
def coerce(cls, key, value):
"""Convert plain list to MutationList"""
if not isinstance(value, MutableList):
if isinstance(value, list):
return MutableList(value)
return Mutable.coerce(key, value)
return value
开发者ID:devhub,项目名称:baph,代码行数:7,代码来源:types.py
示例4: coerce
def coerce(cls, key, value):
if not isinstance(value, MutationList):
if isinstance(value, list):
return MutationList(value)
return Mutable.coerce(key, value) # pragma: no cover
else:
return value
开发者ID:WouterVH,项目名称:ptah,代码行数:7,代码来源:sqla.py
示例5: coerce
def coerce(cls, key, value):
if not isinstance(value, BitFlag):
if isinstance(value, int):
return BitFlag(value)
return Mutable.coerce(key, value)
else:
return value
开发者ID:azflin,项目名称:trump,代码行数:7,代码来源:bitflags.py
示例6: coerce
def coerce(cls, key, value):
if not isinstance(value, cls):
if isinstance(value, dict):
return cls(value)
return Mutable.coerce(key, value) # Raises ValueError for us
else:
return value
开发者ID:fiacre,项目名称:FMCSA-scraper,代码行数:7,代码来源:jsonencodeddict.py
示例7: coerce
def coerce(cls, key, value):
if not isinstance(value, MutableDict):
if isinstance(value, dict):
return MutableDict(value)
return Mutable.coerce(key, value)
else:
return value
开发者ID:Bart1983,项目名称:CouchPotatoServer,代码行数:7,代码来源:model.py
示例8: coerce
def coerce(cls, key, value):
"""Convert plain dictionaries to Features."""
if not isinstance(value, cls):
if isinstance(value, list):
return cls(value)
return Mutable.coerce(key, value) # this will raise an error
else:
return value
开发者ID:colwilson,项目名称:flasker,代码行数:8,代码来源:util.py
示例9: coerce
def coerce(cls, key, value):
"""Convert plain dictionary to JSONMutableDict."""
if not isinstance(value, JSONMutableDict):
if isinstance(value, dict):
return JSONMutableDict(value)
return Mutable.coerce(key, value)
else:
return value
开发者ID:jlynn,项目名称:sqlalchemy_postgresql_json,代码行数:8,代码来源:mutable.py
示例10: coerce
def coerce(cls, key, value):
if isinstance(value, JsonEncodedList):
return value
else:
if isinstance(value, list):
return JsonEncodedList(value)
else:
return Mutable.coerce(key, value)
开发者ID:taphqyu,项目名称:sparta,代码行数:8,代码来源:model_base.py
示例11: coerce
def coerce(cls, key, value):
"Convert plain dictionaries to MutableDict."
if not isinstance(value, MutableDict):
if isinstance(value, dict):
return MutableDict(value)
return Mutable.coerce(key, value)
else:
return value
开发者ID:feltus,项目名称:BDSS,代码行数:8,代码来源:base.py
示例12: coerce
def coerce(cls, index, value):
"""Convert plain list to instance of this class."""
if not isinstance(value, cls):
if isinstance(value, list):
return cls(value)
return Mutable.coerce(index, value)
else:
return value
开发者ID:CyberShadow,项目名称:commandment,代码行数:8,代码来源:mutablelist.py
示例13: coerce
def coerce(cls, key, value):
"Convert plain list to MutationList."
if not isinstance(value, MutationList):
if isinstance(value, list):
return MutationList(value)
# this call will raise ValueError
return Mutable.coerce(key, value) # pragma: no cover
else:
return value
开发者ID:yoshrote,项目名称:columns2,代码行数:9,代码来源:models.py
示例14: coerce
def coerce(cls, key, value):
if not isinstance(value, ConfigurationContainer):
if isinstance(value, dict):
return ConfigurationContainer(value)
# this call will raise ValueError
return Mutable.coerce(key, value)
else:
return value
开发者ID:jonyboy2000,项目名称:redash,代码行数:9,代码来源:configuration.py
示例15: coerce
def coerce(cls, key, value):
"Convert plain dictionaries to MutationDict."
if not isinstance(value, MutationDict):
if isinstance(value, dict):
return MutationDict(value)
# this call will raise ValueError
return Mutable.coerce(key, value)
else:
return value
开发者ID:killthrush,项目名称:pybald,代码行数:9,代码来源:models.py
示例16: coerce
def coerce(cls, key, value):
"""Convert list to MutationList."""
if not isinstance(value, MutationList):
if isinstance(value, list):
return MutationList(value)
# this call will raise ValueError
return Mutable.coerce(key, value)
else:
return value
开发者ID:debon,项目名称:abilian-core,代码行数:10,代码来源:sqlalchemy.py
示例17: coerce
def coerce(cls, key, value):
if not isinstance(value, MutationList):
if isinstance(value, list):
return cls(value)
try:
return Mutable.coerce(key, value)
except ValueError as e:
import pdb ; pdb.set_trace()
else:
return value
开发者ID:frispete,项目名称:websauna,代码行数:10,代码来源:json.py
示例18: coerce
def coerce(cls, key, value):
"""Convert plain dictionaries to MutableDict."""
if value is None:
value = {}
if not isinstance(value, MutableDict):
if isinstance(value, dict):
return MutableDict(value)
# This call will raise ValueError
return Mutable.coerce(key, value)
else:
return value
开发者ID:nandoflorestan,项目名称:bag,代码行数:12,代码来源:json_col.py
示例19: coerce
def coerce(cls, key, value):
"""Convert plain dictionaries to MutableDict.
:param key: string name of the ORM-mapped attribute being set.
:param value: the incoming value.
:return: the method should return the coerced value
"""
if not isinstance(value, cls):
if isinstance(value, dict):
return cls(value)
# this call will raise ValueError
return MutableBase.coerce(key, value)
return value
开发者ID:ekorekin,项目名称:fuel-web,代码行数:13,代码来源:mutable.py
示例20: coerce
def coerce(cls, key, value):
"""
Convert plain sets to MutableSet.
"""
if not isinstance(value, MutableSet):
if isinstance(value, set):
return MutableSet(value)
# this call will raise ValueError
return Mutable.coerce(key, value)
else:
return value
开发者ID:ulysseswolf,项目名称:flaskbb,代码行数:13,代码来源:types.py
注:本文中的sqlalchemy.ext.mutable.Mutable类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论