• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python string.joinfields函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中string.joinfields函数的典型用法代码示例。如果您正苦于以下问题:Python joinfields函数的具体用法?Python joinfields怎么用?Python joinfields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: dotfork

def dotfork(i,b, machineClass, xnrefs):
	global TRANSITION_ARCS
	global ARC_TRANSITIONS
	global TRANSITION_NODES
	if len(xnrefs) == 1:
		# no need for fork if only one xn ref
		return ("", xnrefs[0])
	elif len(xnrefs) == 0:
		nodeShape = 'shape=box, width=".05", height=".05", fixedsize=true'
	else:
		nodeShape = 'style=filled, color=black, shape=circle, width=".05", height=".05", fixedsize=true'
	forkName = "FORK.%s" % string.joinfields(map(str, [ i ] + b), "_")
	forkNodeName = string.joinfields(machineClass + [ forkName ], ".")
	# fork node declaration
	rv = '"%s" [label="", %s];\n' % (forkNodeName, nodeShape)
	forkRef = [ [], forkNodeName, "", "" ] 
	key = string.joinfields(machineClass + [ str(i) ], ".")
	try:
		arcs = TRANSITION_ARCS[key]
		nodes = TRANSITION_NODES[key]
	except KeyError:
		arcs = {}
		nodes = {}
		TRANSITION_ARCS[key] = arcs
		TRANSITION_NODES[key] = nodes
	nodes[forkNodeName] = None
	for ref in xnrefs:
		arc = "%s->%s" % (forkNodeName, ref[1])
		ARC_TRANSITIONS[arc] = key
		arcs[arc] = None
		nodes[ref[1]] = None
		rv = rv + '"%s" -> "%s" [headlabel="%s", lhead="%s", label=""];\n' % (forkNodeName, ref[1], ref[2], ref[3])
	return (rv, forkRef)
开发者ID:yousef-fadila,项目名称:IMS-push-to-talk,代码行数:33,代码来源:dotmachine.py


示例2: excepthook

    def excepthook(type, exc_msg, tb):
        cfg = self.recipe.cfg
        sys.excepthook = sys.__excepthook__
        if cfg.debugRecipeExceptions:
            lines = traceback.format_exception(type, exc_msg, tb)
            print string.joinfields(lines, "")
        if self.linenum is not None:
            prefix = "%s:%s:" % (self.file, self.linenum)
            prefix_len = len(prefix)
            if str(exc_msg)[:prefix_len] != prefix:
                exc_message = "%s:%s: %s: %s" % (self.file, self.linenum,
                                              type.__name__, exc_msg)
            print exc_message

        if self.recipe.buildinfo:
            try:
                buildinfo = self.recipe.buildinfo
                buildinfo.error = exc_message
                buildinfo.file = self.file
                buildinfo.lastline = self.linenum
                buildinfo.stop()
            except:
                log.warning("could not write out to buildinfo")

        if cfg.debugRecipeExceptions and self.recipe.isatty():
            debugger.post_mortem(tb, type, exc_msg)
        else:
            sys.exit(1)
开发者ID:fedora-conary,项目名称:conary,代码行数:28,代码来源:action.py


示例3: addTable

def addTable(items, cols=COLS):
    divrecs = []
    tabrecs = []
    names = {'tab': TAB}
    tabrecs.append('<div id="table0" class="gtable" >')
    tabrecs.append('%(tab)s<table>' % names)

    names['tab'] =  2 * TAB
    i = 0
    while i < len(items):
        tabrecs.append('%(tab)s<tr align=left>' % names)
        names['tab'] =  3 * TAB
        for col in range(cols):
            if i >= len(items): break
            ahref, adiv = items[i]
            
            names['item'] = ahref
            tabrecs.append('%(tab)s<td>%(item)s%(tab)s</td>' % names)

            names['item'] = adiv
            divrecs.append('%(item)s' % names)
            i += 1
        names['tab'] =  2 * TAB
        tabrecs.append('%(tab)s</tr>' % names)

    names['tab'] =  TAB

    tabrecs.append('%(tab)s</table>\n' % names)
    tabrecs.append('</div>\n')
    
    return (joinfields(tabrecs,'\n'), joinfields(divrecs,'\n'))
开发者ID:hbprosper,项目名称:TheNtupleMaker,代码行数:31,代码来源:mkslideshow.py


示例4: docstring

	def docstring(self):
		import string
		input = []
		output = []
		for arg in self.argumentList:
			if arg.flags == ErrorMode or arg.flags == SelfMode:
				continue
			if arg.type == None:
				str = 'void'
			else:
				if hasattr(arg.type, 'typeName'):
					typeName = arg.type.typeName
					if typeName is None: # Suppressed type
						continue
				else:
					typeName = "?"
					print "Nameless type", arg.type
					
				str = typeName + ' ' + arg.name
			if arg.mode in (InMode, InOutMode):
				input.append(str)
			if arg.mode in (InOutMode, OutMode):
				output.append(str)
		if not input:
			instr = "()"
		else:
			instr = "(%s)" % string.joinfields(input, ", ")
		if not output or output == ["void"]:
			outstr = "None"
		else:
			outstr = "(%s)" % string.joinfields(output, ", ")
		return instr + " -> " + outstr
开发者ID:asottile,项目名称:ancient-pythons,代码行数:32,代码来源:bgenGenerator.py


示例5: docecma

def docecma():
	rv = "var transitionArcs = {};\n"
	for xn in dotmachine.TRANSITION_ARCS.keys():
		rv = rv + "transitionArcs[\"%s\"] = [ " % xn
		rv = rv + string.joinfields(map(lambda x: "\"%s\"" % x, dotmachine.TRANSITION_ARCS[xn].keys()), ", ")
		rv = rv + " ];\n"
	rv = rv + "\n"
	rv = rv + "var arcTransitions = {};\n"
	for arc in dotmachine.ARC_TRANSITIONS.keys():
		rv = rv + "arcTransitions[\"%s\"] = \"%s\";\n" % (arc, dotmachine.ARC_TRANSITIONS[arc])
	rv = rv + "\n"
	rv = rv + "var transitionNodes = {};\n"
	for xn in dotmachine.TRANSITION_NODES.keys():
		rv = rv + "transitionNodes[\"%s\"] = [ " % xn
		rv = rv + string.joinfields(map(lambda x: "\"%s\"" % x, dotmachine.TRANSITION_NODES[xn].keys()), ", ")
		rv = rv + " ];\n"
	rv = rv + "\n"
	rv = rv + "var nodeStates = {};\n"
	for node in dotmachine.NODE_STATES.keys():
		rv = rv + "nodeStates[\"%s\"] = \"%s\";\n" % ( node, dotmachine.NODE_STATES[node] ) 
	rv = rv + "\n"
	rv = rv + "var transitionComments = {};\n"
	for xn in dotmachine.TRANSITION_COMMENTS.keys():
		rv = rv + "transitionComments[\"%s\"] = \"%s\";\n" % ( xn, string.replace(dotmachine.TRANSITION_COMMENTS[xn], '"', r'\"' ) )
	rv = rv + "\n"
	rv = rv + "var stateComments = {};\n"
	for state in dotmachine.STATE_COMMENTS.keys():
		rv = rv + "stateComments[\"%s\"] = \"%s\";\n" % ( state, string.replace(dotmachine.STATE_COMMENTS[state], '"', r'\"' ) )
	rv = rv + "\n"
	rv = rv + "var machineComment = \"%s\";\n" % string.replace(dotmachine.MACHINE_COMMENT, '"', r'\"')
	rv = rv + "\n"
	rv = rv + "var externalStates = [ "
	rv = rv + string.joinfields(map(lambda x: "\"%s\"" % x, dotmachine.EXTERNAL_STATES), ", ")
	rv = rv + " ];\n"
	return rv
开发者ID:yousef-fadila,项目名称:IMS-push-to-talk,代码行数:35,代码来源:docmachine.py


示例6: create_test_tab

def create_test_tab(num_of_jobs, uid):
    # Will contain parsed auto-generated crontab entries
    cron_strings = {}
    job_num = 1
    while job_num <= num_of_jobs:
        cron_strings.setdefault(job_num, [])
        create_test_intervals(cron_strings[job_num])
        cron_strings[job_num].append(create_test_commands(job_num, 
        cron_strings[job_num]))
        job_num += 1
    with open(TAB_FILE,'w') as tab:
        for line in cron_strings.iterkeys():
            rand = random.randrange(100)
            # Approximately 30% chance that we will include a comment
            if(rand > 85):
                tab.write('#')
            if(rand >= 70 and rand < 85):
                tab.write('# ')
            # Approximately 15% chance that we will include a blank line
            if(rand >= 50 and rand < 70):
                tab.write('\n')
            for item in cron_strings[line]:
                tab.write(item)
    # Will contain assembled job-interval strings
    test_jobs = []
    with open(TAB_FILE, 'r') as tab:
        for job in tab:
            first_char = job[0]
            if first_char != '\n':
                tmp = job.strip().split(' ')
                interval = string.joinfields(tmp[:5], ' ')
                cmd = string.joinfields(tmp[5:], ' ')
                test_jobs.append(api.Job(interval, cmd, uid, datetime.now()))
    return test_jobs
开发者ID:umzegher,项目名称:Cron,代码行数:34,代码来源:test_support_functions.py


示例7: dotjoin

def dotjoin(i, machineClass, xnrefs):
	global TRANSITION_ARCS
	global ARC_TRANSITIONS
	global TRANSITION_NODES
	if len(xnrefs) == 1:
		# no need for join if only one xn ref
		return ("", xnrefs[0])
	elif len(xnrefs) == 0:
		nodeShape = 'shape=box, width=".05", height=".05", fixedsize=true'
	else:
		nodeShape = 'style=filled, color=black, shape=circle, width=".05", height=".05", fixedsize=true'
	joinName = "JOIN.%s" % i
	joinNodeName = string.joinfields(machineClass + [ joinName ], ".")
	# join node declaration
	rv = '"%s" [label="", %s];\n' % (joinNodeName, nodeShape)
	joinRef = [ [], joinNodeName, "", "" ]
	key = string.joinfields(machineClass + [ str(i) ], ".")
	try:
		nodes = TRANSITION_NODES[key]
		arcs = TRANSITION_ARCS[key]
	except KeyError:
		arcs = {}
		nodes = {}
		TRANSITION_ARCS[key] = arcs
		TRANSITION_NODES[key] = nodes
	nodes[joinNodeName] = None
	for ref in xnrefs:
		arc = "%s->%s" % (ref[1], joinNodeName)
		ARC_TRANSITIONS[arc] = key
		arcs[arc] = None
		nodes[ref[1]] = None
		rv = rv + '"%s" -> "%s" [taillabel="%s", ltail="%s", label=""];\n' % (ref[1], joinNodeName, ref[2], ref[3])
	return (rv, joinRef)
开发者ID:yousef-fadila,项目名称:IMS-push-to-talk,代码行数:33,代码来源:dotmachine.py


示例8: translate

def translate(compilationUnit, machine, targetDirectory, opts):
	header = """//
// This file was generated by ech2java. Do not modify.
//

"""
	# package declaration
	package = ""
	if len(getPackage(compilationUnit)) > 0:
		packageString = "package " + string.joinfields(getPackage(compilationUnit), ".") + ";\n"
		package = echartsLineReference(getPackageLineColumn(compilationUnit), packageString) + "\n"
	# imports
	imports = "import org.echarts.*;\n"
	imports = imports + "import org.echarts.monitor.*;\n"
	for imported in getImports(compilationUnit):
		importedPackage = getImportPackage(imported)
		importModifiers = getImportModifiers(imported)
		importString = "import %s %s;\n" % (string.joinfields(importModifiers, " "), string.joinfields(importedPackage, ".") )
		imports = imports + echartsLineReference(getImportLineColumn(imported), importString)
	imports = imports + "\n"
	# the machine itself
	machine = javamachine(compilationUnit)
	# the translated program
	rv = header + package + imports + machine
	# return the program
	return rv
开发者ID:yousef-fadila,项目名称:IMS-push-to-talk,代码行数:26,代码来源:javamachine.py


示例9: javaconstructor

def javaconstructor(constructor, machineName, machineClass):
	# constructor header
	accessString = string.joinfields(getConstructorAccessModifiers(constructor), " ")
	rv = "%s %s(" % (accessString, machineClass)
	userParamStrings = []
	for param in getConstructorParameters(constructor):
		userParamStrings = userParamStrings + [ javatype(param[0]) + " " + param[1] ]
	paramStrings = userParamStrings + [ "final Machine parentMachine", "final int machineIndex",
									"final MachineCode machineCode" ]
	rv = rv + string.joinfields(paramStrings, ", ") + ") throws Exception {\n"
	rv = rv + "super(%s_states, %s_messageTransitions, %s_messagelessTransitions, %s.class.getName(), parentMachine, machineIndex, machineCode);\n" % \
		 (machineName, machineName, machineName, machineClass)
	# constructor body
	rv = rv + javaaction(getConstructorActionBlock(constructor)) + "}\n"
	# constructor called when creating machine as top-level machine
	rv = rv + getConstructorComment(constructor) + "\n"
	rv = rv + "%s %s(" % (accessString, machineClass)
	rv = rv + string.joinfields(userParamStrings, ", ") + ") throws Exception {\n"
	rv = rv + "this("
	userParamStrings = []
	for param in getConstructorParameters(constructor):
		userParamStrings = userParamStrings + [ param[1] ]
	paramStrings = userParamStrings + [ "null", "-1", "null" ]
	rv = rv + string.joinfields(paramStrings, ", ") + ");\n"
	return rv + "}\n"
开发者ID:yousef-fadila,项目名称:IMS-push-to-talk,代码行数:25,代码来源:javamachine.py


示例10: javatop

def javatop(machine, machineName):
	machineClass = machineName
	if getExtendsClause(machine) == None:
		extends = "TransitionMachine"
	else:
		extends = string.joinfields(getExtendsClause(machine), ".")
	if getImplementsClause(machine) == None:
		implements = ""
	else:
		implementsClasses = []
		for interface in getImplementsClause(machine):
			implementsClasses = implementsClasses + [ string.joinfields(interface, ".") ]
		implements = " implements %s" % string.joinfields(implementsClasses, ", ")
	rv = getMachineComment(machine) + "\n"
	rv = rv + "public class %s extends %s%s {\n" % (machineClass, extends, implements)
	# Define static members and methods for top-level machine and its
	# submachines
	rv = rv + javastatic(machine, machineName, machineClass)
	rv = rv + "// Declarations for %s\n" % machineClass
	# Define top-level machine constructors
	rv = rv + javaconstructors(machine, machineName, machineClass)
	# Define instance members, methods and subclasses for top-level
	# machine and its submachines
	rv = rv + javabody(machine, machineName, machineClass)
	return rv
开发者ID:yousef-fadila,项目名称:IMS-push-to-talk,代码行数:25,代码来源:javamachine.py


示例11: _ctag

def _ctag(str, hrefs=()):
    """Quote, tag, and escape the text.

    This is a modified version of the 'ctag' function appearing in
    StructuredText.py. The differences include, 
      * it uses _split, so that it avoids escaping text in quotes or
      in math-mode.
      * it processes hrefs.
      * it escapes LaTeX special characters.
      * it doesn't try to find duplicate list items - that got moved
      into LaTeX.

    """
    if str is None: str = ''
    str = ' %s' % str			# prepend a space 
    str = _split(str)
    for i in xrange(len(str)): 
	if not i%2:
	    str[i]=regsub.gsub(quotable_re, '\\\\[email protected]\\g<0>@', str[i])
	    str[i]=regsub.gsub(slashable_re, '\\\\\\g<0>', str[i])
	    str[i]=regsub.gsub(ST.strong,' {\\\\bfseries \\1}\\2', str[i])
	    str[i]=regsub.gsub(ST.em,' {\\\\itshape \\1}\\2',str[i])
	    for ref, link in hrefs:
		tag = '{\slshape %s}\\footnote{%s}' % (ref[1:-1], link)
		str[i] = string.joinfields(string.split(str[i], ref), tag)
    return string.joinfields(str)
开发者ID:tutor-web,项目名称:Products.TutorWeb,代码行数:26,代码来源:struct2latex.py


示例12: rebuild_lines

 def rebuild_lines(self):
     """Rebuild a list of lines representing the SubBlock data from the stored values."""
     
     # If there's no data in this SubBlock, then we don't need to return any lines!
     # if len(self.data) == 0:
     #     return []
     
     # Otherwise, let's rebuild the lines
     self.lines = []
     
     # Append the SubBlock title line
     self.lines.append('[ %s ]\n'%self.name)
     
     # Append the header comment line
     if len(self.headerFields) >= self.numberHeaderFields:
         self.lines.append(self.headerFormat%tuple(self.headerFields[0:self.numberHeaderFields])  \
                        + string.joinfields(self.headerFields[self.numberHeaderFields:],' ')+'\n')
         
     # Append the data lines
     sorted_keys = self.data.keys()
     sorted_keys.sort()
     for key in sorted_keys:  
         if len(self.data[key]) >= self.numberDataFields:
              self.lines.append(self.dataFormat%tuple(self.data[key][0:self.numberDataFields])  \
                        + string.joinfields(self.data[key][self.numberDataFields:],' ') +'\n')
              
     # A blank line always         
     self.lines.append('\n')
     return self.lines
开发者ID:dkyu,项目名称:mmtools,代码行数:29,代码来源:TopologyFile.py


示例13: xml_to_tree

def xml_to_tree(filename, class_table = None):    
    p = TreeBuildingParser(class_table = class_table)
    if isinstance(filename, url_directory.BasePath):
	try:
	    lines = filename.Readlines()
	except IOError:
	    raise NoXMLFile, filename.PathString()
	s = string.joinfields(lines, "")
	path = filename
    elif filename == "-":
	s_list = []
	s = sys.stdin.read()
	while s:
	    s_list.append(s)
	    s = sys.stdin.read()
	s = string.joinfields(s_list, "")
	path = None
    else:
	try:
	    fp = open(filename, "r")
	except IOError:
	    raise NoXMLFile, filename
	s = fp.read()
	fp.close()
	path = url_directory.FilePath(filename)
    p.feed(s)
    p.close()
    p.cur_tag[0].path = path
    return p.cur_tag[0]
开发者ID:junion,项目名称:GalaxyWinPython,代码行数:29,代码来源:xml_tree.py


示例14: main

def main():
    uid = os.getuid()

    if len(sys.argv) < 3:
        jobs_old = api.get_jobs_for_user(uid)
        with tempfile.NamedTemporaryFile('w', delete=False) as temp:
            for job in jobs_old:
                temp.write("%s %s\n" % (job.interval, job.command))

            tb_file = temp.name

        editor = os.getenv('EDITOR')
        if editor is not None:
            os.system("%s %s" % (editor, tb_file))
        else:
            subprocess.call("vim %s" % tb_file, shell=True)
    elif sys.argv[1] == '-u':
        tb_file = sys.argv[2]

    jobs_new = []
    with open(tb_file, 'r') as tab:
        for job in tab:
            tmp = job.strip().split(' ')
            interval = string.joinfields(tmp[:5], ' ')
            cmd = string.joinfields(tmp[5:], ' ')
            jobs_new.append(api.Job(interval, cmd, uid, datetime.now()))

    if len(sys.argv) < 3:
        os.unlink(tb_file)

    api.set_jobs(jobs_new, uid)
开发者ID:johntanner,项目名称:Megacron,代码行数:31,代码来源:edit.py


示例15: custom_default_zpt_report

def custom_default_zpt_report(id, result, action='', no_table=0,
                          goofy=re.compile('\W').search
                          ):
    columns=result._searchable_result_columns()
    __traceback_info__=columns
    heading=('<tr>\n%s        </tr>' %
                 string.joinfields(
                     map(lambda c:
                         '          <th>%s</th>\n' % nicify(c['name']),
                         columns),
                     ''
                     )
                 )

    if no_table: tr, _tr, td, _td, delim = '<p>', '</p>', '', '', ',\n'
    else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', '\n'

    row=[]
    for c in columns:
        n=c['name']
# ugh! what the hell is goofy?
#        if goofy(n) is not None:
#            n='expr="_[\'%s]"' % (`'"'+n`[2:])
        row.append('          %s<span tal:replace="result/%s">%s goes here</span>%s'
                   % (td,n,n,_td))

    row=('     %s\n%s\n        %s' % (tr,string.joinfields(row,delim), _tr))

    return custom_default_zpt_report_src(
        id=id, heading=heading, row=row, action=action, no_table=no_table)
开发者ID:Andyvs,项目名称:TrackMonthlyExpenses,代码行数:30,代码来源:Aqueduct.py


示例16: custom_default_report

def custom_default_report(id, result, action='', no_table=0,
                          goofy=re.compile('\W').search
                          ):
    columns=result._searchable_result_columns()
    __traceback_info__=columns
    heading=('<tr>\n%s        </tr>' %
                 string.joinfields(
                     map(lambda c:
                         '          <th>%s</th>\n' % nicify(c['name']),
                         columns),
                     ''
                     )
                 )

    if no_table: tr, _tr, td, _td, delim = '<p>', '</p>', '', '', ',\n'
    else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', '\n'

    row=[]
    for c in columns:
        n=c['name']
        if goofy(n) is not None:
            n='expr="_[\'%s]"' % (`'"'+n`[2:])
        row.append('          %s<dtml-var %s%s>%s'
                   % (td,n,c['type']!='s' and ' null=""' or '',_td))

    row=('     %s\n%s\n        %s' % (tr,string.joinfields(row,delim), _tr))

    return custom_default_report_src(
        id=id,heading=heading,row=row,action=action,no_table=no_table)
开发者ID:Andyvs,项目名称:TrackMonthlyExpenses,代码行数:29,代码来源:Aqueduct.py


示例17: finalize

    def finalize(self):
	length = len(self.lines)
	self.text = string.joinfields(self.lines, '')
	self.lines = []
	self.open_links()
	self.output_links()
	self.close_links()
	links = string.joinfields(self.lines, '')
	self.lines = []

	self.prologue = (
	    self.DOCTYPE +
	    '\n<HTML><HEAD>\n'
	    '  <!-- Converted with texi2html and Python -->\n'
	    '  <TITLE>' + self.title + '</TITLE>\n'
	    '  <LINK REL=Next HREF="'
		+ makefile(self.next) + '" TITLE="' + self.next + '">\n'
	    '  <LINK REL=Previous HREF="'
		+ makefile(self.prev) + '" TITLE="' + self.prev  + '">\n'
	    '  <LINK REL=Up HREF="'
		+ makefile(self.up) + '" TITLE="' + self.up  + '">\n'
	    '</HEAD><BODY>\n' +
	    links)
	if length > 20:
	    self.epilogue = '<P>\n%s</BODY></HTML>\n' % links
开发者ID:asottile,项目名称:ancient-pythons,代码行数:25,代码来源:texi2html.py


示例18: provide_data_for_request

def provide_data_for_request(request):

    try:
        
        query_choice = request.POST["query_choice"]
        frequency_choice = request.POST["freq_choice"]
        returned_node_type = request.POST["ret_node_type"]
        display_type = request.POST["display_type"]
        
        session_data = request.session['tmp_query_results'][str(query_choice)]
    
        ret_node_queries = session_data['ret_node_queries']
        query_info = session_data['query_info']
        use_query = session_data['use_query']
        node_queries = session_data['node_queries']
        
        #temp_node_list will be formed from whichever frequency the user choses...
        
        temp_node_list = session_data['ret_dict'][frequency_choice]
        
        #we also need node_queries and query_info
        
        if len(ret_node_queries.keys()) == 1 and ret_node_queries.has_key('Gene'):
            if len(ret_node_queries['Gene']) > 3:
                use_title = query_info['title'].replace('$$result$$', ret_node_queries['Gene'][0]['display_name'] + '...' + ret_node_queries['Gene'][-1]['display_name'])
            else:
                use_title = query_info['title'].replace('$$result$$', string.joinfields(map(lambda x: x['display_name'], ret_node_queries['Gene']), ','))
        elif len(ret_node_queries.keys()) == 1 and ret_node_queries.has_key('Subject'):
            if len(ret_node_queries['Subject']) > 3:
                use_title = query_info['title'].replace('$$result$$', ret_node_queries['Subject'][0]['display_name'] + '...' + ret_node_queries['Subject'][-1]['display_name'])
            else:
                use_title = query_info['title'].replace('$$result$$', string.joinfields(map(lambda x: x['display_name'], ret_node_queries['Subject']), ','))
        else:
            use_title = 'ERROR: Unknown title...'
        
        #convert the IDs to nodes
        
        ret_nodes = core.get_nodes(temp_node_list, returned_node_type, request,  missing_param="skip")
        
        #too many nodes to render efficiently, will allow user to download csv file...
        if display_type == "Download":
            
            return download(request, use_title, query_info['text'], use_query, node_queries, ret_nodes, len(temp_node_list))
            
            #ret_dict = {'is_graph':False, 'graph':{}, 'title':'Sorry, your query is too large to display.  However, you may download a text version.'}
            
        else:
        
            ret_nodes = core.apply_grouping2({'nodes':ret_nodes, 'links':[]}, [])['nodes']
            
            ret_dict = {'is_graph':True, 'graph':{'nodes':ret_nodes.tolist(), 'links':[]}, 'title':use_title}
        
            return HttpResponse(json.dumps(ret_dict),mimetype="application/json")
    
    except Exception as e:
        print e
        return HttpResponseServerError()
开发者ID:xtmgah,项目名称:HitWalker2,代码行数:57,代码来源:views.py


示例19: read_gif_header

def read_gif_header (results, data, pos):
    h, l = header.unpack (data, pos)
    sig = string.joinfields (h['signature'], '')
    ver = string.joinfields (h['version'], '')
    if sig != 'GIF':
        raise ParseError, 'Not a GIF file'
    elif ver not in ['89a', '87a']:
        raise ParseError, 'Unknown GIF version "%s"' % ver
    return (sig, ver), l
开发者ID:samrushing,项目名称:npstruct,代码行数:9,代码来源:gif.py


示例20: docmachinehtml

def docmachinehtml(compilationUnit, machine, targetDirectory, documentHeader):
	name = getMachineName(compilationUnit)
	package = getPackage(compilationUnit)
	# relative path from machine's html directory to root html
	# directory
	rootPath = string.joinfields(len(package) * [ ".." ], "/")
	htmlPath = targetDirectory + os.sep + name + ".html"
	htmlFile = file(htmlPath, 'w')
	htmlBody = '''
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<LINK rel="stylesheet" type="text/css" href="%s/docmachine.css" />
<TITLE>%s</TITLE>
</HEAD>

<BODY>
<table width="100%%" height="100%%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div id="buttons_outer">
    <div id="buttons_inner">
	    <div id="buttons">
		    <ul id="mainlevel-nav">
			  <li><a href="%s/overview-summary.html" class="mainlevel-nav">Overview</a></li>
			  <li><a href="package-summary.html" class="mainlevel-nav">Package</a></li>
			</ul>						
		</div>
	</div>
</div></td></tr>
<tr><td class="outline">
<div class="header">
<span class="left">Machine</span>
<span class="right">%s</span>
</div>
</td></tr>
<tr><td>
<div id="package_name">%s</div>
<div class="contentheading">%s</div>
<div class="summary"></div>
</td></tr>
<tr><td height="100%%">
<input class="button" value="New Window" type="submit" onclick="window.open('%s')">
<div class="machine-svg">
<iframe src="%s" id="svg" name="svg" height="100%%" width="100%%"
		frameborder="0" marginwidth="0" marginheight="0"></iframe>
</div>
</td></tr>
</table>
</BODY>
</HTML>
''' % (rootPath, name, rootPath, documentHeader, string.joinfields(package, "."), name,
	   name + ".svg",
	   name + ".svg")
	htmlFile.write(htmlBody)
	htmlFile.close()
开发者ID:yousef-fadila,项目名称:IMS-push-to-talk,代码行数:56,代码来源:docmachine.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python string.ljust函数代码示例发布时间:2022-05-27
下一篇:
Python string.join函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap