Example #1
0
    def __run__(self, time):
        info = self.get_build_info()
        issues = []
        curr = self.getReportedIssues()
        for i in info:
            if safe_read_dictionary(i, 'pull_request') is None:
                if str(i['id']) not in curr:
                    urls = re.findall(
                        'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',
                        i['body'])

                    img = ''
                    bodyText = i['body']
                    if len(urls) > 0:
                        img = urls[0]
                        bodyText = bodyText.replace(img, '')

                    Timeline.add_item_from_bot(
                        i['user']['login'] + ' reported an issue',
                        i['title'] + '. ' + bodyText,
                        img,
                        Icons.Github,
                        IconBackgrounds.Yellow,
                    )
                issues.append(i['id'])
        self.writeReportedIssues(issues)
        print(self.getReportedIssues())
Example #2
0
    def __run__(self, time):
        info = self.get_build_info()
        issues = []
        curr = self.getReportedIssues()
        for i in info:
            if safe_read_dictionary(i, 'pull_request') is None:
                if str(i['id']) not in curr:
                    urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',
                                      i['body'])

                    img = ''
                    bodyText = i['body']
                    if len(urls) > 0:
                        img = urls[0]
                        bodyText = bodyText.replace(img, '')

                    Timeline.add_item_from_bot(i['user']['login'] + ' reported an issue',
                                               i['title'] + '. ' + bodyText,
                                               img,
                                               Icons.Github,
                                               IconBackgrounds.Yellow,)
                issues.append(i['id'])
        self.writeReportedIssues(issues)
        print(self.getReportedIssues())
Example #3
0
 def getReportedIssues(cls):
     i = safe_read_dictionary(sync_read_status_file(), 'issues')
     if i is None:
         i = ''
     return i.split()
Example #4
0
 def get_auth(self):
     d = sync_read_status_file()
     return [
         safe_read_dictionary(d, 'github_username'),
         safe_read_dictionary(d, 'github_password')
     ]
Example #5
0
 def getReportedIssues(cls):
     i = safe_read_dictionary(sync_read_status_file(), 'issues')
     if i is None:
         i = ''
     return i.split()
Example #6
0
 def get_auth(self):
     d = sync_read_status_file()
     return [
         safe_read_dictionary(d, 'github_username'),
         safe_read_dictionary(d, 'github_password')
     ]
Example #7
0
    def test_safe_read_dictionary(self):
        d = {}
        v = safe_read_dictionary(d, 'unknown_value')

        self.assertIsNone(v)
Example #8
0
File: vso.py Project: 0x27/redalert
 def get_auth(self):
     d = sync_read_status_file()
     return [safe_read_dictionary(d, "vso_username"), safe_read_dictionary(d, "vso_password")]