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


Python BmarkMgr.count方法代码示例

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


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

示例1: count_rrd

# 需要导入模块: from bookie.models import BmarkMgr [as 别名]
# 或者: from bookie.models.BmarkMgr import count [as 别名]
def count_rrd():
    """Add these counts to the rrd graph"""
    rrd = SystemCounts(
        ini.get('rrd_data').format(here=HERE),
        ini.get('rrd_graphs').format(here=HERE))
    rrd.mark(
        datetime.now(),
        BmarkMgr.count(),
        BmarkMgr.count(distinct=True),
        TagMgr.count()
    )
    rrd.update()
开发者ID:cambot,项目名称:Bookie,代码行数:14,代码来源:tasks.py

示例2: test_unique_ct

# 需要导入模块: from bookie.models import BmarkMgr [as 别名]
# 或者: from bookie.models.BmarkMgr import count [as 别名]
    def test_unique_ct(self):
        """Verify that our unique count method is working"""
        ct = 5
        common = 'testing.com'
        users = []
        for i in range(ct):
            user = User()
            user.username = gen_random_word(10)
            DBSession.add(user)
            users.append(user)

        for i in range(ct - 2):
            b = Bmark(
                url=gen_random_word(12),
                username=users[i].username
            )
            DBSession.add(b)

        # Add in our dupes
        c = Bmark(
            url=common,
            username=users[3].username
        )
        DBSession.add(c)
        DBSession.flush()

        d = Bmark(
            url=common,
            username=users[4].username
        )
        DBSession.add(d)
        DBSession.flush()

        ct = BmarkMgr.count(distinct=True)
        eq_(4, ct, 'We should have a total of 4: ' + str(ct))
开发者ID:cambot,项目名称:Bookie,代码行数:37,代码来源:test_bmarkmgr.py

示例3: dashboard

# 需要导入模块: from bookie.models import BmarkMgr [as 别名]
# 或者: from bookie.models.BmarkMgr import count [as 别名]
def dashboard(request):
    """A public dashboard of the system
    """
    # Generate some user data and stats
    user_count = UserMgr.count()
    pending_activations = ActivationMgr.count()

    # Generate some bookmark data.
    bookmark_count = BmarkMgr.count()
    unique_url_count = BmarkMgr.count(distinct=True)
    users_with_bookmarks = BmarkMgr.count(distinct_users=True)

    return {
        'bookmark_data': {
            'count': bookmark_count,
            'unique_count': unique_url_count,
        },
        'user_data': {
            'count': user_count,
            'activations': pending_activations,
            'with_bookmarks': users_with_bookmarks,
        }
    }
开发者ID:Cfhansen,项目名称:Bookie,代码行数:25,代码来源:stats.py

示例4: test_total_ct

# 需要导入模块: from bookie.models import BmarkMgr [as 别名]
# 或者: from bookie.models.BmarkMgr import count [as 别名]
    def test_total_ct(self):
        """Verify that our total count method is working"""
        ct = 5
        user = User()
        user.username = gen_random_word(10)
        DBSession.add(user)
        for i in range(ct):
            b = Bmark(
                url=gen_random_word(12),
                username=user.username
            )
            b.hash_id = gen_random_word(3)
            DBSession.add(b)

        ct = BmarkMgr.count()
        eq_(5, ct, 'We should have a total of 5: ' + str(ct))
开发者ID:cambot,项目名称:Bookie,代码行数:18,代码来源:test_bmarkmgr.py

示例5: test_per_user

# 需要导入模块: from bookie.models import BmarkMgr [as 别名]
# 或者: from bookie.models.BmarkMgr import count [as 别名]
    def test_per_user(self):
        """We should only get a pair of results for this single user"""
        ct = 5
        common = 'testing.com'
        user = User()
        user.username = gen_random_word(10)
        DBSession.add(user)

        usercommon = User()
        usercommon.username = common
        DBSession.add(usercommon)

        for i in range(ct - 2):
            b = Bmark(
                url=gen_random_word(12),
                username=user.username
            )
            DBSession.add(b)

        # add in our dupes
        c = Bmark(
            url=gen_random_word(10),
            username=usercommon.username,
        )
        DBSession.add(c)
        DBSession.flush()

        d = Bmark(
            url=gen_random_word(10),
            username=usercommon.username,
        )
        DBSession.add(d)
        DBSession.flush()

        ct = BmarkMgr.count(username=usercommon.username)
        eq_(2, ct, 'We should have a total of 2: ' + str(ct))
开发者ID:cambot,项目名称:Bookie,代码行数:38,代码来源:test_bmarkmgr.py

示例6: count_total_bookmarks

# 需要导入模块: from bookie.models import BmarkMgr [as 别名]
# 或者: from bookie.models.BmarkMgr import count [as 别名]
 def count_total_bookmarks():
     """Count the total number of bookmarks in the system"""
     total = BmarkMgr.count()
     stat = StatBookmark(attrib=TOTAL_CT, data=total)
     DBSession.add(stat)
开发者ID:BraindeadCrew,项目名称:Bookie,代码行数:7,代码来源:stats.py

示例7: count_unique_bookmarks

# 需要导入模块: from bookie.models import BmarkMgr [as 别名]
# 或者: from bookie.models.BmarkMgr import count [as 别名]
 def count_unique_bookmarks():
     """Count the unique number of bookmarks in the system"""
     total = BmarkMgr.count(distinct=True)
     stat = StatBookmark(attrib=UNIQUE_CT, data=total)
     DBSession.add(stat)
开发者ID:BraindeadCrew,项目名称:Bookie,代码行数:7,代码来源:stats.py


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