Ejemplo n.º 1
0
    def parse(self):
        bugsfn = os.path.join(self.folder, self.BUGS_FILE)
        commentsfn = os.path.join(self.folder, self.COMMENTS_FILE)

        if self.label == Label.ASSIGNEE:
            label_field = "assigned_to"
        elif self.label == Label.COMPONENT:
            label_field = "component"

        with open(bugsfn, "r") as bugsf:
            bugs_raw = bugsf.read()
        with open(commentsfn, "r") as commentsf:
            comments_raw = commentsf.read()

        bugs = json.loads(bugs_raw)["bugs"]
        comments = json.loads(comments_raw)

        documents = []
        for bug in bugs:
            title = bug["summary"]
            description = comments[str(bug["id"])]["comments"]["text"]
            label = bug[label_field]
            document = Document(title, description, label)
            document._created = comments[str(bug["id"])]["comments"]["time"]
            documents.append(document)

        return documents
Ejemplo n.º 2
0
    def parse(self):
        bugsfn = os.path.join(self.folder, self.BUGS_FILE)
        commentsfn = os.path.join(self.folder, self.COMMENTS_FILE)

        if self.label == Label.ASSIGNEE:
            label_field = "assigned_to"
        elif self.label == Label.COMPONENT:
            label_field = "component"

        with open(bugsfn, "r") as bugsf:
            bugs_raw = bugsf.read()
        with open(commentsfn, "r") as commentsf:
            comments_raw = commentsf.read()

        bugs = json.loads(bugs_raw)["bugs"]
        comments = json.loads(comments_raw)

        documents = []
        for bug in bugs:
            title = bug["summary"]
            description = comments[str(bug["id"])]["comments"]["text"]
            label = bug[label_field]
            document = Document(title, description, label)
            document._created = comments[str(bug["id"])]["comments"]["time"]
            documents.append(document)

        return documents
Ejemplo n.º 3
0
    def parse(self):
        issues = []
        for fn in os.listdir(self.folder):
            filepath = os.path.join(self.folder, fn)
            if os.path.isfile(filepath) and self.project_key in fn:
                with open(filepath) as f:
                    issues += simplejson.load(f)['issues']

        documents = []
        for issue in issues:
            doc = Document(issue['fields']['summary'],
                           issue['fields']['description'],
                           issue['fields']['assignee']['name'])
            doc._created = issue['fields']['created']
            if doc.content or len(doc.title.split()) > 1:
                documents.append(doc)

        return documents
Ejemplo n.º 4
0
    def parse(self):
        issues = []
        for fn in os.listdir(self.folder):
            filepath = os.path.join(self.folder, fn)
            if os.path.isfile(filepath) and self.project_key in fn:
                with open(filepath) as f:
                    issues += simplejson.load(f)['issues']

        documents = []
        for issue in issues:
            doc = Document(issue['fields']['summary'],
                           issue['fields']['description'],
                           issue['fields']['assignee']['name'])
            doc._created = issue['fields']['created']
            if doc.content or len(doc.title.split()) > 1:
                documents.append(doc)

        return documents
Ejemplo n.º 5
0
    def parse(self):
        """Parses data from given folder into list of documents.

        :returns: List of Document objects
        """

        files = os.listdir(self.folder)
        documents = []

        for f in files:
            if f not in ['.DS_Store']:  # excluded files
                full_f = os.path.join(self.folder, f)
                ticket_info = self._parse_file(full_f)
                if ticket_info and re.match(
                        self.project_match, ticket_info[3]):
                    if ticket_info[2] == "Unassigned":
                        ticket_info[2] = None
                    document = Document(
                        ticket_info[0], ticket_info[1], ticket_info[2])
                    document._created = ticket_info[4]
                    documents.append(document)

        return documents
Ejemplo n.º 6
0
    def parse(self):
        """Parses data from given folder into list of documents.

        :returns: List of Document objects
        """

        files = os.listdir(self.folder)
        documents = []

        for f in files:
            if f not in ['.DS_Store']:  # excluded files
                full_f = os.path.join(self.folder, f)
                ticket_info = self._parse_file(full_f)
                if ticket_info and re.match(self.project_match,
                                            ticket_info[3]):
                    if ticket_info[2] == "Unassigned":
                        ticket_info[2] = None
                    document = Document(ticket_info[0], ticket_info[1],
                                        ticket_info[2])
                    document._created = ticket_info[4]
                    documents.append(document)

        return documents