• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python func.lower函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: search_users

def search_users(name):
    ''' Search users in a team'''
    if not require.team.read():
        abort(403)

    team = cached_teams.get_team(name)
    form = SearchForm(request.form)
    users = db.session.query(User).all()

    if request.method == 'POST' and form.user.data:
        query = '%' + form.user.data.lower() + '%'
        founds = db.session.query(User)\
                  .filter(or_(func.lower(User.name).like(query),
                              func.lower(User.fullname).like(query)))\
                  .all()

        if not founds:
            msg = gettext('Ooops!  We didn\'t find a user matching your query:')
            flash(msg)

            return render_template(
                '/team/search_users.html',
                founds = [],
                team = team,
                title = gettext('Search name of User'))
        else:
            for found in founds:
                user2team = User2Team.query\
                                .filter(User2Team.team_id==team.id)\
                                .filter(User2Team.user_id==found.id)\
                                .first()
                found.belong = (1, 0)[user2team is None]

            return render_template(
                '/team/search_users.html',
                founds = founds,
                team = team,
                title = gettext('Search User'))

    return render_template(
        '/team/search_users.html',
        founds = [],
        team = team,
        title = gettext('Search User'))
开发者ID:chispita,项目名称:pybossa,代码行数:44,代码来源:team.py


示例17: _after_create

 def _after_create(target, conn, **kw):
     assert target is column.table
     col_func = func.indico_unaccent(func.lower(column))
     index_kwargs = {}
     if not current_app.config['TESTING'] and has_extension(conn, 'pg_trgm'):
         index_kwargs = {'postgresql_using': 'gin',
                         'postgresql_ops': {col_func.key: 'gin_trgm_ops'}}
     elif not current_app.config['TESTING']:
         print 'Warning: pg_trgm extension is not available'
     Index(conv('ix_{}_{}_unaccent'.format(column.table.name, column.name)), col_func, **index_kwargs).create(conn)
开发者ID:jacquesd,项目名称:indico,代码行数:10,代码来源:unaccent.py


示例18: get_artist2scrobbles

    def get_artist2scrobbles(user, min_count, max_uts=None):
        where = Scrobble.user == user
        if max_uts is not None:
            where = where & (Scrobble.uts <= max_uts)

        return defaultdict(lambda: 0,
                           session.query(func.lower(Scrobble.artist), func.count(Scrobble.id)).\
                                   group_by(Scrobble.artist).\
                                   filter(where).\
                                   having(func.count(Scrobble.id) >= min_count))
开发者ID:Erkan-Yilmaz,项目名称:last.fm.thelogin.ru,代码行数:10,代码来源:milestones.py


示例19: search_teams

def search_teams(type):
    ''' Search Teams '''
    if not require.team.read():
        abort(403)
    
    title = gettext('Search name of teams')
    form = SearchForm(request.form)
    teams = db.session.query(Team).all()

    if request.method == 'POST' and form.user.data:
        query = '%' + form.user.data.lower() + '%'
        if type == 'public':
            founds = db.session.query(Team)\
                       .filter(func.lower(Team.name).like(query))\
                       .filter(Team.public == True)\
                       .all()
        else:
            founds = db.session.query(Team)\
                       .join(User2Team)\
                       .filter(func.lower(Team.name).like(query))\
                       .filter(User2Team.user_id == current_user.id)\
                       .all()
        if not founds:
            msg = gettext('Ooops! We didn\'t find a team matching your query:')
            flash(msg)

            return render_template(
                '/team/search_teams.html',
                founds= [],
                team_type = type,
                title=gettext('Search Team'))
        else:
            return render_template(
                '/team/search_teams.html',
                founds = founds,
                team_type = type,
                title = gettext('Search Team'))

    return render_template(
            '/team/search_teams.html',
            found = [],
            team_type = type,
            title = gettext('Search Team'))
开发者ID:chispita,项目名称:pybossa,代码行数:43,代码来源:team.py


示例20: js_add_tag

    def js_add_tag(self):
        if hasattr(self, 'form_result'):
            json = {'success': '', 'error': ''}
            parent = None
            created = None
            location = self.form_result['location']
            newlocation = self.form_result['newlocation']
            for index, item in enumerate(newlocation):
                if item['title'] == '' and location[index] != '':
                    try:
                        parent = meta.Session.query(LocationTag
                                ).filter(LocationTag.title == location[index]
                                ).filter(LocationTag.parent == parent
                                ).one()
                    except: # XXX bare except
                        break
                else:
                    try:
                        InURLValidator.to_python(item['title_short'])

                        existing = meta.Session.query(LocationTag).filter(or_(func.lower(LocationTag.title_short) == item['title_short'].lower(),
                                                                              func.lower(LocationTag.title) == item['title'].lower()))\
                            .filter(LocationTag.parent == parent).first()
                        if existing is not None:
                            if existing.title.lower() == item['title'].lower():
                                json['error'] = _('The entry already exists')
                                break
                            else:
                                json['error'] = _('Choose a different short title')
                                break
                    except: # XXX bare except
                        json['error'] = _('The short title must contain no spaces')
                        break

                    created = LocationTag(item['title'], item['title_short'], u'', parent, confirmed=False)

                    meta.Session.add(created)
                    meta.Session.commit()
                    break
            if created is not None:
                json['success'] = created.title
            return json
开发者ID:nous-consulting,项目名称:ututi,代码行数:42,代码来源:structure.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python func.max函数代码示例发布时间:2022-05-27
下一篇:
Python func.count函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap