コード例 #1
0
    def transform(self, result, encoding):
        css = u''
        javascript = u''
        for parent in parents(self.published.context, iface=IFlowFolder):
            css = parent._v_css = getattr(  # noqa: P001
                parent,
                '_v_css',
                Scss().compile(parent.css or u''),
            )
            javascript =\
                (parent.javascript or u'').strip().replace(u'\r\n', u'\n')
            break

        root = result.tree.getroot()
        if css:
            head = root.find('head')
            # trick LXML to render styles with //<!CDATA[[
            style = builder.STYLE(u'\n/*', type='text/css')
            style.append(builder.S(CDATA(u'*/\n' + css + u'\n/*')))
            style.getchildren()[0].tail = u'*/\n'
            head.append(style)
            # head.append(builder.STYLE(
            #     css,
            #     type='text/css',
            # ))

        if javascript:
            body = root.find('body')
            # trick LXML to render script with //<!CDATA[[
            script = builder.SCRIPT(u'\n//', type='application/javascript')
            script.append(builder.S(CDATA(u'\n' + javascript + u'\n//')))
            script.getchildren()[0].tail = u'\n'
            body.append(script)

        return result
コード例 #2
0
ファイル: item.py プロジェクト: icetemple/genrss
    def to_element(self) -> ElementT:
        """Returns item element for xml."""
        item = create_element('item', children=[
            create_element('title', CDATA(self.title)),
            create_element('description', CDATA(self.description)),
        ])

        if self.url:
            item.append(create_element('link', self.url))

        item.append(create_element(
            'guid',
            attrib={
                'isPermaLink': str(bool(not self.guid and self.url)).lower()
            },
            text=(self.guid or self.url or CDATA(self.title))
        ))

        if self.author:
            item.append(create_element(
                '{http://purl.org/dc/elements/1.1/}creator',
                CDATA(self.author)
            ))

        for category in self.categories:
            item.append(create_element('category', CDATA(category)))
        if self.enclosure:
            item.append(self.enclosure.to_element())
        if self.pub_date:
            item.append(create_element('pubDate', self.pub_date))

        return item
コード例 #3
0
    def process_availability(self, root, tag, child, script_type, identifier):
        if tag:
            if child.text is None:
                child.text = CDATA(self.add_availability(script_type, identifier, False))
            else:
                if 'SchemeUtil_PMP' not in child.text:
                    new_var = ''
                    current_code_array = child.text.splitlines()
                    current_code = ''
                    for line_code in current_code_array:
                        if line_code.startswith('//'):
                            pass
                        else:
                            current_code = current_code + line_code + '\n'

                    if child.text.count('return ') > 1:
                        new_var = new_var + 'var actual : boolean'
                        new_var = new_var + str(current_code).replace('return', 'actual =').replace('"', '\"')
                    else:
                        new_var = str(current_code).replace('return', 'var actual =', 1).replace('"', '\"')
                    child.text = CDATA(new_var + '\n' + self.add_availability(script_type, identifier, True))
        else:
            new_element = etree.Element('AvailabilityScript')
            new_element.text = CDATA(self.add_availability(script_type, identifier, False))
            root.insert(0, new_element)
コード例 #4
0
 def process_initialize(self, root, tag, child):
     if tag:
         if child.text is None:
             child.text = CDATA(self.add_clause_initialize())
     else:
         new_element = etree.Element('InitializeScript')
         new_element.text = CDATA(self.add_clause_initialize())
         root.insert(0, new_element)
コード例 #5
0
 def process_existence(self, root, tag, child):
     if self.existence != '':
         del root.attrib['existence']
         if tag:
             if child.text is None:
                 child.text = CDATA(self.add_clause_existence())
         else:
             new_element = etree.Element('ExistenceScript')
             new_element.text = CDATA(self.add_clause_existence())
             root.insert(0, new_element)
コード例 #6
0
ファイル: v2v3.py プロジェクト: larseggert/xml2rfc
 def element_artwork(self, e, p):
     if e.text and e.text.strip() and not ']]>' in e.text:
         e.text = CDATA(
             e.text
         )  # prevent text from being mucked up by other processors
     stripattr(e, [
         'height',
         '{http://www.w3.org/XML/1998/namespace}space',
         'width',
     ])
     if e.text and re.search(r'^\s*<CODE BEGINS>', e.text):
         # We have source code.  Permitted attributes: anchor, name,
         # source, type.
         e = self.replace(e, 'sourcecode')
         e.set('markers', 'true')
         match = re.search(
             r'(?s)^\s*<CODE BEGINS>(\s+file\s+"([^"]*)")?(.*?)(<CODE ENDS>(.*))?$',
             e.text)
         file = match.group(1)
         name = match.group(2)
         body = match.group(3)
         ends = match.group(4)
         tail = match.group(5)
         if file and name:
             e.set('name', name)
         e.text = CDATA(body)
         if not ends:
             self.warn(e,
                       "Found <CODE BEGINS> without matching <CODE ENDS>")
         if ends and tail.strip() != "":
             self.warn(e, "Found non-whitespace content after <CODE ENDS>")
             e.tail = tail
         stripattr(e, [
             'align',
             'alt',
             'height',
             'suppress-title',
             'width',
         ])
     src = e.get('src')
     if e.text and e.text.strip() and src:
         # We have both text content and a src attribute -- convert to
         # <artset> with 2 <artwork)
         ext = os.path.splitext(src)[1][1:]
         artset = self.element('artset', line=e.sourceline)
         extart = self.copy(e, 'artwork')
         extart.text = None
         extart.tail = None
         extart.set('type', ext)
         artset.append(extart)
         stripattr(e, ['src'])
         e.set('type', 'ascii-art')
         artset.append(e)
         p.append(artset)
コード例 #7
0
ファイル: main.py プロジェクト: lesnolie/Marverick
def generate_rss_feed(repo, filename, me):
    generator = FeedGenerator()
    generator.id(repo.html_url)
    generator.title(f"RSS feed of {repo.owner.login}'s {repo.name}")
    generator.author(
        {"name": os.getenv("GITHUB_NAME"), "email": os.getenv("GITHUB_EMAIL")}
    )
    generator.link(href=repo.html_url)
    generator.link(
        href=f"https://raw.githubusercontent.com/{repo.full_name}/master/{filename}",
        rel="self",
    )
    for issue in repo.get_issues():
        if not issue.body or not is_me(issue, me) or issue.pull_request:
            continue
        item = generator.add_entry(order="append")
        item.id(issue.html_url)
        item.link(href=issue.html_url)
        item.title(issue.title)
        item.published(issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ"))
        for label in issue.labels:
            item.category({"term": label.name})
        body = "".join(c for c in issue.body if _valid_xml_char_ordinal(c))
        item.content(CDATA(marko.convert(body)), type="html")
    generator.atom_file(filename)
コード例 #8
0
    def _cdata(self, text):
        if isinstance(text, str):
            el = Element('a')
            el.text = CDATA(text)
            return dc(tostring(el)[3:-4])

        return smart_text(text)
コード例 #9
0
ファイル: DT2enex.py プロジェクト: jjon/DT2enex
def generateNoteElement(html, enex):
    soup, noteProps = generateCData(html)
    note = etree.SubElement(enex, "note")
    title = etree.SubElement(note, 'title').text = noteProps['note-title']
    content = etree.SubElement(note, "content").text = CDATA(str(soup))
    etree.SubElement(
        note, "created"
    ).text = f"{dt.utcnow().strftime('%Y%m%dT%H%M%SZ')}"  #todo: replace dummy datetimes
    etree.SubElement(
        note, "updated").text = f"{dt.utcnow().strftime('%Y%m%dT%H%M%SZ')}"
    nattrs = etree.SubElement(note, "note-attributes")
    etree.SubElement(nattrs, 'author').text = "Jon Crump"

    for x in noteProps:
        d = noteProps[x]
        if x != 'note-title':
            resource = etree.SubElement(note, "resource")
            etree.SubElement(resource, "data",
                             encoding="base64").text = d['data']
            etree.SubElement(resource, "mime").text = d['type']
            etree.SubElement(resource, "width").text = d['width']
            etree.SubElement(resource, "height").text = d['height']

            rattrs = etree.SubElement(resource, "resource-attributes")
            etree.SubElement(rattrs, 'file-name').text = d['filename']
コード例 #10
0
ファイル: entry.py プロジェクト: aehlke/python-feedgen
def _add_text_elm(entry, data, name):
    """Add a text subelement to an entry"""
    if not data:
        return

    elm = xml_elem(name, entry)
    type_ = data.get('type')
    if data.get('src'):
        if name != 'content':
            raise ValueError("Only the 'content' element of an entry can "
                             "contain a 'src' attribute")
        elm.attrib['src'] = data['src']
    elif data.get(name):
        # Surround xhtml with a div tag, parse it and embed it
        if type_ == 'xhtml':
            xhtml = '<div xmlns="http://www.w3.org/1999/xhtml">' \
                    + data.get(name) + '</div>'
            elm.append(xml_fromstring(xhtml))
        elif type_ == 'CDATA':
            elm.text = CDATA(data.get(name))
        # Parse XML and embed it
        elif type_ and (type_.endswith('/xml') or type_.endswith('+xml')):
            elm.append(xml_fromstring(data[name]))
        # Embed the text in escaped form
        elif not type_ or type_.startswith('text') or type_ == 'html':
            elm.text = data.get(name)
        # Everything else should be included base64 encoded
        else:
            raise NotImplementedError(
                'base64 encoded {} is not supported at the moment. '
                'Pull requests adding support are welcome.'.format(name)
            )
    # Add type description of the content
    if type_:
        elm.attrib['type'] = type_
コード例 #11
0
def process_version(version, key, path, author):
    cpath = path
    vars = (version.get('vars') or {})
    xmlver = Element(
        'version', {
            'name': key,
            'author': version.get('author') or author,
            'time': get(version, 'time', prefix=path),
        })
    SubElement(xmlver,
               'changelog').text = CDATA(get(version, 'changelog', path))
    file_list = get(version, 'files', path)
    for i in range(len(file_list)):
        filedef = file_list[i]
        cpath = path + ['files', str(i + 1)]
        if isinstance(filedef, str):
            # Simple case: just a string
            SubElement(xmlver,
                       'source').text = replace_text(filedef, vars, cpath)
        else:
            # Complex case, dictionary with fields
            # TODO process variables
            attribs = filedef.copy()
            for k, v in attribs.items():
                attribs[k] = replace_text(str(v), vars, cpath)
            src = attribs.pop('src')
            SubElement(xmlver, 'source', attribs).text = src
    return xmlver
コード例 #12
0
    def encode_item(self, request, item, search_context):
        link_url = request.build_absolute_uri(
            "%s?%s" % (reverse("ows"),
                       urlencode(
                           dict(
                               service="WCS",
                               version="2.0.1",
                               request="DescribeCoverage",
                               coverageId=item.identifier,
                           ))))

        rss_item = RSS(
            "item",
            RSS("title", item.identifier),
            RSS("description", CDATA(item.identifier)),
            RSS("link", link_url),
        )

        if "geo" in search_context.parameters:
            rss_item.append(RSS("guid", request.build_absolute_uri()))
        else:
            rss_item.append(RSS("guid", item.identifier, isPermaLink="false"))

        rss_item.extend(self.encode_item_links(request, item))

        # TODO: remove this for the general dc:date?
        if item.begin_time and item.end_time:
            rss_item.append(
                GML("TimePeriod",
                    GML("beginPosition", isoformat(item.begin_time)),
                    GML("endPosition", isoformat(item.end_time)),
                    **{ns_gml("id"): item.identifier}))

        rss_item.extend(self.encode_spatio_temporal(item))
        return rss_item
コード例 #13
0
    def makeLayers(self, root, mapp, mapkey):
        for l in mapp[mapkey]:
            layer = etree.SubElement(root, "Layer",
                                     name=l["name"].replace("\"", ""))
            for key in l.keys():
                if "include" == key:
                    # import the file?
                    pass
                elif "name" == key:
                    pass
                elif "status" == key:
                    layer.set("status", l[key])
                elif "type" == key:
                    layer.set("type", l[key])
                elif "classes" == key:

                    for s in l[key]:
                        class_ = etree.SubElement(layer, "Class")
                        for k in s.keys():
                            if k == 'name' or k == 'status':
                                class_.set(k, s[k].replace('"', '')
                                           .replace("'", ""))
                            elif k == 'styles':
                                st = s['styles']

                                for sty in st:
                                    stEl = etree.SubElement(class_, "Style")
                                    for key in sty.keys():
                                        self.makeSubElement(stEl, sty, key)
                                    stEl = self.sortChildren(stEl, stEl)
                            elif "labels" == k:
                                kx = self.makeLabels(s, class_, k)
                            else:
                                self.makeSubElement(class_, s, k)
                        class_ = self.sortChildren(class_, class_)

                elif "metadata" == key:
                    meta = etree.SubElement(layer, "Metadata")
                    c = l[key]

                    for kx in c:
                        item = etree.SubElement(meta, "item",
                                                name=kx.replace("'", "")
                                                .replace("\"", ""))
                    item.text = c[kx].replace("'", "").replace("\"", "")
                elif "validation" == key:
                    validation = etree.SubElement(layer, "Validation")
                    for k in l["validation"]:
                        item = etree.SubElement(validation, "item",
                                                name=k[0].replace("'", "")
                                                .replace("\"", ""))
                        item.text = k[1].replace("'", "").replace("\"", "")

                elif "data" == key:
                    data = etree.SubElement(layer, "Data")
                    data.text = CDATA(l["data"][0])
                else:
                    self.makeSubElement(layer, l, key)
            layer = self.sortChildren(layer, layer)
コード例 #14
0
ファイル: image.py プロジェクト: icetemple/genrss
    def to_element(self) -> ElementT:
        """Returns image element for xml."""
        image = create_element('image',
                               children=[
                                   create_element('url', self.url),
                                   create_element('link', self.link),
                                   create_element('title', CDATA(self.title))
                               ])

        if self.description:
            image.append(create_element('description',
                                        CDATA(self.description)))
        if self.height:
            image.append(create_element('height', self.height))
        if self.width:
            image.append(create_element('width', self.width))

        return image
コード例 #15
0
ファイル: tasks2.py プロジェクト: jaesivsm/gtg
    def to_xml(self) -> Element:
        """Serialize the taskstore into a lxml element."""

        root = Element('tasklist')

        for task in self.lookup.values():
            element = SubElement(root, self.XML_TAG)
            element.set('id', str(task.id))
            element.set('status', task.status.value)

            title = SubElement(element, 'title')
            title.text = task.title

            tags = SubElement(element, 'tags')

            for t in task.tags:
                tag_tag = SubElement(tags, 'tag')
                tag_tag.text = str(t.id)

            dates = SubElement(element, 'dates')

            added_date = SubElement(dates, 'added')
            added_date.text = str(task.date_added)

            modified_date = SubElement(dates, 'modified')
            modified_date.text = str(task.date_modified)

            if task.status == Status.DONE:
                done_date = SubElement(dates, 'done')
                done_date.text = str(task.date_closed)

            if task.date_due:
                due = SubElement(dates, 'due')
                due.text = str(task.date_due)

            if task.date_start:
                start = SubElement(dates, 'start')
                start.text = str(task.date_start)

            subtasks = SubElement(element, 'subtasks')

            for subtask in task.children:
                sub = SubElement(subtasks, 'sub')
                sub.text = str(subtask.id)

            content = SubElement(element, 'content')
            text = task.content

            # Poor man's encoding.
            # CDATA's only poison is this combination of characters.
            text = text.replace(']]>', ']]&gt;')
            content.text = CDATA(text)

        return root
コード例 #16
0
 def process_package_covterms(self, child_element):
     for option_cov_term in child_element:
         if option_cov_term.tag == 'Packages':
             for cov_term_opt in option_cov_term:
                 for cov_term_opt_item in cov_term_opt:
                     if cov_term_opt_item.text is not None:
                         if cov_term_opt_item.tag == 'PackageTerms':
                             pass
                         else:
                             cov_term_opt_item.text = CDATA(cov_term_opt_item.text)
     return self
コード例 #17
0
    def encode_entry(self, request, item):
        entry = ATOM(
            "entry",
            ATOM("title", item.identifier),
            ATOM("id", item.identifier),
            ATOM("summary", CDATA(item.identifier)),
        )

        entry.extend(self.encode_item_links(request, item))
        entry.extend(self.encode_spatio_temporal(item))

        return entry
コード例 #18
0
    def _create_xml_content(self, export_data):
        """
        Creates an xml content based on the input data and the EDI report template and puts it into the 'body' field of the 'self'.

        :param export_data: a list of dictionaries with element names and values

        This method is called explicitly when the EDI document is created.
        """
        report_obj = self.env['report']
        self.body = report_obj.get_html(
            self, 'eintegration_edi_manager.edi_document_report_template')
        root = etree.fromstring(self.body.lstrip())
        message_body = root.find('.//MESSAGEBODY')
        element_list = []
        for export_data_item in export_data:
            top = None
            for exported_field in export_data_item['names']:
                element_names = exported_field.split('/')
                field_element = None
                parent_element = top
                for element_name in element_names:
                    if top is None:
                        field_element = etree.Element(element_name)
                        top = field_element
                    else:
                        field_element = parent_element.find(element_name)
                        if field_element is None:
                            field_element = parent_element if parent_element.tag == element_name else etree.SubElement(
                                parent_element, element_name)
                    parent_element = field_element
                data_value = export_data_item['data'].pop(0)
                if isinstance(data_value, (int, float)):
                    field_element.text = CDATA(str(data_value))
                else:
                    field_element.text = CDATA(data_value)
            element_list.append(top)
        for element in element_list:
            message_body.append(element)
        self.body = "<?xml version='1.0' encoding='ISO-8859-1'?>\n" + etree.tostring(
            root, pretty_print=True)
コード例 #19
0
    def cdata_wrap(text):
        if text is None:
            return None

        try:
            if re.search("[<>\'\"]", text) is not None:
                return CDATA(text)
                pass
            return text
        except ValueError as ve:
            raise
        except TypeError as te:
            raise
コード例 #20
0
 def element_artwork(self, e, p):
     if e.text and e.text.strip():
         e.text = CDATA(
             e.text
         )  # prevent text from being mucked up by other processors
     stripattr(e, [
         'height',
         '{http://www.w3.org/XML/1998/namespace}space',
         'width',
     ])
     if e.text and re.search(r'^\s*<CODE BEGINS>', e.text):
         # We have source code.  Permitted attributes: anchor, name,
         # source, type.
         e = self.replace(e, 'sourcecode')
         e.set('markers', 'true')
         match = re.search(
             r'(?s)^\s*<CODE BEGINS>(\s+file\s+"([^"]*)")?(.*?)(<CODE ENDS>(.*))?$',
             e.text)
         file = match.group(1)
         name = match.group(2)
         body = match.group(3)
         ends = match.group(4)
         tail = match.group(5)
         if file and name:
             e.set('name', name)
         e.text = CDATA(body)
         if not ends:
             self.warn(e,
                       "Found <CODE BEGINS> without matching <CODE ENDS>")
         if ends and tail.strip() != "":
             self.warn(e, "Found non-whitespace content after <CODE ENDS>")
             e.tail = tail
         stripattr(e, [
             'align',
             'alt',
             'height',
             'suppress-title',
             'width',
         ])
コード例 #21
0
ファイル: weixin.py プロジェクト: richard-deng/house_base
 def new_dict_to_xml(self, indata):
     log.debug("new_dict_to_xml=%s", indata)
     from lxml import etree
     from lxml.etree import CDATA
     root = etree.Element("xml")
     for k, v in indata.items():
         field = etree.SubElement(root, str(k))
         nv = str(v) if type(v) not in types.StringTypes else v
         log.debug("new_dict_to_xml=%s", nv)
         if k == 'detail':
             field.text = CDATA(nv)
         else:
             field.text = nv
     xmlstr = etree.tostring(root, encoding='utf-8')
     return xmlstr
コード例 #22
0
ファイル: feed.py プロジェクト: ml-feeds/pwc-feeds
    def _output(self, texts: Tuple[bytes, ...]) -> bytes:
        feed_type_desc = self._feed_type_desc
        items = [
            item for text in texts
            for item in self._hext_rule_extract(Html(text.decode()))
        ]
        items = list(unique_everseen(items, json.dumps))
        log.info('HTML inputs %s have %s items in all.', feed_type_desc,
                 len(items))

        feed = self._init_feed()
        is_debug_logged = self._is_debug_logged
        for item in items:
            if item["code_link"].startswith("https://github.com/"):
                item["code_author"] = item["code_link"].removeprefix(
                    "https://github.com/").split("/")[0]
                item[
                    "title"] = "/" + item["code_author"] + "/ " + item["title"]
            if 'categories' not in item:
                item['categories'] = []
            elif isinstance(item['categories'], str):
                item['categories'] = [item['categories']]

            entry = feed.add_entry(order='append')
            entry.title(item['title'])
            entry.link(href=item['link'])
            entry.guid(item['link'], permalink=True)
            # description = '\n\n'.join((item['description'], item['code_link']))
            description = f'{item["description"]} <p>Code: <a href="{item["code_link"]}">{item["code_link"]}</a></p>'
            entry.description(CDATA(description))
            entry.comments(item["code_link"])
            for category in item['categories']:
                if category.startswith(
                        '+') and category[1:].isdigit():  # Ex: +1, +2
                    continue
                category = category.capitalize() if category.isupper(
                ) else category
                entry.category(term=category)
            if is_debug_logged:
                log.debug('Added: %s', item['title'])

        text_: bytes = feed.rss_str(pretty=True)
        log.info('XML output %s has %s items.', feed_type_desc,
                 text_.count(b'<item>'))
        return text_
コード例 #23
0
def clozeQuestion(problemNumber):
    question = etree.SubElement(quiz, "question", type="cloze")
    name = etree.SubElement(question, "name")
    txt = etree.SubElement(name, "text")
    txt.text = problemID + str(problemNumber)
    questionText = etree.SubElement(question, "questiontext", format="html")
    txt = etree.SubElement(questionText, "text")
    cdatadiv = etree.Element("div")

    #############################################################################
    ## The following lines determine the values that are used in the question: ##
    #############################################################################

    amount = 1000 * int(
        5 * random() + 1)  # A random multiple of 1000 between 1000 and 5000.
    interest = int(13 * random() + 4)  # Random integer between 4 and 16.
    years = 2 + int(4 * random())  # Random integer between 2 and 5

    #########################################################################
    ## The following lines create the text for the question:               ##
    #########################################################################

    par = etree.SubElement(cdatadiv, "p")
    par.text = "If I invest R" + str(amount) + " in a fund that receives "
    par.text = par.text + str(interest) + " percent interest per year, "
    par.text = par.text + "compounded monthly, "
    par.text = par.text + "calculate the value of the account after "
    par.text = par.text + str(years) + " years."

    ################################################################################
    ## Lastly, these lines create the Cloze answer boxes with the data they need: ##
    ################################################################################

    par = etree.SubElement(cdatadiv, "p")  # Start a new paragraph
    par.text = clozeAnswerElement(1,
                                  amount * (1 + interest / 1200)**(12 * years),
                                  0.02)

    ########################################################################

    contentStr = etree.tostring(cdatadiv, pretty_print=True)
    txt.text = CDATA(contentStr)
    quiz.append(etree.Comment("New question."))

    return
コード例 #24
0
    def to_element(self) -> ElementT:
        """Returns root element for xml."""
        root = Element('rss', nsmap=self.root_nsmap, version=self.root_version)
        channel = create_element(
            'channel',
            children=[
                create_element('title', CDATA(self.title)),
                create_element('description', CDATA(self.description)),
                create_element('link', self.site_url),
                create_element('{http://www.w3.org/2005/Atom}link',
                               href=self.feed_url,
                               rel='self',
                               type='application/rss+xml'),
                create_element('generator', self.generator),
                create_element('lastBuildDate', datetime.utcnow())
            ])

        channel_image = self.image
        if not channel_image and self.image_url:
            channel_image = Image(self.image_url, self.site_url, self.title)
        if isinstance(channel_image, Image):
            channel.append(channel_image.to_element())

        for category in self.categories:
            channel.append(create_element('category', CDATA(category)))
        if self.pub_date:
            channel.append(create_element('pubDate', self.pub_date))
        if self.copyright:
            channel.append(create_element('copyright', CDATA(self.copyright)))
        if self.language:
            channel.append(create_element('language', CDATA(self.language)))
        if self.editor:
            channel.append(create_element('managingEditor',
                                          CDATA(self.editor)))
        if self.webmaster:
            channel.append(create_element('webMaster', CDATA(self.webmaster)))
        if self.docs_url:
            channel.append(create_element('docs', self.docs_url))

        for item in self.items:
            if isinstance(item, Item):
                channel.append(item.to_element())

        root.append(channel)
        return root
コード例 #25
0
    def export_post_comments(self, nid, base_url):
        wp = self.nsmap['wp']
        content = self.nsmap['content']
        dsq = self.nsmap['dsq']

        post = self.posts[nid]

        item_node = Element('item', nsmap=self.nsmap)
        SubElement(item_node, 'title').text = post['title']
        SubElement(item_node, 'link').text = base_url + self.get_post_path(post) + '/'
        SubElement(item_node, '{%s}encoded' % content).text = CDATA(post['body'])
        SubElement(item_node, '{%s}thread_identifier' % dsq).text = '/' + self.get_post_path(post) + '/'
        SubElement(item_node, '{%s}post_date_gmt' % wp).text = str(post['date'])
        SubElement(item_node, '{%s}comment_status' % wp).text = 'open'

        if nid in self.comments.keys():
            for comment in self.comments[nid]:
                item_node.append(self.export_comment(comment))

        return item_node
コード例 #26
0
ファイル: xml_editing.py プロジェクト: danteorta/suprid
def multiply_fracture_conductivity(origin_xml, new_xml, multiplier):
    """Function that generates a nex XML with some multiple of the conductivity
    -----------
    Parameters:
        origin_xml: String. Full path to the xml to edit
        new_xml: String. Full path to the new xml
        multipler: Float. Conductivity will be multipled by this parameter
        """

    parser = etree.XMLParser(strip_cdata=False)
    tree = etree.parse(origin_xml, parser)
    root = tree.getroot()

    # Read the relevant features
    data = root.find('Mesh').find('Data')
    aperture = data.find('.//DataSet[@TagName="APERTURE"]')
    conductivity = data.find(
        './/DataSet[@TagName="GMFACE_FRACTURE_CONDUCTIVITY"]')

    # Parse the text data as a pandas DataFrame
    cond_data = pn.read_csv(StringIO(conductivity.text),
                            sep='\t\t\t\t',
                            header=None,
                            names=['id_face', 'cond'])

    # Modify the data
    cond_data.loc[:, 'cond'] = cond_data.cond * multiplier
    # Enforce data types
    cond_data = cond_data.astype({'id_face': str, 'cond': str})

    pdb.set_trace()
    # Return the modified data to the text format
    b = cond_data.values.tolist()
    step_1 = ['\t\t\t\t'.join(elm) for elm in b]
    step_2 = '\n\t\t\t\n\t\t\t' + '\n\t\t\t'.join(step_1) + '\n\t\t\t\n\t\t\t'
    # Add the CDATA tag to the new string
    step_3 = CDATA(step_2)
    conductivity.text = step_3
    tree.write(new_xml)
コード例 #27
0
    def create_question_xml(self, slides_lst):
        XHTML_NAMESPACE = xml_schema_url
        XHTML = "{%s}" % XHTML_NAMESPACE
        NSMAP = {
            None: XHTML_NAMESPACE,
            'xsi': 'http://www.w3.org/2001/XMLSchema-instance'
        }
        envelope = Element("HTMLQuestion", nsmap=NSMAP)

        index_path = Path.cwd() / 'docs' / 'index.html'
        index_html = index_path.read_text()

        index_html = index_html.replace(
            'var slides_to_test = [12];',
            'var slides_to_test = ' + str(slides_lst) + ';')

        html_content = SubElement(envelope, 'HTMLContent')
        html_content.text = CDATA(index_html)

        frame_height = SubElement(envelope, 'FrameHeight')
        frame_height.text = '0'

        return tostring(envelope, encoding='unicode')
コード例 #28
0
    def get_kml_for_fields(self,
                           scientific_name=None,
                           province_list=None,
                           provider_id_list=None,
                           latitude=None,
                           longitude=None,
                           start_date=None,
                           end_date=None,
                           page=None,
                           items_per_page=None,
                           start_latitude=None,
                           end_latitude=None,
                           start_longitude=None,
                           end_longitude=None,
                           is_simple_search=False):

        collection_filter = Collection.query.filter(
            Collection.full_scientific_name.like('%' + scientific_name + '%'),
            Collection.province.in_(province_list) if province_list else True,
            Collection.provider_id.in_(provider_id_list)
            if provider_id_list else True,
            Collection.latitude >= start_latitude if start_latitude else True,
            Collection.latitude <= end_latitude if end_latitude else True,
            Collection.longitude >= start_longitude
            if start_longitude else True,
            Collection.longitude <= end_longitude if end_longitude else True,
            Collection.last_date >= start_date if start_date else True,
            Collection.last_date <= end_date if end_date else True)

        if collection_filter.count() == 0:
            return None

        output = io.BytesIO()

        from lxml import etree as et

        root_el = et.Element("kml", xmlns="http://www.opengis.net/kml/2.2")

        document = et.SubElement(root_el, "Document", id="root_doc")
        folder = et.SubElement(document, "Folder")
        et.SubElement(folder, "name").text = "BioNoMo data"
        from unidecode import unidecode
        for collection in collection_filter:
            if collection.longitude and collection.latitude:
                placemark = et.SubElement(folder, "Placemark")
                _content = """
                <span style='font-weight: bold'>{}</span><br><br>
                {}: <span style='font-style: italic'>{}</span><br>
                {}: <span style='font-style: italic'>{}</span><br>
                {}: <span style='font-style: italic'>{}</span><br>
                <br>
                <span style='font-weight: bold'>{}</span><br>
                {}<br>
                """.format(
                    collection.full_scientific_name,
                    unidecode(collection.get_header('header.province')),
                    collection.province if collection.province else "---",
                    unidecode(collection.get_header('header.provider')),
                    collection.provider.name if collection.provider else "---",
                    unidecode(collection.get_header('header.last_date')),
                    collection.last_date if collection.last_date else "---",
                    unidecode(collection.get_header('header.taxonomy')),
                    self.get_taxonomical_tree_as_str_html(collection))
                point = et.SubElement(placemark, "Point")
                et.SubElement(point, "coordinates").text = "{},{}"\
                    .format(collection.longitude, collection.latitude)
                et.SubElement(placemark, "description").text = CDATA(_content)

        tree = et.ElementTree(root_el)
        tree.write(output,
                   pretty_print=False,
                   xml_declaration=True,
                   encoding='utf-8',
                   compression=1)

        return (output, 'zip')
コード例 #29
0
    def to_file(self):
        """ returns:
            - filename: STR
            - fsdb:     FSDB xml data, to be used in frontend."""

        formula = self.comp.formula
        pilots = self.comp.participants
        '''create dicts of attributes for each section'''
        comp_attr = {
            'id':
            '',  # still to do
            'name':
            self.comp.comp_name,
            'location':
            self.comp.comp_site,
            'from':
            self.comp.date_from,
            'to':
            self.comp.date_to,
            'utc_offset':
            self.comp.time_offset / 3600,
            'discipline':
            self.comp.comp_class.lower(),
            'ftv_factor':
            round(1 - formula.validity_param, 2),
            'fai_sanctioning': (1 if self.comp.sanction == 'FAI 1' else
                                2 if self.comp.sanction == 'FAI 2' else 0)
        }

        formula_attr = {
            'id':
            formula.formula_name,
            'min_dist':
            km(formula.min_dist, 1),
            'nom_dist':
            km(formula.nominal_dist, 1),
            'nom_time':
            formula.nominal_time / 3600,
            'nom_launch':
            formula.nominal_launch,
            'nom_goal':
            formula.nominal_goal,
            'day_quality_override':
            0,  # still to implement
            'bonus_gr':
            formula.glide_bonus,
            'jump_the_gun_factor': (0 if formula.max_JTG == 0 else round(
                1 / formula.JTG_penalty_per_sec, 1)),
            'jump_the_gun_max':
            formula.max_JTG,
            'normalize_1000_before_day_quality':
            0,  # still to implement
            'time_points_if_not_in_goal':
            round(1 - formula.no_goal_penalty, 1),
            'use_1000_points_for_max_day_quality':
            0,  # still to implement
            'use_arrival_position_points':
            1 if formula.formula_arrival == 'position' else 0,
            'use_arrival_time_points':
            1 if formula.formula_arrival == 'time' else 0,
            'use_departure_points':
            1 if formula.formula_departure == 'departure' else 0,
            'use_difficulty_for_distance_points':
            1 if formula.formula_distance == 'difficulty' else 0,
            'use_distance_points':
            1 if formula.formula_distance != 'off' else 0,
            'use_distance_squared_for_LC':
            1 if formula.comp_class == 'PG' else 0,  # still to implement
            'use_leading_points':
            1 if formula.formula_departure == 'leadout' else 0,
            'use_semi_circle_control_zone_for_goal_line':
            1,  # still to implement
            'use_time_points':
            1 if formula.formula_time == 'on' else 0,
            'scoring_altitude':
            'GPS' if formula.scoring_altitude == 'GPS' else 'QNH',
            'final_glide_decelerator':
            'none' if formula.arr_alt_bonus == 0 else 'aatb',
            'no_final_glide_decelerator_reason':
            '',
            'min_time_span_for_valid_task':
            60 if self.comp_class == 'PG' else 0,  # still to implement
            'score_back_time':
            formula.score_back_time / 60,
            'use_proportional_leading_weight_if_nobody_in_goal':
            '',  # still to implement
            'leading_weight_factor':
            (0 if formula.formula_departure != 'leadout' else round(
                formula.lead_factor, 3)),
            'turnpoint_radius_tolerance':
            formula.tolerance,
            'use_arrival_altitude_points':
            0 if formula.arr_alt_bonus == 0 else ''  # still to implement
        }
        if formula.arr_alt_bonus > 0:
            formula_attr['aatb_factor'] = round(formula.arr_alt_bonus, 3)
        '''create the file structure'''
        root = ET.Element('Fs')
        root.set('version', '3.5')
        root.set('comment', 'generated by AirScore')
        '''FsCompetition'''
        comp = ET.SubElement(root, 'FsCompetition')
        for k, v in comp_attr.items():
            comp.set(k, str(v))

        formula = ET.SubElement(comp, 'FsScoreFormula')
        for k, v in formula_attr.items():
            formula.set(k, str(v))

        notes = ET.SubElement(comp, 'FsCompetitionNotes')
        notes.text = CDATA('Generated by AirScore')
        # notes.text = '<![CDATA[Generated by AirScore]]>'
        '''FsParticipants'''
        participants = ET.SubElement(comp, 'FsParticipants')
        for p in pilots:
            pil = ET.SubElement(participants, 'FsParticipant')
            pilot_attr = {
                'id': p.ID or p.par_id,
                'name': p.name,
                'birthday': p.pilot_birthdate_str,
                'glider': p.glider,
                'glider_main_colors': '',
                'fai_licence': 1 if p.fai_id else 0,
                'female': p.female,
                'nat_code_3166_a3': p.nat,
                'sponsor': p.sponsor,
                'CIVLID': p.civl_id,
            }
            custom_attr = {
                'fai_n': p.fai_id,
                'class': p.glider_cert,
                'team': p.team,
                'LIVE': p.live_id
            }

            for k, v in pilot_attr.items():
                pil.set(k, str(v))
            cus = ET.SubElement(pil, 'FsCustomAttributes')
            for k, v in custom_attr.items():
                sub = ET.SubElement(cus, 'FsCustomAttribute')
                sub.set('name', k)
                sub.set('value', str(v))
        '''FsTasks'''
        tasks = ET.SubElement(comp, 'FsTasks')
        for idx, t in enumerate(self.tasks):
            task = ET.SubElement(tasks, 'FsTask')
            task.set('id', str(idx + 1))
            task.set('name', t.task_name)
            task.set('tracklog_folder', '')

            task_f = ET.SubElement(task, 'FsScoreFormula')
            task_d = ET.SubElement(task, 'FsTaskDefinition')
            task_s = ET.SubElement(task, 'FsTaskState')
            task_p = ET.SubElement(task, 'FsParticipants')
            task_sp = ET.SubElement(task, 'FsTaskScoreParams')

            # tf = dict(t.formula.to_dict(), **t.stats)
            '''FsTaskState'''
            task_s.set('task_state',
                       ('REGULAR' if not t.stopped_time else 'STOPPED'))  # ?
            task_s.set('score_back_time', str(t.formula.score_back_time / 60))
            task_s.set('cancel_reason', t.comment)
            '''FsScoreFormula'''
            # we permit just few changes in single tasks from comp formula, so we just update those
            tf_attr = formula_attr
            tf_attr.update({
                'jump_the_gun_factor':
                (0 if not t.formula.JTG_penalty_per_sec else round(
                    1 / t.formula.JTG_penalty_per_sec, 1)),
                'time_points_if_not_in_goal':
                1 - t.formula.no_goal_penalty,
                'use_arrival_position_points':
                1 if t.formula.arrival == 'position' else 0,
                'use_arrival_time_points':
                1 if t.formula.arrival == 'time' else 0,
                'use_departure_points':
                1 if t.formula.departure == 'departure' else 0,
                'use_difficulty_for_distance_points':
                1 if t.formula.distance == 'difficulty' else 0,
                'use_distance_points':
                0 if t.formula.distance == 'off' else 1,
                'use_leading_points':
                0 if t.formula.departure == 'off' else 1,
                'use_time_points':
                0 if t.formula.time == 'off' else 1,
                'scoring_altitude':
                'GPS' if t.formula.scoring_altitude == 'GPS' else 'QNH',
                'final_glide_decelerator':
                'none' if t.formula.arr_alt_bonus == 0 else 'aatb',
                'use_arrival_altitude_points':
                0 if t.formula.arr_alt_bonus == 0 else 1,
                'turnpoint_radius_tolerance':
                t.formula.tolerance,
            })

            for k, v in tf_attr.items():
                task_f.set(k, str(v))
            '''FsTaskDefinition'''
            tps = t.turnpoints
            td_attr = {
                'ss':
                [i + 1 for i, tp in enumerate(tps)
                 if tp.type == 'speed'].pop(0),
                'es':
                [i + 1 for i, tp in enumerate(tps)
                 if tp.type == 'endspeed'].pop(0),
                'goal':
                next(tp.shape for tp in tps if tp.type == 'goal').upper(),
                'groundstart':
                0,  # still to implement
                'qnh_setting':
                1013.25  # still to implement
            }

            for k, v in td_attr.items():
                task_d.set(k, str(v))

            t_open = get_isotime(t.date, t.window_open_time, t.time_offset)
            t_close = get_isotime(t.date, t.task_deadline, t.time_offset)
            ss_open = get_isotime(t.date, t.start_time, t.time_offset)
            if t.start_close_time:
                ss_close = get_isotime(t.date, t.start_close_time,
                                       t.time_offset)
            else:
                ss_close = t_close
            if t.window_close_time:
                w_close = get_isotime(t.date, t.window_close_time,
                                      t.time_offset)
            else:
                w_close = ss_close

            for i, tp in enumerate(tps):
                task_tp = ET.SubElement(task_d, 'FsTurnpoint')
                tp_attr = {
                    'id':
                    tp.name,
                    'lat':
                    round(tp.lat, 5),
                    'lon':
                    round(tp.lon, 5),
                    'altitude':
                    tp.altitude,
                    'radius':
                    tp.radius,
                    'open':
                    t_open if i < (td_attr['ss'] - 1) else ss_open,
                    'close':
                    w_close if i == 0 else ss_close if i == (td_attr['ss'] -
                                                             1) else t_close
                }
                for k, v in tp_attr.items():
                    task_tp.set(k, str(v))
                '''we add also FsTaskDistToTp during tp iteration'''
                sp_dist = ET.SubElement(task_sp, 'FsTaskDistToTp')
                sp_dist.set('tp_no', str(i + 1))
                sp_dist.set('distance', str(t.partial_distance[i]))
            '''add start gates'''
            gates = 1
            if t.SS_interval > 0:
                gates += t.start_iteration
            for i in range(gates):
                task_sg = ET.SubElement(task_d, 'FsStartGate')
                intv = 0 if not t.SS_interval else t.SS_interval * i
                i_time = get_isotime(t.date, (t.start_time + intv),
                                     t.time_offset)
                task_sg.set('open', str(i_time))
            '''FsTaskScoreParams'''
            launch_ess = [
                t.partial_distance[i] for i, tp in enumerate(t.turnpoints)
                if tp.type == 'endspeed'
            ].pop()
            sp_attr = {
                'ss_distance':
                km(t.SS_distance),
                'task_distance':
                km(t.opt_dist),
                'launch_to_ess_distance':
                km(launch_ess),
                'no_of_pilots_present':
                t.pilots_present,
                'no_of_pilots_flying':
                t.pilots_launched,
                'no_of_pilots_lo':
                t.pilots_launched - t.pilots_goal,
                'no_of_pilots_reaching_nom_dist':
                len([
                    x for x in t.valid_results
                    if x.distance_flown > t.formula.nominal_dist
                ]),
                'no_of_pilots_reaching_es':
                t.pilots_ess,
                'no_of_pilots_reaching_goal':
                t.pilots_goal,
                'sum_flown_distance':
                km(t.tot_distance_flown),
                'best_dist':
                km(t.max_distance or 0),
                'best_time':
                round((t.fastest or 0) / 3600, 14),
                'worst_time':
                round(
                    max((x.ESS_time or 0) - (x.SSS_time or 0)
                        for x in t.valid_results) / 3600, 14),
                'no_of_pilots_in_competition':
                len(self.comp.participants),
                'no_of_pilots_landed_before_stop':
                0 if not t.stopped_time else t.pilots_landed,
                'sum_dist_over_min':
                km(t.tot_dist_over_min),
                'sum_real_dist_over_min':
                km(t.tot_dist_over_min),  # not yet implemented
                'best_real_dist':
                km(t.max_distance),  # not yet implemented
                'last_start_time':
                get_isotime(
                    t.date,
                    max([
                        x.SSS_time for x in t.valid_results
                        if x.SSS_time is not None
                    ]), t.time_offset),
                'first_start_time':
                ('' if not t.min_dept_time else get_isotime(
                    t.date, t.min_dept_time, t.time_offset)),
                'first_finish_time':
                ('' if not t.min_ess_time else get_isotime(
                    t.date, t.min_ess_time, t.time_offset)),
                'max_time_to_get_time_points':
                round(0 / 3600, 14),  # not yet implemented
                'no_of_pilots_with_time_points':
                len([x for x in t.valid_results if x.time_score > 0]),
                'goal_ratio': (0 if t.pilots_launched == 0 else round(
                    t.pilots_goal / t.pilots_launched, 15)),
                'arrival_weight':
                0 if t.arrival == 0 else round(t.arr_weight, 3),
                'departure_weight':
                0 if t.departure != 'on' else round(t.dep_weight, 3),
                'leading_weight':
                0 if t.departure != 'leadout' else round(t.dep_weight, 3),
                'time_weight':
                0 if t.arrival == 'off' else round(t.time_weight, 3),
                'distance_weight':
                round(t.dist_weight, 3),  # not yet implemented
                'smallest_leading_coefficient':
                round(t.min_lead_coeff, 14),
                'available_points_distance':
                round(t.avail_dist_points, 14),
                'available_points_time':
                round(t.avail_time_points, 14),
                'available_points_departure':
                (0 if not t.formula.departure == 'departure' else round(
                    t.avail_dep_points, 14)),
                'available_points_leading':
                (0 if not t.formula.departure == 'leadout' else round(
                    t.avail_dep_points, 14)),
                'available_points_arrival':
                round(t.avail_arr_points, 14),
                'time_validity':
                round(t.time_validity, 3),
                'launch_validity':
                round(t.launch_validity, 3),
                'distance_validity':
                round(t.dist_validity, 3),
                'stop_validity':
                round(t.stop_validity, 3),
                'day_quality':
                round(t.day_quality, 3),
                'ftv_day_validity':
                t.ftv_validity,
                'time_points_stop_correction':
                0  # not yet implemented
            }
            for k, v in sp_attr.items():
                task_sp.set(k, str(v))
            '''FsParticipants'''
            for i, pil in enumerate(t.pilots):
                '''create pilot result for the task'''
                pil_p = ET.SubElement(task_p, 'FsParticipant')
                pil_p.set('id', str(pil.ID or pil.par_id))
                if not (pil.result_type in ('abs', 'dnf', 'nyp')):
                    '''only if pilot flew'''
                    pil_fd = ET.SubElement(pil_p, 'FsFlightData')
                    pil_r = ET.SubElement(pil_p, 'FsResult')
                    if not (pil.result_type in ['mindist', 'min_dist']):
                        fd_attr = {
                            'distance':
                            km(pil.distance_flown),
                            'bonus_distance':
                            km(pil.distance),
                            # ?? seems 0 for PG and more than dist for HG
                            'started_ss':
                            '' if not pil.real_start_time else get_isotime(
                                t.date, pil.real_start_time, t.time_offset),
                            'finished_ss':
                            '' if not pil.ESS_time else get_isotime(
                                t.date, pil.ESS_time, t.time_offset),
                            'altitude_at_ess':
                            pil.ESS_altitude,
                            'finished_task':
                            '' if not pil.goal_time else get_isotime(
                                t.date, pil.goal_time, t.time_offset),
                            'tracklog_filename':
                            pil.track_file,
                            'lc':
                            pil.lead_coeff,
                            'iv':
                            pil.fixed_LC or '',
                            'ts':
                            get_isotime(t.date, pil.first_time, t.time_offset),
                            'alt':
                            pil.last_altitude,  # ??
                            'bonus_alt':
                            '',  # ?? not implemented
                            'max_alt':
                            pil.max_altitude,
                            'last_tracklog_point_distance':
                            '',  # not implemented yet
                            'bonus_last_tracklog_point_distance':
                            '',  # ?? not implemented
                            'last_tracklog_point_time':
                            get_isotime(t.date, pil.landing_time,
                                        t.time_offset),
                            'last_tracklog_point_alt':
                            pil.landing_altitude,
                            'landed_before_deadline':
                            '1' if pil.landing_time <
                            (t.task_deadline if not t.stopped_time else
                             t.stopped_time) else '0',
                            'reachedGoal':
                            1 if pil.goal_time else 0
                            # only deadline?
                        }
                        for k, v in fd_attr.items():
                            pil_fd.set(k, str(v))

                    r_attr = {
                        'rank':
                        i + 1,  # not implemented, they should be ordered tho
                        # Rank IS NOT SAFE (I guess)
                        'points':
                        round(pil.score),
                        'distance':
                        km(pil.total_distance if pil.total_distance else pil.
                           distance_flown),
                        'ss_time':
                        '' if not pil.ss_time else sec_to_time(
                            pil.ss_time).strftime('%H:%M:%S'),
                        'finished_ss_rank':
                        ''
                        if not pil.ESS_time and pil.ESS_rank else pil.ESS_rank,
                        'distance_points':
                        0 if not pil.distance_score else round(
                            pil.distance_score, 1),
                        'time_points':
                        0 if not pil.time_score else round(pil.time_score, 1),
                        'arrival_points':
                        0 if not pil.arrival_score else round(
                            pil.arrival_score, 1),
                        'departure_points':
                        0 if not t.formula.departure == 'departure' else round(
                            pil.departure_score, 1),
                        'leading_points':
                        0 if not t.formula.departure == 'leadout' else round(
                            pil.departure_score, 1),
                        'penalty':
                        0 if not [
                            n for n in pil.notifications
                            if n.percentage_penalty > 0
                        ] else max(n.percentage_penalty
                                   for n in pil.notifications),
                        'penalty_points':
                        0 if not [
                            n for n in pil.notifications if n.flat_penalty > 0
                        ] else max(n.flat_penalty for n in pil.notifications),
                        'penalty_reason':
                        '; '.join([
                            n.comment for n in pil.notifications
                            if n.flat_penalty + n.percentage_penalty > 0
                            and not n.notification_type == 'jtg'
                        ]),
                        'penalty_points_auto':
                        sum(n.flat_penalty for n in pil.notifications
                            if n.notification_type == 'jtg'),
                        'penalty_reason_auto':
                        '' if not [
                            n for n in pil.notifications
                            if n.notification_type == 'jtg'
                        ] else next(
                            n for n in pil.notifications
                            if n.notification_type == 'jtg').flat_penalty,
                        'penalty_min_dist_points':
                        0,  # ??
                        'got_time_but_not_goal_penalty':
                        (pil.ESS_time or 0) > 0 and not pil.goal_time,
                        'started_ss':
                        '' if not pil.real_start_time else get_isotime(
                            t.date, pil.SSS_time, t.time_offset),
                        'finished_ss':
                        '' if not pil.ESS_time else get_isotime(
                            t.date, pil.ESS_time, t.time_offset),
                        'ss_time_dec_hours':
                        0 if not pil.ESS_time else round(
                            pil.ss_time / 3600, 14),
                        'ts':
                        get_isotime(t.date, pil.first_time,
                                    t.time_offset),  # flight origin time
                        'real_distance':
                        km(pil.distance_flown),
                        'last_distance':
                        '',  # ?? last fix distance?
                        'last_altitude_above_goal':
                        pil.last_altitude,
                        'altitude_bonus_seconds':
                        0,  # not implemented
                        'altitude_bonus_time':
                        sec_to_time(0).strftime('%H:%M:%S'),  # not implemented
                        'altitude_at_ess':
                        pil.ESS_altitude,
                        'scored_ss_time':
                        ('' if not pil.ss_time else sec_to_time(
                            pil.ss_time).strftime('%H:%M:%S')),
                        'landed_before_stop':
                        t.stopped_time and res.landing_time < t.stopped_time
                    }

                    for k, v in r_attr.items():
                        pil_r.set(k, str(v))
        '''creates the file to store'''
        fsdb = ET.tostring(root,
                           pretty_print=True,
                           xml_declaration=True,
                           encoding='UTF-8')

        return self.filename, fsdb
コード例 #30
0
    point.set('IsXOnly', 'False')
    point.set('Index', '329')
    positionScreen = SubElement(point, 'PositionScreen')
    positionScreen.set('X', '{}'.format(xScreen))
    positionScreen.set('Y', '{}'.format(yScreen))


document = Element('Document')
document.set('VersionNumber', '11.0')
document.set('AxesPointsRequired', '0')

image = SubElement(document, 'Image')
image.set('Width', '605')
image.set('Height', '340')
image.text = CDATA(
    'AAAAAYlQTkcNChoKAAAADUlIRFIAAAJdAAABVAgCAAAAkQceKQAAAAlwSFlzAAAOxQAADsIBCC16OAAAIABJREFUeJzt3V9sFNfdxvGzhNYmOLZCKhUk3AaDql6AKApVWlWCIpOoqy7oRUUVCilViuJGrSEyFSiNKtSLloULQksolSiKUilQS76iLELt26i5wIpqXtXUWC2KLLBstRdBgsUFQt632X0vFnbWs7OzM2fmzMw55/tRLmxn5w/2b89zzpkzO7lqtSoAAIAQQogFaZ8AAAAZQi4CAOAgFwEAcJCLAAA4yEUAABzkIgAADnIRAAAHuQgAgINcBADAIZmLw8PDCxa03Hbz5s25RwYHB2XPDQCApC2U2GZ0dHRiYsLnA+Ru3749NTW1cuXKCCcGAEAKZMaLY2Njhw4d8nlBuVxesmSJ7CkBAJCanPTnhudyLbd96qmn1q9f//777z/zzDO//e1vP/e5z0U4QwAAkqMkF1988cXdu3evX7/+4MGD169fP3fuXOP/LZVKckcEACC4QqEgsZWSXKy7detWX19fuVz2f1mpVJI7ewAA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BwCoWCxFZB190EjM+a8fHxtWvXLliwoFKpdHR0uP6v3IkCAJAAJfOoAwMDJ0+evHv3brFY7O/vV3EIAABUCDqPOm+bXK7x2/oe6jOr4+PjL7300tTU1Ne+9rW333572bJlsZwrAACqyeQiAACm4nPgAABwkIsAADjIRQAAHOQiAAAOchEAAAe5CACAg1wEAMBBLgIA4CAXAQBw/D+iSWx0Xhk8WQAAAABJRU5ErkJggg=='
)

coordSystem = SubElement(document, 'CoordSystem')
general = SubElement(coordSystem, 'General')
general.set('CursorSize', '3')
general.set('ExtraPrecision', '1')
coords = SubElement(coordSystem, 'Coords')
coords.set('Type', '0')
coords.set('TypeString', 'Cartesian')
coords.set('Coords', '0')
coords.set('ScaleXTheta', '0')
coords.set('ScaleXThetaString', 'Linear')
coords.set('ScaleYRadius', '0')
coords.set('ScaleYRadiusString', 'Linear')
coords.set('UnitsX', '0')