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


Python func.lower函数代码示例

本文整理汇总了Python中sqlalchemy.sql.func.lower函数的典型用法代码示例。如果您正苦于以下问题:Python lower函数的具体用法?Python lower怎么用?Python lower使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get

    def get(self):
        args = self.get_parser.parse_args()

        queryset = Project.query

        if args.query:
            queryset = queryset.filter(
                or_(
                    func.lower(Project.name).contains(args.query.lower()),
                    func.lower(Project.slug).contains(args.query.lower()),
                ),
            )

        if args.status:
            queryset = queryset.filter(
                Project.status == ProjectStatus[args.status]
            )

        if args.sort == 'name':
            queryset = queryset.order_by(Project.name.asc())
        elif args.sort == 'date':
            queryset = queryset.order_by(Project.date_created.asc())

        project_list = list(queryset)

        context = []
        if project_list:
            latest_build_results = get_latest_builds_query(project_list)
            latest_build_map = dict(
                zip([b.project_id for b in latest_build_results],
                    self.serialize(latest_build_results))
            )

            passing_build_map = {}
            missing_passing_builds = set()
            for build in latest_build_results:
                if build.result == Result.passed:
                    passing_build_map[build.project_id] = build
                else:
                    passing_build_map[build.project_id] = None
                    missing_passing_builds.add(build.project_id)

            if missing_passing_builds:
                passing_build_results = get_latest_builds_query(
                    project_list, result=Result.passed,
                )
                passing_build_map.update(dict(
                    zip([b.project_id for b in passing_build_results],
                        self.serialize(passing_build_results))
                ))

            for project, data in zip(project_list, self.serialize(project_list)):
                # TODO(dcramer): build serializer is O(N) for stats
                data['lastBuild'] = latest_build_map.get(project.id)
                data['lastPassingBuild'] = passing_build_map.get(project.id)
                context.append(data)

        return self.respond(context)
开发者ID:zbyufei,项目名称:changes,代码行数:58,代码来源:project_index.py

示例2: search

    def search(self, string, show_error):
        """
        Search the database for a given item.

        :param string: The search string
        :param show_error: The error string to be show.
        """
        search = '%' + string.lower() + '%'
        search_results = self.plugin.db_manager.get_all_objects(CustomSlide,
                                                                or_(func.lower(CustomSlide.title).like(search),
                                                                    func.lower(CustomSlide.text).like(search)),
                                                                order_by_ref=CustomSlide.title)
        return [[custom.id, custom.title] for custom in search_results]
开发者ID:crossroadchurch,项目名称:paul,代码行数:13,代码来源:mediaitem.py

示例3: tag_search

def tag_search(text, count=5):
    """Search in the tag_search_items table (for location tags)."""
    QTag = aliased(LocationTag)
    QParent = aliased(LocationTag)
    text = text.lower().strip()
    query = meta.Session.query(TagSearchItem)\
        .join(QTag)\
        .outerjoin((QParent, QParent.id==QTag.parent_id))\
        .filter(TagSearchItem.terms.op('@@')(func.plainto_tsquery(text)))\
        .order_by(or_(func.lower(func.btrim(QParent.title)) == text, func.lower(func.btrim(QParent.title_short)) == text).desc())\
        .order_by(or_(func.lower(func.btrim(QTag.title)) == text, func.lower(func.btrim(QTag.title_short)) == text).desc())\
        .order_by(func.ts_rank_cd(TagSearchItem.terms, func.plainto_tsquery(text)))
    if count is not None:
        query = query.limit(count)
    return query.all()
开发者ID:nous-consulting,项目名称:ututi,代码行数:15,代码来源:search.py

示例4: get

    def get(self, project_id):
        project = Project.get(project_id)
        if project is None:
            return '', 404

        args = self.get_parser.parse_args()

        queryset = Plan.query.filter(
            Plan.project_id == project.id,
        )

        if args.query:
            queryset = queryset.filter(
                func.lower(Plan.label).contains(args.query.lower()),
            )

        if args.status:
            queryset = queryset.filter(
                Plan.status == PlanStatus[args.status],
            )

        if args.sort == 'name':
            queryset = queryset.order_by(Plan.label.asc())
        elif args.sort == 'date':
            queryset = queryset.order_by(Plan.date_created.asc())

        return self.paginate(queryset)
开发者ID:jhance,项目名称:changes,代码行数:27,代码来源:project_plan_index.py

示例5: find_synonym

async def find_synonym(name, what):
    async with engine.acquire() as conn:
         synonym = model.Synonym.__table__
         res=await conn.execute(select([synonym.c.our_name]).where(and_(func.lower(synonym.c.other_name) == name.lower(), 
                                                                   synonym.c.category == what)))
         s = await res.fetchone()
         if s: return s[0]
开发者ID:izderadicka,项目名称:mybookshelf2,代码行数:7,代码来源:dal.py

示例6: __init__

 def __init__(self, word):
     if isinstance(word, basestring):
         self.word = word.lower()
     elif isinstance(word, CaseInsensitiveWord):
         self.word = word.word
     else:
         self.word = func.lower(word)
开发者ID:assembl,项目名称:assembl,代码行数:7,代码来源:sqla_types.py

示例7: handle_list

    def handle_list(self, event, owner, status, milestone):
        session = ibid.databases.trac()

        status = status or 'open'
        if status.lower() == 'open':
            statuses = (u'new', u'assigned', u'reopened')
        else:
            statuses = (status.lower(),)

        query = session.query(Ticket).filter(Ticket.status.in_(statuses))

        if owner:
            if owner.lower() == 'my':
                owner = event.sender['nick']
            else:
                owner = owner.lower().replace("'s", '')
            query = query.filter(func.lower(Ticket.owner)==(owner.lower()))

        if milestone:
            query = query.filter_by(milestone=milestone)

        tickets = query.order_by(Ticket.id).all()

        if len(tickets) > 0:
            event.addresponse(u', '.join(['%s (%s): "%s"' % (ticket.id, ticket.owner, ticket.summary) for ticket in tickets]))
        else:
            event.addresponse(u"No tickets found")

        session.close()
开发者ID:B-Rich,项目名称:ibid-1,代码行数:29,代码来源:trac.py

示例8: get_results

def get_results(
    transcript_name, minimum_CG, maximum_CG, maximum_offtarget,
    scaffold, immunostimulatory
):
    try:
        stored_input = db_session.query(InputData).filter(
            func.lower(InputData.transcript_name) == transcript_name.lower(),
            InputData.minimum_CG == minimum_CG,
            InputData.maximum_CG == maximum_CG,
            InputData.maximum_offtarget == maximum_offtarget,
            func.lower(InputData.scaffold) == scaffold.lower(),
            func.lower(InputData.immunostimulatory) == immunostimulatory.lower()
        ).outerjoin(InputData.results).one()
    except NoResultFound:
        return None
    return [result.as_json() for result in stored_input.results]
开发者ID:sh-miR,项目名称:designer,代码行数:16,代码来源:db_api.py

示例9: frames_by_scaffold

def frames_by_scaffold(scaffold):
    if scaffold == 'all':
        return db_session.query(Backbone).all()

    return db_session.query(Backbone).filter(
        func.lower(Backbone.name) == scaffold.lower()
    ).all()
开发者ID:sh-miR,项目名称:designer,代码行数:7,代码来源:db_api.py

示例10: get

    def get(self, build_id):
        build = Build.query.get(build_id)
        if build is None:
            return '', 404

        args = self.parser.parse_args()

        test_list = TestCase.query.options(
            contains_eager('job')
        ).join(
            Job, TestCase.job_id == Job.id,
        ).filter(
            Job.build_id == build.id,
        )

        if args.query:
            test_list = test_list.filter(
                func.lower(TestCase.name).contains(args.query.lower()),
            )

        if args.result:
            test_list = test_list.filter(
                TestCase.result == Result[args.result],
            )

        if args.sort == 'duration':
            sort_by = TestCase.duration.desc()
        elif args.sort == 'name':
            sort_by = TestCase.name.asc()
        elif args.sort == 'retries':
            sort_by = TestCase.reruns.desc()

        test_list = test_list.order_by(sort_by)

        return self.paginate(test_list, max_per_page=None)
开发者ID:Chetane,项目名称:changes,代码行数:35,代码来源:build_test_index.py

示例11: find_series

async def find_series(ser):
    async with engine.acquire() as conn:
        series = model.Series.__table__
        res = await conn.execute(select([series.c.id, series.c.title]).where(func.lower(series.c.title) == ser['title'].lower()))
        s = await res.fetchone()
        if s:
            return {'id': s[0], 'title': s[1]}
开发者ID:izderadicka,项目名称:mybookshelf2,代码行数:7,代码来源:dal.py

示例12: extract_users

    def extract_users(session, comment_txt):
        """ extract referenced users from a message

        replaces "@name" with "@NN" where NN is userid (because username might change, but id won't)
        returns new comment string and list of resolved users
        """

        userpat = re.compile("@([a-zA-Z0-9_]+)", re.I)

        # look them all up in the db
        usernames = set(m.group(1) for m in userpat.finditer(comment_txt))
        users = (
            session.query(UserAccount)
            .filter(func.lower(UserAccount.username).in_([u.lower() for u in usernames]))
            .all()
        )
        user_lookup = dict((u.username.lower(), u) for u in users)

        def user_replace(m):
            if m.group(1).lower() not in user_lookup:
                return m.group(0)
            user = user_lookup[m.group(1).lower()]
            return u"@%d" % (user.id,)

        comment_txt = userpat.sub(user_replace, comment_txt)

        return comment_txt, users
开发者ID:Aupajo,项目名称:unsourced,代码行数:27,代码来源:models.py

示例13: get

    def get(self):
        args = self.get_parser.parse_args()

        queryset = Repository.query

        if args.query:
            queryset = queryset.filter(
                func.lower(Repository.url).contains(args.query.lower()),
            )

        if args.backend:
            queryset = queryset.filter(
                Repository.backend == RepositoryBackend[args.backend]
            )

        if args.status:
            queryset = queryset.filter(
                Repository.status == RepositoryStatus[args.status],
            )

        if args.sort == 'url':
            queryset = queryset.order_by(Repository.url.asc())
        elif args.sort == 'date':
            queryset = queryset.order_by(Repository.date_created.asc())

        return self.paginate(queryset)
开发者ID:dropbox,项目名称:changes,代码行数:26,代码来源:repository_index.py

示例14: get_user_by_username

def get_user_by_username(db_conn, username):
    s = select(['id', 'name', 'email', 'is_superuser']) \
            .select_from(user_tbl) \
            .where(func.lower(user_tbl.c.name) == username.lower())
    rs = db_conn.execute(s)
    assert rs.rowcount == 1
    return rs.fetchone()
开发者ID:mattklein,项目名称:persfin,代码行数:7,代码来源:__init__.py

示例15: get_by_name_query

def get_by_name_query(table, name):
    """Finds a single row in the given table by name, ignoring case.

    Don't use this for Pokémon!  Use `pokemon()`, as it knows about forms.
    """
    q = pokedex_session.query(table).filter(func.lower(table.name)
                                            == name.lower())

    return q
开发者ID:Sanqui,项目名称:spline-pokedex,代码行数:9,代码来源:db.py


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