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


Python db.Integer方法代码示例

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


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

示例1: set_github_repo_ids_from_cran_name

# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import Integer [as 别名]
def set_github_repo_ids_from_cran_name(self):
        q = db.session.query(GithubRepo.login, GithubRepo.repo_name)
        q = q.filter(GithubRepo.language == 'r')
        q = q.filter(GithubRepo.login != 'cran')  # these are just mirrors.
        q = q.filter(GithubRepo.bucket.contains({"cran_descr_file_name": self.project_name}))
        q = q.order_by(GithubRepo.api_raw['stargazers_count'].cast(db.Integer).desc())

        start = time()
        row = q.first()
        print "Github repo query took {}".format(elapsed(start, 4))

        if row is None:
            return None

        else:
            print "Setting a new github repo for {}: {}/{}".format(
                self,
                row[0],
                row[1]
            )
            self.github_owner = row[0]
            self.github_repo_name = row[1]
            self.bucket["matched_from_github_metadata"] = True 
开发者ID:ourresearch,项目名称:depsy,代码行数:25,代码来源:cran_package.py

示例2: set_github_repo

# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import Integer [as 别名]
def set_github_repo(self):
        try:
            urls_str = self.api_raw["info"]["home_page"]
        except KeyError:
            return False

        # People put all kinds of lists in this field. So we're splitting on
        # newlines, commas, and spaces. Won't get everything, but will
        # get most.
        if not urls_str:
            return
        urls = re.compile(r",*\s*\n*").split(urls_str)

        for url in urls:
            login, repo_name = github_api.login_and_repo_name_from_url(url)
            if login and repo_name:
                self.github_repo_name = repo_name
                self.github_owner = login

                # there may be more than one github url. if so, too bad,
                # we're just picking the first one.
                break

        print u"successfully set a github ID for {name}: {login}/{repo_name}.".format(
            name=self.project_name,
            login=self.github_owner,
            repo_name=self.github_repo_name
        )

    # not currently used?
    # def set_github_repo_ids_from_setuppy_name(self):
    #     q = db.session.query(GithubRepo.login, GithubRepo.repo_name)
    #     q = q.filter(GithubRepo.bucket.contains({"setup_py_name": self.project_name}))
    #     q = q.order_by(GithubRepo.api_raw['stargazers_count'].cast(db.Integer).desc())
    #
    #     start = time()
    #     row = q.first()
    #     print "Github repo query took {}".format(elapsed(start, 4))
    #
    #     if row is None:
    #         return None
    #
    #     else:
    #         print "Setting a new github repo for {}: {}/{}".format(
    #             self,
    #             row[0],
    #             row[1]
    #         )
    #         self.github_owner = row[0]
    #         self.github_repo_name = row[1]
    #         self.bucket["matched_from_github_metadata"] = True 
开发者ID:ourresearch,项目名称:depsy,代码行数:53,代码来源:pypi_package.py


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