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

Python sys.ext函数代码示例

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

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



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

示例1: report

def report(log_file_names, args):

    # We only accept one log file
    if len(log_file_names) != 1:
        sys.exit("'timegraph' report uses one log file.")
    else:
        log_file_name = log_file_names[0]

    optstring = "m"
    longopts = []
    process_types = timegraph.ALL_PROCS

    try:
        opts, args = getopt.getopt(args, optstring, longopts)
    except getopt.GetoptError:
        usage()
        sys.exit(1)

    for opt, arg in opts:
        if opt == "-m":
            process_types = timegraph.ONLY_MAKES
        else:
            sys.ext("Unexpected option %s" % (opt,))

    run_timeline(log_file_name, process_types)
开发者ID:gilramir,项目名称:instmake,代码行数:25,代码来源:report_timegraph.py


示例2: combineFiles

def combineFiles(folderName,writefilename):
	filelist = [filename for filename in os.listdir(folderName) if 'txt' in filename]
	for filename in filelist:
	    reader = open(os.path.join(folderName,filename),'r')
	    length = len(reader.next().split(','))
	    for index,line in enumerate(reader):
	        if len(line.split(','))!= length:
	            print filename,index,line
	readers = [open(os.path.join(folderName,x),'r') for x in filelist]
	writefile = open(writefilename,'w')
	writefile.write(','.join(filelist)+'\n')
	for line in zip(*readers):
		linelist = map(lambda one: one.strip().split(','),line)
		lineid = linelist[0][0]
		for columns in linelist:
			if columns[0] != lineid:
				print 'line id do not match'
				sys.ext() 
		newline = [lineid]
		for features in linelist:
			newline.extend(features[1:])
		writefile.write(','.join(newline)+'\n')
		break
	for reader in readers:
		reader.close()
	writefile.close()
开发者ID:alicadaly,项目名称:Trend-Analysis-Based-Patent-Evaluation,代码行数:26,代码来源:combineFeatureFile.py


示例3: parse_citation

def parse_citation(citation, score_threshold=None, normalized_score_threshold=100): 
    
    # Find DOI from CrossRef.
    base = "http://search.crossref.org"
    ext = "/dois?q=" + citation
    
    r = requests.get(base+ext, headers = {"Content-Type": "application/json"})
        
    if not r.ok:
        r.raise_for_status()
        sys.ext()

    decoded = r.json()
    
    doi_list = []
    for potential_ref in decoded:
        if normalized_score_threshold is not None and score_threshold is None:
            if potential_ref["normalizedScore"] >= normalized_score_threshold:
                print(potential_ref["normalizedScore"])
                doi_list.append(potential_ref["doi"].split("http://dx.doi.org/")[1])
        elif score_threshold is not None and normalized_score_threshold is None:
            if potential_ref["score"] >= score_threshold:
                print(potential_ref["score"])
                doi_list.append(potential_ref["doi"].split("http://dx.doi.org/")[1])
        else:
            if potential_ref["score"] >= score_threshold and potential_ref["normalizedScore"] >= normalized_score_threshold:
                print(potential_ref["score"])
                doi_list.append(potential_ref["doi"].split("http://dx.doi.org/")[1])
            
    final_refs = []
    for doi in doi_list:
        temp_ref = gnomics.objects.reference.Reference(identifier = doi, identifier_type = "DOI", source = "CrossRef")
        final_refs.append(temp_ref)
                    
    return final_refs
开发者ID:Superraptor,项目名称:Gnomics,代码行数:35,代码来源:citation.py


示例4: welcome

def welcome():
	start = input("Press enter/return to start or Q to quit").lower()
	if start =='q':
		print("Bye!")
		sys.ext()
	else:
		return True
开发者ID:bdebelle,项目名称:th_python,代码行数:7,代码来源:letter_game.py


示例5: getbpp

def getbpp(fname):
	f = open(fname+'_dp.ps','r')
	ubox = []
	lbox = []
	pair = []
	index = -1
	for line in f:
		line.strip()
		if(re.search('\d+.*ubox',line)):
			line = re.sub('\\n','',line)
			pair = re.split('\s+',line)	
			ubox.append(pair)
		elif(re.search('\d+.*lbox',line)):
			line = re.sub('\\n','',line)
			pair = re.split('\s+',line)	
			lbox.append(pair)	
	for l in lbox:  ##optimize this search?
		for u in range(len(ubox)):
			if((l[0]==ubox[u][0])and(l[1]==ubox[u][1])):
				index = u	
		if(index >= 0 ):
			#print "pop"
		#	ubox.pop(u)
			index = -1
		else:
			print "ERROR: " + str(l) + " has no ubox match"
			sys.ext(2)
	out = sorted(ubox, compare)
	commands.getoutput('rm '+fname+'*.ps')
	return out
开发者ID:McGill-CSB,项目名称:corRna,代码行数:30,代码来源:subopt.py


示例6: main

def main():
    try:
        opts, args = getopt.getopt(
            sys.argv[1:],
            "hc:l:r:o:",
            [
                "help",
                "colorTable=",
                "labelFilename=",
                "referenceFilename=",
                "outputFileBasename=",
            ],
        )
    except getopt.GetoptError as err:
        print((str(err)))
        print(
            "WorkupComputeLabelVolume.py -c <colorTable> -l <labelFilename>  -r <referenceFilename> -o <outputFileBasename>"
        )
        sys.exit(2)
    colorTable = ""
    labelFilename = ""
    outputFileBasename = ""
    referenceFilename = ""
    for opt, arg in opts:
        if opt == "-h":
            print(
                "WorkupComputeLabelVolume.py -c <colorTable> -l <labelFilename>  -r <referenceFilename> -o <outputFileBasename>"
            )
            sys.ext()
        elif opt in ("-c", "--colorTable"):
            colorTable = arg
        elif opt in ("-l", "--labelFilename"):
            labelFilename = arg
        elif opt in ("-r", "--referenceFilename"):
            referenceFilename = arg
        elif opt in ("-o", "--outputFileBasename"):
            outputFileBasename = arg

    if colorTable and labelFilename and outputFileBasename:
        print(
            (
                """ Arguments:
        color table: {0}
        labelFile: {1}
        referenceFilename: {2}
        outputFileBasename: {3}""".format(
                    colorTable, labelFilename, referenceFilename, outputFileBasename
                )
            )
        )

        outputFiles = volume_measure(
            colorTable, labelFilename, referenceFilename, outputFileBasename
        )
        print(outputFiles)
    else:
        print(
            "WorkupComputeLabelVolume.py -c <colorTable> -l <labelFilename> -o <outputFileBasename>"
        )
开发者ID:BRAINSia,项目名称:BRAINSTools,代码行数:59,代码来源:measureVolumes.py


示例7: __parse_byteorderid__

    def __parse_byteorderid__(self):
        byteorder = ['little-endian', 'big-endian']

        if self.buf[28] == '\xFE' and self.buf[29] == '\xFF':
            return byteorder[0]
        elif self.buf[28] == '\xFF' and self.buf[29] == '\xFE':
            return byteorder[1]
        else:
            print("ERROR: wrong byte order identifier!\n")
            sys.ext(1)
开发者ID:lemonjia,项目名称:Dorado,代码行数:10,代码来源:cfbf-parser.py


示例8: add_vm

def add_vm(vmparams, name, vmdisk, nic_net1):
    try:
        api.vms.add(vmparams)
    except Exception as e:
        print "Error creating VM with specified parameters, recheck your params"
        print e
        sys.exit(1)

    if verbosity > 1:
        print "VM created successfuly"

    if verbosity > 1:
        print "Attaching networks and boot order..."
    vm = api.vms.get(name=name)
    vm.nics.add(nic_net1)

    try:
        vm.update()
    except:
        print "Error attaching networks, please recheck and remove configurations left behind"
        sys.exit(1)

    if verbosity > 1:
        print "Adding HDD"
    try:
        vm.disks.add(vmdisk)
    except:
        print "Error attaching disk, please recheck and remove any leftover configuration"
        sys.ext(1)
    
    if verbosity > 1:
        print "Setting boot order"
    try:
        hd_boot_dev = params.Boot(dev='hd')
        net_boot_dev = params.Boot(dev='network')
        vm.os.set_boot([net_boot_dev, hd_boot_dev])
    except:
        print "Error setting boot order"
        sys.exit(1)
    
    if verbosity > 1:
        print "VM creation successful"

    vm = api.vms.get(name=name)
    vm.high_availability.enabled = True
    vm.update()

    #wait until VM is stopped before we start it.
    status = api.vms.get(name=name).status.state
    while status != 'down':
        print status
        time.sleep(1)
        status = api.vms.get(name=name).status.state
    vm.start()
开发者ID:champain,项目名称:ovirt-scripts,代码行数:54,代码来源:create-vm.py


示例9: main

def main(argv):
    postcode=''
    try:
        opts, args =getopt.getopt(argv, "hi:o:", ["ifile", "ofile"])
    except getopt.GetoptError:
        print 'dmi.py -i <query>'
        sys.ext(2)
    postcode= args[0]
    # print args[0]
    
    dmi = 'http://www.dmi.dk/vejr/til-lands/byvejr/by/vis/DK/%s' % (postcode)
    webbrowser.open_new(dmi)
开发者ID:jpank,项目名称:dmi-alfred,代码行数:12,代码来源:alfredDMI.py


示例10: execute

    def execute(self, callback=None):
        """
        Given the command-line arguments, this figures out which subcommand is
        being run, creates a parser appropriate to that command, and runs it.
        """
        # Preprocess options to extract --settings and --pythonpath.
        # These options could affect the commands that are available, so they
        # must be processed early.
        self.parser = parser = NewOptionParser(prog=self.prog_name,
                             usage=self.usage_info,
#                             version=self.get_version(),
                             formatter = NewFormatter(),
                             add_help_option = False,
                             option_list=self.option_list)
        
        if not self.global_options:
            global_options, args = parser.parse_args(self.argv)
            global_options.apps_dir = os.path.normpath(os.path.join(global_options.project, 'apps'))
            handle_default_options(global_options)
            args = args[1:]
        else:
            global_options = self.global_options
            args = self.argv

        if global_options.envs:
            for x in global_options.envs:
                if '=' in x:
                    k, v = x.split('=')
                    os.environ[k.strip()] = v.strip()
                else:
                    print ('Error: environment variable definition (%s) format is not right, '
                           'shoule be -Ek=v or -Ek="a b"' % x)

        global_options.settings = global_options.settings or os.environ.get('SETTINGS', 'settings.ini')
        global_options.local_settings = global_options.local_settings or os.environ.get('LOCAL_SETTINGS', 'local_settings.ini')
        
        if callback:
            callback(global_options)
            
        if len(args) == 0:
            if global_options.version:
                print self.get_version()
                sys.exit(0)
            else:
                self.print_help(global_options)
                sys.ext(1)

        self.do_command(args, global_options)
开发者ID:ahlfors,项目名称:uliweb,代码行数:48,代码来源:commands.py


示例11: initCamera

def initCamera():
	global size
	camera = cvCreateCameraCapture(1)
	if not camera:
		print "Could not open webcam!"
		sys.ext(1)
	cvSetCaptureProperty(camera, CV_CAP_PROP_FRAME_WIDTH, 320)
	cvSetCaptureProperty(camera, CV_CAP_PROP_FRAME_HEIGHT, 240)
	frame = cvQueryFrame(camera)
	if frame is not None:
		w = frame.width
		h = frame.height
		print "%d %d"%(w, h)
		size = cvSize(w, h)
	time.sleep(1)
	return camera
开发者ID:joshuabenuck,项目名称:commute,代码行数:16,代码来源:track.py


示例12: get_events

def get_events(args):
    url = "http://%s:%d/events" % (args.hostname, args.port)

    if args.timeout is not None:
        to = args.timeout

    # Build the request and load it
    try:
        if not args.username and not args.password:
            req = urllib2.urlopen(url, timeout=to)
        elif args.username and args.password:
            print("Username/Password not supported ANYMOAR MOUAHAHA.")
            sys.exit(STATE_CRITICAL)
        else:
            print("Error: please provide both username and password.")
            req = None
    except urllib2.HTTPError as e:
        print('CRITICAL: HTTPError = ' + str(e.code))
        sys.exit(STATE_CRITICAL)
    except urllib2.URLError as e:
        print('CRITICAL: URLError = ' + str(e.reason))
        sys.exit(STATE_CRITICAL)
    except httplib.HTTPException as e:
        print('CRITICAL: HTTPException')
        sys.exit(STATE_CRITICAL)

    # Exit if empty requests object
    if not req:
        sys.exit(STATE_UNKNOWN)

    # Handle HTTP codes
    if req.getcode() == 200:
        try:
            res = json.loads(req.read())
        except Exception:
            print("UNKNOWN: Error decoding JSON Object.")
            sys.exit(STATE_UNKNOWN)
        format_json_and_exit(events=res, info=args.info)
    # Error
    elif req.getcode() == 500:
        print("CRITICAL: Sensu API returned an HTTP 500. Is RabbitMQ/sensu-server running?")
        sys.ext(STATE_CRITICAL)
    else:
        print("CRITICAL: Bad response (%d) from Sensu API." % (req.getcode()))
        sys.exit(STATE_CRITICAL)
开发者ID:amaumene,项目名称:nagios-plugins-sensu,代码行数:45,代码来源:check_sensu_events.py


示例13: getUserEnhancedFactor

 def getUserEnhancedFactor(self, uid, seg_num):
     if seg_num < 2:
         print seg_num
         print 'Invalid segment number'
         sys.exit(1)
     try:
         if uid not in self.user_buy_num or len(self.user_buy_num[uid][seg_num-2]) == 0:
             return 0
     except:
         print seg_num
         sys.ext(1)
     total_num = 0
     for pid in self.user_buy_num[uid][seg_num-2]:
         for penality in self.user_buy_num[uid][seg_num-2][pid][1]:
             self.u_enhanced_factor +=\
                 penality*self.product_factor[self.pid_dict[pid]]
         total_num += self.user_buy_num[uid][seg_num-2][pid][0]
     self.u_enhanced_factor = self.u_enhanced_factor/total_num
     return total_num
开发者ID:anthonylife,项目名称:TaobaoCompetition2014,代码行数:19,代码来源:model.py


示例14: main

     def main(self, screen):
	clock = pygame.time.Clock()
	pygame.display.set_caption("Starwars")
	
	background_img = pygame.Surface(screen.get_size())
	background_img = pygame.image.load('deathstar.png').convert()

        global laserSprites, enemySprites, sprites
	laserSprites = pygame.sprite.RenderPlain(())
	enemySprites = pygame.sprite.RenderPlain(())
	enemySprites.add(Enemy(1))

        sprites = pygame.sprite.Group()
        player = Player(sprites)
        frame=0
        while 1:
		dt = clock.tick(30)
		counter = 0
        frame+=1
        screen.blit(background_img, (0, 0))
        laserSprites.update()
        laserSprites.draw(screen)
        enemySprites.update()
        enemySprites.draw(screen)
        sprites.update(dt / 1000.)
        sprites.draw(screen)


        for hit in pygame.sprite.groupcollide(enemySprites, sprites, 0, 0):
                                sys.ext()
                  #collision detection between player and enemy ship


        for hit in pygame.sprite.groupcollide(enemySprites, laserSprites, 1, 0):
                                break
                       #collision detection between laser and enemy ship


        for event in pygame.event.get():
			if event.type == pygame.QUIT:
				sys.exit()
			elif event.type == KEYDOWN and event.key == K_ESCAPE:
				sys.exit()
开发者ID:dirtyfish,项目名称:starwars2,代码行数:43,代码来源:164_2.py


示例15: parseFile

def parseFile():
    global input_site
    global inputType
    lines = []
    cleaned_lines = []
    dom = parse("tempLinks.xml")
    for node in dom.getElementsByTagName('Base'):
      input_site = node.toxml()[1:-7]
    for node in dom.getElementsByTagName('Base'):
      print (node.toxml()[12:15])
      inputType = node.toxml()[12:15]

    for node in dom.getElementsByTagName('Code'):
        lines.append(node.toxml())

    for line in lines:
        #print line[17:-7]
        cleaned_lines.append(line[17:-7])
    cleaned_lines
    output(cleaned_lines)
    sys.ext()
开发者ID:konceptz,项目名称:AssortedPythonScripts,代码行数:21,代码来源:LinkFinder_CLI.py


示例16: get_fda_obj

def get_fda_obj(drug):
    for drug_obj in drug.drug_objects:
        if 'object_type' in drug_obj:
            if drug_obj['object_type'].lower() in ['fda drug', 'fda']:
                return drug_obj['object']
    
    for rxcui in gnomics.objects.drug.Drug.rxcui(drug):
        base = "https://api.fda.gov/drug/"
        ext = "label.json?search=openfda.rxcui:" + str(rxcui) + "&limit=1"
        r = requests.get(base+ext, headers = {"Content-Type": "application/json"})
        if not r.ok:
            r.raise_for_status()
            sys.ext()
            
        decoded = r.json()
        fda_obj_temp = decoded["results"][0]
        drug.drug_objects.append({
            'object': fda_obj_temp,
            'object_type': "ChemSpider compound"
        })
        
        return fda_obj_temp   
开发者ID:Superraptor,项目名称:Gnomics,代码行数:22,代码来源:fda.py


示例17: _read

    def _read(self, name, group, stype, jsonfile,
              connection=None, save_connection=True):
        jf = open(jsonfile).read()
        data = json.loads(jf)

        if name is not None:
            data['server-name'] = name

        if group is not None:
            data['group-name'] = group

        if stype is not None:
            data['server-type'] = stype

        stype = data['server-type']

        if stype == 'http':
            server = HttpServer(name, group)
        elif stype == 'odbc':
            server = OdbcServer(name, group)
        elif stype == 'xdbc':
            server = XdbcServer(name, group)
        elif stype == 'webdav':
            server = WebDAVServer(name, group)
        elif stype is None:
            print("Server type must be specified.")
            sys.ext(1)
        else:
            print("Unexpected server type: {0}".format(stype))
            sys.exit(1)

        server = server.unmarshal(data,
                                  connection=connection,
                                  save_connection=save_connection)

        return server
开发者ID:JamFuller,项目名称:python_api,代码行数:36,代码来源:server.py


示例18: execute

    def execute(self):
        """
        Given the command-line arguments, this figures out which subcommand is
        being run, creates a parser appropriate to that command, and runs it.
        """
        # Preprocess options to extract --settings and --pythonpath.
        # These options could affect the commands that are available, so they
        # must be processed early.
        parser = NewOptionParser(prog=self.prog_name,
                             usage=self.usage_info,
#                             version=self.get_version(),
                             formatter = NewFormatter(),
                             add_help_option = False,
                             option_list=self.option_list)
        
        if not self.global_options:
            global_options, args = parser.parse_args(self.argv)
            global_options.apps_dir = os.path.normpath(os.path.join(global_options.project, 'apps'))
            handle_default_options(global_options)
            args = args[1:]
        else:
            global_options = self.global_options
            args = self.argv
    
        def print_help(global_options):
            parser.print_help()
            sys.stderr.write(self.print_help_info(global_options) + '\n')
            sys.exit(1)
            
        if len(args) == 0:
            if global_options.version:
                print self.get_version()
                sys.exit(1)
            else:
                print_help(global_options)
                sys.ext(1)
    
        try:
            subcommand = args[0]
        except IndexError:
            subcommand = 'help' # Display help if no arguments were given.
    
        if subcommand == 'help':
            if len(args) > 1:
                command = self.fetch_command(global_options, args[1])
                if issubclass(command, CommandManager):
                    cmd = command(['help'], None, '%s %s' % (self.prog_name, args[1]), global_options=global_options)
                    cmd.execute()
                else:
                    command().print_help(self.prog_name, args[1])
                sys.exit(1)
            else:
                print_help(global_options)
        if global_options.help:
            print_help(global_options)
        else:
            command = self.fetch_command(global_options, subcommand)
            if issubclass(command, CommandManager):
                cmd = command(args[1:], None, '%s %s' % (self.prog_name, subcommand), global_options=global_options)
                cmd.execute()
            else:
                cmd = command()
                cmd.run_from_argv(self.prog_name, subcommand, global_options, args[1:])
开发者ID:tangjn,项目名称:uliweb,代码行数:63,代码来源:commands.py


示例19: parseDottedForm

def parseDottedForm(df):
    tokens = df.split(".")
    if len(tokens) != 4:
        print "Invalid PO Dot Form: " + df
        return None, None

    tokenValues = [int(token) for token in tokens]
    po_num = (tokenValues[0] << 24) + (tokenValues[1] << 16) + (tokenValues[2] << 8) + tokenValues[3]
    po_df = tuple(tokens)
    return po_df, po_num

if __name__ == '__main__':
    rq = requests.get(ALLOCATIONS_URL)
    if rq.status_code != 200:
        print "Failed to retrieve Bosswave allocations file from GitHub"
        sys.ext(1)

    allocs = yaml.load(rq.text)

    with open(DEST_FILE, 'w') as f:
        f.write("package edu.berkeley.cs.sdb.bosswave;\n\n")
        f.write("public class POAllocations {\n")

        for key, params in allocs.iteritems():
            key_toks = key.split('/')
            if len(key_toks) != 2:
                print "Invalid PO Allocation: " + key_toks
                continue

            mask = int(key_toks[1])
            po_df, po_num = parseDottedForm(key_toks[0])
开发者ID:SoftwareDefinedBuildings,项目名称:bw2android,代码行数:31,代码来源:genAndroidAllocations.py


示例20: Load

def Load(filename="default.cfg"):
    global parser, offset, tower, doors, torches_top, wall, floor, ceiling, exit_portal, master_halls, master_rooms, master_features, master_floors, chests, double_treasure, enchant_system, spawners, master_mobs, torches_bottom, min_dist, max_dist, loops, fill_caves, subfloor, torches_position, skeleton_balconies, sand_traps, master_ruins, ruin_ruins, maximize_distance, hall_piston_traps, resetting_hall_pistons, structure_values, default_entrances, master_entrances, master_treasure, secret_rooms, secret_door, silverfish, bury, master_projectile_traps, maps, mapstore, mapcolor, paintingcolor, max_mob_tier, custom_spawners, master_stairwells, hidden_spawners, master_srooms, SpawnCount, SpawnMaxNearbyEntities, SpawnMinDelay, SpawnMaxDelay, SpawnRequiredPlayerRange, chest_traps, master_chest_traps, treasure_SpawnCount, treasure_SpawnMaxNearbyEntities, treasure_SpawnMinDelay, treasure_SpawnMaxDelay, treasure_SpawnRequiredPlayerRange, file_extra_items, file_dyes, file_potions, file_magic_items, file_fortunes, dir_paintings, dir_books, dir_shops, dir_extra_spawners, dir_extra_items, river_biomes, ocean_biomes, use_incomplete_chunks, master_hall_traps, master_landmarks, default_landmarks, master_landmark_mobs, th_locked, th_bonus, th_intermediate, th_spawners

    temp = os.path.join(sys.path[0], "configs", filename)
    try:
        fh = open(temp)
        fh.close
        filename = temp
    except:
        filename = os.path.join("configs", filename)

    print "Reading config from", filename, "..."
    try:
        parser.readfp(open(filename))
    except Exception as e:
        print "Failed to read config file!"
        sys.exit(e.message)

    # Load the various extra file locations
    file_extra_items = getPath("locations", "file_extra_items", file_extra_items)
    file_dyes = getPath("locations", "file_dyes", file_dyes)
    file_potions = getPath("locations", "file_potions", file_potions)
    file_magic_items = getPath("locations", "file_magic_items", file_magic_items)
    file_fortunes = getPath("locations", "file_fortunes", file_fortunes)
    dir_paintings = getPath("locations", "dir_paintings", dir_paintings)
    dir_books = getPath("locations", "dir_books", dir_books)
    dir_shops = getPath("locations", "dir_shops", dir_shops)
    dir_extra_spawners = getPath("locations", "dir_extra_spawners", dir_extra_spawners)
    dir_extra_items = getPath("locations", "dir_extra_items", dir_extra_items)

    # These are not used until actual generation begins, so check they are
    # good now.
    if isFile(file_fortunes) is False:
        print "Warning: fortune file '" + file_fortunes + "' not found."
    if isDir(dir_paintings) is False:
        print "Warning: paintings directory '" + dir_paintings + "' not found."
    if isDir(dir_books) is False:
        print "Warning: books directory '" + dir_books + "' not found."
    if isDir(dir_shops) is False:
        print "Warning: shops directory '" + dir_shops + "' not found."
    if dir_extra_spawners != "":
        if isDir(dir_extra_spawners) is False:
            print "Warning: extra spawners directory '" + dir_extra_spawners + "' not found."
            dir_extra_spawners = ""
    if dir_extra_items != "":
        if isDir(dir_extra_items) is False:
            print "Warning: extra items directory '" + dir_extra_items + "' not found."
            dir_extra_items = ""

    # Only vanilla items have been loaded so far, we can now load the rest
    if file_extra_items != "":
        items.LoadItems(file_extra_items)
    if dir_extra_items != "":
        items.LoadNBTFiles(dir_extra_items)
    items.LoadDyedArmour(file_dyes)
    items.LoadPotions(file_potions)
    items.LoadMagicItems(file_magic_items)
    shop.Load(dir_shops)

    LoadSpawners()
    if dir_extra_spawners != "":
        LoadSpawners(dir_extra_spawners)
    if len(custom_spawners) > 0:
        print "Loaded", len(custom_spawners), "custom spawners."

    # Load master tables from .cfg.
    master_halls = parser.items("halls")
    try:
        master_hall_traps = parser.items("hall traps")
    except:
        print "WARNING: No hall traps section found in config. Using default."
        master_hall_traps = [["Blank", 100]]

    master_rooms = parser.items("rooms")
    master_srooms = parser.items("secret rooms")
    master_features = parser.items("features")
    master_stairwells = parser.items("stairwells")
    master_floors = parser.items("floors")

    try:
        temp_projectile_traps = parser.items("projectile traps")
    except:
        print "WARNING: No projectile traps section found in config. Using default."
        temp_projectile_traps = master_projectile_traps

    temp_chest_traps = parser.items("chest_traps")
    try:
        master_ruins = parser.items("ruins")
    except:
        print "WARNING: No ruins section found in config. Using default."
    try:
        master_treasure = parser.items("treasure rooms")
    except:
        print "WARNING: No treasure rooms section found in config. " " Using default."

    # Load per-biome entrances.
    # First, the default
    try:
        default_entrances = parser.items("entrances")
    except:
#.........这里部分代码省略.........
开发者ID:orphu,项目名称:mcdungeon,代码行数:101,代码来源:cfg.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python sys.getPath函数代码示例发布时间:2022-05-27
下一篇:
Python sys.exit函数代码示例发布时间: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