コード例 #1
0
def generate_user_story(user_story: UserStory, locale: LocaleDictionary,
                        paragraph: Paragraph) -> Paragraph:
    with paragraph.create(Tabularx(table_spec="|X|X|",
                                   row_height="1.4")) as tabularx:
        tabularx: Tabularx

        definitions_of_done = Itemize()
        for definition_of_done in user_story.definitions_of_done:
            definitions_of_done.add_item(definition_of_done)
        comments = Itemize()
        for comment in user_story.comments:
            comments.add_item(comment)

        tabularx.add_row(
            [MultiColumn(2, data=bold(user_story.name), color="gray")])
        tabularx.add_row([f"{locale.as_user}: ", f"{locale.user_want}: "])
        tabularx.add_row([user_story.user, user_story.action])
        if user_story.description is not None:
            tabularx.add_row([
                MultiColumn(
                    2,
                    align=NoEscape("|p{\\rowWidth}|"),
                    data=[f"{locale.description}: ", user_story.description],
                    color="gray")
            ])
        if len(user_story.definitions_of_done) > 0:
            tabularx.add_row([
                MultiColumn(2,
                            align=NoEscape("|p{\\rowWidth}|"),
                            data=[
                                f"{locale.definition_of_done}: ",
                                definitions_of_done
                            ])
            ])
        if len(user_story.assignments) > 0:
            tabularx.add_row([
                MultiColumn(2,
                            align=NoEscape("|p{\\rowWidth}|"),
                            data=[
                                f"{locale.assignation}: ",
                                ", ".join(user_story.assignments)
                            ],
                            color="gray")
            ])
        tabularx.add_row([
            f"{locale.estimated_duration}: ",
            f"{user_story.estimated_duration:g} {locale.man_days} ({int(user_story.estimated_duration * 8)}"
            f" {locale.hours})"
        ])
        tabularx.add_row(
            [f"{locale.status}: ",
             user_story.status.translate(locale)])
        if len(user_story.comments) > 0:
            tabularx.add_row([
                MultiColumn(2,
                            align=NoEscape("|p{\\rowWidth}|"),
                            data=[f"{locale.comments}: ", comments],
                            color="gray")
            ])
    return paragraph
コード例 #2
0
    def write_prgramm_statments(self, doc):
        section1 = Section("rCat, v.0.1", numbering=False)
        section1.append(
            "This program is developed by Florian Barth and Evgeny Kim with the help of Roman Klinger and Sandra Murr. It is part of the Center for Reflected Text Analytics (CRETA) at the Universtiy of Stuttgart.\n\nFeel free to contact us:"
        )

        list = Itemize()
        list.add_item("*****@*****.**")

        section1.append(list)
        doc.append(section1)
コード例 #3
0
ファイル: args.py プロジェクト: Neraste/PyLaTeX
def test_lists():
    # Lists
    itemize = Itemize()
    itemize.add_item(s="item")
    itemize.append("append")

    enum = Enumerate()
    enum.add_item(s="item")
    enum.append("append")

    desc = Description()
    desc.add_item(label="label", s="item")
    desc.append("append")
コード例 #4
0
ファイル: args.py プロジェクト: rfilmyer/PyLaTeX
def test_lists():
    # Lists
    itemize = Itemize()
    itemize.add_item(s="item")
    itemize.append("append")

    enum = Enumerate()
    enum.add_item(s="item")
    enum.append("append")

    desc = Description()
    desc.add_item(label="label", s="item")
    desc.append("append")
コード例 #5
0
    def build_text_automatic(self, record):
        text = record[Constants.TEXT_FIELD]
        sentences = nlp_utils.get_sentences(text)
        lemmatized_words = []
        for sentence in sentences:
            lemmatized_words.append(
                nlp_utils.lemmatize_sentence(sentence,
                                             nltk.re.compile(''),
                                             min_length=1,
                                             max_length=100))

        doc_parts = []
        itemize = Itemize()

        for sentence in lemmatized_words:
            new_words = []
            itemize.add_item('')
            for tagged_word in sentence:
                tag = tagged_word[1]
                word = tagged_word[0]
                singular = pattern.text.en.singularize(word)
                word_found = False

                # if tag == 'VBD':
                #     new_words.append(
                #         '\\colorbox[rgb]{0.5,0.5,0.5}{' + word + '}')
                #     word_found = True
                #
                # if tag.startswith('PRP'):
                #     new_words.append(
                #         '\\colorbox[rgb]{0.85,0.85,0.85}{' + word + '}')
                #     word_found = True

                for topic_id in self.automatic_context_topic_ids:
                    if word in self.topic_words_map[topic_id]:
                        # if singular in context_words[Constants.ITEM_TYPE][topic]:
                        self.tag_word(word)
                        color_id = self.automatic_context_topic_colors[
                            topic_id]
                        color = self.rgb_tuples[color_id]
                        new_words.append('\\colorbox[rgb]{' + str(color[0]) +
                                         ',' + str(color[1]) + ',' +
                                         str(color[2]) + '}{' + word + '}')
                        word_found = True
                        break
                if not word_found:
                    new_words.append(word)
            itemize.append(NoEscape(' '.join(new_words)))
        doc_parts.append(itemize)

        return doc_parts
コード例 #6
0
    def build_text_automatic(self, record):
        text = record[Constants.TEXT_FIELD]
        sentences = nlp_utils.get_sentences(text)
        lemmatized_words = []
        for sentence in sentences:
            lemmatized_words.append(nlp_utils.lemmatize_sentence(
                sentence, nltk.re.compile(''),
                min_length=1, max_length=100))

        doc_parts = []
        itemize = Itemize()

        for sentence in lemmatized_words:
            new_words = []
            itemize.add_item('')
            for tagged_word in sentence:
                tag = tagged_word[1]
                word = tagged_word[0]
                singular = pattern.text.en.singularize(word)
                word_found = False

                # if tag == 'VBD':
                #     new_words.append(
                #         '\\colorbox[rgb]{0.5,0.5,0.5}{' + word + '}')
                #     word_found = True
                #
                # if tag.startswith('PRP'):
                #     new_words.append(
                #         '\\colorbox[rgb]{0.85,0.85,0.85}{' + word + '}')
                #     word_found = True

                for topic_id in self.automatic_context_topic_ids:
                    if word in self.topic_words_map[topic_id]:
                    # if singular in context_words[Constants.ITEM_TYPE][topic]:
                        self.tag_word(word)
                        color_id = self.automatic_context_topic_colors[topic_id]
                        color = self.rgb_tuples[color_id]
                        new_words.append(
                            '\\colorbox[rgb]{' +
                            str(color[0]) + ',' + str(color[1]) + ',' +
                            str(color[2]) + '}{' + word + '}')
                        word_found = True
                        break
                if not word_found:
                    new_words.append(word)
            itemize.append(NoEscape(' '.join(new_words)))
        doc_parts.append(itemize)

        return doc_parts
コード例 #7
0
ファイル: args.py プロジェクト: vovchikthebest/PyLaTeX
def test_lists():
    # Lists
    itemize = Itemize()
    itemize.add_item(s="item")
    itemize.append("append")
    repr(itemize)

    enum = Enumerate(enumeration_symbol=r"\alph*)", options={'start': 172})
    enum.add_item(s="item")
    enum.add_item(s="item2")
    enum.append("append")
    repr(enum)

    desc = Description()
    desc.add_item(label="label", s="item")
    desc.append("append")
    repr(desc)
コード例 #8
0
ファイル: args.py プロジェクト: cmrfrd/PyLaTeX
def test_lists():
    # Lists
    itemize = Itemize()
    itemize.add_item(s="item")
    itemize.append("append")
    repr(itemize)

    enum = Enumerate(enumeration_symbol=r"\alph*)", options={'start': 172})
    enum.add_item(s="item")
    enum.add_item(s="item2")
    enum.append("append")
    repr(enum)

    desc = Description()
    desc.add_item(label="label", s="item")
    desc.append("append")
    repr(desc)
コード例 #9
0
ファイル: class_latexdoc.py プロジェクト: plutoese/latexdoc
    def add_list(self, lists, type=1):
        """ 添加列表

        :param list lists: 列表名称
        :param int type: 列表类型
        :return: 无返回值
        """
        if type == 1:
            items = Itemize()
        elif type == 2:
            items = Enumerate()
        elif type == 3:
            items = Description()
        else:
            items = Itemize()
        for item in lists:
            items.add_item(item)

        self.doc.append(items)
コード例 #10
0
ファイル: class_latexdoc.py プロジェクト: plutoese/Robot
    def add_list(self,lists,type=1):
        """ 添加列表

        :param list lists: 列表名称
        :param int type: 列表类型
        :return: 无返回值
        """
        if type == 1:
            items = Itemize()
        elif type == 2:
            items = Enumerate()
        elif type == 3:
            items = Description()
        else:
            items = Itemize()
        for item in lists:
            items.add_item(item)

        self.doc.append(items)
コード例 #11
0
ファイル: args.py プロジェクト: vaskevich/PyLaTeX
def test_lists():
    # Lists
    itemize = Itemize()
    itemize.add_item(s="item")
    itemize.append("append")
    repr(itemize)

    empty_itemize = Itemize()
    assert empty_itemize.dumps() == ''
    repr(empty_itemize)

    enum = Enumerate()
    enum.add_item(s="item")
    enum.append("append")
    repr(enum)

    desc = Description()
    desc.add_item(label="label", s="item")
    desc.append("append")
    repr(desc)
コード例 #12
0
ファイル: pdf_generator.py プロジェクト: stefanw/froide
def add_message_to_doc(doc, message):
    att_queryset = message.foiattachment_set.filter(
        is_redacted=False,
        is_converted=False
    )

    with doc.create(Description()) as descr:
        descr.add_item(str(_('From:')), message.real_sender)
        descr.add_item(str(_('To:')), message.get_text_recipient())
        descr.add_item(str(_('Date:')),
            formats.date_format(message.timestamp, "DATETIME_FORMAT"))
        descr.add_item(str(_('Via:')), message.get_kind_display())
        descr.add_item(str(_('URL:')), message.get_accessible_link())
        descr.add_item(str(_('Subject:')), message.subject)
        if len(att_queryset):
            itemize = Itemize()
            for att in att_queryset:
                itemize.add_item(att.name)
            descr.add_item(str(_('Attachments:')), itemize)

    doc.append(NoEscape('\\noindent\\makebox[\\linewidth]{\\rule{\\textwidth}{1pt}}'))
    doc.append(LineBreak())
    append_text(doc, message.plaintext)
コード例 #13
0
def add_message_to_doc(doc, message):
    att_queryset = message.foiattachment_set.filter(
        is_redacted=False,
        is_converted=False
    )

    with doc.create(Description()) as descr:
        descr.add_item(str(_('From:')), message.real_sender)
        descr.add_item(str(_('To:')), message.get_text_recipient())
        descr.add_item(str(_('Date:')),
            formats.date_format(message.timestamp, "DATETIME_FORMAT"))
        descr.add_item(str(_('Via:')), message.get_kind_display())
        descr.add_item(str(_('URL:')), message.get_accessible_link())
        descr.add_item(str(_('Subject:')), message.subject)
        if len(att_queryset):
            itemize = Itemize()
            for att in att_queryset:
                itemize.add_item(att.name)
            descr.add_item(str(_('Attachments:')), itemize)

    doc.append(NoEscape('\\noindent\\makebox[\\linewidth]{\\rule{\\textwidth}{1pt}}'))
    doc.append(LineBreak())
    append_text(doc, message.plaintext)
コード例 #14
0
a = Axis(data=None, options=None)

p = Plot(name=None, func=None, coordinates=None, options=None)

# Utils
escape_latex(s='')

fix_filename(path='')

dumps_list(l=[], escape=False, token='\n')

bold(s='')

italic(s='')

verbatim(s='', delimiter='|')

# Lists
itemize = Itemize()
itemize.add_item(s="item")
itemize.append("append")

enum = Enumerate()
enum.add_item(s="item")
enum.append("append")

desc = Description()
desc.add_item(label="label", s="item")
desc.append("append")
コード例 #15
0
ファイル: work.py プロジェクト: zrr1999/znkzykzzn
alf = al_for("1:10")
alf.append("sdas")
func.add_state(alf)
func.add_state(NoEscape("计算粒子群的速度并计算位置"))
func.add_state(Command("Return", "最优值"))
alc.append(func)

al2, alc = algorithm("改进粒子群算法", "适应度函数", "最优值", core=core, label=["算法", "输入", "输出"])
func = al_function("Particle_Swarm_Optimization", "适应度函数")
func.add_state(NoEscape("初始化参数"))
func.add_state(NoEscape("初始化粒子位置"))
func.add_state(Command("Return", "最优值"))
alc.append(func)

env = Itemize()
env.add_item("系统:Windows 10")
env.add_item("开发工具:PyCharm、VSCode")
env.add_item("编程语言:Python3.7")
env.add_item("Python库:Copy(用于深拷贝), Numpy(用于计算粒子速度和位置), Matplotlib(用于可视化),, mpl_toolkits(用于3D可视化)")
env.add_item("报告编写语言:LaTex(使用PyTex编写生成、XeLaTex编译)")

fg = Itemize()  # 分工
fg.add_item(NoEscape("蚁群算法设计:詹荣瑞、安然、刘欢"))
fg.add_item(NoEscape("实验一分析:刘欢"))
fg.add_item(NoEscape("实验二分析:安然"))
fg.add_item(NoEscape("实验三分析:詹荣瑞"))
fg.add_item(NoEscape("报告编写:詹荣瑞、刘欢、安然"))

# 粒子群算法介绍
lzq = (r"粒子群算法(Particle Swarm Optimization,简称PSO)是1995年Eberhart博士和Kennedy博士一起提出的。"
       r"粒子群算法是通过模拟鸟群捕食行为设计的一种群智能算法。"
コード例 #16
0
ファイル: texparser.py プロジェクト: mylv1222/MarkTex
def de_itemize(s: env.Itemize):
    tokens = [de_line(c) for c in s.children]
    ui = TItem()
    for line in tokens:
        ui.add_item(line)
    return ui
コード例 #17
0
 def fromItemize(self, s: Itemize):
     tokens = [self.fromTokenLine(c) for c in s.buffer]
     ui = TItem()
     for line in tokens:
         ui.add_item(line)
     return ui
コード例 #18
0
ファイル: args.py プロジェクト: amitdash/PyLaTeX
a = Axis(data=None, options=None)

p = Plot(name=None, func=None, coordinates=None, options=None)

# Utils
escape_latex(s='')

fix_filename(path='')

dumps_list(l=[], escape=False, token='\n')

bold(s='')

italic(s='')

verbatim(s='', delimiter='|')

# Lists
itemize = Itemize()
itemize.add_item(s="item")
itemize.append("append")

enum = Enumerate()
enum.add_item(s="item")
enum.append("append")

desc = Description()
desc.add_item(label="label", s="item")
desc.append("append")