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


Python strings.strip函数代码示例

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


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

示例1: message_top

 def message_top(self):
     culprit = strip(self.culprit)
     if culprit:
         return culprit
     message = strip(self.message)
     if not strip(message):
         return '<unlabeled message>'
     return truncatechars(message.splitlines()[0], 100)
开发者ID:gaojiashenghim,项目名称:sentry,代码行数:8,代码来源:models.py

示例2: serialize

    def serialize(self):
        if self.stacktrace:
            stacktrace = self.stacktrace.serialize()
        else:
            stacktrace = None

        return {
            'type': strip(self.type) or None,
            'value': strip(self.value) or None,
            'module': strip(self.module) or None,
            'stacktrace': stacktrace,
        }
开发者ID:DarkHorseComics,项目名称:sentry,代码行数:12,代码来源:interfaces.py

示例3: message_short

 def message_short(self):
     message = strip(self.message)
     if not message:
         message = '<unlabeled message>'
     else:
         message = truncatechars(message.splitlines()[0], 100)
     return message
开发者ID:JJediny,项目名称:sentry,代码行数:7,代码来源:group.py

示例4: error

 def error(self):
     message = strip(self.message)
     if message:
         message = truncatechars(message, 100)
     else:
         message = '<unlabeled message>'
     return message
开发者ID:gaojiashenghim,项目名称:sentry,代码行数:7,代码来源:models.py

示例5: error

 def error(self):
     message = strip(self.get_legacy_message())
     if not message:
         message = '<unlabeled message>'
     else:
         message = truncatechars(message.splitlines()[0], 100)
     return message
开发者ID:Akashguharoy,项目名称:sentry,代码行数:7,代码来源:event.py

示例6: get_metadata

 def get_metadata(self):
     message = strip(self.data.get('message'))
     if not message:
         title = '<unlabeled event>'
     else:
         title = truncatechars(message.splitlines()[0], 100)
     return {
         'title': title,
     }
开发者ID:280185386,项目名称:sentry,代码行数:9,代码来源:base.py

示例7: save

 def save(self, *args, **kwargs):
     if not self.last_seen:
         self.last_seen = timezone.now()
     if not self.first_seen:
         self.first_seen = self.last_seen
     if not self.active_at:
         self.active_at = self.first_seen
     # We limit what we store for the message body
     self.message = strip(self.message)
     if self.message:
         self.message = truncatechars(self.message.splitlines()[0], 255)
     super(Group, self).save(*args, **kwargs)
开发者ID:JJediny,项目名称:sentry,代码行数:12,代码来源:group.py

示例8: get_metadata

    def get_metadata(self):
        message = strip(get_path(self.data, 'logentry', 'formatted') or
                        get_path(self.data, 'logentry', 'message'))

        if message:
            title = truncatechars(message.splitlines()[0], 100)
        else:
            title = '<unlabeled event>'

        return {
            'title': title,
        }
开发者ID:Kayle009,项目名称:sentry,代码行数:12,代码来源:base.py

示例9: get_metadata

 def get_metadata(self):
     # See GH-3248
     message_interface = self.data.get('sentry.interfaces.Message', {
         'message': self.data.get('message', ''),
     })
     message = strip(message_interface.get('formatted', message_interface['message']))
     if not message:
         title = '<unlabeled event>'
     else:
         title = truncatechars(message.splitlines()[0], 100)
     return {
         'title': title,
     }
开发者ID:Akashguharoy,项目名称:sentry,代码行数:13,代码来源:base.py

示例10: get_context

    def get_context(self, event, is_public=False, **kwargs):
        last_frame = None
        interface = event.interfaces.get("sentry.interfaces.Stacktrace")
        if interface is not None and interface.frames:
            last_frame = interface.frames[-1]

        e_module = strip(self.module)
        e_type = strip(self.type) or "Exception"
        e_value = strip(self.value)

        if self.module:
            fullname = "%s.%s" % (e_module, e_type)
        else:
            fullname = e_type

        return {
            "is_public": is_public,
            "event": event,
            "exception_value": e_value or e_type or "<empty value>",
            "exception_type": e_type,
            "exception_module": e_module,
            "fullname": fullname,
            "last_frame": last_frame,
        }
开发者ID:huy8989,项目名称:sentry,代码行数:24,代码来源:interfaces.py

示例11: get_context

    def get_context(self, event, is_public=False, **kwargs):
        last_frame = None
        interface = event.interfaces.get('sentry.interfaces.Stacktrace')
        if interface is not None and interface.frames:
            last_frame = interface.frames[-1]

        e_module = strip(self.module)
        e_type = strip(self.type) or 'Exception'
        e_value = strip(self.value)

        if self.module:
            fullname = '%s.%s' % (e_module, e_type)
        else:
            fullname = e_type

        return {
            'is_public': is_public,
            'event': event,
            'exception_value': e_value or e_type or '<empty value>',
            'exception_type': e_type,
            'exception_module': e_module,
            'fullname': fullname,
            'last_frame': last_frame
        }
开发者ID:DarkHorseComics,项目名称:sentry,代码行数:24,代码来源:interfaces.py

示例12: notify

    def notify(self, notification):
        event = notification.event
        group = event.group
        project = group.project

        if not self.is_configured(project):
            return

        webhook = self.get_option('webhook', project)
        username = self.get_option('username', project).strip()
        icon_url = self.get_option('icon_url', project)

        title = group.message_short.encode('utf-8')
        project_name = get_project_full_name(project).encode('utf-8')

        # event.get
        description = "[TAG:]\t" + ",".join(["(%s=%s)" % (key, value) for key, value in event.get_tags()]) + \
                      "\n\n[MESSAGE:]\n" + strip(event.message)

        payload = {
            "text": '[%s] %s' % (project_name, title),
            "attachments": [{
                "title": title,
                "description": description,
                "url": group.get_absolute_url(),
                "color": self.color_for_group(group)
            }],
            "displayUser": {
                "name": username.encode('utf-8'),
                "avatarUrl": ""
            }
        }

        payload['displayUser']['avatarUrl'] = icon_url if icon_url else DEFAULT_IMG

        values = json.dumps(payload)

        # Apparently we've stored some bad data from before we used `URLField`.
        webhook = webhook.strip(' ')
        return http.safe_urlopen(webhook, method='POST', data=values, headers={"Content-Type":"application/json"})
开发者ID:minbaby,项目名称:sentry-pubuim,代码行数:40,代码来源:plugin.py

示例13: notify_users

    def notify_users(self, group, event, fail_silently=False):
        repo = self.get_option('repo', group.project)
        api_endpoint = self.get_option('api_endpoint', group.project) or "https://api.github.com/"
        url = '%srepos/%s/issues' % (api_endpoint, repo,)

        title = event.error()
        body = '%s\n\n[<a href="%s">View on Sentry</a>]' % (strip(group.culprit), group.get_absolute_url())
        labels = self.get_option('label', group.project)

        data = {
          "title": title,
          "body": body,
        }
        if labels:
            data["labels"] = [x.strip() for x in labels.split(",")]

        req = urllib2.Request(url, json.dumps(data))
        req.add_header('User-Agent', 'sentry-notify-github-issues/%s' % self.version)
        req.add_header('Authorization', 'token %s' % self.get_option('access_token', group.project))
        req.add_header('Content-Type', 'application/json')
        resp = urllib2.urlopen(req)
        data = json.loads(resp.read())

        self.create_sentry_issue(group, data["title"], data["html_url"], "GH-%s" % data["number"])
开发者ID:yoshiori,项目名称:sentry-notify-github-issues,代码行数:24,代码来源:plugin.py

示例14: title

 def title(self):
     culprit = strip(self.culprit)
     if culprit:
         return culprit
     return self.message
开发者ID:JJediny,项目名称:sentry,代码行数:5,代码来源:group.py

示例15: has_two_part_message

 def has_two_part_message(self):
     message = strip(self.message)
     return '\n' in message or len(message) > 100
开发者ID:JJediny,项目名称:sentry,代码行数:3,代码来源:group.py


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