当前位置: 首页>>代码示例>>Python>>正文


Python util._repr_params方法代码示例

本文整理汇总了Python中sqlalchemy.sql.util._repr_params方法的典型用法代码示例。如果您正苦于以下问题:Python util._repr_params方法的具体用法?Python util._repr_params怎么用?Python util._repr_params使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sqlalchemy.sql.util的用法示例。


在下文中一共展示了util._repr_params方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_repr_params_positional_list

# 需要导入模块: from sqlalchemy.sql import util [as 别名]
# 或者: from sqlalchemy.sql.util import _repr_params [as 别名]
def test_repr_params_positional_list(self):
        # given non-multi-params in a list.   repr params with
        # per-element truncation, mostly does the exact same thing
        eq_(
            repr(
                sql_util._repr_params(
                    [[i for i in range(300)], 5],
                    batches=10,
                    max_chars=80,
                    ismulti=False,
                )
            ),
            "[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 ... "
            "(1310 characters truncated) ...  "
            "292, 293, 294, 295, 296, 297, 298, 299], 5]",
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:18,代码来源:test_logging.py

示例2: test_repr_params_ismulti_named_dict

# 需要导入模块: from sqlalchemy.sql import util [as 别名]
# 或者: from sqlalchemy.sql.util import _repr_params [as 别名]
def test_repr_params_ismulti_named_dict(self):
        # given non-multi-params in a list.   repr params with
        # per-element truncation, mostly does the exact same thing
        param = {"key_%s" % i: i for i in range(10)}
        eq_(
            repr(
                sql_util._repr_params(
                    [param for j in range(50)],
                    batches=5,
                    max_chars=80,
                    ismulti=True,
                )
            ),
            "[%(param)r, %(param)r, %(param)r  ... "
            "displaying 5 of 50 total bound parameter sets ...  "
            "%(param)r, %(param)r]" % {"param": param},
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:19,代码来源:test_logging.py

示例3: test_repr_params_ismulti_list

# 需要导入模块: from sqlalchemy.sql import util [as 别名]
# 或者: from sqlalchemy.sql.util import _repr_params [as 别名]
def test_repr_params_ismulti_list(self):
        # given multi-params in a list.   repr params with
        # per-element truncation, mostly does the exact same thing
        eq_(
            repr(
                sql_util._repr_params(
                    [
                        [[i for i in range(300)], 5],
                        [[i for i in range(300)], 5],
                        [[i for i in range(300)], 5],
                    ],
                    batches=10,
                    max_chars=80,
                    ismulti=True,
                )
            ),
            "[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 ... "
            "(1310 characters truncated) ...  292, 293, 294, 295, 296, 297, "
            "298, 299], 5], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 ... "
            "(1310 characters truncated) ...  292, 293, 294, 295, 296, 297, "
            "298, 299], 5], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 ... "
            "(1310 characters truncated) ...  292, 293, 294, 295, 296, 297, "
            "298, 299], 5]]",
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:26,代码来源:test_logging.py

示例4: __str__

# 需要导入模块: from sqlalchemy.sql import util [as 别名]
# 或者: from sqlalchemy.sql.util import _repr_params [as 别名]
def __str__(self):
        from sqlalchemy.sql import util

        details = [SQLAlchemyError.__str__(self)]
        if self.statement:
            details.append("[SQL: %r]" % self.statement)
            if self.params:
                params_repr = util._repr_params(self.params, 10)
                details.append("[parameters: %r]" % params_repr)
        return ' '.join([
            "(%s)" % det for det in self.detail
        ] + details) 
开发者ID:jpush,项目名称:jbox,代码行数:14,代码来源:exc.py

示例5: __str__

# 需要导入模块: from sqlalchemy.sql import util [as 别名]
# 或者: from sqlalchemy.sql.util import _repr_params [as 别名]
def __str__(self):
        from sqlalchemy.sql import util

        details = [self._message()]
        if self.statement:
            details.append("[SQL: %r]" % self.statement)
            if self.params:
                params_repr = util._repr_params(self.params, 10)
                details.append("[parameters: %r]" % params_repr)
        code_str = self._code_str()
        if code_str:
            details.append(code_str)
        return ' '.join([
            "(%s)" % det for det in self.detail
        ] + details) 
开发者ID:yfauser,项目名称:planespotter,代码行数:17,代码来源:exc.py

示例6: __str__

# 需要导入模块: from sqlalchemy.sql import util [as 别名]
# 或者: from sqlalchemy.sql.util import _repr_params [as 别名]
def __str__(self):
        from sqlalchemy.sql import util
        params_repr = util._repr_params(self.params, 10)

        return ' '.join([
            "(%s)" % det for det in self.detail
            ] + [
                SQLAlchemyError.__str__(self),
                repr(self.statement), repr(params_repr)
            ]) 
开发者ID:gltn,项目名称:stdm,代码行数:12,代码来源:exc.py

示例7: _sql_message

# 需要导入模块: from sqlalchemy.sql import util [as 别名]
# 或者: from sqlalchemy.sql.util import _repr_params [as 别名]
def _sql_message(self, as_unicode):
        from sqlalchemy.sql import util

        details = [self._message(as_unicode=as_unicode)]
        if self.statement:
            if not as_unicode and not compat.py3k:
                stmt_detail = "[SQL: %s]" % compat.safe_bytestring(
                    self.statement
                )
            else:
                stmt_detail = "[SQL: %s]" % self.statement
            details.append(stmt_detail)
            if self.params:
                if self.hide_parameters:
                    details.append(
                        "[SQL parameters hidden due to hide_parameters=True]"
                    )
                else:
                    params_repr = util._repr_params(
                        self.params, 10, ismulti=self.ismulti
                    )
                    details.append("[parameters: %r]" % params_repr)
        code_str = self._code_str()
        if code_str:
            details.append(code_str)
        return "\n".join(["(%s)" % det for det in self.detail] + details) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:28,代码来源:exc.py

示例8: test_repr_params_large_list_of_dict

# 需要导入模块: from sqlalchemy.sql import util [as 别名]
# 或者: from sqlalchemy.sql.util import _repr_params [as 别名]
def test_repr_params_large_list_of_dict(self):
        eq_(
            repr(
                sql_util._repr_params(
                    [{"data": str(i)} for i in range(100)],
                    batches=10,
                    ismulti=True,
                )
            ),
            "[{'data': '0'}, {'data': '1'}, {'data': '2'}, {'data': '3'}, "
            "{'data': '4'}, {'data': '5'}, {'data': '6'}, {'data': '7'}"
            "  ... displaying 10 of 100 total bound "
            "parameter sets ...  {'data': '98'}, {'data': '99'}]",
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:16,代码来源:test_logging.py

示例9: test_repr_params_positional_array

# 需要导入模块: from sqlalchemy.sql import util [as 别名]
# 或者: from sqlalchemy.sql.util import _repr_params [as 别名]
def test_repr_params_positional_array(self):
        eq_(
            repr(
                sql_util._repr_params(
                    [[1, 2, 3], 5], batches=10, ismulti=False
                )
            ),
            "[[1, 2, 3], 5]",
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:11,代码来源:test_logging.py

示例10: test_repr_params_unknown_list

# 需要导入模块: from sqlalchemy.sql import util [as 别名]
# 或者: from sqlalchemy.sql.util import _repr_params [as 别名]
def test_repr_params_unknown_list(self):
        # not known if given multiparams or not.   repr params with
        # straight truncation
        eq_(
            repr(
                sql_util._repr_params(
                    [[i for i in range(300)], 5], batches=10, max_chars=80
                )
            ),
            "[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,  ... "
            "(1315 characters truncated) ... , 293, 294, 295, 296, "
            "297, 298, 299], 5]",
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:15,代码来源:test_logging.py

示例11: __str__

# 需要导入模块: from sqlalchemy.sql import util [as 别名]
# 或者: from sqlalchemy.sql.util import _repr_params [as 别名]
def __str__(self):
        from sqlalchemy.sql import util
        params_repr = util._repr_params(self.params, 10)

        return ' '.join([
                            "(%s)" % det for det in self.detail
                        ] + [
                            SQLAlchemyError.__str__(self),
                             repr(self.statement), repr(params_repr)
                        ]) 
开发者ID:binhex,项目名称:moviegrabber,代码行数:12,代码来源:exc.py


注:本文中的sqlalchemy.sql.util._repr_params方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。