File: python.py

package info (click to toggle)
python-azure 20230112%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 749,544 kB
  • sloc: python: 6,815,827; javascript: 287; makefile: 195; xml: 109; sh: 105
file content (32 lines) | stat: -rw-r--r-- 1,174 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from typing import List
from datetime import datetime

from github.Issue import Issue

from common import Common

_PYTHON_OWNER = {'msyyc', 'Wzb123456789'}
_PYTHON_REPO = 'Azure/azure-sdk-for-python'
_FILE_OUT_NAME_PYTHON = 'sdk_issue_python.md'

class Python(Common):

    def collect_open_issues(self) -> List[Issue]:
        open_issues = super().collect_open_issues()
        # Skip issue created by owners
        filtered_issues = [i for i in open_issues if i.user.login not in self.language_owner]
        return filtered_issues

    def judge_status(self, issue: Issue) -> str:
        bot_advice = super().judge_status(issue)
        # Prompt to add `issue-addressed` tag if customer has not replied > 7 days
        issue_labels = [label.name for label in issue.labels]
        if not bot_advice and 'issue-addressed' not in issue_labels and 'needs-author-feedback' not in issue_labels:
            if (datetime.today() - list(issue.get_comments())[-1].updated_at).days > 7:
                return 'no reply > 7'
        return bot_advice


def python_process() -> None:
    instance = Python(_PYTHON_OWNER, _PYTHON_REPO, _FILE_OUT_NAME_PYTHON)
    instance.run()