当前位置: 首页>>代码示例>>Python>>正文


Python nodes.target方法代码示例

本文整理汇总了Python中docutils.nodes.target方法的典型用法代码示例。如果您正苦于以下问题:Python nodes.target方法的具体用法?Python nodes.target怎么用?Python nodes.target使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在docutils.nodes的用法示例。


在下文中一共展示了nodes.target方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: moveit_tabletop_pick

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def moveit_tabletop_pick(self, target_block):
        # self.sawyer_robot.gripper_open()
        self.trajectory_planner.ceilheight = 0.7
        self.trajectory_planner.register_box(target_block)

        result = False
        while not result or result < 0:
            self.scheduler_yield()
            rospy.logwarn("target block: " + str(target_block))

            target_block.grasp_pose = copy.deepcopy(
                self.compute_grasp_pose_offset(target_block.tabletop_arm_view_estimated_pose))
            rospy.logwarn("target block pose : " + str(target_block.grasp_pose))
            self.trajectory_planner.set_default_tables_z()
            self.trajectory_planner.table1_z = demo_constants.TABLE_HEIGHT
            self.trajectory_planner.update_table1_collision()
            result = self.trajectory_planner.pick_block(target_block, "table1")
            rospy.logwarn("pick result: " + str(result))

        self.environment_estimation.table.notify_gripper_pick(target_block, self.gripper_state) 
开发者ID:microsoft,项目名称:AI-Robot-Challenge-Lab,代码行数:22,代码来源:task_planner.py

示例2: moveit_traytop_pick

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def moveit_traytop_pick(self, target_block):
        # self.sawyer_robot.gripper_open()
        result = False
        while not result or result < 0:
            self.scheduler_yield()
            rospy.logwarn("target block: " + str(target_block))
            target_block.grasp_pose = self.compute_grasp_pose_offset(target_block.traytop_arm_view_estimated_pose)

            rospy.logwarn("target block pose : " + str(target_block.grasp_pose))
            self.trajectory_planner.set_default_tables_z()
            self.trajectory_planner.table2_z = demo_constants.TABLE_HEIGHT
            self.trajectory_planner.update_table2_collision()

            result = self.trajectory_planner.pick_block(target_block, "table2")
            rospy.logwarn("pick result: " + str(result))

        target_block.tray.notify_pick_block(target_block,self.gripper_state) 
开发者ID:microsoft,项目名称:AI-Robot-Challenge-Lab,代码行数:19,代码来源:task_planner.py

示例3: indirect_target_error

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def indirect_target_error(self, target, explanation):
        naming = ''
        reflist = []
        if target['names']:
            naming = '"%s" ' % target['names'][0]
        for name in target['names']:
            reflist.extend(self.document.refnames.get(name, []))
        for id in target['ids']:
            reflist.extend(self.document.refids.get(id, []))
        if target['ids']:
            naming += '(id="%s")' % target['ids'][0]
        msg = self.document.reporter.error(
              'Indirect hyperlink target %s refers to target "%s", %s.'
              % (naming, target['refname'], explanation), base_node=target)
        msgid = self.document.set_id(msg)
        for ref in utils.uniq(reflist):
            prb = nodes.problematic(
                  ref.rawsource, ref.rawsource, refid=msgid)
            prbid = self.document.set_id(prb)
            msg.add_backref(prbid)
            ref.replace_self(prb)
        target.resolved = 1 
开发者ID:skarlekar,项目名称:faces,代码行数:24,代码来源:references.py

示例4: hyperlink_target

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def hyperlink_target(self, match):
        pattern = self.explicit.patterns.target
        lineno = self.state_machine.abs_line_number()
        block, indent, offset, blank_finish = \
              self.state_machine.get_first_known_indented(
              match.end(), until_blank=True, strip_indent=False)
        blocktext = match.string[:match.end()] + '\n'.join(block)
        block = [escape2null(line) for line in block]
        escaped = block[0]
        blockindex = 0
        while True:
            targetmatch = pattern.match(escaped)
            if targetmatch:
                break
            blockindex += 1
            try:
                escaped += block[blockindex]
            except IndexError:
                raise MarkupError('malformed hyperlink target.')
        del block[:blockindex]
        block[0] = (block[0] + ' ')[targetmatch.end()-len(escaped)-1:].strip()
        target = self.make_target(block, blocktext, lineno,
                                  targetmatch.group('name'))
        return [target], blank_finish 
开发者ID:skarlekar,项目名称:faces,代码行数:26,代码来源:states.py

示例5: parse_target

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def parse_target(self, block, block_text, lineno):
        """
        Determine the type of reference of a target.

        :Return: A 2-tuple, one of:

            - 'refname' and the indirect reference name
            - 'refuri' and the URI
            - 'malformed' and a system_message node
        """
        if block and block[-1].strip()[-1:] == '_': # possible indirect target
            reference = ' '.join([line.strip() for line in block])
            refname = self.is_reference(reference)
            if refname:
                return 'refname', refname
        reference = ''.join([''.join(line.split()) for line in block])
        return 'refuri', unescape(reference) 
开发者ID:skarlekar,项目名称:faces,代码行数:19,代码来源:states.py

示例6: add_target

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def add_target(self, targetname, refuri, target, lineno):
        target.line = lineno
        if targetname:
            name = normalize_name(unescape(targetname))
            target['names'].append(name)
            if refuri:
                uri = self.inliner.adjust_uri(refuri)
                if uri:
                    target['refuri'] = uri
                else:
                    raise ApplicationError('problem with URI: %r' % refuri)
            self.document.note_explicit_target(target, self.parent)
        else:                       # anonymous target
            if refuri:
                target['refuri'] = refuri
            target['anonymous'] = 1
            self.document.note_anonymous_target(target) 
开发者ID:skarlekar,项目名称:faces,代码行数:19,代码来源:states.py

示例7: superscript_children

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def superscript_children(self, target):
        """
        Yield the children of `target` in order, removing
        parenthesized sense numbers like "(1)" and "(2)" from text
        nodes, and adding new superscript nodes as necessary.
        """
        for e in target:
            if not isinstance(e, nodes.Text):
                yield e
                continue
            m = self.sense_re.match(e)
            if not m:
                yield e
                continue
            yield nodes.Text(m.group(1))
            yield nodes.superscript(text=m.group(2)) 
开发者ID:georgia-tech-db,项目名称:eva,代码行数:18,代码来源:__init__.py

示例8: parse_target

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def parse_target(self, block, block_text, lineno):
        """
        Determine the type of reference of a target.

        :Return: A 2-tuple, one of:

            - 'refname' and the indirect reference name
            - 'refuri' and the URI
            - 'malformed' and a system_message node
        """
        if block and block[-1].strip()[-1:] == '_': # possible indirect target
            reference = ' '.join([line.strip() for line in block])
            refname = self.is_reference(reference)
            if refname:
                return 'refname', refname
        ref_parts = split_escaped_whitespace(' '.join(block))
        reference = ' '.join(''.join(unescape(part).split())
                             for part in ref_parts)
        return 'refuri', reference 
开发者ID:QData,项目名称:deepWordBug,代码行数:21,代码来源:states.py

示例9: run

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def run(self):
        env = self.state.document.settings.env

        targetid = "pdvega-plot-{0}".format(env.new_serialno('pdvega-plot'))
        targetnode = nodes.target('', '', ids=[targetid])

        code = '\n'.join(self.content)

        # Here we cache the code for use in later setup
        if not hasattr(env, 'pdvega_plot_setup'):
            env.pdvega_plot_setup = []
        env.pdvega_plot_setup.append({
            'docname': env.docname,
            'lineno': self.lineno,
            'code': code,
            'target': targetnode,
        })

        result = [targetnode]

        if 'show' in self.options:
            source_literal = nodes.literal_block(code, code)
            source_literal['language'] = 'python'
            result.append(source_literal)

        return result 
开发者ID:altair-viz,项目名称:pdvega,代码行数:28,代码来源:pdvegaplot.py

示例10: get_target

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def get_target(self, tid):
        """
        Returns a target node for the specified ID.

        This took a lot of digging through the Docutils and Sphinx sources to
        figure out: it appears that including the 'names' argument to the
        target node and calling note_explicit_target are essential to allow
        us to cross reference these targets from the rest of the documentation.
        """
        target = nodes.target('', '', ids=[tid], names=[tid])
        self.state.document.note_explicit_target(target)
        return target 
开发者ID:popsim-consortium,项目名称:stdpopsim,代码行数:14,代码来源:speciescatalog.py

示例11: genetic_map_section

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def genetic_map_section(self, species, genetic_map):
        map_id = self.get_genetic_map_id(species, genetic_map)
        target = self.get_target(map_id)
        section = nodes.section(ids=[map_id])
        section += nodes.title(text=genetic_map.id)
        section += nodes.paragraph(text=genetic_map.long_description)
        section += nodes.rubric(text="Citations")
        section += self.citation_list(genetic_map)
        return [target, section] 
开发者ID:popsim-consortium,项目名称:stdpopsim,代码行数:11,代码来源:speciescatalog.py

示例12: model_section

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def model_section(self, species, model):
        mid = self.get_demographic_model_id(species, model)
        target = self.get_target(mid)
        section = nodes.section(ids=[mid])
        section += nodes.title(text=model.description)
        section += nodes.paragraph(text=model.long_description)
        section += nodes.rubric(text="Details")
        section += self.model_summary(model)
        section += nodes.rubric(text="Populations")
        section += self.population_table(model)
        section += nodes.rubric(text="Citations")
        section += self.citation_list(model)
        section += nodes.rubric(text="Demographic Model parameters")
        section += self.model_parameter_table(species, model)
        return [target, section] 
开发者ID:popsim-consortium,项目名称:stdpopsim,代码行数:17,代码来源:speciescatalog.py

示例13: run

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def run(self):
        env = self.state.document.settings.env
    
        # create a new target node for linking to
        targetid = "todo-%d" % env.new_serialno('todo')
        targetnode = nodes.target('', '', ids=[targetid])

        # make the admonition node
        ad = make_admonition(Todo, self.name, [('Todo')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        # store a handle in a global list of all todos
        if not hasattr(env, 'todo_all_todos'):
            env.todo_all_todos = []
        env.todo_all_todos.append({
            'docname': env.docname,
            'lineno': self.lineno,
            'todo': ad[0].deepcopy(),
            'target': targetnode,
        })

        # return both the linking target and the node itself
        return [targetnode] + ad


# env data is persistent across source files so we purge whenever the source file has changed. 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:29,代码来源:qt_doc.py

示例14: process_todo_nodes

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def process_todo_nodes(app, doctree, fromdocname):
    if not app.config.todo_include_todos:
        for node in doctree.traverse(Todo):
            node.parent.remove(node)

    # Replace all todolist nodes with a list of the collected todos.
    # Augment each todo with a backlink to the original location.
    env = app.builder.env

    for node in doctree.traverse(Todolist):
        if not app.config.todo_include_todos:
            node.replace_self([])
            continue

        content = []

        for todo_info in env.todo_all_todos:
            para = nodes.paragraph()
            filename = env.doc2path(todo_info['docname'], base=None)
            description = (
                ('(The original entry is located in %s, line %d and can be found ') %
                (filename, todo_info['lineno']))
            para += nodes.Text(description, description)

            # Create a reference
            newnode = nodes.reference('', '')
            innernode = nodes.emphasis(('here'), ('here'))
            newnode['refdocname'] = todo_info['docname']
            newnode['refuri'] = app.builder.get_relative_uri(
                fromdocname, todo_info['docname'])
            newnode['refuri'] += '#' + todo_info['target']['refid']
            newnode.append(innernode)
            para += newnode
            para += nodes.Text('.)', '.)')

            # Insert into the todolist
            content.append(todo_info['todo'])
            content.append(para)

        node.replace_self(content) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:42,代码来源:qt_doc.py

示例15: apply

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import target [as 别名]
def apply(self):
        anonymous_refs = []
        anonymous_targets = []
        for node in self.document.traverse(nodes.reference):
            if node.get('anonymous'):
                anonymous_refs.append(node)
        for node in self.document.traverse(nodes.target):
            if node.get('anonymous'):
                anonymous_targets.append(node)
        if len(anonymous_refs) \
              != len(anonymous_targets):
            msg = self.document.reporter.error(
                  'Anonymous hyperlink mismatch: %s references but %s '
                  'targets.\nSee "backrefs" attribute for IDs.'
                  % (len(anonymous_refs), len(anonymous_targets)))
            msgid = self.document.set_id(msg)
            for ref in anonymous_refs:
                prb = nodes.problematic(
                      ref.rawsource, ref.rawsource, refid=msgid)
                prbid = self.document.set_id(prb)
                msg.add_backref(prbid)
                ref.replace_self(prb)
            return
        for ref, target in zip(anonymous_refs, anonymous_targets):
            target.referenced = 1
            while True:
                if target.hasattr('refuri'):
                    ref['refuri'] = target['refuri']
                    ref.resolved = 1
                    break
                else:
                    if not target['ids']:
                        # Propagated target.
                        target = self.document.ids[target['refid']]
                        continue
                    ref['refid'] = target['ids'][0]
                    self.document.note_refid(ref)
                    break 
开发者ID:skarlekar,项目名称:faces,代码行数:40,代码来源:references.py


注:本文中的docutils.nodes.target方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。